From eec49d74d79edbee9d4ff77cbfe9171e553159d2 Mon Sep 17 00:00:00 2001 From: Giovanni Harting <539@idlegandalf.com> Date: Tue, 18 May 2021 20:18:34 +0200 Subject: [PATCH] add pkgrel increase, fixed some bugs related to relative paths --- makepkg.tmpl | 2 +- master.py | 29 +++++++++++++++++++++-------- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/makepkg.tmpl b/makepkg.tmpl index 78ba1c7..cd08561 100644 --- a/makepkg.tmpl +++ b/makepkg.tmpl @@ -124,7 +124,7 @@ DBGSRCDIR="/usr/src/debug" #-- Log files: specify a fixed directory where all log files will be placed #LOGDEST=/home/makepkglogs #-- Packager: name/email of the person or organization building packages -#PACKAGER="John Doe " +PACKAGER="ALHP Buildbot" #-- Specify a key to use for package signing #GPGKEY="" diff --git a/master.py b/master.py index d92beed..134633a 100644 --- a/master.py +++ b/master.py @@ -36,12 +36,15 @@ def build(pkgbuild, repo): # import pgp keys import_keys(pkgbuild) + # increase pkgrel + increase_pkgrel(pkgbuild) + # build with devtools os.chdir(pathlib.Path(pkgbuild).parent) res = subprocess.run( - ["makechrootpkg", "-D", os.path.join(sys.path[0], config["basedir"]["makepkg"]), "-l", process_name, "-r", - os.path.join(sys.path[0], config["basedir"]["chroot"]), "--", "--config", - os.path.join(sys.path[0], config["basedir"]["makepkg"]) + "makepkg-" + '-'.join( + ["makechrootpkg", "-D", os.path.join(config["basedir"]["makepkg"]), "-l", process_name, "-r", + os.path.join(config["basedir"]["chroot"]), "--", "--config", + os.path.join(config["basedir"]["makepkg"]) + "makepkg-" + '-'.join( repo.split("-")[1:]) + ".conf"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) if res.returncode: logging.warning("[%s/%s] Build failed. Check repo/logs for more information.", repo, name) @@ -52,8 +55,8 @@ def build(pkgbuild, repo): # write logs if not os.path.exists(os.path.join(config["basedir"]["repo"], "logs", repo)): - pathlib.Path(os.path.join(sys.path[0], config["basedir"]["repo"], "logs", repo)).mkdir(parents=True, - exist_ok=True) + pathlib.Path(os.path.join(config["basedir"]["repo"], "logs", repo)).mkdir(parents=True, + exist_ok=True) with open(os.path.join(config["basedir"]["repo"], "logs", repo, name + ".log"), "w") as log: log.write(res.stdout.decode()) @@ -142,8 +145,6 @@ def get_failed_packages(repo): def build_cleanup(): - logging.debug("[GIT] %s", subprocess.run(["git", "clean", "-xdf"], check=True, stdout=subprocess.PIPE, - stderr=subprocess.STDOUT).stdout.decode()) os.chdir(sys.path[0]) @@ -167,7 +168,7 @@ def setup_makepkg(repo): c_all = conf.read() c_all = c_all.replace("-mtune=generic", "") c_all = c_all.replace("-O2", "-O3") - c_all = regex_march.sub(r"\1" + '-'.join(repo.split("-")[1:]) + " ", c_all) + c_all = regex_march.sub(r"\1" + '-'.join(repo.split("-")[1:]), c_all) with open(makepkg_repo, "w") as conf: conf.write(c_all) @@ -211,6 +212,8 @@ def update_git2svn(): os.chdir(git_dir) logging.debug("[GIT] %s", subprocess.run(["git", "clean", "-xdf"], check=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT).stdout.decode()) + logging.debug("[GIT] %s", subprocess.run(["git", "reset", "--hard"], check=True, stdout=subprocess.PIPE, + stderr=subprocess.STDOUT).stdout.decode()) logging.debug("[GIT] %s", subprocess.run(["git", "pull"], check=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT).stdout.decode()) os.chdir("..") @@ -229,6 +232,16 @@ def parse_pkgbuild(pkgbuild_file): return version.parse("{}-{}".format(pkgver[0], pkgrel[0])) +def increase_pkgrel(pkgbuild_file): + with open(pkgbuild_file, errors='ignore') as p: + pkgbuild_str = p.read() + + pkgbuild_str = regex_pkgrel.sub(r"pkgrel=\1.1", pkgbuild_str) + + with open(pkgbuild_file, "w") as pkg: + pkg.write(pkgbuild_str) + + def parse_repo(name, repo): ver_split = find_all_files_for_pkg(name, repo)[0].split("-")