[debrepatch] 02/03: debpatch: make the changelogs nicer and less R-B specific
Ximin Luo
infinity0 at debian.org
Thu Nov 17 19:10:21 UTC 2016
This is an automated email from the git hooks/post-receive script.
infinity0 pushed a commit to branch master
in repository debrepatch.
commit 62c97538b13301493101a798a4868dad084efe57
Author: Ximin Luo <infinity0 at debian.org>
Date: Thu Nov 17 20:04:21 2016 +0100
debpatch: make the changelogs nicer and less R-B specific
---
debpatch | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)
diff --git a/debpatch b/debpatch
index 061d63d..71b410d 100755
--- a/debpatch
+++ b/debpatch
@@ -66,7 +66,7 @@ def read_dch_patch(dch_patch):
def apply_dch_patch(source_file, current, patch_name, old_version, target, dry_run):
# Do not change this text, unless you also add logic to detect markers from
# previously-released versions.
- marker = "Patch '%s' applied by debpatch(1)" % patch_name
+ marker = "Patch %s applied by debpatch(1)." % patch_name
if marker in current["Changes"]:
logging.info("patch %s already applied to d/changelog", patch_name)
return target["Version"]
@@ -77,26 +77,25 @@ def apply_dch_patch(source_file, current, patch_name, old_version, target, dry_r
if target["Distribution"] == "UNRELEASED":
# UNRELEASED causes hard-to-reason-about behaviours in dch, let's avoid that
newdist = current["Distribution"] if current["Distribution"] != "UNRELEASED" else DISTRIBUTION_DEFAULT
- newdist = newdist + "-reproducible"
logging.info("using distribution '%s' instead of 'UNRELEASED'", newdist)
target["Distribution"] = newdist
if not old_version or not target["Version"].startswith(old_version):
logging.warn("don't know how to reapply version-change %s to %s" %
(old_version, target["Version"]))
- logging.warn("will give -n to `dch` instead of trying to be smart; feel free to make me smarter")
- dch_args.append("-n")
- version = None
+ version = subprocess.check_output(["sh", "-c",
+ "EDITOR=cat dch -n 2>/dev/null | dpkg-parsechangelog -l- -SVersion"
+ ]).decode("utf-8").rstrip()
+ logging.warn("using version %s based on `dch -n`; feel free to make me smarter", version)
else:
version_suffix = target["Version"][len(old_version):]
version = current["Version"] + version_suffix
logging.info("using version %s based on suffix %s", version, version_suffix)
- dch_args.extend(["-v", version])
if dry_run:
- return version if version else subprocess.check_output(["sh", "-c",
- "EDITOR=cat dch -n 2>/dev/null | dpkg-parsechangelog -l- -SVersion"]).decode("utf-8").rstrip()
+ return version
+ dch_args += ["-v", version]
dch_args += ["--force-distribution", "-D", target["Distribution"]]
dch_args += ["-u", target["Urgency"]]
if "Maintainer" in target:
@@ -110,8 +109,8 @@ def apply_dch_patch(source_file, current, patch_name, old_version, target, dry_r
token = "DEBPATCH PLACEHOLDER %s DELETEME" % random.randint(0, 2**64)
shutil.copy(source_file, source_file + ".debpatch.bak")
try:
- C(["dch", "-c", source_file] + dch_args + [marker])
- C(["dch", "-c", source_file, "-a", token], )
+ C(["dch", "-c", source_file] + dch_args + [token])
+ C(["dch", "-c", source_file, "-a", marker], )
C(["sed", "-e", "/%s/c\\\n%s" % (token, changes.replace("\n", "\\\n")), "-i", source_file])
except:
os.rename(source_file, source_file + ".debpatch.err")
@@ -166,7 +165,7 @@ def debpatch(patch, patch_name, args):
"Version": None,
"Distribution": DISTRIBUTION_DEFAULT,
"Urgency": "low",
- "Changes": " * Hopefully make this package reproducible.",
+ "Changes": " * Rebase patch %s." % patch_name,
}
elif len(changelog) > 1:
raise ValueError("more than one debian/changelog patch???")
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/debrepatch.git
More information about the Reproducible-commits
mailing list