: nply/foundationpkgs

commit a3cb61de57c4466dd3fcef9c71cab50d686a8557
parent bfd2449e0da2d25aaa24aaf5cabe9f6114d894cf
Author: Bharatvaj Hemanth <bharatvaj@yahoo.com>
Date: Fri, 11 Sep 2026 20:45:46 +0530

Serve artifacts under nply.org dl path
6 files changed, 27 insertions(+), 12 deletions(-)
diff --git a/AGENTS.md b/AGENTS.md
@@ -22,7 +22,7 @@ See `docs/ci.md` for deployment/configuration details and `docs/ci-architecture.
 
 - Prefer small, detachable scripts with environment-variable configuration over repo-specific hardcoding.
 - Preserve the build-key contract: changes that affect output must change the key; generated intermediates should not.
-- Publish artifacts atomically under `$FPKGS_DL_ROOT/<target>/<pkgname>/<pkgver>-r<pkgrel>/<buildkey>/`.
+- Publish artifacts atomically under `$FPKGS_DL_ROOT/<target>/<pkgname>/<pkgver>-r<pkgrel>/<buildkey>/`; expose their public URL with `$FPKGS_DL_BASE_URL`.
 - Report package/target outcomes to minci when `FPKGS_MINCI_URL`, `FPKGS_MINCI_KEY`, and `FPKGS_MINCI_SECRET` are set.
 - When adding a dependency used by an APKBUILD, add an APKBUILD for it when it is not a system/base package.
 
diff --git a/CONTEXT.md b/CONTEXT.md
@@ -14,7 +14,9 @@
 
 **Artifact**: A built package tarball plus checksum, build log, and manifest published below the download root.
 
-**Download root**: The filesystem tree served by `dl.nply.org`; configured as `$FPKGS_DL_ROOT` and normally `/srv/http/dl.nply.org/foundationpkgs`.
+**Download root**: The filesystem tree where artifacts are published; configured as `$FPKGS_DL_ROOT` and normally `/srv/http/dl.nply.org/foundationpkgs`.
+
+**Download base URL**: The public URL prefix for artifact manifests; configured as `$FPKGS_DL_BASE_URL`. It currently points at `https://nply.org/dl/foundationpkgs` and can later move to `https://dl.nply.org/foundationpkgs`.
 
 **minci**: The CI report sink and web interface at `ci.nply.org`. It records per-package results; it does not perform package builds.
 
diff --git a/docs/ci-architecture.dot b/docs/ci-architecture.dot
@@ -29,7 +29,7 @@ digraph foundationpkgs_ci {
   pacstall [label="pacstall path\nAPKBUILD → generated .pacscript\n(runtime intermediate)", fillcolor="#f5d0fe"];
 
   publish [label="atomic publish\n$FPKGS_DL_ROOT/<target>/<pkg>/<ver-rrel>/<buildkey>/", fillcolor="#d1fae5"];
-  dl [label="dl.nply.org\nlighttpd static artifacts", fillcolor="#a7f3d0"];
+  dl [label="nply.org/dl now\ndl.nply.org later\nlighttpd static artifacts", fillcolor="#a7f3d0"];
   minci [label="minci report\nci.nply.org/cgi-bin/minci.cgi", fillcolor="#fee2e2"];
   web [label="CI dashboard\nci.nply.org", fillcolor="#fecaca"];
 
diff --git a/docs/ci-architecture.svg b/docs/ci-architecture.svg
@@ -219,9 +219,10 @@
 <!-- dl -->
 <g id="node13" class="node">
 <title>dl</title>
-<path fill="#a7f3d0" stroke="#334155" d="M2886,-213C2886,-213 2736,-213 2736,-213 2730,-213 2724,-207 2724,-201 2724,-201 2724,-187 2724,-187 2724,-181 2730,-175 2736,-175 2736,-175 2886,-175 2886,-175 2892,-175 2898,-181 2898,-187 2898,-187 2898,-201 2898,-201 2898,-207 2892,-213 2886,-213"/>
-<text text-anchor="middle" x="2811" y="-197.8" font-family="Helvetica,sans-Serif" font-size="14.00">dl.nply.org</text>
-<text text-anchor="middle" x="2811" y="-182.8" font-family="Helvetica,sans-Serif" font-size="14.00">lighttpd static artifacts</text>
+<path fill="#a7f3d0" stroke="#334155" d="M2886,-220.5C2886,-220.5 2736,-220.5 2736,-220.5 2730,-220.5 2724,-214.5 2724,-208.5 2724,-208.5 2724,-179.5 2724,-179.5 2724,-173.5 2730,-167.5 2736,-167.5 2736,-167.5 2886,-167.5 2886,-167.5 2892,-167.5 2898,-173.5 2898,-179.5 2898,-179.5 2898,-208.5 2898,-208.5 2898,-214.5 2892,-220.5 2886,-220.5"/>
+<text text-anchor="middle" x="2811" y="-205.3" font-family="Helvetica,sans-Serif" font-size="14.00">nply.org/dl now</text>
+<text text-anchor="middle" x="2811" y="-190.3" font-family="Helvetica,sans-Serif" font-size="14.00">dl.nply.org later</text>
+<text text-anchor="middle" x="2811" y="-175.3" font-family="Helvetica,sans-Serif" font-size="14.00">lighttpd static artifacts</text>
 </g>
 <!-- publish&#45;&gt;dl -->
 <g id="edge12" class="edge">
diff --git a/docs/ci.md b/docs/ci.md
@@ -25,6 +25,7 @@ stdin and only enqueues builds for `refs/heads/main` by default.
 #!/bin/sh
 FPKGS_ROOT=/home/git/repositories/nply/foundationpkgs.git \
 FPKGS_DL_ROOT=/srv/http/dl.nply.org/foundationpkgs \
+FPKGS_DL_BASE_URL=https://nply.org/dl/foundationpkgs \
 FPKGS_WORK_ROOT=/var/tmp/fpkgs-ci \
 /path/to/fpkgs-ci.sh post-receive
 ```

@@ -55,7 +56,10 @@ $FPKGS_DL_ROOT/<target>/<pkgname>/<pkgver>-r<pkgrel>/<buildkey>/
 ```
 
 Each directory contains package tarballs, checksums, `build.log`, and a
-`manifest` file.
+`manifest` file. `artifact_url` in the manifest is derived from
+`$FPKGS_DL_BASE_URL`; it currently defaults to `https://nply.org/dl/foundationpkgs`
+so the public path can move to `https://dl.nply.org/foundationpkgs` later without
+changing artifact storage.
 
 ## POSIX rule
 
diff --git a/scripts/fpkgs-ci.sh b/scripts/fpkgs-ci.sh
@@ -12,6 +12,7 @@
 # Environment:
 #   FPKGS_ROOT       repository checkout (default: current directory)
 #   FPKGS_DL_ROOT    publication root (default: /srv/http/dl.nply.org/foundationpkgs)
+#   FPKGS_DL_BASE_URL public artifact URL base (default: https://nply.org/dl/foundationpkgs)
 #   FPKGS_WORK_ROOT  work/cache root (default: /var/tmp/fpkgs-ci)
 #   FPKGS_TARGETS    target triplets (default: native guess_triplet)
 #   FPKGS_REF        ref to build from post-receive (default: refs/heads/main)

@@ -26,6 +27,7 @@ SELF_DIR=$(cd "$(dirname "$SELF_ARG")" && pwd)
 SELF=$SELF_DIR/$(basename "$SELF_ARG")
 FPKGS_ROOT=${FPKGS_ROOT:-$(pwd)}
 FPKGS_DL_ROOT=${FPKGS_DL_ROOT:-/srv/http/dl.nply.org/foundationpkgs}
+FPKGS_DL_BASE_URL=${FPKGS_DL_BASE_URL:-https://nply.org/dl/foundationpkgs}
 FPKGS_WORK_ROOT=${FPKGS_WORK_ROOT:-/var/tmp/fpkgs-ci}
 FPKGS_REF=${FPKGS_REF:-refs/heads/main}
 

@@ -202,19 +204,24 @@ publish_output() {
 	log=$5
 	rev=$6
 	out=$(artifact_dir "$apk" "$target" "$key")
-	tmp=$out.tmp.$$ 
+	pkg=$(pkg_field "$apk" pkgname)
+	ver=$(pkg_field "$apk" pkgver)
+	rel=$(pkg_field "$apk" pkgrel)
+	[ -n "$rel" ] || rel=0
+	tmp=$out.tmp.$$
 	rm -rf "$tmp"
 	mkdir -p "$tmp"
 	find "$dist" -type f -name '*.tar.gz' -exec cp {} "$tmp/" \;
 	find "$dist" -type f -name '*.sha256' -exec cp {} "$tmp/" \;
 	cp "$log" "$tmp/build.log"
 	{
-		printf 'pkgname=%s\n' "$(pkg_field "$apk" pkgname)"
-		printf 'pkgver=%s\n' "$(pkg_field "$apk" pkgver)"
-		printf 'pkgrel=%s\n' "$(pkg_field "$apk" pkgrel)"
+		printf 'pkgname=%s\n' "$pkg"
+		printf 'pkgver=%s\n' "$ver"
+		printf 'pkgrel=%s\n' "$rel"
 		printf 'target=%s\n' "$target"
 		printf 'gitrev=%s\n' "$rev"
 		printf 'buildkey=%s\n' "$key"
+		printf 'artifact_url=%s/%s/%s/%s-r%s/%s/\n' "$FPKGS_DL_BASE_URL" "$target" "$pkg" "$ver" "$rel" "$key"
 		printf 'built_at=%s\n' "$(date -u +%Y-%m-%dT%H:%M:%SZ)"
 	} >"$tmp/manifest"
 	mkdir -p "$(dirname "$out")"

@@ -366,10 +373,11 @@ post_receive() {
 		{
 			printf 'FPKGS_ROOT=%s\n' "$FPKGS_ROOT"
 			printf 'FPKGS_DL_ROOT=%s\n' "$FPKGS_DL_ROOT"
+			printf 'FPKGS_DL_BASE_URL=%s\n' "$FPKGS_DL_BASE_URL"
 			printf 'FPKGS_WORK_ROOT=%s\n' "$FPKGS_WORK_ROOT"
 			printf 'REV=%s\n' "$new"
 		} >"$job"
-		( FPKGS_ROOT=$FPKGS_ROOT FPKGS_DL_ROOT=$FPKGS_DL_ROOT FPKGS_WORK_ROOT=$FPKGS_WORK_ROOT nohup "$SELF" run "$new" >"$FPKGS_WORK_ROOT/$new.log" 2>&1 & )
+		( FPKGS_ROOT=$FPKGS_ROOT FPKGS_DL_ROOT=$FPKGS_DL_ROOT FPKGS_DL_BASE_URL=$FPKGS_DL_BASE_URL FPKGS_WORK_ROOT=$FPKGS_WORK_ROOT nohup "$SELF" run "$new" >"$FPKGS_WORK_ROOT/$new.log" 2>&1 & )
 	done
 }