Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.user > #173199 > unrolled thread
| Started by | Michael Lange <klappnase@freenet.de> |
|---|---|
| First post | 2016-10-05 11:30 +0200 |
| Last post | 2016-10-06 01:10 +0200 |
| Articles | 8 — 3 participants |
Back to article view | Back to linux.debian.user
aptitude cli options vs. apt-get (esp. --ignore-hold option) Michael Lange <klappnase@freenet.de> - 2016-10-05 11:30 +0200
Re: aptitude cli options vs. apt-get (esp. --ignore-hold option) Darac Marjal <mailinglist@darac.org.uk> - 2016-10-05 11:50 +0200
Re: aptitude cli options vs. apt-get (esp. --ignore-hold option) Michael Lange <klappnase@freenet.de> - 2016-10-05 12:10 +0200
Re: aptitude cli options vs. apt-get (esp. --ignore-hold option) Jörg-Volker Peetz <jvpeetz@web.de> - 2016-10-05 17:40 +0200
Re: aptitude cli options vs. apt-get (esp. --ignore-hold option) Michael Lange <klappnase@freenet.de> - 2016-10-05 20:30 +0200
aptitude cli undocumented behaviour [was: aptitude cli options vs. apt-get ...] Michael Lange <klappnase@freenet.de> - 2016-10-05 20:50 +0200
Re: aptitude cli undocumented behaviour [was: aptitude cli options vs. apt-get ...] Jörg-Volker Peetz <jvpeetz@web.de> - 2016-10-05 22:40 +0200
[solved]Re: aptitude cli undocumented behaviour [was: aptitude cli options vs. apt-get ...] Michael Lange <klappnase@freenet.de> - 2016-10-06 01:10 +0200
| From | Michael Lange <klappnase@freenet.de> |
|---|---|
| Date | 2016-10-05 11:30 +0200 |
| Subject | aptitude cli options vs. apt-get (esp. --ignore-hold option) |
| Message-ID | <soQGt-7ks-3@gated-at.bofh.it> |
Hello,
I use the following line (borrowed from apticron) in a script to generate
a list of upgradable packages:
PKGNAMES=`apt-get -q -y -s --ignore-hold --allow-unauthenticated dist-upgrade | \
/bin/grep ^Inst | /usr/bin/cut -d\ -f2 | /usr/bin/sort`
Now I would like to do the same with aptitude, so the user may pick which
program they prefer to install the available updates.
The aptitude equivalent I have come up with so far is:
PKGNAMES=`aptitude -v -y -s --allow-untrusted full-upgrade | \
/bin/grep ^Inst | /usr/bin/cut -d\ -f2 | /usr/bin/sort`
I figure that probably --allow-untrusted does the same for aptitude as
--allow-unauthenticated does for apt-get (?) , however from man aptitude I
cannot see anything like apt-get's --ignore-hold option.
So my question is: is there a way to include updates to packages put on
hold to the output of "aptitude full-upgrade" as in apt-get, that I have
been missing, or is this simply not possible?
Regards
Michael
.-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-.
You are an excellent tactician, Captain. You let your second in
command attack while you sit and watch for weakness.
-- Khan Noonian Singh, "Space Seed", stardate 3141.9
[toc] | [next] | [standalone]
| From | Darac Marjal <mailinglist@darac.org.uk> |
|---|---|
| Date | 2016-10-05 11:50 +0200 |
| Message-ID | <soQZP-7rL-11@gated-at.bofh.it> |
| In reply to | #173199 |
On Wed, Oct 05, 2016 at 11:19:52AM +0200, Michael Lange wrote: >Hello, > >I use the following line (borrowed from apticron) in a script to generate >a list of upgradable packages: > >PKGNAMES=`apt-get -q -y -s --ignore-hold --allow-unauthenticated dist-upgrade | \ > /bin/grep ^Inst | /usr/bin/cut -d\ -f2 | /usr/bin/sort` > >Now I would like to do the same with aptitude, so the user may pick which >program they prefer to install the available updates. >The aptitude equivalent I have come up with so far is: > >PKGNAMES=`aptitude -v -y -s --allow-untrusted full-upgrade | \ > /bin/grep ^Inst | /usr/bin/cut -d\ -f2 | /usr/bin/sort` aptitude is, generally speaking, a more user-friendly interface to the apt system. If you're scripting (and especially as it already works), you should stick with apt-get. apt-get's output tends to be more stable and more readily parsable. Is there some feature of aptitude that apt is missing? What's your motivation for switching to aptitude here? > >I figure that probably --allow-untrusted does the same for aptitude as >--allow-unauthenticated does for apt-get (?) , however from man aptitude I >cannot see anything like apt-get's --ignore-hold option. > >So my question is: is there a way to include updates to packages put on >hold to the output of "aptitude full-upgrade" as in apt-get, that I have >been missing, or is this simply not possible? > >Regards > >Michael > >.-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-. > >You are an excellent tactician, Captain. You let your second in >command attack while you sit and watch for weakness. > -- Khan Noonian Singh, "Space Seed", stardate 3141.9 > -- For more information, please reread.
[toc] | [prev] | [next] | [standalone]
| From | Michael Lange <klappnase@freenet.de> |
|---|---|
| Date | 2016-10-05 12:10 +0200 |
| Message-ID | <soRjb-7Pg-5@gated-at.bofh.it> |
| In reply to | #173200 |
On Wed, 5 Oct 2016 10:41:40 +0100 Darac Marjal <mailinglist@darac.org.uk> wrote: > aptitude is, generally speaking, a more user-friendly interface to the > apt system. If you're scripting (and especially as it already works), > you should stick with apt-get. apt-get's output tends to be more stable > and more readily parsable. > > Is there some feature of aptitude that apt is missing? What's your > motivation for switching to aptitude here? It's just to give users the choice. Some people prefer aptitude and I figure it's nice to let them have their will :-) I also don't think that apt-get and aptitude are exactly equivalent, sometimes they may disagree about which packages to install/remove to fulfil the dependencies a set of updates brings with. Parsing the output does not seem to be a problem here either, it took me a while to figure out that I had to replace apt-get's -q with aptitude's -v , but now apparently it can be parsed just the same. And it's not that aptitude does not work in my script, it's just that if the option to include available updates for held back packages (and possibly packages these would cause to be newly installed or removed) in the upgrading candidates list is set, I don't know how to do this with aptitude. Regards Michael .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-. Another Armenia, Belgium ... the weak innocents who always seem to be located on a natural invasion route. -- Kirk, "Errand of Mercy", stardate 3198.4
[toc] | [prev] | [next] | [standalone]
| From | Jörg-Volker Peetz <jvpeetz@web.de> |
|---|---|
| Date | 2016-10-05 17:40 +0200 |
| Message-ID | <soWsx-2L8-1@gated-at.bofh.it> |
| In reply to | #173199 |
Michael Lange wrote on 10/05/16 11:19: > Hello, > > I use the following line (borrowed from apticron) in a script to generate > a list of upgradable packages: > > PKGNAMES=`apt-get -q -y -s --ignore-hold --allow-unauthenticated dist-upgrade | \ > /bin/grep ^Inst | /usr/bin/cut -d\ -f2 | /usr/bin/sort` > > Now I would like to do the same with aptitude, so the user may pick which > program they prefer to install the available updates. > The aptitude equivalent I have come up with so far is: > > PKGNAMES=`aptitude -v -y -s --allow-untrusted full-upgrade | \ > /bin/grep ^Inst | /usr/bin/cut -d\ -f2 | /usr/bin/sort` > > I figure that probably --allow-untrusted does the same for aptitude as > --allow-unauthenticated does for apt-get (?) , however from man aptitude I > cannot see anything like apt-get's --ignore-hold option. > > So my question is: is there a way to include updates to packages put on > hold to the output of "aptitude full-upgrade" as in apt-get, that I have > been missing, or is this simply not possible? > Your aptitude variant will also list new packages to be installed (e.g., a package with a version number in its name like libperl5.24). Otherwise you could try a search pattern of aptitude. This ability of aptitude is one of the advantages of aptitude IMO. Wouldn't PKGNAMES=$(aptitude -F '%p' --allow-untrusted search '~U' | sort) just do what you want? Also, it seems to be faster. Regards, jvp. > Regards > > Michael
[toc] | [prev] | [next] | [standalone]
| From | Michael Lange <klappnase@freenet.de> |
|---|---|
| Date | 2016-10-05 20:30 +0200 |
| Message-ID | <soZ74-54g-7@gated-at.bofh.it> |
| In reply to | #173208 |
Hi, On Wed, 5 Oct 2016 17:35:58 +0200 Jörg-Volker Peetz <jvpeetz@web.de> wrote: > Your aptitude variant will also list new packages to be installed > (e.g., a package with a version number in its name like libperl5.24). > Yes, that is in fact the point here. This is the same as for the corresponding apt-get command. If the user does not want to see new packages, they will be removed again from the list in the next step. It also shows packages which will be removed during an upgrade, which might also be of interest, although currently my code does not collect this information. > Otherwise you could try a search pattern of aptitude. This ability of > aptitude is one of the advantages of aptitude IMO. > > Wouldn't > > PKGNAMES=$(aptitude -F '%p' --allow-untrusted search '~U' | sort) > > just do what you want? Also, it seems to be faster. Yes, if only upgrades for already installed packages should be displayed this is certainly better. It looks like this doesn't even need the sort, and probably the --allow-untrusted isn't necessary either (I don't have any untrusted mirrors in my sources.list to verify this, though). At least updates for "holds" are shown this way. Regards Michael .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-. "The release of emotion is what keeps us health. Emotionally healthy." "That may be, Doctor. However, I have noted that the healthy release of emotion is frequently unhealthy for those closest to you." -- McCoy and Spock, "Plato's Stepchildren", stardate 5784.3
[toc] | [prev] | [next] | [standalone]
| From | Michael Lange <klappnase@freenet.de> |
|---|---|
| Date | 2016-10-05 20:50 +0200 |
| Subject | aptitude cli undocumented behaviour [was: aptitude cli options vs. apt-get ...] |
| Message-ID | <soZqp-5hM-5@gated-at.bofh.it> |
| In reply to | #173199 |
Hi,
On Wed, 5 Oct 2016 11:19:52 +0200
Michael Lange <klappnase@freenet.de> wrote:
(...)
> So my question is: is there a way to include updates to packages put on
> hold to the output of "aptitude full-upgrade" as in apt-get, that I have
> been missing, or is this simply not possible?
I looked again at man aptitude and according to the paragraphs about
"safe-upgrade" and "full-upgrade":
"If no <package>s are listed on the command line, aptitude will attempt
to upgrade every package that can be upgraded. Otherwise, aptitude will
attempt to upgrade only the packages which it is instructed to
upgrade."
I would have expected, that passing the packages put on hold as
arguments, as in
aptitude full-upgrade `aptitude -q=2 -F %p search ~U`
would only try to upgrade these. However when I tried a dry-run on my
almost-up-to-date Jessie box here, with a few holds (hplip and friends) I
got the following surprising result (command lines wrapped by sylpheed):
The list of package holds:
# aptitude -q=2 -F %p search ~ahold
hplip
hplip-data
hplip-gui
libhpmud0
libsane-hpaio
printer-driver-hpcups
Available updates that would be installed by default:
# aptitude -y -v -s full-upgrade | /bin/grep ^Inst | /usr/bin/cut -d\
-f2 | /usr/bin/sort
libdatetime-timezone-perl
tzdata
tzdata-java
# aptitude -y -v -s full-upgrade `aptitude -q=2 -F %p search ~U`
| /bin/grep ^Inst | /usr/bin/cut -d\ -f2 | /usr/bin/sort
hplip
hplip-data
hplip-gui
libdatetime-timezone-perl
libhpmud0
libsane-hpaio
printer-driver-hpcups
tzdata
tzdata-java
tzdata and friends obviously don't have anything to do with hplip, so it
looks like the man page isn't telling the truth.
Can anyone confirm this behaviour, did I misinterpret the manpage, or why
does this happen?
Right now this looks like it is exactly what I have been asking for in
the first post, but the manpage seems to contradict...
Regards
Michael
.-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-.
In the strict scientific sense we all feed on death -- even vegetarians.
-- Spock, "Wolf in the Fold", stardate 3615.4
[toc] | [prev] | [next] | [standalone]
| From | Jörg-Volker Peetz <jvpeetz@web.de> |
|---|---|
| Date | 2016-10-05 22:40 +0200 |
| Subject | Re: aptitude cli undocumented behaviour [was: aptitude cli options vs. apt-get ...] |
| Message-ID | <sp18R-6Qb-19@gated-at.bofh.it> |
| In reply to | #173213 |
Michael Lange wrote on 10/05/16 20:42: > Hi, > > On Wed, 5 Oct 2016 11:19:52 +0200 > Michael Lange <klappnase@freenet.de> wrote: > > (...) >> So my question is: is there a way to include updates to packages put on >> hold to the output of "aptitude full-upgrade" as in apt-get, that I have >> been missing, or is this simply not possible? > > I looked again at man aptitude and according to the paragraphs about > "safe-upgrade" and "full-upgrade": > > "If no <package>s are listed on the command line, aptitude will attempt > to upgrade every package that can be upgraded. Otherwise, aptitude will > attempt to upgrade only the packages which it is instructed to > upgrade." > > I would have expected, that passing the packages put on hold as > arguments, as in > > aptitude full-upgrade `aptitude -q=2 -F %p search ~U` > > would only try to upgrade these. However when I tried a dry-run on my > almost-up-to-date Jessie box here, with a few holds (hplip and friends) I > got the following surprising result (command lines wrapped by sylpheed): > > The list of package holds: > > # aptitude -q=2 -F %p search ~ahold > hplip > hplip-data > hplip-gui > libhpmud0 > libsane-hpaio > printer-driver-hpcups > > Available updates that would be installed by default: > > # aptitude -y -v -s full-upgrade | /bin/grep ^Inst | /usr/bin/cut -d\ > -f2 | /usr/bin/sort > libdatetime-timezone-perl > tzdata > tzdata-java > > # aptitude -y -v -s full-upgrade `aptitude -q=2 -F %p search ~U` > | /bin/grep ^Inst | /usr/bin/cut -d\ -f2 | /usr/bin/sort > hplip > hplip-data > hplip-gui > libdatetime-timezone-perl > libhpmud0 > libsane-hpaio > printer-driver-hpcups > tzdata > tzdata-java > > tzdata and friends obviously don't have anything to do with hplip, so it > looks like the man page isn't telling the truth. > Can anyone confirm this behaviour, did I misinterpret the manpage, or why > does this happen? > Right now this looks like it is exactly what I have been asking for in > the first post, but the manpage seems to contradict... > You used '~U' in the first and the last command, not '~ahold'. This last command could also be written shorter: aptitude -y -v -s full-upgrade '~U' | ... There's also the switch '--remove-user-tag': aptitude -y -v -s --remove-tag hold full-upgrade | ... Does this what you want? Regards, jvp.
[toc] | [prev] | [next] | [standalone]
| From | Michael Lange <klappnase@freenet.de> |
|---|---|
| Date | 2016-10-06 01:10 +0200 |
| Subject | [solved]Re: aptitude cli undocumented behaviour [was: aptitude cli options vs. apt-get ...] |
| Message-ID | <sp3u1-eo-5@gated-at.bofh.it> |
| In reply to | #173217 |
On Wed, 5 Oct 2016 22:37:40 +0200
Jörg-Volker Peetz <jvpeetz@web.de> wrote:
> You used '~U' in the first and the last command, not '~ahold'.
> This last command could also be written shorter:
>
> aptitude -y -v -s full-upgrade '~U' | ...
Thanks!!!
You are of course right, that was a copy and paste accident. (^.^);
I just tried it (i.e. what I actually wanted to try before) again on my
laptop (with stretch), where (much to my confusion) things worked as the
man page promised - now I know why!
Actually I already have been thinking about using (consciously this time)
aptitude -y -v -s full-upgrade `aptitude -q=2 -F %p search ~U`
, but invoking it this way looks a lot like a pain in the neck (and btw
appears to be slower). I wasn't aware that you can pass a search pattern
like ~U to full-upgrade. This seems to do exactly what I want.
>
> There's also the switch '--remove-user-tag':
>
> aptitude -y -v -s --remove-tag hold full-upgrade | ...
This does not seem to have any effect. Isn't this used rather like
aptitude remove-user-tag hold pkgname
which at least with "hold" as tag does not have any effect either, I
suppose it's meant for custom user-defined tag names?
Anyway, "aptitude -y -v -s --allow-untrusted full-upgrade '~U'" seems to
be what I want.
Thanks for your help!
Michael
.-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-.
Men of peace usually are [brave].
-- Spock, "The Savage Curtain", stardate 5906.5
[toc] | [prev] | [standalone]
Back to top | Article view | linux.debian.user
csiph-web