Merge lp:~xnox/ubuntu-dev-tools/gnupginterface-is-evil into lp:~ubuntu-dev/ubuntu-dev-tools/trunk
- gnupginterface-is-evil
- Merge into trunk
Status: | Superseded |
---|---|
Proposed branch: | lp:~xnox/ubuntu-dev-tools/gnupginterface-is-evil |
Merge into: | lp:~ubuntu-dev/ubuntu-dev-tools/trunk |
Diff against target: |
461 lines (+4/-382) 6 files modified
debian/changelog (+4/-1) debian/control (+0/-3) debian/copyright (+0/-2) dgetlp (+0/-335) doc/dgetlp.1 (+0/-40) setup.py (+0/-1) |
To merge this branch: | bzr merge lp:~xnox/ubuntu-dev-tools/gnupginterface-is-evil |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu Development Team | Pending | ||
Review via email: mp+122402@code.launchpad.net |
This proposal has been superseded by a proposal from 2012-09-07.
Commit message
Description of the change
gnupginterface is evil, since it doesn't have python3 port. python-gnupg does have python3 port.
Colin Watson (cjwatson) wrote : | # |
Stefano Rivera (stefanor) wrote : | # |
Do we still need dgetlp? The only reason we still had it was for downloading stuff from the +queue pages. But now we have a spiffy new queue tool in ubuntu-
Dimitri John Ledkov (xnox) wrote : | # |
ubuntu-dev-tools in in universe & python-gnupg api is nice.
Lighter dependencies is good, so subprocess would be good as well.
Yeah, I was not sure about dgetlp at all, since it didn't look like it works with 3.0 formats correctly.
Please remove dgetlp & drop python-
James Page (james-page) wrote : | # |
Dmitrijs - please could you drop this merge proposal unless you intend to complete the work in your previous comment.
Ta.
- 1347. By Dimitri John Ledkov
-
* dgetlp: drop it, and hence remove python-
gnupginterface dependency.
Unmerged revisions
- 1347. By Dimitri John Ledkov
-
* dgetlp: drop it, and hence remove python-
gnupginterface dependency.
Preview Diff
1 | === modified file 'debian/changelog' |
2 | --- debian/changelog 2012-08-17 20:44:21 +0000 |
3 | +++ debian/changelog 2012-09-07 16:32:31 +0000 |
4 | @@ -15,7 +15,7 @@ |
5 | - Avoid duplicate Reverse-Build-Deps when sources build binaries of the |
6 | same name. |
7 | - Explain that backports aren't to fix bugs. |
8 | - * sponsor-patch: Don't fall over bugs targetted at the development release |
9 | + * sponsor-patch: Don't fall over bugs targeted at the development release |
10 | (LP: #936014) |
11 | |
12 | [ Benjamin Drung ] |
13 | @@ -23,6 +23,9 @@ |
14 | (LP: #1029155) |
15 | * sponsor-patch: Fix crash if Debian patch contains a slash. |
16 | |
17 | + [ Dmitrijs Ledkovs ] |
18 | + * dgetlp: drop it, and hence remove python-gnupginterface dependency. |
19 | + |
20 | -- Stefano Rivera <stefanor@ubuntu.com> Wed, 18 Jul 2012 12:47:01 +0200 |
21 | |
22 | ubuntu-dev-tools (0.143) unstable; urgency=low |
23 | |
24 | === modified file 'debian/control' |
25 | --- debian/control 2012-06-20 09:40:07 +0000 |
26 | +++ debian/control 2012-09-07 16:32:31 +0000 |
27 | @@ -17,7 +17,6 @@ |
28 | python-apt (>= 0.7.93~), |
29 | python-debian (>= 0.1.20~), |
30 | python-distro-info (>= 0.4~), |
31 | - python-gnupginterface, |
32 | python-httplib2, |
33 | python-launchpadlib (>= 1.5.7), |
34 | python-mox, |
35 | @@ -61,7 +60,6 @@ |
36 | pbuilder | cowdancer | sbuild, |
37 | perl-modules, |
38 | python-dns, |
39 | - python-gnupginterface, |
40 | python-soappy, |
41 | quilt, |
42 | reportbug (>= 3.39ubuntu1) |
43 | @@ -81,7 +79,6 @@ |
44 | - check-symbols - will compare and give you a diff of the exported symbols of |
45 | all .so files in a binary package. |
46 | - dch-repeat - used to repeat a change log into an older release. |
47 | - - dgetlp - download a source package from the Launchpad librarian. |
48 | - grab-merge - grabs a merge from merges.ubuntu.com easily. |
49 | - grep-merges - search for pending merges from Debian. |
50 | - harvest - grabs information about development opportunities from |
51 | |
52 | === modified file 'debian/copyright' |
53 | --- debian/copyright 2012-02-25 14:42:08 +0000 |
54 | +++ debian/copyright 2012-09-07 16:32:31 +0000 |
55 | @@ -40,9 +40,7 @@ |
56 | version 2 can be found in the /usr/share/common-licenses/GPL-2 file. |
57 | |
58 | Files: 404main |
59 | - dgetlp |
60 | doc/404main.1 |
61 | - doc/dgetlp.1 |
62 | doc/import-bug-from-debian.1 |
63 | doc/pbuilder-dist-simple.1 |
64 | doc/pbuilder-dist.1 |
65 | |
66 | === removed file 'dgetlp' |
67 | --- dgetlp 2012-05-06 04:27:32 +0000 |
68 | +++ dgetlp 1970-01-01 00:00:00 +0000 |
69 | @@ -1,335 +0,0 @@ |
70 | -#!/usr/bin/python |
71 | -# -*- coding: UTF-8 -*- |
72 | -# Copyright (C) 2008 Terence Simpson <tsimpson@ubuntu.com> |
73 | -# License: |
74 | -# This program is free software; you can redistribute it and/or modify |
75 | -# it under the terms of the GNU General Public License as published by |
76 | -# the Free Software Foundation; either version 2 of the License, or |
77 | -# (at your option) any later version. |
78 | -# |
79 | -# This program is distributed in the hope that it will be useful, |
80 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
81 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
82 | -# GNU General Public License for more details. |
83 | -# |
84 | -# You should have received a copy of the GNU General Public License along |
85 | -# with this program; if not, write to the Free Software Foundation, Inc., |
86 | -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
87 | -# |
88 | -# This script simulates «dget»'s behaviour for files hosted at |
89 | -# launchpadlibrarian.net. |
90 | -# |
91 | -# Detailed description: |
92 | -# This script attempts to download the source package in the same |
93 | -# way as dget does, but from launchpadlibrarian.net, which doesn't |
94 | -# store all the files in the same directory. It (the script) assumes |
95 | -# that the files are stored in sequential directories on Launchpad |
96 | -# Librarian and attempts to download and then unpack them. |
97 | -# This is a Python rewrite of the original bash script |
98 | - |
99 | -import cStringIO |
100 | -import email.feedparser |
101 | -import hashlib |
102 | -import optparse |
103 | -import os |
104 | -import sys |
105 | -import urllib2 |
106 | - |
107 | -try: |
108 | - import GnuPGInterface |
109 | -except ImportError: |
110 | - print >> sys.stderr, ("Please install 'python-gnupginterface' in order to " |
111 | - "use this utility.") |
112 | - sys.exit(1) |
113 | - |
114 | -from ubuntutools import subprocess |
115 | -import ubuntutools.misc |
116 | - |
117 | -USAGE = u"""Usage: %prog [-d|(-v|-q)] <Launchpad URL> |
118 | - |
119 | -This scripts simulates «dget»'s behaviour for files hosted at |
120 | -launchpadlibrarian.net. |
121 | - |
122 | -If you specify the -d option then it won't do anything, except download the |
123 | -.dsc file, but just print the commands it would run otherwise. |
124 | - |
125 | -Example: |
126 | - %prog http://launchpadlibrarian.net/10348157/coreutils_5.97-5.4ubuntu1.dsc |
127 | -""" |
128 | - |
129 | -BASE_URL = "http://launchpadlibrarian.net/" |
130 | - |
131 | -Debug = Verbose = Quiet = False |
132 | - |
133 | -def unsign(data): |
134 | - if data.splitlines()[0] != "-----BEGIN PGP SIGNED MESSAGE-----": |
135 | - return data |
136 | - oldstdout = sys.stdout |
137 | - oldstderr = sys.stderr |
138 | - sys.stdout = sys.__stdout__ |
139 | - sys.stderr = sys.__stderr__ |
140 | - gpg = GnuPGInterface.GnuPG() |
141 | - proc = gpg.run(["--decrypt"], create_fhs=['stdin', 'stdout']) |
142 | - proc.handles['stdin'].write(data) |
143 | - proc.handles['stdin'].close() |
144 | - plain = proc.handles['stdout'].read() |
145 | - proc.handles['stdout'].close() |
146 | - try: |
147 | - proc.wait() |
148 | - except: |
149 | - pass |
150 | - sys.stdout = oldstdout |
151 | - sys.stderr = oldstderr |
152 | - return plain |
153 | - |
154 | -def get_entries(data): |
155 | - parser = email.feedparser.FeedParser() |
156 | - parser.feed(data) |
157 | - return parser.close() |
158 | - |
159 | -class DscParse(object): |
160 | - """Attempt to get the file list from the .dsc file""" |
161 | - def __init__(self, data): |
162 | - """ |
163 | - __init__(data) |
164 | - Given the contents of a .dsc, parse it and extract it's content |
165 | - """ |
166 | - self.entries = get_entries(unsign(data)) |
167 | - self.files = [x.strip().split() for x in |
168 | - self.entries['Files'].splitlines()] |
169 | - |
170 | - def verify_all(self): |
171 | - """ |
172 | - verify_all() |
173 | - Verifies all the files, first checking the size, then the md5 sum. |
174 | - Currently not used in this utility. |
175 | - """ |
176 | - assert self.files, "I have no files" |
177 | - ret = [] |
178 | - for f in self.files: |
179 | - ret.append(self.verify(f)) |
180 | - return ret |
181 | - |
182 | - def verify(self, name): |
183 | - """ |
184 | - verify(name) |
185 | - Verify the file 'name', first checking the size, then the md5 sum. |
186 | - """ |
187 | - assert self.files, "I have no files" |
188 | - f = None |
189 | - if isinstance(name, list): |
190 | - f = name |
191 | - else: |
192 | - for i in self.files: |
193 | - if i[2] == name: |
194 | - f = i |
195 | - if not f: |
196 | - raise ValueError, "%s is not in the .dsc" % name |
197 | - (md5sum, size, name) = tuple(f) |
198 | - stat = os.stat(name) |
199 | - if str(stat.st_size) != size: |
200 | - return (False, name, "Expected a size of %s, got %s" % \ |
201 | - (size, stat.st_size)) |
202 | - return self.getsum(name, md5sum) |
203 | - |
204 | - def getsum(self, name, md5sum=None): |
205 | - """ |
206 | - getsum(name[, md5sum]) |
207 | - Read the file 'name' (in 1MB chunks) and generate an md5 sum, |
208 | - then compares that to the md5 sum in the .dsc file. |
209 | - """ |
210 | - chunk_size = 1073741824 |
211 | - fd = open(name, 'rb') |
212 | - res = hashlib.md5() |
213 | - if not md5sum: |
214 | - assert self.files, "I have no files" |
215 | - md5sum = [x[0] for x in self.files if x[2] == name][0] |
216 | - data = fd.read(chunk_size) |
217 | - while data: |
218 | - res.update(data) |
219 | - data = fd.read(chunk_size) |
220 | - if res.hexdigest() != md5sum: |
221 | - return (False, name, "Expected md5sum of %r, got %r" % \ |
222 | - (md5sum, res.hexdigest())) |
223 | - return (True, name, None) |
224 | - |
225 | - def is_native(self): |
226 | - """ |
227 | - is_native() |
228 | - Returns True if this .dsc describes a native debian package; |
229 | - else false. |
230 | - """ |
231 | - return len(self.files) == 1 |
232 | - |
233 | - # Access to fields in the .dsc via a dict-like interface |
234 | - def __getitem__(self, item): |
235 | - """ |
236 | - x.__getitem(item) -> x[item] |
237 | - """ |
238 | - return self.entries.__getitem__(item) |
239 | - |
240 | - def __contains__(self, item): |
241 | - """ |
242 | - x.__contains__(item) -> item in x |
243 | - """ |
244 | - return self.entries.__contains__(item) |
245 | - |
246 | - def __getattr__(self, attr): |
247 | - """ |
248 | - x.__getattr__(attr) -> item.attr |
249 | - """ |
250 | - return getattr(self.entries, attr) |
251 | - |
252 | -def error(ret, msg, *args): |
253 | - """Prints an error message, unless quiet is set, and exits with ret""" |
254 | - if not Quiet: |
255 | - print >> sys.stderr, msg % args |
256 | - sys.exit(ret) |
257 | - |
258 | -def debug(msg, *args): |
259 | - """If debugging is enabled, print a message""" |
260 | - if Debug: |
261 | - print >> sys.stderr, msg % args |
262 | - |
263 | -def info(msg, *args): |
264 | - """If verbose is enabled, print a message""" |
265 | - if Verbose: |
266 | - print msg % tuple(args) |
267 | - |
268 | -def status(msg, *args): |
269 | - """Prints a message, unless quiet is enabled""" |
270 | - if not Quiet: |
271 | - print msg % tuple(args) |
272 | - |
273 | -def download(dscinfo, number, filename, verify=True): |
274 | - """download filename""" |
275 | - ftype = filename.endswith(".diff.gz") and "diff.gz" or \ |
276 | - filename.endswith(".orig.tar.gz") and "orig.tar.gz" or \ |
277 | - filename.endswith(".dsc") and "dsc" or "tar.gz" |
278 | - if verify and os.path.exists(filename): |
279 | - info('Verifying "%s"', filename) |
280 | - res = dscinfo.verify(filename) |
281 | - if not res[0]: |
282 | - error(104, "Verification of %s failed: %s", filename, res[2]) |
283 | - status("Getting %s", filename) |
284 | - debug("%s%s/%s", BASE_URL, number, filename) |
285 | - try: |
286 | - fd = urllib2.urlopen("%s%s/%s" % (BASE_URL, number, filename)) |
287 | - outfd = open(filename, 'wb') |
288 | - outfd.write(fd.read()) |
289 | - fd.close() |
290 | - outfd.close() |
291 | - except urllib2.HTTPError, err: |
292 | - status(u"Failed to fetch «%s» file, aborting.", ftype) |
293 | - error(106, "Error: (%d %s)", err.code, err.msg) |
294 | - except urllib2.URLError, err: |
295 | - status(u"Failed to fetch «%s» file, aborting.", ftype) |
296 | - error(105, "Error: %s", err) |
297 | - except IOError, err: |
298 | - status('Could not create "%s"', filename) |
299 | - error(107, "Error: %s", err) |
300 | - |
301 | -def unpack(filename): |
302 | - out = open('/dev/null', 'w') |
303 | - err = open('/dev/null', 'w') |
304 | - cmd = ["dpkg-source", "-x", filename] |
305 | - ret = subprocess.call(cmd, stdout=out, stderr=err) |
306 | - out.close() |
307 | - err.close() |
308 | - if ret: |
309 | - status("Failed to unpack source, aborting.") |
310 | - sys.exit(108) |
311 | - |
312 | -def get_host(url): |
313 | - return urllib2.splithost(urllib2.splittype(url)[1])[0] |
314 | - |
315 | -def main(): |
316 | - global Debug, Verbose, Quiet |
317 | - parser = optparse.OptionParser(usage=USAGE) |
318 | - parser.add_option("-d", "--debug", action="store_true", dest="debug", |
319 | - default=False, help="Enable debugging") |
320 | - parser.add_option("-v", "--verbose", action="store_true", dest="verbose", |
321 | - default=False, help="Enable verbose output") |
322 | - parser.add_option("-q", "--quiet", action="store_true", dest="quiet", |
323 | - default=False, help="Never print any output") |
324 | - |
325 | - (options, args) = parser.parse_args() |
326 | - ubuntutools.misc.require_utf8() |
327 | - |
328 | - if len(args) != 1: |
329 | - parser.error("Missing URL") |
330 | - Debug = options.debug |
331 | - Verbose = options.verbose |
332 | - Quiet = options.quiet |
333 | - if Verbose and Quiet: |
334 | - error(4, "Specifying both --verbose and --quiet does not make sense") |
335 | - if Quiet: |
336 | - sys.stderr = cStringIO.StringIO() |
337 | - sys.stdout = cStringIO.StringIO() |
338 | - |
339 | - url = args[0] |
340 | - |
341 | - if url.startswith("https://"): |
342 | - url = url.replace("https://", "http://", 1) |
343 | - |
344 | - if not url.startswith("http://"): |
345 | - url = "http://" + url |
346 | - |
347 | - if get_host(url).startswith("www."): |
348 | - url = url.replace("www.", "", 1) |
349 | - |
350 | - if get_host(url) != get_host(BASE_URL): |
351 | - error(1, "Error: This utility only works for files on %s.\n" |
352 | - "Maybe you want to try dget?", BASE_URL) |
353 | - |
354 | - (number, filename) = url.split('/')[3:] |
355 | - |
356 | - if not filename.endswith('.dsc'): |
357 | - error(2, "You have to provide the URL for the .dsc file.") |
358 | - |
359 | - try: |
360 | - number = int(number) |
361 | - except: |
362 | - error(3, "Bad URL format") |
363 | - |
364 | - if os.path.exists(filename): |
365 | - os.remove(filename) |
366 | - |
367 | - download(None, number, filename, False) |
368 | - try: |
369 | - fd = open(filename) |
370 | - dsc_data = fd.read() |
371 | - fd.close() |
372 | - except Exception: |
373 | - status("Error: Please report this bug, providing the URL and attach" |
374 | - " the following backtrace") |
375 | - raise |
376 | - |
377 | - dscinfo = DscParse(dsc_data) |
378 | - |
379 | -# launchpadlibrarian.net seems to store in this order: |
380 | -# For native packages: |
381 | -# <number>/.changes |
382 | -# <number>+1/.tar.gz |
383 | -# <number>+2/.dsc |
384 | -# For non-native packages: |
385 | -# <number>/.changes |
386 | -# <number>+1/.orig.tar.gz |
387 | -# <number>+2/.diff.gz |
388 | -# <number>+3/.dsc |
389 | -## |
390 | -# *Assuming* this does not change, we can figure out where the files are on |
391 | -# launchpadlibrarian.net relative to the .dsc file we're given. |
392 | - |
393 | -# Only one file listed in the .dsc means it's native package |
394 | - if len(dscinfo.files) == 1: |
395 | - download(dscinfo, number-1, dscinfo.files[0][-1]) # .tar.gz |
396 | - else: |
397 | - download(dscinfo, number-1, dscinfo.files[1][-1]) # .diff.gz |
398 | - download(dscinfo, number-2, dscinfo.files[0][-1]) # .orig.tar.gz |
399 | - |
400 | - status("Unpacking") |
401 | - unpack(filename) |
402 | - |
403 | -if __name__ == "__main__": |
404 | - main() |
405 | |
406 | === removed file 'doc/dgetlp.1' |
407 | --- doc/dgetlp.1 2012-01-22 19:26:39 +0000 |
408 | +++ doc/dgetlp.1 1970-01-01 00:00:00 +0000 |
409 | @@ -1,40 +0,0 @@ |
410 | -.TH DGETLP "1" "27 August 2008" "ubuntu-dev-tools" |
411 | - |
412 | -.SH NAME |
413 | -dgetlp \- simulate ``dget'' behaviour for files hosted at librarian.launchpad.net |
414 | - |
415 | -.SH SYNOPSIS |
416 | -.B dgetlp [\fB\-d\fP|\fB(\fB\-v\fP|\fB\-q\fP)\fP] <\fBLaunchpad DSC URL\fP> |
417 | - |
418 | -.SH DESCRIPTION |
419 | -\fBdgetlp\fR simulates dget behaviour by downloading and extracting the |
420 | -<\fBLaunchpad DSC URL\fP> from the Launchpad Librarian. |
421 | - |
422 | -.SH OPTIONS |
423 | -Listed below are the command line options for dgetlp: |
424 | -.TP |
425 | -.B \-h, \-\-help |
426 | -show this help message and exit. |
427 | -.TP |
428 | -.B \-d, \-\-debug |
429 | -Enable debugging. |
430 | -.TP |
431 | -.B \-v, \-\-verbose |
432 | -Enable verbose output. |
433 | -.TP |
434 | -.B \-q, \-\-quiet |
435 | -Never print any output. |
436 | -.TP |
437 | -.B <Launchpad DSC URL> |
438 | -This is the source package that you would like to be downloaded from the |
439 | -Launchpad Librarian. |
440 | - |
441 | -.SH EXAMPLE |
442 | -.B dgetlp http://launchpadlibrarian.net/10348157/coreutils_5.97-5.4ubuntu1.dsc |
443 | - |
444 | -.SH AUTHOR |
445 | -\fBdgetlp\fR was written by Terence Simpson <tsimpson@ubuntu.com> and |
446 | -modified by Siegfried-A. Gevatter <rainct@ubuntu.com>. The python rewrite |
447 | -was written by Terence Simpson <tsimpson@ubuntu.com> based off the original. |
448 | -This man page was written by Ryan Kavanagh <ryanakca@kubuntu.org>. |
449 | -Both are released under the GNU General Public License, version 2 or later. |
450 | |
451 | === modified file 'setup.py' |
452 | --- setup.py 2012-02-15 14:42:58 +0000 |
453 | +++ setup.py 2012-09-07 16:32:31 +0000 |
454 | @@ -19,7 +19,6 @@ |
455 | 'check-mir', |
456 | 'check-symbols', |
457 | 'dch-repeat', |
458 | - 'dgetlp', |
459 | 'grab-merge', |
460 | 'grep-merges', |
461 | 'harvest', |
You could also just use subprocess, for the sake of having lighter release- upgrader. python-gnupg is
dependencies - I did that in ubuntu-
currently in universe so this change would require an MIR.