git » repo-mgmt.git » commit 06eae5c

mechanism for publish-pkg to also make sure the relevant repos go up

author Urja (ARMLFS builder)
2025-09-21 17:21:04 UTC
committer Urja (ARMLFS builder)
2025-09-21 17:21:04 UTC
parent 0f3ccccdfc3d600fcb57998ed74414ae515cdeab

mechanism for publish-pkg to also make sure the relevant repos go up

(untested)

export-gits.sh +10 -0
publish-pkg.py +35 -0
push-gits.sh +11 -2

diff --git a/export-gits.sh b/export-gits.sh
index 0ed717d..028b5e7 100755
--- a/export-gits.sh
+++ b/export-gits.sh
@@ -47,6 +47,16 @@ doatree() {
 	done
 }
 
+if [[ "$#" -gt 1 ]]; then
+	repo=$1
+	shift
+	cd /sources/$repo-pkgbuilds
+	for pkg; do
+		doagit $repo-pkgbuilds $pkg/.git sources/$repo-pkgbuilds "$repo " git-arr-$repo.cfg
+	done
+	exit 0
+fi
+
 doatree sources sources "ARMLFS /sources/" git-arr-sources.cfg
 for repo in core base kde5; do
 	doatree sources/$repo-pkgbuilds $repo-pkgbuilds "$repo " git-arr-$repo.cfg
diff --git a/publish-pkg.py b/publish-pkg.py
index 00d5c44..2e8b900 100755
--- a/publish-pkg.py
+++ b/publish-pkg.py
@@ -30,6 +30,14 @@ def subc(*args, **kwargs):
         sys.exit(1)
     return Return(c.returncode, c.stdout)
 
+def builddir(pkg):
+    cmd = [ "tar", "-xO", "--force-local", "--occurrence=1", "-f", pkg, ".BUILDINFO" ]
+    info = subc(cmd, capture_output=True, text=True)
+    pfx = "builddir = "
+    for L in info.splitlines():
+        if L.startswith(pfx):
+            return L[len(pfx):].strip()
+    return None
 
 releasepkg="/mnt/nfs/pkg"
 
@@ -38,6 +46,7 @@ subc("mountpoint -q pkg && umount pkg || true", shell=True)
 os.chdir("pkg-untested")
 
 bases={}
+builddirs = set()
 count=0
 
 # this is os.walk, simplified, but yielding DirEntries, and only for non-dirs,
@@ -57,12 +66,14 @@ def filewalk(top):
 			new_path = os.path.join(top, dirname)
 			stack.append(new_path)
 
+
 for root, entry in filewalk('.'):
 	if entry.name.endswith('.pkg.tar.xz'):
 		if not entry.is_file():
 			continue
 		if root not in bases.keys():
 			bases[root] = []
+                builddirs.add(builddir(os.path.join(root, entry.name)))
 		bases[root].append(entry.name)
 		count+=1
 		#print(os.path.join(root, entry.name))
@@ -87,6 +98,30 @@ except KeyboardInterrupt:
     sys.exit(1)
 
 bp=os.getcwd()
+
+print("Publishing git repos...")
+repodirs = {}
+for d in builddirs:
+        repo, pkg = os.path.split(d)
+        if repo not in repodirs.keys():
+            repodirs[repo] = []
+        repodirs[repo].append(pkg)
+for r in repodirs.keys():
+    os.chdir(r)
+    for pkg in repodirs[r]:
+        cmd1 = f"grep -q {pkg} order || echo {pkg} >> order"
+        cmd2 = f"./git-it-up.sh {pkg}"
+        subc(cmd1, shell=True)
+        subc(cmd2, shell=True)
+    os.chdir("/sources/repo-mgmt")
+    _,r2 = os.path.split(r)
+    r2,_ = r2.split("-")
+    cmd1 = [ "./export-gits.sh", r2 ] + repodirs[r]
+    cmd2 = [ "./push-gits.sh", r2 ] + repodirs[r]
+    subc(cmd1)
+    subc(cmd2)
+
+os.chdir(bp)
 print("Moving packages to release directory",end="")
 for k in bases.keys():
 	print(f"\nFrom {k}:.",end='',flush=True)
diff --git a/push-gits.sh b/push-gits.sh
index e4d6f84..cbb4df0 100755
--- a/push-gits.sh
+++ b/push-gits.sh
@@ -32,12 +32,21 @@ doagit() {
 doatree() {
 	cd /$1
 	local GITS=$(find -mindepth 2 -maxdepth 2 -name '.git' -type d)
-
 	for g in $GITS; do
-		doagit $2 $g $1 "$3"
+		doagit $2 $g $1
 	done
 }
 
+if [[ "$#" -gt 1 ]]; then
+	repo=$1
+	shift
+	cd /sources/$repo-pkgbuilds
+	for pkg; do
+		doagit $repo-pkgbuilds $pkg/.git sources/$repo-pkgbuilds
+	done
+	exit 0
+fi
+
 doatree sources sources
 for repo in core base kde5; do
 	doatree sources/$repo-pkgbuilds $repo-pkgbuilds