Merge lp:~darkxst/ppa-purge/multiarch-lp892886 into lp:ppa-purge

Proposed by Tim on 2012-11-15
Status: Merged
Merged at revision: 57
Proposed branch: lp:~darkxst/ppa-purge/multiarch-lp892886
Merge into: lp:ppa-purge
Diff against target: 63 lines (+23/-4)
3 files modified
debian/changelog (+6/-0)
debian/control (+1/-1)
ppa-purge (+16/-3)
To merge this branch: bzr merge lp:~darkxst/ppa-purge/multiarch-lp892886
Reviewer Review Type Date Requested Status
Robert Hooker Approve on 2012-11-27
Tormod Volden 2012-11-15 Approve on 2012-11-21
Review via email: mp+134576@code.launchpad.net

Description of the Change

uses dpkg-query to extract the actual multiarch package names (where applicable). This lets ppa-purge work correctly on multiarch systems.

To post a comment you must log in.
Tormod Volden (tormodvolden) wrote :

Thanks for this! I would maybe had strengthened the /ii/ regex to prevent matching on some unfortunate package name.

Can you please also add a package dependency on whatever version of dpkg-query is needed for this?

Tim (darkxst) wrote :

I will check tomorrow if I can strengthen the regex.

However dpkg-query is a core part of dpkg (i.e. what handles dpkg -l package), so no extra dependency should be needed.

Tormod Volden (tormodvolden) wrote :

Something like /\tii$/ should be enough since you use a "\t" in your -f string.

I was thinking of a /versioned/ dependency, since the -f format parameters you are using are not supported in older dpkg. This would break backports of ppa-purge.

58. By Tim on 2012-11-16

stengthen regex and add dependency

Tim (darkxst) wrote :

Added a dependency on the correct version of dpkg, turns out the required format fields are only available in Quantal and Raring

Tim (darkxst) wrote :

The following provides a similar result on Precise, perhaps we should fallback to that if the current dpkg-query fails.

-f='${PackageSpec}\t${Status}\n'

59. By Tim on 2012-11-17

Add support for multiarch on Precise

60. By Tim on 2012-11-17

correct reverst list generation on Precise

Tim (darkxst) wrote :

r59 and r60 correctly generate the package revert list on multiarch Precise. It may work with apt-get however aptitude is completely broken on Precise with respect to multiarch dependency resolution (LP: #831768). Also its probably not ideal hardcoding the foreign arch, but I couldnt work out how to get this info under precise.

So probably best to just merge r57+r58 for now, which atleast cover Q and R

61. By Tim on 2012-11-21

cleanup of precise support.

Tim (darkxst) wrote :

Cleaned up a bit and tested on precise with the patched aptitude (LP: 831768) that is awaiting upload for SRU. In combination with that patch, this is now working perfectly.

Tormod Volden (tormodvolden) wrote :

Awesome! What about a versioned dependency on this aptitude package?

You may also delete the ARCH variable at the same time since it is not used.

62. By Tim on 2012-11-21

remove unused ARCH variable

63. By Tim on 2012-11-21

update depends

Tim (darkxst) wrote :

ok done.

Tormod Volden (tormodvolden) wrote :

From looking at http://manpages.ubuntu.com/manpages/natty/man1/dpkg.1.html it seems like --print-foreign-architectures and PackageSpec was available already in dpkg_1.16.0~ubuntu7_i386 - in case it should work on natty and oneiric as well.

I would love to see a fallback that works in 10.04 as well, but that can be added later. It is more important to get this version out soon.

Tormod Volden (tormodvolden) wrote :

But then for natty and oneiric we would need backports of that aptitude package as well...

I have neither multiarch fu nor a multiarch system to test on, but otherwise this looks good to me.

review: Approve
Tim (darkxst) wrote :

Yes, would need to get the aptitude patch backported to get it working on natty and oneiric.

Robert Hooker (sarvatt) wrote :

Ok I just checked it out and this works, but there is a problem in that packages that only existed in the PPA and not in the distro do not get removed which makes it not work with xorg-edgers thanks to libdrm-nouveau2 in precise. That's a problem for another day though and this does work for most use cases :) Thanks for this Tim! I'm not able to upload it so I subscribed the sponsors team to the bug.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2010-11-10 20:13:14 +0000
3+++ debian/changelog 2012-11-21 09:41:37 +0000
4@@ -1,3 +1,9 @@
5+ppa-purge (0.2.8+bzr57) raring; urgency=low
6+
7+ * Generate a multiarch aware package revert list (LP: 892886)
8+
9+ -- Tim Lunn <tim@feathertop.org> Fri, 16 Nov 2012 10:43:20 +1100
10+
11 ppa-purge (0.2.8+bzr56) natty; urgency=low
12
13 * Really implement the "-y" option.
14
15=== modified file 'debian/control'
16--- debian/control 2010-10-15 21:22:59 +0000
17+++ debian/control 2012-11-21 09:41:37 +0000
18@@ -8,7 +8,7 @@
19
20 Package: ppa-purge
21 Architecture: all
22-Depends: ${misc:Depends}, aptitude
23+Depends: ${misc:Depends}, aptitude (>= 0.6.6-1ubuntu1.2), dpkg (>= 1.16.1)
24 Description: disables a PPA and reverts to official packages
25 This program disables a PPA from your Software Sources and reverts your
26 system back to the official Ubuntu packages. You can use this to return your
27
28=== modified file 'ppa-purge'
29--- ppa-purge 2010-11-10 20:13:14 +0000
30+++ ppa-purge 2012-11-21 09:41:37 +0000
31@@ -5,7 +5,7 @@
32 # AUTHORS: Robert Hooker (Sarvatt), Tormod Volden
33
34 # Defaults
35-ARCH=$(dpkg --print-architecture)
36+F_ARCHS=$(dpkg --print-foreign-architectures)
37 PPA_PKGS=$(mktemp)
38 REVERTS=$(mktemp)
39 trap "rm $PPA_PKGS $REVERTS" 0
40@@ -127,8 +127,21 @@
41 msg "Note: Not removing ppa-purge package"
42 fi
43
44-dpkg --get-selections | awk '/install$/{print $1}' |
45- sort | comm -12 - $PPA_PKGS > $REVERTS
46+# Get multi-arch package names for revert list
47+cat $PPA_PKGS | sort -u |
48+ xargs dpkg-query -W -f='${binary:Package}\t${db:Status-Abbrev}\n' 2>/dev/null |
49+ awk '/\tii $/{print $1}' > $REVERTS
50+# Fallback for Precise
51+if [ ! -s $REVERTS ]; then
52+ for PACKAGE in $(cat $PPA_PKGS | sort -u); do
53+ dpkg-query -W -f='${PackageSpec}\t${Status}\n' $PACKAGE 2>/dev/null |
54+ awk '/\tinstall/{print $1}' >> $REVERTS
55+ for F_ARCH in $F_ARCHS; do
56+ dpkg-query -W -f='${PackageSpec}\t${Status}\n' "$PACKAGE:$F_ARCH" 2>/dev/null |
57+ awk '/\tinstall/{print $1}' >> $REVERTS
58+ done
59+ done
60+fi
61
62 # Create apt argument list for reverting packages
63 REINSTALL=""

Subscribers

People subscribed via source and target branches

to all changes: