diff options
author | Olav Vitters <olav@vitters.nl> | 2020-04-23 17:36:45 +0200 |
---|---|---|
committer | Olav Vitters <olav@vitters.nl> | 2020-04-23 17:36:45 +0200 |
commit | b202fdd45973a9ec02699d29bc27b4d0f05bfae8 (patch) | |
tree | 6b5f1b23cb7c31ad89fdbbdcaad54ccac9187be3 | |
parent | aeb84f81397f0608da98d12c019fc23c4b038475 (diff) | |
download | mgagnome-b202fdd45973a9ec02699d29bc27b4d0f05bfae8.tar mgagnome-b202fdd45973a9ec02699d29bc27b4d0f05bfae8.tar.gz mgagnome-b202fdd45973a9ec02699d29bc27b4d0f05bfae8.tar.bz2 mgagnome-b202fdd45973a9ec02699d29bc27b4d0f05bfae8.tar.xz mgagnome-b202fdd45973a9ec02699d29bc27b4d0f05bfae8.zip |
remove dep3 support
-rwxr-xr-x | mgagnome | 126 |
1 files changed, 1 insertions, 125 deletions
@@ -900,9 +900,6 @@ class SpecFile(): class Patch(): """Do things with patches""" - re_dep3 = re.compile(r'^(?:#\s*)?(?P<header>[-A-Za-z0-9]+?):\s*(?P<data>.*)$') - re_dep3_cont = re.compile(r'^#?\s+(?P<data>.*)$') - def __init__(self, path, show_path=False): """Path: path to patch (might not exist)""" self.path = path @@ -911,111 +908,6 @@ class Patch(): def __str__(self): return self.path if self.show_path else os.path.basename(self.path) - def add_dep3(self): - """Add DEP-3 headers to a patch file""" - if self.dep3['valid']: - return False - - new_headers = ( - ('Author', self.svn_author), - ('Subject', ''), - ('Applied-Upstream', ''), - ('Forwarded', ''), - ('Bug', ''), - ) - - with tempfile.NamedTemporaryFile(dir=os.path.dirname(self.path), delete=False) as fdst: - with open(self.path, "r", encoding="utf-8") as fsrc: - # Start with any existing DEP3 headers - for i in range(self.dep3['last_nr']): - fdst.write(fsrc.read()) - - # After that add the DEP3 headers - add_line = False - for header, data in new_headers: - if header in self.dep3['headers']: - continue - - # XXX - wrap this at 80 chars - add_line = True - print("%s: %s" % (header, "" if data is None else data), file=fdst) - - if add_line: print("", file=fdst) - # Now copy any other data and the patch - shutil.copyfileobj(fsrc, fdst) - - fdst.flush() - os.rename(fdst.name, self.path) - - call_editor(self.path) - - #Author: fwang - #Subject: Build fix: Fix glib header inclusion - #Applied-Upstream: commit:30602 - #Forwarded: yes - #Bug: http://bugzilla.abisource.com/show_bug.cgi?id=13247 - - def _read_dep3(self): - """Read DEP-3 headers from an existing patch file - - This will also parse git headers""" - dep3 = {} - headers = {} - - last_header = None - last_nr = 0 - nr = 0 - try: - with open(self.path, "r", encoding="utf-8") as f: - for line in line_input(f): - nr += 1 - # stop trying to parse when real patch begins - if line == '---': - break - - r = self.re_dep3.match(line) - if r: - info = r.groupdict() - - # Avoid matching URLS - if info['data'].startswith('//') and info['header'].lower() == info['header']: - continue - - headers[info['header']] = info['data'] - last_header = info['header'] - last_nr = nr - continue - - r = self.re_dep3_cont.match(line) - if r: - info = r.groupdict() - if last_header: - headers[last_header] = " ".join((headers[last_header], info['data'])) - last_nr = nr - continue - - last_header = None - except IOError: - pass - - dep3['valid'] = \ - (('Description' in headers and headers['Description'].strip() != '') - or ('Subject' in headers and headers['Subject'].strip() != '')) \ - and (('Origin' in headers and headers['Origin'].strip() != '') \ - or ('Author' in headers and headers['Author'].strip() != '') \ - or ('From' in headers and headers['From'].strip() != '')) - dep3['last_nr'] = last_nr - dep3['headers'] = headers - - self._dep3 = dep3 - - @property - def dep3(self): - if not hasattr(self, '_dep3'): - self._read_dep3() - - return self._dep3 - @property def svn_author(self): if not hasattr(self, '_svn_author'): @@ -1501,17 +1393,7 @@ def cmd_patches(options, parser): if '.patch' in filename or '.diff' in filename: p = Patch(os.path.join(root, package, "SOURCES", filename), show_path=options.path) - valid = "" - forwarded = "" - if p.dep3['headers']: - forwarded = p.dep3['headers'].get('Forwarded', "no") - if p.dep3['valid']: - valid = "VALID" - print("\t".join((module, package, str(p), forwarded, valid))) - -def cmd_dep3(options, parser): - p = Patch(options.patch) - p.add_dep3() + print("\t".join((module, package, str(p)))) def cmd_check_prep(options, parser): s = Downstream.package_spec(options.package) @@ -2072,12 +1954,6 @@ def main(): func=cmd_co, all=False ) - subparser = subparsers.add_parser('dep3', help='add dep3 headers') - subparser.add_argument("patch", help="Patch") - subparser.set_defaults( - func=cmd_dep3, path=False - ) - subparser = subparsers.add_parser('gnome-release-email', help='submit packages based on GNOME ftp-release-list email') subparser.add_argument("-m", "--mail", help="Email address to send the progress to") subparser.add_argument("--fork", action="store_true", |