Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #207960 > unrolled thread

apt pinning: find out from which system version is a package

Started byEmanuel Berg <moasenwood@zoho.eu>
First post2019-04-29 05:40 +0200
Last post2019-05-03 04:00 +0200
Articles 18 — 8 participants

Back to article view | Back to linux.debian.user


Contents

  apt pinning: find out from which system version is a package Emanuel Berg <moasenwood@zoho.eu> - 2019-04-29 05:40 +0200
    Re: apt pinning: find out from which system version is a package Jonas Smedegaard <jonas@jones.dk> - 2019-04-29 07:40 +0200
      Re: apt pinning: find out from which system version is a package "Alexander V. Makartsev" <avbetev@gmail.com> - 2019-04-29 09:20 +0200
        Re: apt pinning: find out from which system version is a package Emanuel Berg <moasenwood@zoho.eu> - 2019-05-03 03:40 +0200
      Re: apt pinning: find out from which system version is a package Emanuel Berg <moasenwood@zoho.eu> - 2019-05-03 03:40 +0200
        Re: apt pinning: find out from which system version is a package Greg Wooledge <wooledg@eeg.ccf.org> - 2019-05-03 14:40 +0200
    Re: apt pinning: find out from which system version is a package David Wright <deblis@lionunicorn.co.uk> - 2019-04-29 15:50 +0200
      Re: apt pinning: find out from which system version is a package Emanuel Berg <moasenwood@zoho.eu> - 2019-05-03 03:50 +0200
        Re: apt pinning: find out from which system version is a package <tomas@tuxteam.de> - 2019-05-03 08:50 +0200
          Re: apt pinning: find out from which system version is a package Emanuel Berg <moasenwood@zoho.eu> - 2019-05-03 23:20 +0200
            Re: apt pinning: find out from which system version is a package David Wright <deblis@lionunicorn.co.uk> - 2019-05-04 17:30 +0200
        Re: apt pinning: find out from which system version is a package Greg Wooledge <wooledg@eeg.ccf.org> - 2019-05-03 14:40 +0200
        Re: apt pinning: find out from which system version is a package David Wright <deblis@lionunicorn.co.uk> - 2019-05-03 14:50 +0200
    Re: apt pinning: find out from which system version is a package Francisco M Neto <fmneto@fmneto.com.br> - 2019-04-29 23:20 +0200
      Re: apt pinning: find out from which system version is a package Toni Mas <antomassol@gmail.com> - 2019-04-29 23:20 +0200
        Re: apt pinning: find out from which system version is a package Emanuel Berg <moasenwood@zoho.eu> - 2019-05-03 04:10 +0200
        Re: apt pinning: find out from which system version is a package Emanuel Berg <moasenwood@zoho.eu> - 2019-05-03 04:10 +0200
      Re: apt pinning: find out from which system version is a package Emanuel Berg <moasenwood@zoho.eu> - 2019-05-03 04:00 +0200

#207960 — apt pinning: find out from which system version is a package

FromEmanuel Berg <moasenwood@zoho.eu>
Date2019-04-29 05:40 +0200
Subjectapt pinning: find out from which system version is a package
Message-ID<xS5j3-59d-1@gated-at.bofh.it>
With apt pinning [1], in /etc/apt/preferences ,
I have learned that one can have certain packs
from another release than the rest of the
system, seemlessly (?) with apt-get and the
other tools, for example like this for
w3m-el-snapshot:

    Package: *
    Pin: release a=testing
    Pin-Priority: -10

    Package: w3m-el-snapshot
    Pin: release a=testing
    Pin-Priority: 800

But is there a way to find out/confirm from
which release is a certain pack? I know about
'aptitude show' but save for the version, which
I suppose one could Google and compare (poor
man's solution IMO), it doesn't seem to say
what I can see.

Neither does 'dpkg -l'.

So is there a way to do this with shell
tool(s)?

TIA


[1] https://wiki.debian.org/AptPreferences

-- 
underground experts united
http://user.it.uu.se/~embe8573

[toc] | [next] | [standalone]


#207961

FromJonas Smedegaard <jonas@jones.dk>
Date2019-04-29 07:40 +0200
Message-ID<xS7bb-6lr-5@gated-at.bofh.it>
In reply to#207960

[Multipart message — attachments visible in raw view] — view raw

Quoting Emanuel Berg (2019-04-29 05:30:30)
> With apt pinning [1], in /etc/apt/preferences ,
> I have learned that one can have certain packs
> from another release than the rest of the
> system, seemlessly (?) with apt-get and the
> other tools, for example like this for
> w3m-el-snapshot:
> 
>     Package: *
>     Pin: release a=testing
>     Pin-Priority: -10
> 
>     Package: w3m-el-snapshot
>     Pin: release a=testing
>     Pin-Priority: 800
> 
> But is there a way to find out/confirm from
> which release is a certain pack? I know about
> 'aptitude show' but save for the version, which
> I suppose one could Google and compare (poor
> man's solution IMO), it doesn't seem to say
> what I can see.
> 
> Neither does 'dpkg -l'.
> 
> So is there a way to do this with shell
> tool(s)?

Add file /etc/apt/apt.conf.d/99aptitude-list-suite-local
eith the following one-line content:

aptitude::UI::Package-Display-Format "%c%a%M%S %p %Z %t %v %V";

...and install and use aptitude in fullscreen mode (i.e. start it with 
no non-option arguments).

 - Jonas

-- 
 * Jonas Smedegaard - idealist & Internet-arkitekt
 * Tlf.: +45 40843136  Website: http://dr.jones.dk/

 [x] quote me freely  [ ] ask before reusing  [ ] keep private

[toc] | [prev] | [next] | [standalone]


#207966

From"Alexander V. Makartsev" <avbetev@gmail.com>
Date2019-04-29 09:20 +0200
Message-ID<xS8JX-7nw-3@gated-at.bofh.it>
In reply to#207961

[Multipart message — attachments visible in raw view] — view raw

On 29.04.2019 10:35, Jonas Smedegaard wrote:
> Quoting Emanuel Berg (2019-04-29 05:30:30)
>> With apt pinning [1], in /etc/apt/preferences ,
>> I have learned that one can have certain packs
>> from another release than the rest of the
>> system, seemlessly (?) with apt-get and the
>> other tools, for example like this for
>> w3m-el-snapshot:
>>
>>     Package: *
>>     Pin: release a=testing
>>     Pin-Priority: -10
>>
>>     Package: w3m-el-snapshot
>>     Pin: release a=testing
>>     Pin-Priority: 800
>>
>> But is there a way to find out/confirm from
>> which release is a certain pack? I know about
>> 'aptitude show' but save for the version, which
>> I suppose one could Google and compare (poor
>> man's solution IMO), it doesn't seem to say
>> what I can see.
>>
>> Neither does 'dpkg -l'.
>>
>> So is there a way to do this with shell
>> tool(s)?
> Add file /etc/apt/apt.conf.d/99aptitude-list-suite-local
> eith the following one-line content:
>
> aptitude::UI::Package-Display-Format "%c%a%M%S %p %Z %t %v %V";
>
> ...and install and use aptitude in fullscreen mode (i.e. start it with 
> no non-option arguments).
>
>  - Jonas
>
You can check what branches have the package you want with "rmadison"
command.
Example:
$ sudo apt install devscripts
$ rmadison linux-image-amd64
linux-image-amd64 | 3.16+63+deb8u2  | oldstable         | amd64, i386
linux-image-amd64 | 4.9+80+deb9u7   | stable            | amd64
linux-image-amd64 | 4.19+104~bpo9+1 | stretch-backports | amd64
linux-image-amd64 | 4.19+104        | testing           | amd64
linux-image-amd64 | 4.19+104        | unstable          | amd64


You can check what package will be installed with "apt-cache" command.
Example:
$ apt-cache policy linux-image-amd64
linux-image-amd64:
  Installed: 4.15+91~bpo9+1
  Candidate: 4.19+104~bpo9+1
  Version table:
     4.19+104~bpo9+1 100
        100 https://mirror.yandex.ru/debian stretch-backports/main amd64
Packages
 *** 4.15+91~bpo9+1 100
        100 /var/lib/dpkg/status
     4.9+80+deb9u7 500
        500 https://mirror.yandex.ru/debian stretch/main amd64 Packages
     4.9+80+deb9u6 500
        500 http://security.debian.org/debian-security
stretch/updates/main amd64 Packages

-- 
With kindest regards, Alexander.

⢀⣴⠾⠻⢶⣦⠀ 
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
⠈⠳⣄⠀⠀⠀⠀ 

[toc] | [prev] | [next] | [standalone]


#208059

FromEmanuel Berg <moasenwood@zoho.eu>
Date2019-05-03 03:40 +0200
Message-ID<xTvl7-D3-3@gated-at.bofh.it>
In reply to#207966
Alexander V. Makartsev wrote:

> You can check what branches have the package
> you want with "rmadison" command.
>
> Example:
> $ sudo apt install devscripts
> $ rmadison linux-image-amd64
> linux-image-amd64 | 3.16+63+deb8u2  | oldstable         | amd64, i386
> linux-image-amd64 | 4.9+80+deb9u7   | stable            | amd64
> linux-image-amd64 | 4.19+104~bpo9+1 | stretch-backports | amd64
> linux-image-amd64 | 4.19+104        | testing           | amd64
> linux-image-amd64 | 4.19+104        | unstable          | amd64
>
> You can check what package will be installed with "apt-cache" command.
> Example:
> $ apt-cache policy linux-image-amd64
> linux-image-amd64:
>   Installed: 4.15+91~bpo9+1
> [...]

Priviet and good answer!

Still two invocations, but no worries, I can
make a zsh function and have them next to each
other, and then drop the unnecessary stuff :)

Thank you!

-- 
underground experts united
http://user.it.uu.se/~embe8573

[toc] | [prev] | [next] | [standalone]


#208060

FromEmanuel Berg <moasenwood@zoho.eu>
Date2019-05-03 03:40 +0200
Message-ID<xTvl7-D3-5@gated-at.bofh.it>
In reply to#207961
Jonas Smedegaard wrote:

> Add file
> /etc/apt/apt.conf.d/99aptitude-list-suite-local
> eith the following one-line content:
>
> aptitude::UI::Package-Display-Format "%c%a%M%S %p %Z %t %v %V";
>
> ...and install and use aptitude in fullscreen
> mode (i.e. start it with no non-option
> arguments).

No lack of hacker points in this answer but
I don't like fullscreen shell tools, that's
actually the opposite of what I like with
the shell.

Optimally I'd like it like this:

    $ from-what-release w3m-el-snapshot
    testing

Still, thank you for the answer.

-- 
underground experts united
http://user.it.uu.se/~embe8573

[toc] | [prev] | [next] | [standalone]


#208070

FromGreg Wooledge <wooledg@eeg.ccf.org>
Date2019-05-03 14:40 +0200
Message-ID<xTFDP-6TK-1@gated-at.bofh.it>
In reply to#208060
On Fri, May 03, 2019 at 03:30:13AM +0200, Emanuel Berg wrote:
> Optimally I'd like it like this:
> 
>     $ from-what-release w3m-el-snapshot
>     testing

The problem here is the packaging system does not KNOW from which source
a package came, after it is installed.

The best you can do is try to guess.

If the installed version of the package happens to match up with one of
the CURRENT package lists, then you could report that.

Otherwise, if the version string contains "+deb9u" then it probably came
from a stretch security update.  Likewise, if it contains "+deb8u" then
it probably came from a jessie security update.  And so on.

If none of those things happens to be true, then there's really no way
to know.

[toc] | [prev] | [next] | [standalone]


#207977

FromDavid Wright <deblis@lionunicorn.co.uk>
Date2019-04-29 15:50 +0200
Message-ID<xSePn-2CX-3@gated-at.bofh.it>
In reply to#207960
On Mon 29 Apr 2019 at 05:30:30 (+0200), Emanuel Berg wrote:
> With apt pinning [1], in /etc/apt/preferences ,
> I have learned that one can have certain packs
> from another release than the rest of the
> system, seemlessly (?) with apt-get and the
> other tools, for example like this for
> w3m-el-snapshot:
> 
>     Package: *
>     Pin: release a=testing
>     Pin-Priority: -10
> 
>     Package: w3m-el-snapshot
>     Pin: release a=testing
>     Pin-Priority: 800
> 
> But is there a way to find out/confirm from
> which release is a certain pack? I know about
> 'aptitude show' but save for the version, which
> I suppose one could Google and compare (poor
> man's solution IMO), it doesn't seem to say
> what I can see.
> 
> Neither does 'dpkg -l'.
> 
> So is there a way to do this with shell tool(s)?

apt-show-versions can give you a good idea. Occasionally,
and after major upgrades, I archive the output of:

$ apt-cache dump | grep -A 2 '^Package:' | grep -B 2 '^ File:' | sed -e 'N;N;s/\n/ /g;s/ \+/ /g;N' | grep -v '^--' | sort >> "$Unique1"
$ dpkg-query -W -f '^Package: ${Package} \n' | grep --file=- "$Unique1" | sort

Cheers,
David.

[toc] | [prev] | [next] | [standalone]


#208061

FromEmanuel Berg <moasenwood@zoho.eu>
Date2019-05-03 03:50 +0200
Message-ID<xTvuN-Gt-1@gated-at.bofh.it>
In reply to#207977
David Wright wrote:

> $ apt-cache dump | grep -A 2 '^Package:' | grep -B 2 '^ File:' | sed -e 'N;N;s/\n/ /g;s/ \+/ /g;N' | grep -v '^--' | sort >> "$Unique1"
> $ dpkg-query -W -f '^Package: ${Package} \n' | grep --file=- "$Unique1" | sort

That's some heavy parsing, only I don't get it
to work. I get "no such file or directory: "
from the first, apt-cache-dump invocation.

Maybe do a shell function of it (whatever shell
you prefer)?

Also I don't understand where the argument
goes? Where is ${Package} defined, even tho it
didn't (for me) even get that far?

-- 
underground experts united
http://user.it.uu.se/~embe8573

[toc] | [prev] | [next] | [standalone]


#208066

From<tomas@tuxteam.de>
Date2019-05-03 08:50 +0200
Message-ID<xTAb7-3B7-1@gated-at.bofh.it>
In reply to#208061

[Multipart message — attachments visible in raw view] — view raw

On Fri, May 03, 2019 at 03:46:50AM +0200, Emanuel Berg wrote:
> David Wright wrote:
> 
> > $ apt-cache dump | grep -A 2 '^Package:' | grep -B 2 '^ File:' | sed -e 'N;N;s/\n/ /g;s/ \+/ /g;N' | grep -v '^--' | sort >> "$Unique1"
> > $ dpkg-query -W -f '^Package: ${Package} \n' | grep --file=- "$Unique1" | sort
> 
> That's some heavy parsing, only I don't get it
> to work. I get "no such file or directory: "
> from the first, apt-cache-dump invocation.
                          ^^^

This is because it's spelt "apt-cache dump", I guess ;-)

Cheers
-- t

[toc] | [prev] | [next] | [standalone]


#208092

FromEmanuel Berg <moasenwood@zoho.eu>
Date2019-05-03 23:20 +0200
Message-ID<xTNL4-3xl-3@gated-at.bofh.it>
In reply to#208066
tomas wrote:

>> That's some heavy parsing, only I don't get
>> it to work. I get "no such file or directory:
>> " from the first, apt-cache-dump invocation.
>
> This is because it's spelt "apt-cache dump",
> I guess ;-)

No, then it says "zsh: command not found:" :)

-- 
underground experts united
http://user.it.uu.se/~embe8573

[toc] | [prev] | [next] | [standalone]


#208119

FromDavid Wright <deblis@lionunicorn.co.uk>
Date2019-05-04 17:30 +0200
Message-ID<xU4LT-5qI-5@gated-at.bofh.it>
In reply to#208092
On Fri 03 May 2019 at 23:09:58 (+0200), Emanuel Berg wrote:
> tomas wrote:
> 
> >> That's some heavy parsing, only I don't get
> >> it to work. I get "no such file or directory:
> >> " from the first, apt-cache-dump invocation.
> >
> > This is because it's spelt "apt-cache dump",
> > I guess ;-)
> 
> No, then it says "zsh: command not found:" :)

Unless you paste something that shows what you actually did,
I don't see that this reply advances the thread.

I've no idea whether using zsh instead of bash has any syntactical
implications. If binaries such as apt-cache and dpkg-query are
inaccessible, that's for you to fix. AFAIK their packages are
either essential or important.

I presume you realise that "$Unique1" is a temporary file. Because
I create them with mktemp, I have to redirect using >> rather than >
to circumvent bash's noclobber.

Finally, my script fragment was designed to yield information in bulk,
ie for all packages, because your OP contained 'dpkg -l'. But having
now seen your optimal requirement for '$ from-what-release foo',
my script is probably overkill.

Cheers,
David.

[toc] | [prev] | [next] | [standalone]


#208069

FromGreg Wooledge <wooledg@eeg.ccf.org>
Date2019-05-03 14:40 +0200
Message-ID<xTFDP-6TK-3@gated-at.bofh.it>
In reply to#208061
On Fri, May 03, 2019 at 03:46:50AM +0200, Emanuel Berg wrote:
> David Wright wrote:
> 
> > $ dpkg-query -W -f '^Package: ${Package} \n' | grep --file=- "$Unique1" | sort

> Also I don't understand where the argument
> goes? Where is ${Package} defined, even tho it
> didn't (for me) even get that far?

It's in single quotes, not double quotes.  Therefore it is NOT expanded
by the shell.  The shell passes that string verbatim to the dpkg-query
command.

So the question becomes, what does ${Package} mean to dpkg-query?

Therefore, we consult the man page:

              Package  information  can  be  included  by  inserting  variable
              references    to    package    fields    using    the     syntax
              “${field[;width]}”. [...]

              The following fields are recognized [...]:

                 [...]
                 Maintainer
                 Origin
                 Package
                 Pre-Depends
                 [...]

And there you go.

[toc] | [prev] | [next] | [standalone]


#208071

FromDavid Wright <deblis@lionunicorn.co.uk>
Date2019-05-03 14:50 +0200
Message-ID<xTFNv-6Xi-1@gated-at.bofh.it>
In reply to#208061
On Fri 03 May 2019 at 03:46:50 (+0200), Emanuel Berg wrote:
> David Wright wrote:
> 
> > $ apt-cache dump | grep -A 2 '^Package:' | grep -B 2 '^ File:' | sed -e 'N;N;s/\n/ /g;s/ \+/ /g;N' | grep -v '^--' | sort >> "$Unique1"
> > $ dpkg-query -W -f '^Package: ${Package} \n' | grep --file=- "$Unique1" | sort
> 
> That's some heavy parsing,

You wrote "no worries, I can make a zsh function and have them next to
each other" so I guess you're up to it …

> only I don't get it
> to work. I get "no such file or directory: "
> from the first, apt-cache-dump invocation.

… but I advise that you cut and paste.

> Maybe do a shell function of it (whatever shell
> you prefer)?

Don't think that I type this stuff into the command line itself.
This is just one part of a bash function that writes five files
to an archive, the output from dpkg -l, just the package names,
packages and versions, apt-show-versions, and the process above
which is named "origins".

These files can then be inspected, diffed etc, at leisure even
while the host concerned is not running.

> Also I don't understand where the argument
> goes? Where is ${Package} defined, even tho it
> didn't (for me) even get that far?

It's nothing to do with bash, as it's protected by '',
but see   man dpkg-query   just above 'EXIT STATUS'.

Cheers,
David.

[toc] | [prev] | [next] | [standalone]


#207990

FromFrancisco M Neto <fmneto@fmneto.com.br>
Date2019-04-29 23:20 +0200
Message-ID<xSlQS-76X-5@gated-at.bofh.it>
In reply to#207960

[Multipart message — attachments visible in raw view] — view raw

Greetings!


On Mon, 2019-04-29 at 05:30 +0200, Emanuel Berg wrote:
> But is there a way to find out/confirm from
> which release is a certain pack? 

	You're looking for apt-cache policy.

	Example:

==========================

$ apt-cache policy gnome-core
gnome-core:
  Installed: 1:3.30+1
  Candidate: 1:3.30+1
  Version table:
 *** 1:3.30+1 900
        900 http://sft.if.usp.br/debian buster/main amd64 Packages
        800 http://sft.if.usp.br/debian sid/main amd64 Packages
        100 /var/lib/dpkg/status
     1:3.22+3 400
        400 http://sft.if.usp.br/debian stretch/main amd64 Packages

==============================

 
-- 
[]'s,

Francisco M Neto <fmneto@fmneto.com.br>

GPG: 4096R/D692FBF0

[toc] | [prev] | [next] | [standalone]


#207991

FromToni Mas <antomassol@gmail.com>
Date2019-04-29 23:20 +0200
Message-ID<xSlQS-76X-7@gated-at.bofh.it>
In reply to#207990
apt-show-versions script are useful as well.
apt-show-versions is a package itself.


Toni Mas

Missatge de Francisco M Neto <fmneto@fmneto.com.br> del dia dl., 29
d’abr. 2019 a les 23:10:
>
> Greetings!
>
>
> On Mon, 2019-04-29 at 05:30 +0200, Emanuel Berg wrote:
> > But is there a way to find out/confirm from
> > which release is a certain pack?
>
>         You're looking for apt-cache policy.
>
>         Example:
>
> ==========================
>
> $ apt-cache policy gnome-core
> gnome-core:
>   Installed: 1:3.30+1
>   Candidate: 1:3.30+1
>   Version table:
>  *** 1:3.30+1 900
>         900 http://sft.if.usp.br/debian buster/main amd64 Packages
>         800 http://sft.if.usp.br/debian sid/main amd64 Packages
>         100 /var/lib/dpkg/status
>      1:3.22+3 400
>         400 http://sft.if.usp.br/debian stretch/main amd64 Packages
>
> ==============================
>
>
> --
> []'s,
>
> Francisco M Neto <fmneto@fmneto.com.br>
>
> GPG: 4096R/D692FBF0

[toc] | [prev] | [next] | [standalone]


#208063

FromEmanuel Berg <moasenwood@zoho.eu>
Date2019-05-03 04:10 +0200
Message-ID<xTvO9-12S-3@gated-at.bofh.it>
In reply to#207991
One can also do it like this:

$ aptitude versions w3m-el-snapshot
Package w3m-el-snapshot:
p   1.4.569+0.20170110-1                     stable               500 
i   1.4.632+0.20181112-2                     testing              800 

-- 
underground experts united
http://user.it.uu.se/~embe8573

[toc] | [prev] | [next] | [standalone]


#208064

FromEmanuel Berg <moasenwood@zoho.eu>
Date2019-05-03 04:10 +0200
Message-ID<xTvO9-12S-1@gated-at.bofh.it>
In reply to#207991
Toni Mas wrote:

> apt-show-versions script are useful as well.
> apt-show-versions is a package itself.

It sure is and it sure is exactly what I'm
looking for with no need to parse the output to
get it exactly to the point:

$ apt-show-versions w3m-el-snapshot
w3m-el-snapshot:all/testing 1.4.632+0.20181112-2 uptodate

-- 
underground experts united
http://user.it.uu.se/~embe8573

[toc] | [prev] | [next] | [standalone]


#208062

FromEmanuel Berg <moasenwood@zoho.eu>
Date2019-05-03 04:00 +0200
Message-ID<xTvEu-Ka-3@gated-at.bofh.it>
In reply to#207990
Francisco M Neto wrote:

>> But is there a way to find out/confirm from
>> which release is a certain pack?
>
> You're looking for apt-cache policy. [...]
>
> $ apt-cache policy gnome-core
> gnome-core:
>   Installed: 1:3.30+1
>   Candidate: 1:3.30+1
>   Version table:
>  *** 1:3.30+1 900
>         900 http://sft.if.usp.br/debian buster/main amd64 Packages
>         800 http://sft.if.usp.br/debian sid/main amd64 Packages
>         100 /var/lib/dpkg/status
>      1:3.22+3 400
>         400 http://sft.if.usp.br/debian stretch/main amd64 Packages

Right, now I see it!

Alexander V Makartsev already told me this, but
I got distracted by the _first_ thing he
showed me :$

Like a jab in boxing, if thrown good enough, it
makes you not see the cross coming from
behind...

OK, well then, thank you both!

-- 
underground experts united
http://user.it.uu.se/~embe8573

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.user


csiph-web