add pkgrel increase, fixed some bugs related to relative paths

This commit is contained in:
2021-05-18 20:18:34 +02:00
parent c3d26b1450
commit eec49d74d7
2 changed files with 22 additions and 9 deletions

View File

@@ -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 <john@doe.com>"
PACKAGER="ALHP Buildbot"
#-- Specify a key to use for package signing
#GPGKEY=""

View File

@@ -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("-")