Merge lp:~hodgestar/software-properties/configurable-key-server into lp:software-properties
Proposed by
Hodgestar
Status: | Merged |
---|---|
Merged at revision: | 662 |
Proposed branch: | lp:~hodgestar/software-properties/configurable-key-server |
Merge into: | lp:software-properties |
Diff against target: |
144 lines (+24/-5) 5 files modified
add-apt-repository (+8/-2) software-properties-gtk (+4/-0) software-properties-kde (+5/-0) softwareproperties/SoftwareProperties.py (+1/-1) softwareproperties/ppa.py (+6/-2) |
To merge this branch: | bzr merge lp:~hodgestar/software-properties/configurable-key-server |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Barry Warsaw (community) | code | Needs Fixing | |
Ubuntu Core Development Team | Pending | ||
Review via email: mp+57406@code.launchpad.net |
Description of the change
A small patch that adds a --keyserver option to apt-add-repository. My main use case is so that I can fall back to other alternatives if the Ubuntu key server is down or inaccessible for some reason. I consider the patch just a draft -- I don't know enough about how the code base is used to tell whether I've added the new option to the appropriate places.
To post a comment you must log in.
Hi Simon, thanks very much for the contribution to Ubuntu! I agree this could be a useful addition to the code. It doesn't happen often (these days, IME) but I have seen failures from the ubuntu keyserver, so in those cases it would be nice to have a fallback.
I have some comments on your patch. You're not too far off, but with a few changes, I think it would be a solid addition.
In add-apt-repository, I don't think you need the 'dest' argument to add_option(). The long version of the switch will be taken as the default dest. Also note the misspelling of 'Default' in the help string.
It looks like you have multiple places where 'hkp:// keyserver. ubuntu. com:80/ ' is hardcoded. I'd refactor this so that it's defined exactly once, in a module global constant (upper-cased) in ppa.py. Then in apt-add-repository, I'd change the import at line 9 to be:
from softwarepropert ies.ppa import DEFAULT_KEYSERVER, expand_ppa_line
(i.e. DEFAULT_KEYSERVER being the module global). Use that variable in the add_option() call.
Interestingly enough, the SoftwareProperties class already takes an `options` keyword in its __init__(), so I don't think you need to extend that method's signature to take a keyserver argument. In add-apt-repository, just create the instance like this:
sp = SoftwarePropert ies(options= options)
I guess the only concern here is whether the `options` that SoftwareProperties takes is intended to be the command line options or something else. Since it's undocumented and untested, let's assume 'yes' although the use of self.options. massive_ debug has me scratching my head. Anyway, I'd just pass in options to the constructor.
Now when you instantiate AddPPASigningKe yThread, pass in something like this:
worker = AddPPASigningKe yThread( parsed_ uri.path, options and options.keyserver)
Now in ppa.py, where you add a keyserver argument to AddPPASigningKe yThread. __init_ _(), use a default value of None instead of the hardcoded path, and do something like this in the __init__():
self.keyserver = (keyserver if keyserver is not None else DEFAULT_KEYSERVER)
I hope that all makes sense!
I wish this were testable, because then I'd be sure to request that you add a test for your new code :). If you feel like giving it a shot, go for it, but as the rest of the code isn't well tested, I wouldn't block your branch on that.
Marking as needs-fixing for now, but I'm happy to review an update if you push it.