Merge lp:~darkxst/ppa-purge/soname into lp:ppa-purge

Proposed by Tim Lunn
Status: Merged
Merge reported by: Tim Lunn
Merged at revision: not available
Proposed branch: lp:~darkxst/ppa-purge/soname
Merge into: lp:ppa-purge
Diff against target: 99 lines (+44/-17)
3 files modified
debian/changelog (+7/-0)
debian/control (+1/-1)
ppa-purge (+36/-16)
To merge this branch: bzr merge lp:~darkxst/ppa-purge/soname
Reviewer Review Type Date Requested Status
ppa-purge Pending
Review via email: mp+241863@code.launchpad.net
To post a comment you must log in.
lp:~darkxst/ppa-purge/soname updated
60. By Tim Lunn

add bug ref

61. By Tim Lunn

reformat with tabs

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 2012-11-30 10:12:27 +0000
3+++ debian/changelog 2014-12-11 21:31:44 +0000
4@@ -1,3 +1,10 @@
5+ppa-purge (0.2.8+bzr58~trusty1) trusty; urgency=medium
6+
7+ * Add some logic to handle packages that have had a soname bump, packages with
8+ manual renames will still break, however these should be pretty rare. (LP: #1392954)
9+
10+ -- Tim Lunn <tim@feathertop.org> Sat, 15 Nov 2014 18:32:51 +1100
11+
12 ppa-purge (0.2.8+bzr57) raring; urgency=low
13
14 [ Tim Lunn ]
15
16=== modified file 'debian/control'
17--- debian/control 2012-11-30 10:12:27 +0000
18+++ debian/control 2014-12-11 21:31:44 +0000
19@@ -8,7 +8,7 @@
20
21 Package: ppa-purge
22 Architecture: all
23-Depends: ${misc:Depends}, aptitude (>= 0.6.6-1ubuntu1.2), dpkg (>= 1.16.1)
24+Depends: ${misc:Depends}, aptitude (>= 0.6.6-1ubuntu1.2), dpkg (>= 1.16.1), dctrl-tools
25 Description: disables a PPA and reverts to official packages
26 This program disables a PPA from your Software Sources and reverts your
27 system back to the official Ubuntu packages. You can use this to return your
28
29=== modified file 'ppa-purge'
30--- ppa-purge 2012-11-21 09:30:49 +0000
31+++ ppa-purge 2014-12-11 21:31:44 +0000
32@@ -143,31 +143,51 @@
33 done
34 fi
35
36-# Create apt argument list for reverting packages
37+# Disable PPA from sources.list files
38+for LIST in $(find /etc/apt/ -name "*.list" -exec readlink -f '{}' \;); do
39+ if [ -e $LIST ] && grep -q $PPAOWNER/$PPANAME $LIST; then
40+ msg "Disabling $PPAOWNER PPA from $LIST"
41+ sed -ri "\:^[^#]+/${PPAOWNER}/${PPANAME}/:s/^deb/# deb/" $LIST
42+ fi
43+done
44+
45+msg "Updating packages lists"
46+$APT update > /dev/null || warn "$APT update failed for some reason"
47+
48+# Create apt argument list for reverting packages, most of the foo here is to attempt
49+# to unroll soname bumps
50+
51 REINSTALL=""
52 for PACKAGE in $(cat $REVERTS); do
53- REINSTALL="$REINSTALL $PACKAGE/$DIST"
54+ PKG=$(echo $PACKAGE | cut -d ':' -f1)
55+ [[ $PACKAGE == *:* ]] && D_ARCH=":"$(echo $PACKAGE | cut -d ':' -f2)
56+
57+ if [ $(grep-aptavail -XPc -s Package $PKG) -eq 0 ]; then
58+ PAT=$(echo $PKG | sed -e s/[0-9][a-z]\$/'..'/ -e s/[0-9]/'.'/g)
59+
60+ APTAVAIL=$(grep-aptavail -eP --pattern=$PAT'$' -s Package -n | sort -uV | sed -e '$!d')
61+
62+ #explicitly remove packages that don't exist in archive
63+ if [ "x$APTAVAIL" != "x$PKG" ]; then
64+ REINSTALL="$REINSTALL $PACKAGE-"
65+ fi
66+
67+ #downgrade packages that have a soname bump
68+ if [ -n "$APTAVAIL" ]; then
69+ REINSTALL="$REINSTALL $APTAVAIL$D_ARCH/$DIST"
70+ fi
71+ else
72+ REINSTALL="$REINSTALL $PACKAGE/$DIST"
73+ fi
74 done
75
76 msg "Package revert list generated:"
77 msg "$REINSTALL"
78 echo
79
80-# Disable PPA from sources.list files
81-for LIST in $(find /etc/apt/ -name "*.list" -exec readlink -f '{}' \;); do
82- if [ -e $LIST ] && grep -q $PPAOWNER/$PPANAME $LIST; then
83- msg "Disabling $PPAOWNER PPA from $LIST"
84- sed -ri "\:^[^#]+/${PPAOWNER}/${PPANAME}/:s/^deb/# deb/" $LIST
85- fi
86-done
87-
88-msg "Updating packages lists"
89-$APT update > /dev/null || warn "$APT update failed for some reason"
90-
91 # FIXME:
92-# Workaround for now in case APT fails because of a package not in Ubuntu.
93-# APTALT actually works but it would be preferred to remove the package
94-# from $REINSTALL directly.
95+# Workaround for now in case APT fails. APTALT is a little more foregiving if the
96+# revert list isn't 100% correct.
97
98 if $APT $APTARG install $REINSTALL; then
99 msg "PPA purged successfully"

Subscribers

People subscribed via source and target branches

to all changes: