Merge lp:~vorlon/update-notifier/lp.876298 into lp:update-notifier
| Status: | Merged |
|---|---|
| Merged at revision: | 669 |
| Proposed branch: | lp:~vorlon/update-notifier/lp.876298 |
| Merge into: | lp:update-notifier |
| Diff against target: |
491 lines (+365/-8) 13 files modified
data/Makefile.am (+14/-1) data/package-data-downloader (+274/-0) data/package-data-downloads-failed-permanently.in (+14/-0) data/package-data-downloads-failed.in (+15/-0) debian/changelog (+16/-0) debian/control (+1/-1) debian/update-notifier-common.cron.daily (+6/-0) debian/update-notifier-common.dirs (+2/-0) debian/update-notifier-common.install (+2/-0) debian/update-notifier-common.postinst (+11/-0) debian/update-notifier-common.triggers (+1/-0) po/POTFILES.in (+2/-0) src/update-notifier.c (+7/-6) |
| To merge this branch: | bzr merge lp:~vorlon/update-notifier/lp.876298 |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Michael Vogt | 2012-03-20 | Pending | |
| Ubuntu Core Development Team | 2012-03-20 | Pending | |
|
Review via email:
|
|||
Description of the Change
initial implementation of a hook to let packages queue delayed downloads
- 654. By Steve Langasek on 2012-03-20
-
add proper exception handling so we can at least see unexpected exceptions;
this uncovered a buglet trying to push to sums without declaring it first... - 655. By Steve Langasek on 2012-03-20
-
use 'with open()' to be more idiomatic
- 656. By Steve Langasek on 2012-03-20
-
print the filename as we download it, not as we parse it
- 657. By Steve Langasek on 2012-03-20
-
support localization of the new file
- 658. By Steve Langasek on 2012-03-20
-
src/update-
notifier. c: when there are new hooks, check them whether or
not dpkg has run; this allows other packages to send us notifications
by ways other than running a package maintainer script. - 659. By Steve Langasek on 2012-03-20
-
there's no reason to 'pass' if we have other handling in place for the
exception - 660. By Steve Langasek on 2012-03-20
-
don't skip the script unless the *current* package is listed as failing the
checksum check.
| Steve Langasek (vorlon) wrote : | # |
| Steve Langasek (vorlon) wrote : | # |
I think the best solution here is to just require packages to remove their own stamp files in the maintainer script when they want to ensure a new download; annoyingly manual, but anything else is either going to download too little, or way too much.
- 661. By Steve Langasek on 2012-03-21
-
add support for reading proxy settings from apt
- 662. By Steve Langasek on 2012-03-21
-
Add proper error handling in case of download failure
- 663. By Steve Langasek on 2012-03-21
-
debian/
update- notifier- common. cron.daily: add a cronjob to periodically
retry any failed downloads. - 664. By Steve Langasek on 2012-03-21
-
add support for stampfiles for both permanent and temporary hook failures,
so we can keep track of what notifications we need to send to users. - 665. By Steve Langasek on 2012-03-22
-
Add data/package-
data-downloads- failed- permanently. in, so we can actually
notify the user of permanent errors. - 666. By Steve Langasek on 2012-03-22
-
tune the language in the notification for the non-permanent failures, based on
improvements in the new one for permanent failures - 667. By Steve Langasek on 2012-03-22
-
whoops, wrong variable
| Michael Vogt (mvo) wrote : | # |
Thanks Steve!
That looks very good, some small remarks:
+ regexp = re.compile(
+ for file in os.listdir(
+ match = regexp.match(file)
+ if match:
+ res.append(
Could be written as something like:
+ return glob.glob(
proxy_list = subprocess.
214 + 'http', 'Acquire:
215 + 'https', 'Acquire:
216 + 'ftp', 'Acquire:
...
Could we written as:
import apt
http_proxy = apt.apt_
https_proxy = apt.apt_
I think its a good idea to use:
+ output = subprocess.
instead of the buildin hashlib as this is simpler
+ if line == " $packages\n":
Could be written as something like:
line = string.
Note that this is all minor nitpicking. Having tests would be awsome of course, but
I can have a look at tihs tomorrow morning.
| Steve Langasek (vorlon) wrote : | # |
> Could be written as something like:
> + return glob.glob(
We do want to strip off the extension and directory name, though, to get just the name of the hook that's failed. So in the end, I'm not sure this is shorter/cleaner?
Committed the other two suggestions, thanks!
- 668. By Steve Langasek on 2012-03-23
-
since we already depend on python-apt, just use it instead of shelling out to
apt-config. - 669. By Steve Langasek on 2012-03-23
-
use string.Template per mvo's suggestion, instead of doing by-hand variable
substitution.
| Michael Vogt (mvo) wrote : | # |
Thanks a bunch, I don't have a strong opinion about the glob, here is the full alternative that we could
use, but either way is fine I think:
- res = []
- regexp = re.compile(
- for file in os.listdir(
- match = regexp.match(file)
- if match:
- res.append(
- return res
+ files = glob.glob(
+ return [os.path.
I work on lp:~mvo/update-notifier/lp.876298/ now to add some small tests and I did include this
change but feel free to not merge it if you like the previous version better, both work fine.
| Michael Vogt (mvo) wrote : | # |
I commited some basic tests to lp:~mvo/update-notifier/lp.876298/ mostly because I wanted to make sure that
I don't break stuff where I changed stuff. I also did some code changes and tried to cover them with tests
so that its safe. None of the code changes is really critical, look at them and pick the bits you like and
ignore the others :) I hope they all make sense but to a certain extend its a matter of preference. Taking
the tests would be nice though they should work regardless of the code changes I made.
Feedback very welcome, it would be really nice if we had a test for the process_
but I have not looked what this involves, probably a bit of "from mock import Mock,patch" to patch some
of the methods like urlretrieve() that we want to have mocks.
Thanks again for your work on this feature, I think its highly useful!
| Steve Langasek (vorlon) wrote : | # |
On Fri, Mar 23, 2012 at 09:16:20AM -0000, Michael Vogt wrote:
> I commited some basic tests to lp:~mvo/update-notifier/lp.876298/ mostly
> because I wanted to make sure that I don't break stuff where I changed
> stuff. I also did some code changes and tried to cover them with tests so
> that its safe. None of the code changes is really critical, look at them
> and pick the bits you like and ignore the others :) I hope they all make
> sense but to a certain extend its a matter of preference. Taking the
> tests would be nice though they should work regardless of the code changes
> I made.
Thanks, I've merged these changes into trunk now. (Well, this is an
overloaded MP now, isn't it?)
> Feedback very welcome, it would be really nice if we had a test for the
> process_
> probably a bit of "from mock import Mock,patch" to patch some of the
> methods like urlretrieve() that we want to have mocks.
I haven't had a chance to look at adding these tests yet. :/
We also don't have counter-based aging of failures yet. I guess we need to
get that sorted before landing this feature?
--
Steve Langasek Give me a lever long enough and a Free OS
Debian Developer to set it on, and I can move the world.
Ubuntu Developer http://
<email address hidden> <email address hidden>

This implementation has a problem. The file in /usr/share/ package- data-downloads will always have the mtime that was set when the package was created. This means that if a user installs an out-of-date version of the package which successfully downloads the data it requests, then runs apt-get update and installs the current version, the hook will not trigger because the stamp file's date will still be newer than the mtime on the hook.
Still thinking how to fix this.