From ee75ae67a0a78d1108df57ecc7e0ef17e36ac33a Mon Sep 17 00:00:00 2001 From: Christoph Reiter Date: Sun, 9 Jun 2019 15:23:43 +0200 Subject: [PATCH] Fix duplicate srcinfo output for msys packages --- update-srcinfo.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/update-srcinfo.py b/update-srcinfo.py index 05a47c9..aa670a6 100644 --- a/update-srcinfo.py +++ b/update-srcinfo.py @@ -53,6 +53,16 @@ def get_cache_key(pkgbuild_path): return h.hexdigest() +def fixup_makepkg_output(text): + # makepkg-mingw runs makepkg twice for mingw32/64. In case of msys + # packages this results in the output geting duplicated. + # Dedup the output so we can use makepkg-mingw for all packages and still + # get the right output. + if text[len(text)//2:] == text[:len(text)//2]: + return text[len(text)//2:] + return text + + def get_srcinfo_for_pkgbuild(pkgbuild_path): pkgbuild_path = os.path.abspath(pkgbuild_path) git_cwd = os.path.dirname(pkgbuild_path) @@ -68,6 +78,8 @@ def get_srcinfo_for_pkgbuild(pkgbuild_path): cwd=git_cwd, stderr=devnull).decode("utf-8") + text = fixup_makepkg_output(text) + repo = subprocess.check_output( ["git", "ls-remote", "--get-url", "origin"], cwd=git_cwd).decode("utf-8").strip()