pthbs

Packaging Through Hashed Build Scripts
git clone https://ccx.te2000.cz/git/pthbs
Log | Files | Refs | Submodules | README

commit c66934a90cc43c347626cc2ef6d67f8774ed5838
parent 87a5dbb497297b13d1560c472bb56c84e864bd9a
Author: ccx <ccx@te2000.cz>
Date:   Fri,  8 Mar 2024 17:46:09 +0000

Handle paths to environment packages

Diffstat:
Mgenpkg.py | 16+++++++++++++++-
Mpackages/core-system-conf | 10++++++----
Mpackages/core-system-init | 4++--
Mpackages/core-system-rc | 4++--
Mpackages/default.environment | 8++++----
Mpackages/logincaps | 5+++++
Mpackages/userspace.environment | 2+-
Mtemplates/pkg/core-system-conf | 2++
Mtemplates/pkg/logincaps | 5+++++
9 files changed, 42 insertions(+), 14 deletions(-)

diff --git a/genpkg.py b/genpkg.py @@ -105,6 +105,16 @@ class Main: with open(fname) as f: self.env.globals.update(yaml.safe_load(f)) + def pkg_env_sha256(self, name): + current = self.rendering[-1] + if current not in self.deps: + self.deps[current] = set((name,)) + else: + self.deps[current].add(name) + self._pkg_sha256(name) + envlist = ''.join(sorted('%s.%s\n' % (d, self.package_hashes[d]) for d in self.deps[name])) + return hashlib.sha256(envlist.encode()).hexdigest() + def pkg_sha256(self, name): current = self.rendering[-1] if current not in self.deps: @@ -139,7 +149,11 @@ class Main: return self.package_hashes[name] def pkg_install_name(self, name): - return "%s.%s" % (name.split(":")[0], self.pkg_sha256(name)) + rootname = name.split(":")[0] + if rootname.endswith('.environment'): + return "env.%s" % (self.pkg_env_sha256(name),) + else: + return "%s.%s" % (name.split(":")[0], self.pkg_sha256(name)) def pkg_install_dir(self, name): return os.path.join( diff --git a/packages/core-system-conf b/packages/core-system-conf @@ -12,7 +12,9 @@ #+s6-rc.6cefe2791153127e0a783521ab97f3b124f023f21cdc2eddadbb865496ad0b45 #+s6.bb3974d7b49c2034b5064bac508beae2d4bfc1a7b6543aefcbc1af9e9e94f1a7 #+zsh.762204e14953017be79e356d4bf9f7681625a750ecc951f3510bf144ea7b51bb -#@git:7b63e9ab32c2044b5abefbdadc73a519b967897b:core-system-conf +#+core-system-scripts.132a3b1c6b226dee79156049db1244ebeacdf5a4bfcffc74b6b97175dad000fd +#+logincaps.d91b19069a50bdc149c19a468e1aa30252308ce2366858d85e1b36279f79c933 +#@git:aa6e56d2a3e1cf0d53d70db8348c35272e876677:core-system-conf def_prefix() { prefix=/versions/$pthbs_package @@ -40,11 +42,11 @@ linkdep() { cd 'core-system-conf' printf '%s\n' >config/etc/motd \ "Welcome to $(cat ./config/hostname)!" \ - 'Current running configuration was generated from core-system-conf:7b63e9ab32c2044b5abefbdadc73a519b967897b' \ - 'Last change on 2024-03-08 11:53:47 +0000 by ccx' + 'Current running configuration was generated from core-system-conf:aa6e56d2a3e1cf0d53d70db8348c35272e876677' \ + 'Last change on 2024-03-08 13:19:44 +0000 by ccx' env 'pthbs_path_core-system-conf'="$prefix" \ - 'pthbs_path_containers=/versions/containers.environment.5c638a60055f057e241390ce3f606b4555427cd47c09becd05c48c29ca76d8bb' \ + 'pthbs_path_containers=/versions/env.9cf55586e2295800df02539537b4c0407b2f5a19bf5e648083e92f419eb321e5' \ make -j${JOBS:-1} -l$((1+${JOBS:-1})) all sort -u build/execfile | while IFS= read exename; do diff --git a/packages/core-system-init b/packages/core-system-init @@ -5,9 +5,9 @@ #+s6-portable-utils.39f4babb8cd30769f1a931708e5442244b0305c36ddafe32348c7dc30c000b00 #+s6-linux-init.396413eed542c149346f51a569f2d686c03b2104f4d062f52422e444ad9b502d #+execline.9d9d14aad09d9643f578727ab1ed3363b975772358c4ac8e756abdad4fca7a3d -#+core-system-rc.ea60f9ba73b7c28b8d75afeb51e41eae62d88c829734e8cb73ed5c7cf2fb0358 +#+core-system-rc.3995e5ea62be56347d3d84443f0de1dd9c2b021f59170809a35bd81c9e455eab -s6rcdb=/versions/core-system-rc.ea60f9ba73b7c28b8d75afeb51e41eae62d88c829734e8cb73ed5c7cf2fb0358/config/s6-rc-db +s6rcdb=/versions/core-system-rc.3995e5ea62be56347d3d84443f0de1dd9c2b021f59170809a35bd81c9e455eab/config/s6-rc-db prefix=/versions/$pthbs_package pkgdir="$pthbs_destdir/$prefix" diff --git a/packages/core-system-rc b/packages/core-system-rc @@ -3,7 +3,7 @@ #+busybox-diffutils.4f5a07b29246414b77a7d71b103263af8f1249d75ddcbd9864e00def3d6feded #+s6-rc.6cefe2791153127e0a783521ab97f3b124f023f21cdc2eddadbb865496ad0b45 #+fileset.22d9abf3009dbbfe507bd7ff93fdd0bf7f86ee0bc317b37b423b89d70ab950a2 -#+core-system-conf.9028fdf62e86bda47421ae1d0561c4e19cb891b8650195b825142f1bba0f4c68 +#+core-system-conf.ca6eb3340c075b6860f7c8c6e8f7fbf2036f1f20977f2200a09001d008901dd0 def_prefix() { prefix=/versions/$pthbs_package @@ -13,7 +13,7 @@ def_dest() { } def_dest -src=/versions/core-system-conf.9028fdf62e86bda47421ae1d0561c4e19cb891b8650195b825142f1bba0f4c68/config/s6-rc-source +src=/versions/core-system-conf.ca6eb3340c075b6860f7c8c6e8f7fbf2036f1f20977f2200a09001d008901dd0/config/s6-rc-source s6-rc-compile ./s6-rc-db "$src" mkdir -p "$dest/config" mv -v s6-rc-db "$dest/config/" diff --git a/packages/default.environment b/packages/default.environment @@ -1,7 +1,7 @@ -#+core-system-conf.9028fdf62e86bda47421ae1d0561c4e19cb891b8650195b825142f1bba0f4c68 -#+core-system-rc.ea60f9ba73b7c28b8d75afeb51e41eae62d88c829734e8cb73ed5c7cf2fb0358 +#+core-system-conf.ca6eb3340c075b6860f7c8c6e8f7fbf2036f1f20977f2200a09001d008901dd0 +#+core-system-rc.3995e5ea62be56347d3d84443f0de1dd9c2b021f59170809a35bd81c9e455eab #+core-system-scripts.132a3b1c6b226dee79156049db1244ebeacdf5a4bfcffc74b6b97175dad000fd -#+core-system-init.ec947ff186c088e0446df3bbc55762b4c7bb529a09282f63d060492682baf2d9 +#+core-system-init.553229c8a34a8f564447d966c8646e7299e7101ab4abad414756119add88ee0e #+busybox.e60885fe93ee85c01831673bb29f0e62a64903f4ce3094e3dc35bc8ec8887ad9 #+gnu-make.782c9e6625fd7420e2cd38b847afed19db3b3844cae8a0426a0dbf73e10d78e5 #+musl-cross-make.65f98305f5666435bf0c6b9ccedffae2179ff1b3286752756886f760cf7771d2 @@ -26,7 +26,7 @@ #+confz.6658089fa0f90962e97d41b3fd8400d7ea37c6872828f5f7bd122a2d07a9c467 #+containers.60c1acf0dfce9a977591b80f5ae29b57f6b436815af20c2a4cbd3c28d8308427 #+fileset.22d9abf3009dbbfe507bd7ff93fdd0bf7f86ee0bc317b37b423b89d70ab950a2 -#+logincaps.17443761febb558783bbc9fe3a6d04c132d8e15e94c06c9d115828d0f84664a1 +#+logincaps.d91b19069a50bdc149c19a468e1aa30252308ce2366858d85e1b36279f79c933 #+snaprep.42b7b97b7530a211dd0f01680c9b15362aa2e7249bc27cea0deb0632f7535bb1 #+curl.b82f818e85570a561ca20ca417adba2f1c3214ef5c3e01626c0a4aa099b90f0c #+git.1839db7305bbee32d184adc0ece64d40ab58132d3c7749b426c4d680659bd4eb diff --git a/packages/logincaps b/packages/logincaps @@ -30,6 +30,11 @@ fi cd login sh build_static.sh cp -a login "$pkgdir/command/" +cat >"$pkgdir/command/login-keepenv" <<EOF +#!$(which execlineb) -S0 +$pkgdir/command/login -p $@ +EOF +chmod +x "$pkgdir/command/login-keepenv" cd "$pthbs_destdir/versions/$pthbs_package" find -type d -o -print | awk -F/ ' diff --git a/packages/userspace.environment b/packages/userspace.environment @@ -22,7 +22,7 @@ #+confz.6658089fa0f90962e97d41b3fd8400d7ea37c6872828f5f7bd122a2d07a9c467 #+containers.60c1acf0dfce9a977591b80f5ae29b57f6b436815af20c2a4cbd3c28d8308427 #+fileset.22d9abf3009dbbfe507bd7ff93fdd0bf7f86ee0bc317b37b423b89d70ab950a2 -#+logincaps.17443761febb558783bbc9fe3a6d04c132d8e15e94c06c9d115828d0f84664a1 +#+logincaps.d91b19069a50bdc149c19a468e1aa30252308ce2366858d85e1b36279f79c933 #+snaprep.42b7b97b7530a211dd0f01680c9b15362aa2e7249bc27cea0deb0632f7535bb1 #+curl.b82f818e85570a561ca20ca417adba2f1c3214ef5c3e01626c0a4aa099b90f0c #+git.1839db7305bbee32d184adc0ece64d40ab58132d3c7749b426c4d680659bd4eb diff --git a/templates/pkg/core-system-conf b/templates/pkg/core-system-conf @@ -13,6 +13,8 @@ #+{{pkg_install_name("s6-rc")}} #+{{pkg_install_name("s6")}} #+{{pkg_install_name("zsh")}} +#+{{pkg_install_name("core-system-scripts")}} +#+{{pkg_install_name("logincaps")}} #@git:{{submodule.current[name]}}:{{name}} {% include "functions/vars" %} diff --git a/templates/pkg/logincaps b/templates/pkg/logincaps @@ -7,6 +7,11 @@ cd login sh build_static.sh cp -a login "$pkgdir/command/" +cat >"$pkgdir/command/login-keepenv" <<EOF +#!$(which execlineb) -S0 +$pkgdir/command/login -p $@ +EOF +chmod +x "$pkgdir/command/login-keepenv" {%- endblock %} {% block genlinks_begin %} x["./command/zshaskpass_lock"]=1