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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3503 - (show annotations) (download)
Thu Mar 15 14:09:12 2012 UTC (12 years, 6 months ago) by ovitters
File size: 26195 byte(s)
remove obsolete comment
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', '--qf', '%name|%version|%files', '.', "--media", MEDIA], close_fds=True).strip("\n").splitlines()
476
477 FILES = {}
478 TARBALLS = {}
479
480 for line in contents:
481 try:
482 srpm, version, 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] = {}
495 TARBALLS[module][srpm] = version
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].keys())))
513
514 return downstream[upstream].keys()
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 root = os.path.expanduser(PKGROOT)
524
525 for package, module, package_version, spec_version, downstream_files in sorted(join_streams()):
526 print "%s => %s" % (module, package)
527 subprocess.call(['mgarepo', 'co', package], cwd=root)
528
529 def join_streams(show_version=False, only_diff_version=False):
530 root = os.path.expanduser(PKGROOT)
531
532 upstream = get_upstream_names()
533 downstream, downstream_files = get_downstream_names()
534
535 matches = upstream & set(downstream.keys())
536 for module in matches:
537 for package in downstream[module].keys():
538 package_version = downstream[module][package]
539 spec_version = None
540 if show_version or only_diff_version:
541 cwd = os.path.join(root, package)
542 try:
543 spec_version = SpecFile(os.path.join(cwd, "SPECS", "%s.spec" % package)).version
544 except subprocess.CalledProcessError:
545 spec_version = 'N/A'
546
547 if only_diff_version and package_version == spec_version:
548 continue
549
550 yield (package, module, package_version, spec_version, downstream_files[package])
551
552 def cmd_ls(options, parser):
553 for package, module, package_version, spec_version, downstream_files in sorted(join_streams(show_version=options.show_version, only_diff_version=options.diff)):
554 print package,"\t",
555 if options.upstream: print module, "\t",
556 if options.show_version: print spec_version, "\t", package_version, "\t",
557 print
558
559 def cmd_patches(options, parser):
560 root = os.path.expanduser(PKGROOT)
561
562 for package, module, package_version, spec_version, downstream_files in sorted(join_streams()):
563 for filename in downstream_files:
564 if '.patch' in filename or '.diff' in filename:
565
566 p = Patch(os.path.join(root, package, "SOURCES", filename), show_path=options.path)
567 valid = ""
568 forwarded = ""
569 if p.dep3['headers']:
570 forwarded = p.dep3['headers'].get('Forwarded', "no")
571 if p.dep3['valid']:
572 valid="VALID"
573 print "\t".join((module, package, str(p), forwarded, valid))
574
575 def cmd_dep3(options, parser):
576 p = Patch(options.patch)
577 p.add_dep3()
578
579 def cmd_package_new_version(options, parser):
580 # Determine the package name
581 if options.upstream:
582 try:
583 package = get_downstream_from_upstream(options.package, options.version)[0]
584 except ValueError, e:
585 print >>sys.stderr, "ERROR: %s" % e
586 sys.exit(1)
587 else:
588 package = options.package
589
590 # Directories packages are located in
591 root = os.path.expanduser(PKGROOT)
592 cwd = os.path.join(root, package)
593
594 # Checkout package to ensure the checkout reflects the latest changes
595 try:
596 subprocess.check_call(['mgarepo', 'co', package], cwd=root)
597 except subprocess.CalledProcessError:
598 sys.exit(1)
599
600 # SpecFile class handles the actual version+release change
601 s = SpecFile(os.path.join(cwd, "SPECS", "%s.spec" % package))
602 print "%s => %s" % (s.version, options.version)
603 if not s.update(options.version):
604 sys.exit(1)
605
606 # Check hash, if given
607 if options.hexdigest is not None:
608 sources = [name for name, origname in s.sources.iteritems() if '://' in origname]
609 if not len(sources):
610 print >>sys.stderr, "ERROR: Cannot determine source file (for hash check)!"
611 sys.stderr(1)
612
613 for filename in sources:
614 if not is_valid_hash(os.path.join(cwd, "SOURCES", filename), options.algo, options.hexdigest):
615 print >>sys.stderr, "ERROR: Hash file failed check for %s!" % path
616 print >>sys.stderr, "ERROR: Reverting changes!"
617 subprocess.call(['svn', 'revert', '-R', cwd], cwd=cwd)
618 sys.exit(1)
619
620 # We can even checkin and submit :-)
621 if options.submit:
622 try:
623 # checkin changes
624 subprocess.check_call(['mgarepo', 'ci', '-m', 'new version %s' % options.version], cwd=cwd)
625 # and submit
626 subprocess.check_call(['mgarepo', 'submit'], cwd=cwd)
627 except subprocess.CalledProcessError:
628 sys.exit(1)
629
630 def cmd_parse_ftp_release_list(options, parser):
631 def _send_reply_mail(contents, orig_msg, to, error=False):
632 """Send an reply email"""
633 contents.seek(0)
634 msg = MIMEText(contents.read(), _charset='utf-8')
635 if error:
636 # XXX - ugly
637 contents.seek(0)
638 lastline = contents.read().splitlines()[-1]
639 # Remove things like "ERROR: " and so on from the last line
640 lastline = re.sub(r'^(?:[^ :]+:\s+)+', '', lastline)
641 subjecterror = " (ERROR: %s)" % lastline if lastline else " (ERROR)"
642 else:
643 subjecterror = ""
644 msg['Subject'] = "Re: %s%s" % (orig_msg['Subject'], subjecterror)
645 msg['To'] = to
646 msg["In-Reply-To"] = orig_msg["Message-ID"]
647 msg["References"] = orig_msg["Message-ID"]
648
649 # Call sendmail program directly so it doesn't matter if the service is running
650 cmd = ['/usr/sbin/sendmail', '-oi', '--']
651 cmd.extend([to])
652 p = subprocess.Popen(cmd, stdin=subprocess.PIPE)
653 p.stdin.write(msg.as_string())
654 p.stdin.flush()
655 p.stdin.close()
656 p.wait()
657
658
659 msg = email.email.message_from_file(sys.stdin)
660
661 if options.mail:
662 stdout = tempfile.TemporaryFile()
663 stderr = stdout
664 else:
665 stdout = sys.stdout
666 stderr = sys.stderr
667
668 try:
669 module = msg['X-Module-Name']
670 version = msg['X-Module-Version']
671 hexdigest = msg['X-Module-SHA256-tar.xz']
672 except KeyError, e:
673 print >>stderr, "ERROR: %s" % e
674 if options.mail: _send_reply_mail(stdout, msg, options.mail, error=True)
675 sys.exit(1)
676
677 try:
678 packages = get_downstream_from_upstream(module, version)
679 except ValueError, e:
680 print >>stderr, "ERROR: %s" % e
681 if options.mail: _send_reply_mail(stdout, msg, options.mail, error=True)
682 sys.exit(1)
683
684 if options.wait:
685 # maildrop aborts and will try to deliver after 5min
686 # fork to avoid this
687 if os.fork() != 0: sys.exit(0)
688 time.sleep(SLEEP_INITIAL)
689
690 error = False
691 for package in packages:
692 if subprocess.call(['mga-gnome', 'increase', '--submit', '--hash', hexdigest, package, version], stdout=stdout, stderr=stderr):
693 error = True
694
695 if options.mail: _send_reply_mail(stdout, msg, options.mail, error=error)
696
697 def main():
698 description = """Mageia GNOME commands."""
699 epilog="""Report bugs to Olav Vitters"""
700 parser = argparse.ArgumentParser(description=description,epilog=epilog)
701
702 # SUBPARSERS
703 subparsers = parser.add_subparsers(title='subcommands')
704 # install
705 subparser = subparsers.add_parser('co', help='checkout all GNOME modules')
706 subparser.set_defaults(
707 func=cmd_co
708 )
709
710 subparser = subparsers.add_parser('packages', help='list all GNOME packages')
711 subparser.add_argument("-m", "--m", action="store_true", dest="upstream",
712 help="Show upstream module")
713 subparser.add_argument( "--version", action="store_true", dest="show_version",
714 help="Show version numbers")
715 subparser.add_argument( "--diff", action="store_true", dest="diff",
716 help="Only show packages with different version")
717 subparser.set_defaults(
718 func=cmd_ls, upstream=False, show_version=False, diff=False
719 )
720
721 subparser = subparsers.add_parser('patches', help='list all GNOME patches')
722 subparser.add_argument("-p", "--path", action="store_true", dest="path",
723 help="Show full path to patch")
724 subparser.set_defaults(
725 func=cmd_patches, path=False
726 )
727
728 subparser = subparsers.add_parser('dep3', help='Add dep3 headers')
729 subparser.add_argument("patch", help="Patch")
730 subparser.set_defaults(
731 func=cmd_dep3, path=False
732 )
733
734 subparser = subparsers.add_parser('increase', help='Increase version number')
735 subparser.add_argument("package", help="Package name")
736 subparser.add_argument("version", help="Version number")
737 subparser.add_argument("-u", "--upstream", action="store_true", dest="upstream",
738 help="Package name reflects the upstream name")
739 subparser.add_argument("-s", "--submit", action="store_true", dest="submit",
740 help="Commit changes and submit")
741 subparser.add_argument("-a", "--algorithm", choices=hashlib.algorithms, dest="algo",
742 help="Hash algorithm")
743 subparser.add_argument("--hash", dest="hexdigest",
744 help="Hexdigest of the hash")
745 subparser.set_defaults(
746 func=cmd_package_new_version, submit=False, upstream=False, hexdigest=None, algo="sha256"
747 )
748
749 subparser = subparsers.add_parser('gnome-release-email', help='Submit packages based on GNOME ftp-release-list email')
750 subparser.add_argument("-m", "--mail", help="Email address to send the progress to")
751 subparser.add_argument("-w", "--wait", action="store_true",
752 help="Wait before trying to retrieve the new version")
753 subparser.set_defaults(
754 func=cmd_parse_ftp_release_list
755 )
756
757 if len(sys.argv) == 1:
758 parser.print_help()
759 sys.exit(2)
760
761 options = parser.parse_args()
762
763 try:
764 options.func(options, parser)
765 except KeyboardInterrupt:
766 print('Interrupted')
767 sys.exit(1)
768 except EOFError:
769 print('EOF')
770 sys.exit(1)
771 except IOError, e:
772 if e.errno != errno.EPIPE:
773 raise
774 sys.exit(0)
775
776 if __name__ == "__main__":
777 main()

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.30