diff options
author | Britney Fransen <brfransen@gmail.com> | 2022-11-18 20:11:10 (GMT) |
---|---|---|
committer | Britney Fransen <brfransen@gmail.com> | 2022-11-18 20:11:10 (GMT) |
commit | aa49a137c882caf85fe2036641d1eaa87b900b7a (patch) | |
tree | a506a2be9564107a8b580fa5d1d072797c67fd30 /linhes | |
parent | bad99ceb7fe0551a50d34a6d88fdb95894e42c79 (diff) | |
download | linhes_pkgbuild-aa49a137c882caf85fe2036641d1eaa87b900b7a.zip linhes_pkgbuild-aa49a137c882caf85fe2036641d1eaa87b900b7a.tar.gz linhes_pkgbuild-aa49a137c882caf85fe2036641d1eaa87b900b7a.tar.bz2 |
linhes-dev: mp.py: rework --rmold
rename scripts to lh_
Diffstat (limited to 'linhes')
-rw-r--r-- | linhes/linhes-dev/PKGBUILD | 10 | ||||
-rwxr-xr-x | linhes/linhes-dev/lh_setup_dev.sh (renamed from linhes/linhes-dev/setup_lhdev.sh) | 0 | ||||
-rwxr-xr-x | linhes/linhes-dev/lh_sync.sh (renamed from linhes/linhes-dev/lhsync.sh) | 6 | ||||
-rwxr-xr-x | linhes/linhes-dev/lh_update_db_repo.sh (renamed from linhes/linhes-dev/update_db_repo.sh) | 2 | ||||
-rwxr-xr-x | linhes/linhes-dev/mp.py | 107 |
5 files changed, 45 insertions, 80 deletions
diff --git a/linhes/linhes-dev/PKGBUILD b/linhes/linhes-dev/PKGBUILD index 199d03f..2824f1e 100644 --- a/linhes/linhes-dev/PKGBUILD +++ b/linhes/linhes-dev/PKGBUILD @@ -1,19 +1,19 @@ pkgname=linhes-dev pkgver=9.0 -pkgrel=2 +pkgrel=3 pkgdesc="Scripts to develop LinHES" arch=('x86_64') license=('GPL2') depends=('clean-chroot-manager' 'git' 'python-gitpython' 'rclone' 'yaah') url="http://linhes.org/" -source=('lhsync.sh' 'mp.py' 'setup_lhdev.sh' 'update_db_repo.sh') +source=('lh_sync.sh' 'mp.py' 'lh_setup_dev.sh' 'lh_update_db_repo.sh') package() { cd ${srcdir} install -d ${pkgdir}/usr/bin install -D -m755 * ${pkgdir}/usr/bin/ } -sha256sums=('d781ffb509282d03f40612556a40455fc6ee58b4b3fc60e5457c90cacd65f99c' - '9b577c3508baa3c27fc0dc8891b2da80f7b759cddf23c684a303dcba7ace0474' +sha256sums=('61871516d2bbe1c3300e78715c7c43c46e9b877c66b21e674384d3809b7fdc5e' + '099c88be69e376df8cc8c5454a0ef4ce08660a8868c0c895d1bcc12498bdb833' 'b5d12503757471be72fa20fb86a0b1563916b4db85048dcd78b49eaade3db989' - '6c3adaea49b7a0bb1baa4ed2d2b1d9f9fbab2f78b6e7ec1e8bedf4abecda25ba') + '86c9ebe77228f7e3cc07cb05f480e5584e0e3cad1b889b63a50821f7323bf449') diff --git a/linhes/linhes-dev/setup_lhdev.sh b/linhes/linhes-dev/lh_setup_dev.sh index df034c5..df034c5 100755 --- a/linhes/linhes-dev/setup_lhdev.sh +++ b/linhes/linhes-dev/lh_setup_dev.sh diff --git a/linhes/linhes-dev/lhsync.sh b/linhes/linhes-dev/lh_sync.sh index e8cd8b1..053aaba 100755 --- a/linhes/linhes-dev/lhsync.sh +++ b/linhes/linhes-dev/lh_sync.sh @@ -51,7 +51,7 @@ function sync_dirs { echo "--------" echo "Updating the whole package db..." echo "--------" - update_db_repo.sh $LOCAL $3 + lh_update_db_repo.sh $LOCAL $3 echo "--------" echo "Pushing the package db to linhes.org" @@ -116,11 +116,11 @@ case $1 in ;; *) echo "Invalid Options" - echo "lhsync.sh (testing|release|source[testing|release]) (update_db|resync|force)" + echo "lh_sync.sh (testing|release|source[testing|release]) (update_db|resync|force)" echo echo "force: force rclone to sync when too many deletes are detected" echo "resync: overwrites the local package and source repos with ones from linhes.org" echo "update_db: recreate the db files in the repo and syncs to linhes.org" - echo "EXAMPLE: lhsync.sh testing update_db <= will sync the testing repo with linhes.org update the local database and resync with linhes.org" + echo "EXAMPLE: lh_sync.sh testing update_db <= will sync the testing repo with linhes.org update the local database and resync with linhes.org" ;; esac diff --git a/linhes/linhes-dev/update_db_repo.sh b/linhes/linhes-dev/lh_update_db_repo.sh index b277a1f..3316e38 100755 --- a/linhes/linhes-dev/update_db_repo.sh +++ b/linhes/linhes-dev/lh_update_db_repo.sh @@ -4,7 +4,7 @@ if [ $# -ne 2 ] then echo "incorrect number of args" - echo "update_db_repo.sh directory repo" + echo "lh_update_db_repo.sh directory repo" echo "EX: update_db_repo.sh /data/dev/pkg_repo/x86_64/linhes-testing linhes-testing" exit 1 fi diff --git a/linhes/linhes-dev/mp.py b/linhes/linhes-dev/mp.py index 7aa9d28..7f4c317 100755 --- a/linhes/linhes-dev/mp.py +++ b/linhes/linhes-dev/mp.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Version 3.0.1 +# Version 3.0.2 import os import sys import re @@ -173,7 +173,6 @@ class Packagefile(object): self.arch = value elif item == "depends": self.pkg_dependencies = value.split() - elif item == "makedepends": self.makepkg_dependencies = self.makepkg_dependencies + value.split() elif item == "makedepends_x86_64": @@ -371,8 +370,8 @@ class Packagefile(object): p.close() def make_package(self): - if self.arch == 'any': - self.CARCH = 'any' + #if self.arch == 'any': + # self.CARCH = 'any' #creates both binary and source package print("- Making package...") retcode = subprocess.call(["sudo", "ccm", "s"]) @@ -405,15 +404,15 @@ class Packagefile(object): # pkgname could be a list of several pkgs. Since bash array format is # loose, let bash parse the pkgname(s) first, then return a list for us. self.updateINIT() - if self.arch == 'any': - self.CARCH = 'any' + #if self.arch == 'any': + # self.CARCH = 'any' for i in self.pkglist: print(" Package name:",i) - self.GZPKG = i + "-" + self.epoch + self.pkgver + "-" + self.pkgrel + "-" + self.CARCH + ".pkg.tar.gz" - self.XZPKG = i + "-" + self.epoch + self.pkgver + "-" + self.pkgrel + "-" + self.CARCH + ".pkg.tar.xz" - self.ZSTPKG = i + "-" + self.epoch + self.pkgver + "-" + self.pkgrel + "-" + self.CARCH + ".pkg.tar.zst" + self.GZPKG = i + "-" + self.epoch + self.pkgver + "-" + self.pkgrel + "-" + self.arch + ".pkg.tar.gz" + self.XZPKG = i + "-" + self.epoch + self.pkgver + "-" + self.pkgrel + "-" + self.arch + ".pkg.tar.xz" + self.ZSTPKG = i + "-" + self.epoch + self.pkgver + "-" + self.pkgrel + "-" + self.arch + ".pkg.tar.zst" #print(self.GZPKG) #print(self.XZPKG) #print(self.ZSTPKG) @@ -429,44 +428,28 @@ class Packagefile(object): print(" ERROR in function update_database: Couldn't find the new package:",self.TOTALPKG) sys.exit(2) + # Remove old package(s) from local copy + print(" Looking for old packages") + + oldfilelist = glob.glob(self.DOCROOT + "/" + i + "-*-*-*.pkg.tar.*") + print(" Old Packages:",oldfilelist) + if oldfilelist: + for DELPKG in oldfilelist: + if "--rmold" in self.cli_list: + print(" Deleting old package:",DELPKG) + os.remove(DELPKG) + + # Copy in new package print(" Copying " + self.TOTALPKG + " to " + self.PKGDEST) if shutil.copy2(self.TOTALPKG, self.PKGDEST): os.remove(self.mydir + "/" + self.TOTALPKG) - - # Remove old package(s) from local copy - #print i + "-" + self.epoch + '(pkgver|[\d.]+)' + "-" + '(?!pkgrel)' - oldpkgcheck = re.compile( re.escape(i) + "-" + self.epoch + '(pkgver|[\d.]+)' + "-" + '(?!pkgrel)' ) - - dirlist = os.listdir(self.DOCROOT) - for n in dirlist: - if n.startswith(i): - if not oldpkgcheck.search(n): - print(n,"does not match") - continue - else: - OLDPKG = glob.glob(oldpkgcheck.search(n).group() + "*.pkg.tar.*") - print(" OLDPKG =",OLDPKG) - if OLDPKG: - for DELPKG in OLDPKG: - if "--rmold" in self.cli_list: - print("Deleting old package:",DELPKG) - os.remove(DELPKG) - #subprocess.call(["repo-remove", self.DOCROOT+ "/" + self.REPO + ".db.tar.gz", DELPKG]) - # Remove any symlinks to old packages - # We make it conditional on "--force" because force will overwrite - # an existing package and we want the symlink to stay, pointing to - # the newly built package with the same pkgrel. - if "--force" not in self.makepkg_cmd: - if os.path.islink(self.mydir + "/" + DELPKG): - os.remove(self.mydir + "/" + DELPKG) - # Copy in new package - print(" Updating " + self.DOCROOT + " with " + self.TOTALPKG) - print(" Copying " + self.PKGDEST + "/" + self.TOTALPKG) + print(" Copying " + self.TOTALPKG + " to " + self.DOCROOT) shutil.copy2(self.PKGDEST + "/" + self.TOTALPKG, self.DOCROOT) - print(" Creating symlink " + self.PKGDEST + "/" + self.TOTALPKG) + print(" Creating symlink to " + self.PKGDEST + "/" + self.TOTALPKG) if os.path.islink(self.mydir + "/" + self.TOTALPKG): os.remove(self.mydir + "/" + self.TOTALPKG) os.symlink(self.DOCROOT + "/" + self.TOTALPKG, self.mydir + "/" + self.TOTALPKG) + print(" Adding package to repo") subprocess.call(["repo-add", self.DOCROOT+ "/" + self.REPO + ".db.tar.gz", self.DOCROOT + "/" + self.TOTALPKG]) #print(" Updating pacman database") #subprocess.call(["pacman","-Syyyyy" ]) @@ -481,35 +464,17 @@ class Packagefile(object): sys.exit(2) i = self.pkglist[0] - oldpkgcheck = re.compile( re.escape(i) + "-" + self.epoch + '(pkgver|[\d.]+)' + "-" + '(?!pkgrel)' ) - dirlist = os.listdir(self.SRCPKGDEST + "/" ) - if self.pkgbase: - # Remove old src package(s) from local copy - if "--rmold" in self.cli_list: - for n in dirlist: - if n.startswith(self.pkgbase): - if not oldpkgcheck.search(n): - print(n,"does not match") - continue - else: - OLDSRCPKG = glob.glob(oldpkgcheck.search(n).group() + "*.src.tar.gz") - else: - # Remove old src package(s) from local copy - if "--rmold" in self.cli_list: - for n in dirlist: - if n.startswith(self.pkgname): - if not oldpkgcheck.search(n): - print(n,"does not match") - continue - else: - OLDSRCPKG = glob.glob(oldpkgcheck.search(n).group() + "*.src.tar.gz") - if OLDSRCPKG: - print("OLDSRCPKG =",OLDSRCPKG) - for DELSRCPKG in OLDSRCPKG: - print("Deleting old source package",DELSRCPKG) - os.remove(DELSRCPKG) - - print(" Copying new source package to",self.SRCPKGDEST + "/" + self.REPO + "/" + self.SRCPKG) + + print(" Looking for old sources") + oldfilelist = glob.glob(self.SRCPKGDEST + "/" + self.REPO + "/" + i + "-*-*.src.tar.gz") + print(" Old Sources:",oldfilelist) + if oldfilelist: + for DELPKG in oldfilelist: + if "--rmold" in self.cli_list: + print(" Deleting old source:",DELPKG) + os.remove(DELPKG) + + print(" Copying " + self.SRCPKG + " to " + self.SRCPKGDEST + "/" + self.REPO) if shutil.copy2(self.SRCPKGDEST + "/" + self.SRCPKG, self.SRCPKGDEST + "/" + self.REPO + "/"): os.remove(self.SRCPKGDEST + "/" + self.SRCPKG) @@ -528,8 +493,8 @@ class Packagefile(object): os.rmdir(self.mydir + "/src") # Remove any old -build and -package log files os.chdir(self.mydir) - build_log = self.pkgname + "-" + self.pkgver + "-" + self.pkgrel + "-" + self.CARCH + "-build.log" - pkg_log = self.pkgname + "-" + self.pkgver + "-" + self.pkgrel + "-" + self.CARCH + "-package.log" + build_log = self.pkgname + "-" + self.pkgver + "-" + self.pkgrel + "-" + self.arch + "-build.log" + pkg_log = self.pkgname + "-" + self.pkgver + "-" + self.pkgrel + "-" + self.arch + "-package.log" all_logs = glob.glob("*.log*") #print "All Logs:",all_logs saved_logs = [] |