Merge lp:~apachelogger/software-properties/series-check into lp:software-properties

Proposed by Harald Sitter
Status: Merged
Merged at revision: 968
Proposed branch: lp:~apachelogger/software-properties/series-check
Merge into: lp:software-properties
Diff against target: 91 lines (+32/-4)
2 files modified
debian/changelog (+12/-0)
softwareproperties/ppa.py (+20/-4)
To merge this branch: bzr merge lp:~apachelogger/software-properties/series-check
Reviewer Review Type Date Requested Status
Michael Vogt Pending
Ubuntu Core Development Team Pending
Review via email: mp+293513@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Harald Sitter (apachelogger) wrote :

hellow?

Revision history for this message
Harald Sitter (apachelogger) wrote :

ping

Revision history for this message
Harald Sitter (apachelogger) wrote :

Are we sure this thing is still maintained? :O

Revision history for this message
Brian Murray (brian-murray) wrote :

Could you give an example of how we might test this change?

Revision history for this message
Harald Sitter (apachelogger) wrote :

> $ grep -E '(ID|CODENAME)' /etc/lsb-release
> DISTRIB_ID=floof
> DISTRIB_CODENAME=xenial

> $ sudo add-apt-repository -m ppa:alexlarsson/ubuntu/xdg-app

this adds yakkety because of the code path in question

> pitchy patchy
> $ sudo add-apt-repository -m -r ppa:alexlarsson/ubuntu/xdg-app
> $ sudo add-apt-repository -m ppa:alexlarsson/ubuntu/xdg-app

now it adds xenial as that is the codename of floof and the codename also exists on launchpad

960. By Harald Sitter

merge

961. By Harald Sitter

Add a comment about the codename logic todo with series

962. By Harald Sitter

fix changelog

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 2016-07-13 19:27:04 +0000
3+++ debian/changelog 2016-08-12 11:52:12 +0000
4@@ -1,3 +1,15 @@
5+software-properties (0.96.24.2) UNRELEASED; urgency=medium
6+
7+ * Do not assume that a distribution adding the PPA of another distribution
8+ will want the latest series all the time. Instead check if the requested
9+ codename (that is the codename of the installed distribution) is a valid
10+ series in launchpad for the distribution the PPA belongs to. This
11+ essentially enables derivate distributions to carry a different name but
12+ use the same series name. As long as launchpad knows about the series we
13+ should be fine even if the constraints are a bit lax.
14+
15+ -- Harald Sitter <sitter@kde.org> Mon, 02 May 2016 10:41:50 +0200
16+
17 software-properties (0.96.24.1) yakkety; urgency=medium
18
19 * tests/test_shortcuts.py: make the tests python2 compatible.
20
21=== modified file 'softwareproperties/ppa.py'
22--- softwareproperties/ppa.py 2016-06-22 13:48:33 +0000
23+++ softwareproperties/ppa.py 2016-08-12 11:52:12 +0000
24@@ -52,6 +52,7 @@
25 LAUNCHPAD_USER_API = 'https://launchpad.net/api/1.0/%s'
26 LAUNCHPAD_USER_PPAS_API = 'https://launchpad.net/api/1.0/%s/ppas'
27 LAUNCHPAD_DISTRIBUTION_API = 'https://launchpad.net/api/1.0/%s'
28+LAUNCHPAD_DISTRIBUTION_SERIES_API = 'https://launchpad.net/api/1.0/%s/%s'
29 # Specify to use the system default SSL store; change to a different path
30 # to test with custom certificates.
31 LAUNCHPAD_PPA_CERT = "/etc/ssl/certs/ca-certificates.crt"
32@@ -90,6 +91,14 @@
33 lp_url = LAUNCHPAD_PPA_API % (owner_name, ppa)
34 return get_info_from_lp(lp_url)
35
36+def series_valid_for_distro(distribution, series):
37+ lp_url = LAUNCHPAD_DISTRIBUTION_SERIES_API % (distribution, series)
38+ try:
39+ get_info_from_lp(lp_url)
40+ return True
41+ except PPAException:
42+ return False
43+
44 def get_current_series_from_lp(distribution):
45 lp_url = LAUNCHPAD_DISTRIBUTION_API % distribution
46 return os.path.basename(get_info_from_lp(lp_url)["current_series_link"])
47@@ -165,7 +174,7 @@
48 try:
49 # double check that the signing key is a v4 fingerprint (160bit)
50 if not verify_keyid_is_v4(signing_key_fingerprint):
51- print("Error: signing key fingerprint '%s' too short" %
52+ print("Error: signing key fingerprint '%s' too short" %
53 signing_key_fingerprint)
54 return False
55 except TypeError:
56@@ -210,7 +219,7 @@
57 def _verify_fingerprint(self, keyring, expected_fingerprint, keyring_dir):
58 got_fingerprints = self._get_fingerprints(keyring, keyring_dir)
59 if len(got_fingerprints) > 1:
60- print("Got '%s' fingerprints, expected only one" %
61+ print("Got '%s' fingerprints, expected only one" %
62 len(got_fingerprints))
63 return False
64 got_fingerprint = got_fingerprints[0]
65@@ -222,7 +231,7 @@
66
67 def add_ppa_signing_key(self, ppa_path=None):
68 """Query and add the corresponding PPA signing key.
69-
70+
71 The signing key fingerprint is obtained from the Launchpad PPA page,
72 via a secure channel, so it can be trusted.
73 """
74@@ -364,9 +373,16 @@
75 return self._info
76
77 def expand(self, codename, distro=None):
78- if distro is not None and distro != self._info["distribution"]:
79+ if (distro is not None
80+ and distro != self._info["distribution"]
81+ and not series_valid_for_distro(self._info["distribution"], codename)):
82 # The requested PPA is for a foreign distribution. Guess that
83 # the user wants that distribution's current series.
84+ # This only applies if the local distribution is not the same
85+ # distribution the remote PPA is associated with AND the local
86+ # codename is not equal to the PPA's series.
87+ # e.g. local:Foobar/xenial and ppa:Ubuntu/xenial will use 'xenial'
88+ # local:Foobar/fluffy and ppa:Ubuntu/xenial will use '$latest'
89 codename = get_current_series_from_lp(self._info["distribution"])
90 debline = "deb http://ppa.launchpad.net/%s/%s/%s %s main" % (
91 self._info["owner"][1:], self._info["name"],

Subscribers

People subscribed via source and target branches

to status/vote changes: