You've already forked wine-staging
mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2025-09-12 18:50:20 -07:00
patchupdate.py: Extract revision information directly from patch subject.
This commit is contained in:
13
debian/tools/patchlist.sh
vendored
13
debian/tools/patchlist.sh
vendored
@@ -1,19 +1,13 @@
|
||||
#!/bin/sh
|
||||
PATCH_DATA=$(cat);
|
||||
PATCH_LINES=$(echo "${PATCH_DATA}" | wc -l);
|
||||
PATCH_LINES=$((${PATCH_LINES}+22));
|
||||
PATCH_LINES=$((${PATCH_LINES}+23));
|
||||
|
||||
cat <<EOF
|
||||
From: FDS-Team <webmaster@fds-team.de>
|
||||
Subject: Autogenerated patch list.
|
||||
|
||||
---
|
||||
include/wine/library.h | 1 +
|
||||
libs/wine/config.c | 16 ++++++++++++++++
|
||||
libs/wine/wine.def | 1 +
|
||||
libs/wine/wine.map | 1 +
|
||||
4 files changed, 19 insertions(+)
|
||||
|
||||
diff --git a/include/wine/library.h b/include/wine/library.h
|
||||
index 242bb69..fae73fe 100644
|
||||
--- a/include/wine/library.h
|
||||
@@ -27,7 +21,7 @@ index 242bb69..fae73fe 100644
|
||||
extern void wine_init_argv0_path( const char *argv0 );
|
||||
extern void wine_exec_wine_binary( const char *name, char **argv, const char *env_var );
|
||||
diff --git a/libs/wine/config.c b/libs/wine/config.c
|
||||
index a273502..d6b0067 100644
|
||||
index a273502..0a3182f 100644
|
||||
--- a/libs/wine/config.c
|
||||
+++ b/libs/wine/config.c
|
||||
@@ -478,6 +478,${PATCH_LINES} @@ const char *wine_get_version(void)
|
||||
@@ -38,11 +32,12 @@ index a273502..d6b0067 100644
|
||||
+{
|
||||
+ const char *author;
|
||||
+ const char *subject;
|
||||
+ int revision;
|
||||
+}
|
||||
+wine_patch_data[] =
|
||||
+{
|
||||
${PATCH_DATA}
|
||||
+ { NULL, NULL }
|
||||
+ { NULL, NULL, 0 }
|
||||
+};
|
||||
+
|
||||
+/* return the applied non-standard patches */
|
||||
|
6
debian/tools/patchupdate.py
vendored
6
debian/tools/patchupdate.py
vendored
@@ -499,9 +499,9 @@ def generate_makefile(all_patches):
|
||||
# Create *.ok file (used to generate patchlist)
|
||||
if len(patch.patches):
|
||||
fp.write("\t@( \\\n")
|
||||
for p in _unique(patch.patches, key=lambda p: (p.patch_author, p.patch_subject)):
|
||||
fp.write("\t\techo '+ { \"%s\", \"%s\" },'; \\\n" % \
|
||||
(_escape(p.patch_author), _escape(p.patch_subject)))
|
||||
for p in _unique(patch.patches, key=lambda p: (p.patch_author, p.patch_subject, p.patch_revision)):
|
||||
fp.write("\t\techo '+ { \"%s\", \"%s\", %d },'; \\\n" % \
|
||||
(_escape(p.patch_author), _escape(p.patch_subject), p.patch_revision))
|
||||
fp.write("\t) > %s.ok\n" % patch.name)
|
||||
else:
|
||||
fp.write("\ttouch %s.ok\n" % patch.name)
|
||||
|
71
debian/tools/patchutils.py
vendored
71
debian/tools/patchutils.py
vendored
@@ -39,25 +39,26 @@ class PatchApplyError(RuntimeError):
|
||||
|
||||
class PatchObject(object):
|
||||
def __init__(self, filename, header):
|
||||
self.patch_author = header['author'] if header else None
|
||||
self.patch_email = header['email'] if header else None
|
||||
self.patch_subject = header['subject'] if header else None
|
||||
self.patch_author = header['author']
|
||||
self.patch_email = header['email']
|
||||
self.patch_subject = header['subject']
|
||||
self.patch_revision = header['revision'] if header.has_key('revision') else 1
|
||||
|
||||
self.extracted_patch = None
|
||||
self.unique_hash = None
|
||||
self.extracted_patch = None
|
||||
self.unique_hash = None
|
||||
|
||||
self.filename = filename
|
||||
self.offset_begin = None
|
||||
self.offset_end = None
|
||||
self.isbinary = False
|
||||
self.filename = filename
|
||||
self.offset_begin = None
|
||||
self.offset_end = None
|
||||
self.isbinary = False
|
||||
|
||||
self.oldname = None
|
||||
self.newname = None
|
||||
self.modified_file = None
|
||||
self.oldname = None
|
||||
self.newname = None
|
||||
self.modified_file = None
|
||||
|
||||
self.oldsha1 = None
|
||||
self.newsha1 = None
|
||||
self.newmode = None
|
||||
self.oldsha1 = None
|
||||
self.newsha1 = None
|
||||
self.newmode = None
|
||||
|
||||
def is_binary(self):
|
||||
return self.isbinary
|
||||
@@ -287,6 +288,29 @@ def read_patch(filename):
|
||||
patch.offset_end = fp.tell()
|
||||
return patch
|
||||
|
||||
def _parse_author(author):
|
||||
author = ' '.join([data.decode(format or 'utf-8').encode('utf-8') for \
|
||||
data, format in email.header.decode_header(author)])
|
||||
r = re.match("\"?([^\"]*)\"? <(.*)>", author)
|
||||
if r is None: raise NotImplementedError("Failed to parse From - header.")
|
||||
return r.group(1).strip(), r.group(2).strip()
|
||||
|
||||
def _parse_subject(subject):
|
||||
subject = subject.strip()
|
||||
if subject.endswith("."): subject = subject[:-1]
|
||||
r = re.match("\\[PATCH([^]]*)\\](.*)", subject, re.IGNORECASE)
|
||||
if r is not None:
|
||||
subject = r.group(2).strip()
|
||||
r = re.search("v([0-9]+)", r.group(1), re.IGNORECASE)
|
||||
if r is not None: return "%s." % subject, int(r.group(1))
|
||||
r = re.match("(.*)\\((v|try|rev|take) *([0-9]+)\\)", subject, re.IGNORECASE)
|
||||
if r is not None: return "%s." % r.group(1).strip(), int(r.group(3))
|
||||
r = re.match("(.*)[.,] *(v|try|rev|take) *([0-9]+)", subject, re.IGNORECASE)
|
||||
if r is not None: return "%s." % r.group(1).strip(), int(r.group(3))
|
||||
r = re.match("([^:]+) v([0-9])+: (.*)", subject, re.IGNORECASE)
|
||||
if r is not None: return "%s: %s." % (r.group(1), r.group(3)), int(r.group(2))
|
||||
return "%s." % subject, 1
|
||||
|
||||
header = {}
|
||||
with _FileReader(filename) as fp:
|
||||
while True:
|
||||
@@ -295,12 +319,7 @@ def read_patch(filename):
|
||||
break
|
||||
|
||||
elif line.startswith("From: "):
|
||||
author = ' '.join([data.decode(format or 'utf-8').encode('utf-8') for \
|
||||
data, format in email.header.decode_header(line[6:])])
|
||||
r = re.match("\"?([^\"]*)\"? <(.*)>", author)
|
||||
if r is None: raise NotImplementedError("Failed to parse From - header.")
|
||||
header['author'] = r.group(1).strip()
|
||||
header['email'] = r.group(2).strip()
|
||||
header['author'], header['email'] = _parse_author(line[6:])
|
||||
assert fp.read() == line
|
||||
|
||||
elif line.startswith("Subject: "):
|
||||
@@ -311,15 +330,7 @@ def read_patch(filename):
|
||||
if not line.startswith(" "): break
|
||||
subject += line.rstrip("\r\n")
|
||||
assert fp.read() == line
|
||||
r = re.match("^\\[PATCH[^]]*\\](.*)", subject)
|
||||
if r is not None: subject = r.group(1)
|
||||
r = re.match("(.*)\\(try [0-9]+\\)$", subject)
|
||||
if r is None: r = re.match("(.*), v[0-9]+$", subject)
|
||||
if r is None: r = re.match("^[^:]+ v[0-9]+: (.*)", subject)
|
||||
if r is not None: subject = r.group(1)
|
||||
subject = subject.strip()
|
||||
if not subject.endswith("."): subject += "."
|
||||
header['subject'] = subject.strip()
|
||||
header['subject'], header['revision'] = _parse_subject(subject)
|
||||
|
||||
elif line.startswith("diff --git "):
|
||||
tmp = line.strip().split(" ")
|
||||
|
Reference in New Issue
Block a user