/[soft]/mga-gnome/trunk/mga-gnome
ViewVC logotype

Contents of /mga-gnome/trunk/mga-gnome

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3384 - (show annotations) (download)
Sun Mar 11 13:15:23 2012 UTC (8 years, 4 months ago) by ovitters
File size: 25540 byte(s)
put better error message in subject line
1 #!/usr/bin/python -u
2
3 # A lot of the code comes from ftpadmin, see
4 # http://git.gnome.org/browse/sysadmin-bin/tree/ftpadmin
5 # Written by Olav Vitters
6
7 # basic modules:
8 import os
9 import os.path
10 import sys
11 import re
12 import subprocess
13
14 # command line parsing, error handling:
15 import argparse
16 import errno
17
18 # overwriting files by moving them (safer):
19 import tempfile
20 import shutil
21
22 # version comparison:
23 import rpm
24
25 # opening tarballs:
26 import tarfile
27 import gzip
28 import bz2
29 import lzma # pyliblzma
30
31 # getting links from HTML document:
32 from sgmllib import SGMLParser
33 import urllib2
34 import urlparse
35
36 # for checking hashes
37 import hashlib
38
39 # for parsing ftp-release-list emails
40 import email
41 from email.mime.text import MIMEText
42
43 # to be able to sleep for a while
44 import time
45
46 # version freeze
47 import datetime
48
49 MEDIA="Core Release Source"
50 URL="http://download.gnome.org/sources/"
51 PKGROOT='~/pkgs'
52 SLEEP_INITIAL=300
53
54 re_majmin = re.compile(r'^([0-9]+\.[0-9]+).*')
55 re_version = re.compile(r'([-.]|\d+|[^-.\d]+)')
56
57 def version_cmp(a, b):
58 """Compares two versions
59
60 Returns
61 -1 if a < b
62 0 if a == b
63 1 if a > b
64 """
65
66 return rpm.labelCompare(('1', a, '1'), ('1', b, '1'))
67
68 def get_latest_version(versions, max_version=None):
69 """Gets the latest version number
70
71 if max_version is specified, gets the latest version number before
72 max_version"""
73 latest = None
74 for version in versions:
75 if ( latest is None or version_cmp(version, latest) > 0 ) \
76 and ( max_version is None or version_cmp(version, max_version) < 0 ):
77 latest = version
78 return latest
79
80 def judge_version_increase(version_old, version_new):
81 """Judge quality of version increase:
82
83 Returns a tuple containing judgement and message
84
85 Judgement:
86 Less than 0: Error
87 0 to 4: Better not
88 5+: Ok"""
89 versions = (version_old, version_new)
90
91 # First do a basic version comparison to ensure version_new is actually newer
92 compare = version_cmp(version_new, version_old)
93
94 if compare == 0:
95 # 1.0.0 -> 1.0.1
96 return (-2, "Already at version %s!" % (version_old))
97
98 if compare != 1:
99 # 1.0.1 -> 1.0.0
100 return (-3, "Version %s is older than current version %s!" % (version_new, version_old))
101
102 # Version is newer, but we don't want to see if it follows the GNOME versioning scheme
103 majmins = [re_majmin.sub(r'\1', ver) for ver in versions if re_majmin.match(ver) is not None]
104
105 if len(majmins) == 1:
106 return (-1, "Version number scheme changes: %s" % (", ".join(versions)))
107
108 if len(majmins) == 0:
109 return (0, "Unsupported version numbers: %s" % (", ".join(versions)))
110
111 # Follows GNOME versioning scheme
112 # Meaning: x.y.z
113 # x = major
114 # y = minor : even if stable
115 # z = micro
116
117 # Major+minor the same? Then go ahead and upgrade!
118 if majmins[0] == majmins[1]:
119 # Majmin of both versions are the same, looks good!
120 # 1.1.x -> 1.1.x or 1.0.x -> 1.0.x
121 return (10, None)
122
123 # More detailed analysis needed, so figure out the numbers
124 majmin_nrs = [map(long, ver.split('.')) for ver in majmins]
125
126 # Check/ensure major version number is the same
127 if majmin_nrs[0][0] != majmin_nrs[1][0]:
128 # 1.0.x -> 2.0.x
129 return (1, "Major version number increase")
130
131 # Minor indicates stable/unstable
132 devstate = (majmin_nrs[0][1] % 2 == 0, majmin_nrs[1][1] % 2 == 0)
133
134 # Upgrading to unstable is weird
135 if not devstate[1]:
136 if devstate[0]:
137 # 1.2.x -> 1.3.x
138 return (1, "Stable to unstable increase")
139
140 # 1.3.x -> 1.5.x
141 return (4, "Unstable to unstable version increase")
142
143 # Unstable => stable is always ok
144 if not devstate[0]:
145 # 1.1.x -> 1.2.x
146 return (5, "Unstable to stable")
147
148 # Can only be increase of minors from one stable to the next
149 # 1.0.x -> 1.2.x
150 return (6, "Stable version increase")
151
152 def line_input (file):
153 for line in file:
154 if line[-1] == '\n':
155 yield line[:-1]
156 else:
157 yield line
158
159 def call_editor(filename):
160 """Return a sequence of possible editor binaries for the current platform"""
161
162 editors = []
163
164 for varname in 'VISUAL', 'EDITOR':
165 if varname in os.environ:
166 editors.append(os.environ[varname])
167
168 editors.extend(('/usr/bin/editor', 'vi', 'pico', 'nano', 'joe'))
169
170 for editor in editors:
171 try:
172 ret = subprocess.call([editor, filename])
173 except OSError, e:
174 if e.errno == 2:
175 continue
176 raise
177
178 if ret == 127:
179 continue
180
181 return True
182
183 class urllister(SGMLParser):
184 def reset(self):
185 SGMLParser.reset(self)
186 self.urls = []
187
188 def start_a(self, attrs):
189 href = [v for k, v in attrs if k=='href']
190 if href:
191 self.urls.extend(href)
192
193 class XzTarFile(tarfile.TarFile):
194
195 OPEN_METH = tarfile.TarFile.OPEN_METH.copy()
196 OPEN_METH["xz"] = "xzopen"
197
198 @classmethod
199 def xzopen(cls, name, mode="r", fileobj=None, **kwargs):
200 """Open gzip compressed tar archive name for reading or writing.
201 Appending is not allowed.
202 """
203 if len(mode) > 1 or mode not in "rw":
204 raise ValueError("mode must be 'r' or 'w'")
205
206 if fileobj is not None:
207 fileobj = _LMZAProxy(fileobj, mode)
208 else:
209 fileobj = lzma.LZMAFile(name, mode)
210
211 try:
212 # lzma doesn't immediately return an error
213 # try and read a bit of data to determine if it is a valid xz file
214 fileobj.read(_LZMAProxy.blocksize)
215 fileobj.seek(0)
216 t = cls.taropen(name, mode, fileobj, **kwargs)
217 except IOError:
218 raise tarfile.ReadError("not a xz file")
219 except lzma.error:
220 raise tarfile.ReadError("not a xz file")
221 t._extfileobj = False
222 return t
223
224 if not hasattr(tarfile.TarFile, 'xzopen'):
225 tarfile.open = XzTarFile.open
226
227 def is_valid_hash(path, algo, hexdigest):
228 if algo not in hashlib.algorithms:
229 raise ValueError("Unknown hash algorithm: %s" % algo)
230
231 local_hash = getattr(hashlib, algo)()
232
233 with open(path, 'rb') as fp:
234 data = fp.read(32768)
235 while data:
236 local_hash.update(data)
237 data = fp.read(32768)
238
239 return local_hash.hexdigest() == hexdigest
240
241 class SpecFile(object):
242 re_update_version = re.compile(r'^(?P<pre>Version:\s*)(?P<version>.+)(?P<post>\s*)$', re.MULTILINE + re.IGNORECASE)
243 re_update_release = re.compile(r'^(?P<pre>Release:\s*)(?P<release>%mkrel \d+)(?P<post>\s*)$', re.MULTILINE + re.IGNORECASE)
244
245 def __init__(self, path):
246 self.path = path
247 self.cwd = os.path.dirname(path)
248
249 @property
250 def version(self):
251 return subprocess.check_output(["rpm", "--specfile", self.path, "--queryformat", "%{VERSION}\n"]).splitlines()[0]
252 @property
253 def sources(self):
254 ts = rpm.ts()
255 spec = ts.parseSpec(self.path)
256 srclist = spec.sources if isinstance(spec.sources, (list, tuple)) \
257 else spec.sources()
258 return dict((os.path.basename(name), name) for name, no, flags in srclist)
259
260 def update(self, version):
261 """Update specfile (increase version)"""
262 cur_version = self.version
263
264 (judgement, msg) = judge_version_increase(cur_version, version)
265
266 if judgement < 0:
267 print >>sys.stderr, "ERROR: %s!" % (msg)
268 return False
269
270 if judgement < 5:
271 print "WARNING: %s!" % (msg)
272 return False
273
274 # XXX - os.path.join is hackish
275 if subprocess.check_output(["svn", "diff", os.path.join(self.path, '..')]) != '':
276 print >>sys.stderr, "ERROR: Package has uncommitted changes!"
277 return False
278
279 with open(self.path, "rw") as f:
280 data = f.read()
281
282 if data.count("%mkrel") != 1:
283 print >>sys.stderr, "ERROR: Multiple %mkrel found; don't know what to do!"
284 return False
285
286 data, nr = self.re_update_version.subn(r'\g<pre>%s\g<post>' % version, data, 1)
287 if nr != 1:
288 print >>sys.stderr, "ERROR: Could not increase version!"
289 return False
290
291 data, nr = self.re_update_release.subn(r'\g<pre>%mkrel 1\g<post>', data, 1)
292 if nr != 1:
293 print >>sys.stderr, "ERROR: Could not reset release!"
294 return False
295
296 # Overwrite file with new version number
297 write_file(self.path, data)
298
299
300 # Verify that RPM also agrees that version number has changed
301 if self.version != version:
302 print "ERROR: Increased version to %s, but RPM doesn't agree!?!" % version
303 return False
304
305 try:
306 # Download new tarball
307 subprocess.check_call(['mgarepo', 'sync', '-d'], cwd=self.cwd)
308 # Check patches still apply
309 subprocess.check_call(['bm', '-p', '--nodeps'], cwd=self.cwd)
310 except subprocess.CalledProcessError:
311 return False
312
313 return True
314
315 class Patch(object):
316 """Do things with patches"""
317
318 re_dep3 = re.compile(r'^(?:#\s*)?(?P<header>[-A-Za-z0-9]+?):\s*(?P<data>.*)$')
319 re_dep3_cont = re.compile(r'^#?\s+(?P<data>.*)$')
320
321 def __init__(self, path, show_path=False):
322 """Path: path to patch (might not exist)"""
323 self.path = path
324 self.show_path = show_path
325
326 def __str__(self):
327 return self.path if self.show_path else os.path.basename(self.path)
328
329 def add_dep3(self):
330 """Add DEP-3 headers to a patch file"""
331 if self.dep3['valid']:
332 return False
333
334 new_headers = (
335 ('Author', self.svn_author),
336 ('Subject', ''),
337 ('Applied-Upstream', ''),
338 ('Forwarded', ''),
339 ('Bug', ''),
340 )
341
342 with tempfile.NamedTemporaryFile(dir=os.path.dirname(self.path), delete=False) as fdst:
343 with open(self.path, "r") as fsrc:
344 # Start with any existing DEP3 headers
345 for i in range(self.dep3['last_nr']):
346 fdst.write(fsrc.read())
347
348 # After that add the DEP3 headers
349 add_line = False
350 for header, data in new_headers:
351 if header in self.dep3['headers']:
352 continue
353
354 # XXX - wrap this at 80 chars
355 add_line = True
356 print >>fdst, "%s: %s" % (header, "" if data is None else data)
357
358 if add_line: print >>fdst, ""
359 # Now copy any other data and the patch
360 shutil.copyfileobj(fsrc, fdst)
361
362 fdst.flush()
363 os.rename(fdst.name, self.path)
364
365 call_editor(self.path)
366
367 #Author: fwang
368 #Subject: Build fix: Fix glib header inclusion
369 #Applied-Upstream: commit:30602
370 #Forwarded: yes
371 #Bug: http://bugzilla.abisource.com/show_bug.cgi?id=13247
372
373 def _read_dep3(self):
374 """Read DEP-3 headers from an existing patch file
375
376 This will also parse git headers"""
377 dep3 = {}
378 headers = {}
379
380 last_header = None
381 last_nr = 0
382 nr = 0
383 try:
384 with open(self.path, "r") as f:
385 for line in line_input(f):
386 nr += 1
387 # stop trying to parse when real patch begins
388 if line == '---':
389 break
390
391 r = self.re_dep3.match(line)
392 if r:
393 info = r.groupdict()
394
395 # Avoid matching URLS
396 if info['data'].startswith('//') and info['header'].lower () == info['header']:
397 continue
398
399 headers[info['header']] = info['data']
400 last_header = info['header']
401 last_nr = nr
402 continue
403
404 r = self.re_dep3_cont.match(line)
405 if r:
406 info = r.groupdict()
407 if last_header:
408 headers[last_header] = " ".join((headers[last_header], info['data']))
409 last_nr = nr
410 continue
411
412 last_header = None
413 except IOError:
414 pass
415
416 dep3['valid'] = \
417 (('Description' in headers and headers['Description'].strip() != '')
418 or ('Subject' in headers and headers['Subject'].strip() != '')) \
419 and (('Origin' in headers and headers['Origin'].strip() != '') \
420 or ('Author' in headers and headers['Author'].strip() != '') \
421 or ('From' in headers and headers['From'].strip() != ''))
422 dep3['last_nr'] = last_nr
423 dep3['headers'] = headers
424
425 self._dep3 = dep3
426
427 @property
428 def dep3(self):
429 if not hasattr(self, '_dep3'):
430 self._read_dep3()
431
432 return self._dep3
433
434 @property
435 def svn_author(self):
436 if not hasattr(self, '_svn_author'):
437 try:
438 contents = subprocess.check_output(['svn', 'log', '-q', "--", self.path], close_fds=True).strip("\n").splitlines()
439
440 for line in contents:
441 if ' | ' not in line:
442 continue
443
444 fields = line.split(' | ')
445 if len(fields) >= 3:
446 self._svn_author = fields[1]
447 except subprocess.CalledProcessError:
448 pass
449
450 if not hasattr(self, '_svn_author'):
451 return None
452
453 return self._svn_author
454
455 def get_upstream_names():
456 urlopen = urllib2.build_opener()
457
458 good_dir = re.compile('^[-A-Za-z0-9_+.]+/$')
459
460 # Get the files
461 usock = urlopen.open(URL)
462 parser = urllister()
463 parser.feed(usock.read())
464 usock.close()
465 parser.close()
466 files = parser.urls
467
468 tarballs = set([filename.replace('/', '') for filename in files if good_dir.search(filename)])
469
470 return tarballs
471
472 def get_downstream_names():
473 re_file = re.compile(r'^(?P<module>.*?)[_-](?:(?P<oldversion>([0-9]+[\.])*[0-9]+)-)?(?P<version>([0-9]+[\.\-])*[0-9]+)\.(?P<format>(?:tar\.|diff\.)?[a-z][a-z0-9]*)$')
474
475 contents = subprocess.check_output(['urpmf', '--files', '.', "--media", MEDIA], close_fds=True).strip("\n").splitlines()
476
477 FILES = {}
478 TARBALLS = {}
479
480 for line in contents:
481 try:
482 srpm, filename = line.split(":")
483 except ValueError:
484 print >>sys.stderr, line
485 continue
486
487 if '.tar' in filename:
488 r = re_file.match(filename)
489 if r:
490 fileinfo = r.groupdict()
491 module = fileinfo['module']
492
493 if module not in TARBALLS:
494 TARBALLS[module] = set()
495 TARBALLS[module].add(srpm)
496
497 if srpm not in FILES:
498 FILES[srpm] = set()
499 FILES[srpm].add(filename)
500
501 return TARBALLS, FILES
502
503 def get_downstream_from_upstream(upstream, version):
504 # Determine the package name
505 downstream, downstream_files = get_downstream_names()
506
507 if upstream not in downstream:
508 raise ValueError("No packages for upstream name: %s" % upstream)
509
510 if len(downstream[upstream]) != 1:
511 # XXX - Make it more intelligent
512 raise ValueError("Multiple packages found for %s: %s" % (upstream, ", ".join(downstream[upstream])))
513
514 return list(downstream[upstream])
515
516 def write_file(path, data):
517 with tempfile.NamedTemporaryFile(dir=os.path.dirname(path), delete=False) as fdst:
518 fdst.write(data)
519 fdst.flush()
520 os.rename(fdst.name, path)
521
522 def cmd_co(options, parser):
523 upstream = get_upstream_names()
524 downstream, downstream_files = get_downstream_names()
525
526 cwd = os.path.expanduser(PKGROOT)
527
528 matches = upstream & set(downstream.keys())
529 for module in matches:
530 print module, "\t".join(downstream[module])
531 for package in downstream[module]:
532 subprocess.call(['mgarepo', 'co', package], cwd=cwd)
533
534 def join_streams():
535 upstream = get_upstream_names()
536 downstream, downstream_files = get_downstream_names()
537
538 matches = upstream & set(downstream.keys())
539 for module in matches:
540 for package in downstream[module]:
541 yield (package, module)
542
543 def cmd_ls(options, parser):
544 for package, module in sorted(join_streams()):
545 print "\t".join((package, module)) if options.upstream else package
546
547 def cmd_patches(options, parser):
548 upstream = get_upstream_names()
549 downstream, downstream_files = get_downstream_names()
550
551 path = os.path.expanduser(PKGROOT)
552
553 import pprint
554
555 matches = upstream & set(downstream.keys())
556 for module in sorted(matches):
557 for srpm in downstream[module]:
558 for filename in downstream_files[srpm]:
559 if '.patch' in filename or '.diff' in filename:
560
561 p = Patch(os.path.join(path, srpm, "SOURCES", filename), show_path=options.path)
562 valid = ""
563 forwarded = ""
564 if p.dep3['headers']:
565 forwarded = p.dep3['headers'].get('Forwarded', "no")
566 if p.dep3['valid']:
567 valid="VALID"
568 print "\t".join((module, srpm, str(p), forwarded, valid))
569
570 def cmd_dep3(options, parser):
571 p = Patch(options.patch)
572 p.add_dep3()
573
574 def cmd_package_new_version(options, parser):
575 # Determine the package name
576 if options.upstream:
577 try:
578 package = get_downstream_from_upstream(options.package, options.version)[0]
579 except ValueError, e:
580 print >>sys.stderr, "ERROR: %s" % e
581 sys.exit(1)
582 else:
583 package = options.package
584
585 # Directories packages are located in
586 root = os.path.expanduser(PKGROOT)
587 cwd = os.path.join(root, package)
588
589 # Checkout package to ensure the checkout reflects the latest changes
590 try:
591 subprocess.check_call(['mgarepo', 'co', package], cwd=root)
592 except subprocess.CalledProcessError:
593 sys.exit(1)
594
595 # SpecFile class handles the actual version+release change
596 s = SpecFile(os.path.join(cwd, "SPECS", "%s.spec" % package))
597 print "%s => %s" % (s.version, options.version)
598 if not s.update(options.version):
599 sys.exit(1)
600
601 # Check hash, if given
602 if options.hexdigest is not None:
603 sources = [name for name, origname in s.sources.iteritems() if '://' in origname]
604 if not len(sources):
605 print >>sys.stderr, "ERROR: Cannot determine source file (for hash check)!"
606 sys.stderr(1)
607
608 for filename in sources:
609 if not is_valid_hash(os.path.join(cwd, "SOURCES", filename), options.algo, options.hexdigest):
610 print >>sys.stderr, "ERROR: Hash file failed check for %s!" % path
611 print >>sys.stderr, "ERROR: Reverting changes!"
612 subprocess.call(['svn', 'revert', '-R', cwd], cwd=cwd)
613 sys.exit(1)
614
615 # We can even checkin and submit :-)
616 if options.submit:
617 try:
618 # checkin changes
619 subprocess.check_call(['mgarepo', 'ci', '-m', 'new version %s' % options.version], cwd=cwd)
620 # and submit
621 subprocess.check_call(['mgarepo', 'submit'], cwd=cwd)
622 except subprocess.CalledProcessError:
623 sys.exit(1)
624
625 def cmd_parse_ftp_release_list(options, parser):
626 # XXX - not working yet
627 def _send_reply_mail(contents, orig_msg, to, error=False):
628 """Send an reply email"""
629 contents.seek(0)
630 msg = MIMEText(contents.read(), _charset='utf-8')
631 if error:
632 # XXX - ugly
633 contents.seek(0)
634 lastline = contents.read().splitlines()[-1]
635 # Remove things like "ERROR: " and so on from the last line
636 lastline = re.sub(r'^(?:[^ :]+:\s+)+', '', lastline)
637 subjecterrror = " (ERROR: %s)" % lastline if lastline else " (ERROR)"
638 else:
639 subjecterror = ""
640 msg['Subject'] = "Re: %s%s" (orig_msg['Subject'], subjecterror)
641 msg['To'] = to
642 msg["In-Reply-To"] = orig_msg["Message-ID"]
643 msg["References"] = orig_msg["Message-ID"]
644
645 # Call sendmail program directly so it doesn't matter if the service is running
646 cmd = ['/usr/sbin/sendmail', '-oi', '--']
647 cmd.extend([to])
648 p = subprocess.Popen(cmd, stdin=subprocess.PIPE)
649 p.stdin.write(msg.as_string())
650 p.stdin.flush()
651 p.stdin.close()
652 p.wait()
653
654
655 msg = email.email.message_from_file(sys.stdin)
656
657 if options.mail:
658 stdout = tempfile.TemporaryFile()
659 stderr = stdout
660 else:
661 stdout = sys.stdout
662 stderr = sys.stderr
663
664 version_freeze = datetime.datetime(2012,3,7,23,59,0)
665 now = datetime.datetime.utcnow()
666 if now > version_freeze:
667 print >>stderr, "ERROR: Past version freeze"
668 if options.mail: _send_reply_mail(stdout, msg, options.mail, error=True)
669 sys.exit(1)
670
671 try:
672 module = msg['X-Module-Name']
673 version = msg['X-Module-Version']
674 hexdigest = msg['X-Module-SHA256-tar.xz']
675 except KeyError, e:
676 print >>stderr, "ERROR: %s" % e
677 if options.mail: _send_reply_mail(stdout, msg, options.mail, error=True)
678 sys.exit(1)
679
680 try:
681 packages = get_downstream_from_upstream(module, version)
682 except ValueError, e:
683 print >>stderr, "ERROR: %s" % e
684 if options.mail: _send_reply_mail(stdout, msg, options.mail, error=True)
685 sys.exit(1)
686
687 if options.wait:
688 # maildrop aborts and will try to deliver after 5min
689 # fork to avoid this
690 if os.fork() != 0: sys.exit(0)
691 time.sleep(SLEEP_INITIAL)
692
693 error = False
694 for package in packages:
695 if subprocess.call(['mga-gnome', 'increase', '--submit', '--hash', hexdigest, package, version], stdout=stdout, stderr=stderr):
696 error = True
697
698 if options.mail: _send_reply_mail(stdout, msg, options.mail, error=error)
699
700 def main():
701 description = """Mageia GNOME commands."""
702 epilog="""Report bugs to Olav Vitters"""
703 parser = argparse.ArgumentParser(description=description,epilog=epilog)
704
705 # SUBPARSERS
706 subparsers = parser.add_subparsers(title='subcommands')
707 # install
708 subparser = subparsers.add_parser('co', help='checkout all GNOME modules')
709 subparser.set_defaults(
710 func=cmd_co
711 )
712
713 subparser = subparsers.add_parser('packages', help='list all GNOME packages')
714 subparser.add_argument("-m", "--m", action="store_true", dest="upstream",
715 help="Show upstream module")
716 subparser.set_defaults(
717 func=cmd_ls, upstream=False
718 )
719
720 subparser = subparsers.add_parser('patches', help='list all GNOME patches')
721 subparser.add_argument("-p", "--path", action="store_true", dest="path",
722 help="Show full path to patch")
723 subparser.set_defaults(
724 func=cmd_patches, path=False
725 )
726
727 subparser = subparsers.add_parser('dep3', help='Add dep3 headers')
728 subparser.add_argument("patch", help="Patch")
729 subparser.set_defaults(
730 func=cmd_dep3, path=False
731 )
732
733 subparser = subparsers.add_parser('increase', help='Increase version number')
734 subparser.add_argument("package", help="Package name")
735 subparser.add_argument("version", help="Version number")
736 subparser.add_argument("-u", "--upstream", action="store_true", dest="upstream",
737 help="Package name reflects the upstream name")
738 subparser.add_argument("-s", "--submit", action="store_true", dest="submit",
739 help="Commit changes and submit")
740 subparser.add_argument("-a", "--algorithm", choices=hashlib.algorithms, dest="algo",
741 help="Hash algorithm")
742 subparser.add_argument("--hash", dest="hexdigest",
743 help="Hexdigest of the hash")
744 subparser.set_defaults(
745 func=cmd_package_new_version, submit=False, upstream=False, hexdigest=None, algo="sha256"
746 )
747
748 subparser = subparsers.add_parser('gnome-release-email', help='Submit packages based on GNOME ftp-release-list email')
749 subparser.add_argument("-m", "--mail", help="Email address to send the progress to")
750 subparser.add_argument("-w", "--wait", action="store_true",
751 help="Wait before trying to retrieve the new version")
752 subparser.set_defaults(
753 func=cmd_parse_ftp_release_list
754 )
755
756 if len(sys.argv) == 1:
757 parser.print_help()
758 sys.exit(2)
759
760 options = parser.parse_args()
761
762 try:
763 options.func(options, parser)
764 except KeyboardInterrupt:
765 print('Interrupted')
766 sys.exit(1)
767 except EOFError:
768 print('EOF')
769 sys.exit(1)
770 except IOError, e:
771 if e.errno != errno.EPIPE:
772 raise
773 sys.exit(0)
774
775 if __name__ == "__main__":
776 main()

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.28