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
=== modified file 'debian/changelog'
--- debian/changelog 2016-07-13 19:27:04 +0000
+++ debian/changelog 2016-08-12 11:52:12 +0000
@@ -1,3 +1,15 @@
1software-properties (0.96.24.2) UNRELEASED; urgency=medium
2
3 * Do not assume that a distribution adding the PPA of another distribution
4 will want the latest series all the time. Instead check if the requested
5 codename (that is the codename of the installed distribution) is a valid
6 series in launchpad for the distribution the PPA belongs to. This
7 essentially enables derivate distributions to carry a different name but
8 use the same series name. As long as launchpad knows about the series we
9 should be fine even if the constraints are a bit lax.
10
11 -- Harald Sitter <sitter@kde.org> Mon, 02 May 2016 10:41:50 +0200
12
1software-properties (0.96.24.1) yakkety; urgency=medium13software-properties (0.96.24.1) yakkety; urgency=medium
214
3 * tests/test_shortcuts.py: make the tests python2 compatible.15 * tests/test_shortcuts.py: make the tests python2 compatible.
416
=== modified file 'softwareproperties/ppa.py'
--- softwareproperties/ppa.py 2016-06-22 13:48:33 +0000
+++ softwareproperties/ppa.py 2016-08-12 11:52:12 +0000
@@ -52,6 +52,7 @@
52LAUNCHPAD_USER_API = 'https://launchpad.net/api/1.0/%s'52LAUNCHPAD_USER_API = 'https://launchpad.net/api/1.0/%s'
53LAUNCHPAD_USER_PPAS_API = 'https://launchpad.net/api/1.0/%s/ppas'53LAUNCHPAD_USER_PPAS_API = 'https://launchpad.net/api/1.0/%s/ppas'
54LAUNCHPAD_DISTRIBUTION_API = 'https://launchpad.net/api/1.0/%s'54LAUNCHPAD_DISTRIBUTION_API = 'https://launchpad.net/api/1.0/%s'
55LAUNCHPAD_DISTRIBUTION_SERIES_API = 'https://launchpad.net/api/1.0/%s/%s'
55# Specify to use the system default SSL store; change to a different path56# Specify to use the system default SSL store; change to a different path
56# to test with custom certificates.57# to test with custom certificates.
57LAUNCHPAD_PPA_CERT = "/etc/ssl/certs/ca-certificates.crt"58LAUNCHPAD_PPA_CERT = "/etc/ssl/certs/ca-certificates.crt"
@@ -90,6 +91,14 @@
90 lp_url = LAUNCHPAD_PPA_API % (owner_name, ppa)91 lp_url = LAUNCHPAD_PPA_API % (owner_name, ppa)
91 return get_info_from_lp(lp_url)92 return get_info_from_lp(lp_url)
9293
94def series_valid_for_distro(distribution, series):
95 lp_url = LAUNCHPAD_DISTRIBUTION_SERIES_API % (distribution, series)
96 try:
97 get_info_from_lp(lp_url)
98 return True
99 except PPAException:
100 return False
101
93def get_current_series_from_lp(distribution):102def get_current_series_from_lp(distribution):
94 lp_url = LAUNCHPAD_DISTRIBUTION_API % distribution103 lp_url = LAUNCHPAD_DISTRIBUTION_API % distribution
95 return os.path.basename(get_info_from_lp(lp_url)["current_series_link"])104 return os.path.basename(get_info_from_lp(lp_url)["current_series_link"])
@@ -165,7 +174,7 @@
165 try:174 try:
166 # double check that the signing key is a v4 fingerprint (160bit)175 # double check that the signing key is a v4 fingerprint (160bit)
167 if not verify_keyid_is_v4(signing_key_fingerprint):176 if not verify_keyid_is_v4(signing_key_fingerprint):
168 print("Error: signing key fingerprint '%s' too short" % 177 print("Error: signing key fingerprint '%s' too short" %
169 signing_key_fingerprint)178 signing_key_fingerprint)
170 return False179 return False
171 except TypeError:180 except TypeError:
@@ -210,7 +219,7 @@
210 def _verify_fingerprint(self, keyring, expected_fingerprint, keyring_dir):219 def _verify_fingerprint(self, keyring, expected_fingerprint, keyring_dir):
211 got_fingerprints = self._get_fingerprints(keyring, keyring_dir)220 got_fingerprints = self._get_fingerprints(keyring, keyring_dir)
212 if len(got_fingerprints) > 1:221 if len(got_fingerprints) > 1:
213 print("Got '%s' fingerprints, expected only one" % 222 print("Got '%s' fingerprints, expected only one" %
214 len(got_fingerprints))223 len(got_fingerprints))
215 return False224 return False
216 got_fingerprint = got_fingerprints[0]225 got_fingerprint = got_fingerprints[0]
@@ -222,7 +231,7 @@
222231
223 def add_ppa_signing_key(self, ppa_path=None):232 def add_ppa_signing_key(self, ppa_path=None):
224 """Query and add the corresponding PPA signing key.233 """Query and add the corresponding PPA signing key.
225 234
226 The signing key fingerprint is obtained from the Launchpad PPA page,235 The signing key fingerprint is obtained from the Launchpad PPA page,
227 via a secure channel, so it can be trusted.236 via a secure channel, so it can be trusted.
228 """237 """
@@ -364,9 +373,16 @@
364 return self._info373 return self._info
365374
366 def expand(self, codename, distro=None):375 def expand(self, codename, distro=None):
367 if distro is not None and distro != self._info["distribution"]:376 if (distro is not None
377 and distro != self._info["distribution"]
378 and not series_valid_for_distro(self._info["distribution"], codename)):
368 # The requested PPA is for a foreign distribution. Guess that379 # The requested PPA is for a foreign distribution. Guess that
369 # the user wants that distribution's current series.380 # the user wants that distribution's current series.
381 # This only applies if the local distribution is not the same
382 # distribution the remote PPA is associated with AND the local
383 # codename is not equal to the PPA's series.
384 # e.g. local:Foobar/xenial and ppa:Ubuntu/xenial will use 'xenial'
385 # local:Foobar/fluffy and ppa:Ubuntu/xenial will use '$latest'
370 codename = get_current_series_from_lp(self._info["distribution"])386 codename = get_current_series_from_lp(self._info["distribution"])
371 debline = "deb http://ppa.launchpad.net/%s/%s/%s %s main" % (387 debline = "deb http://ppa.launchpad.net/%s/%s/%s %s main" % (
372 self._info["owner"][1:], self._info["name"],388 self._info["owner"][1:], self._info["name"],

Subscribers

People subscribed via source and target branches

to status/vote changes: