commit 05c56da9ed88fd63cfc79bedc2a205d05d8dff39
parent a20ab3e24c66d7c6be2258569ef228eab68daf8d
Author: Jan Pobříslo <ccx@te2000.cz>
Date: Wed, 14 Jun 2023 12:46:04 +0200
skaware
Diffstat:
8 files changed, 60 insertions(+), 53 deletions(-)
diff --git a/command/pthbs-build b/command/pthbs-build
@@ -133,7 +133,11 @@ if env -i \
fi
else
ret=$?
- grep -C 1 -Eie '(error|fatal)[: ]' "$workdir/build.log"
+ if test -n "$pthbs_fail_log_cmd"; then
+ $pthbs_fail_log_cmd "$workdir/build.log"
+ else
+ grep -C 1 -Eie '(error|fatal)[: ]' "$workdir/build.log"
+ fi
echo "BUILD FAILED: exitcode $ret"
fi
if test -z "$pthbs_skip_cleanup"; then
diff --git a/command/pthbs-install b/command/pthbs-install
@@ -35,12 +35,17 @@ if test -e "$buildinfo"; then
rm -r "$buildinfo"
fi
mkdir -p "$buildinfo"
+
builddir=$(dirname "$pthbs_destdir")
if test -e "$builddir/build.log"; then
mv "$builddir/build.log" "$buildinfo/log"
bzip2 "$buildinfo/log"
fi
+if test -e "$builddir/pthbs-setup"; then
+ mv "$builddir/pthbs-setup" "$buildinfo/"
+fi
+
if test -n "$pthbs_build_environment"; then
ln -s "$pthbs_build_environment" "$buildinfo/env"
fi
diff --git a/command/pthbs-makegen b/command/pthbs-makegen
@@ -126,7 +126,7 @@ function make_envfile( n, envfile, envhash) {
for(n=1; n<=dep_count; n++) {
printf " %s", deps[n]
}
- printf "\n\t%s\n", "pthbs-build "q(ENVIRON["script"])
+ printf "\n\t%s\n", "if test -f "q("$@")"; then touch "q("$@")"; else pthbs-build "q(ENVIRON["script"])"; fi"
has_body = 1
exit 0
}
diff --git a/genpkg.py b/genpkg.py
@@ -11,6 +11,7 @@ import yaml
class SubmoduleInfo:
def __init__(self):
self._current_commits = None
+ self._by_commit = Path('./sources/by-commit')
@property
def current(self):
@@ -23,9 +24,29 @@ class SubmoduleInfo:
r[2][8:]: r[1]
for r in records if r[2].startswith("sources/")
}
+ for repo, commit in self._current_commits.items():
+ if not (self._by_commit / commit).exists():
+ os.symlink("../" + repo, str(self._by_commit / commit))
return self._current_commits
+class FileInfo:
+ def __init__(self):
+ self._sha256_cache = None
+ self._files_dir = Path('./files')
+
+ def __getitem__(self, key):
+ if key in self.sha256_cache:
+ return self.sha256_cache[key]
+ fp = self._files_dir / key
+ with fp.open('rb') as f:
+ file_hash = hashlib.file_digest(f, "sha256").hexdigest()
+ self.sha256_cache[key] = file_hash
+ if not (self._files_dir / "by-sha256" / file_hash).exists():
+ os.symlink("../" + key, str(self._files_dir / "by-sha256" / file_hash))
+ return file_hash
+
+
class Main:
def __init__(self, out_dir="packages", template_dir="templates"):
self.out_dir = Path(out_dir)
@@ -38,6 +59,7 @@ class Main:
self.env.globals["pkg_install_name"] = self.pkg_install_name
self.env.globals["pkg_install_dir"] = self.pkg_install_dir
self.env.globals["submodule"] = SubmoduleInfo()
+ self.env.globals["files"] = SubmoduleInfo()
self.package_hashes = {}
self.rendering = []
@@ -53,7 +75,7 @@ class Main:
t = self.env.get_template("pkg/" + name)
self.rendering.append(name)
- data = bytes(t.render().encode('utf8'))
+ data = bytes(t.render(name=name).encode('utf8'))
self.package_hashes[name] = hashlib.sha256(data).hexdigest()
lastname = self.rendering.pop()
assert name == lastname
diff --git a/packages/default.environment b/packages/default.environment
@@ -1,4 +1,12 @@
#+busybox.db62e4a9ea0f78c45e803fb9350b99b1b860457bb4b165ed18f11fb198375458
#+gnu-make.1591841d61749dff544266ed7ceaf40631698486319b221a0dbb1bd0b2297ac9
#+musl-cross-make.174caae2eabc9cd58859ace659c02352f121b4021e96cf6381632129988e39ec
-#+execline.e8cdfebc01299a8edf599c44bcce9772a867ac9c47403a7d6d17c54fd6a937bc-
\ No newline at end of file
+#+execline.bf7abe6c42100f6d10de8fce4c9b6d2879887b8e629bdda60214781680292eb6
+#+s6.8c7aebd121449a138cb2901fdf5f4d28c08e4ebf547094fdf3b20366eab17b3d
+#+s6-rc.82cd1c0129e2931d3ce5a0f87c68975f8d1718fd39bf58ce5f86db47e82932ff
+#+s6-portable-utils.4eac242634e759a9da20bf0e7b2f8b41cc248d97b05947c56b1321f5407493d5
+#+s6-linux-utils.5f428fd3f213e746dc703dd5fc06b2179293cd1791bc34590b883fbb003351d4
+#+s6-linux-init.863fd837322c69c2e92a9d75661c483a72e853f5438cb62be926b3b5d12406ea
+#+mdevd.cd38a8e0d5b9494e35597d3c260b3710fc54c2020c2de4ad78a18ad53e196a6f
+#+s6-dns.5fd84dae00e72969ebeb48aeaddfe4ed717127d66fd1c73413f071419f1df3b9
+#+s6-networking.b9d93d7943d89450f426f0cecf82c9febd56d5f4972d3edf39c30afb20e225f8+
\ No newline at end of file
diff --git a/packages/execline b/packages/execline
@@ -8,25 +8,20 @@
: ${JOBS:=1}
-export CC="$pthbs_build_environment/command/x86_64-linux-musl-gcc"
-export CXX="$pthbs_build_environment/command/x86_64-linux-musl-g++"
-export LD="$pthbs_build_environment/command/x86_64-linux-musl-ld"
-export AR="$pthbs_build_environment/command/x86_64-linux-musl-ar"
-
prefix=/home/ccx/versions/$pthbs_package
-cd execline
+cd 'execline'
+
./configure \
--prefix="$prefix" \
- --sysdepdir="${prefix}/sysdeps" \
- --binprefix="${prefix}/command" \
- --extbinprefix="${prefix}/command" \
--dynlibdir="${prefix}/library.so" \
+ --bindir="${prefix}/command" \
--libdir="${prefix}/library" \
- --includedir="${prefix}/include" \
+ --shebangdir="${prefix}/command" \
--with-sysdeps='/home/ccx/versions/skalibs.45af710fd510dbca710416233602d6e38c7a07378270a33c909682d48ca297ab/sysdeps' \
--with-include="$pthbs_build_environment/include" \
- --with-lib='/home/ccx/versions/skalibs.45af710fd510dbca710416233602d6e38c7a07378270a33c909682d48ca297ab/library' \
- --disable-shared --enable-static --enable-allstatic --enable-static-libc
+ --with-lib="$pthbs_build_environment/library" \
+ --with-dynlib="$pthbs_build_environment/library.so" \
+ --disable-shared --enable-static --enable-allstatic --enable-static-libc --absolute-paths
make -j${JOBS:-1} -l$((1+${JOBS:-1}))
make DESTDIR="$pthbs_destdir" install
diff --git a/templates/pkg/default.environment b/templates/pkg/default.environment
@@ -2,3 +2,11 @@
#+{{pkg_install_name("gnu-make")}}
#+{{pkg_install_name("musl-cross-make")}}
#+{{pkg_install_name("execline")}}
+#+{{pkg_install_name("s6")}}
+#+{{pkg_install_name("s6-rc")}}
+#+{{pkg_install_name("s6-portable-utils")}}
+#+{{pkg_install_name("s6-linux-utils")}}
+#+{{pkg_install_name("s6-linux-init")}}
+#+{{pkg_install_name("mdevd")}}
+#+{{pkg_install_name("s6-dns")}}
+#+{{pkg_install_name("s6-networking")}}
diff --git a/templates/pkg/execline b/templates/pkg/execline
@@ -1,36 +1 @@
-{% extends "genlinks" %}
-{%- block script %}
-#+*
-#+{{pkg_install_name("musl-cross-make")}}
-#+{{pkg_install_name("gnu-make")}}
-#+{{pkg_install_name("busybox")}}
-#+{{pkg_install_name("skalibs")}}
-#@git:{{submodule.current.execline}}:execline
-
-: ${JOBS:=1}
-
-export CC="$pthbs_build_environment/command/{{triplet}}-gcc"
-export CXX="$pthbs_build_environment/command/{{triplet}}-g++"
-export LD="$pthbs_build_environment/command/{{triplet}}-ld"
-export AR="$pthbs_build_environment/command/{{triplet}}-ar"
-
-prefix={{versions}}/$pthbs_package
-cd execline
-./configure \
- --prefix="$prefix" \
- --sysdepdir="${prefix}/sysdeps" \
- --binprefix="${prefix}/command" \
- --extbinprefix="${prefix}/command" \
- --dynlibdir="${prefix}/library.so" \
- --libdir="${prefix}/library" \
- --includedir="${prefix}/include" \
- --with-sysdeps='{{pkg_install_dir("skalibs")}}/sysdeps' \
- --with-include="$pthbs_build_environment/include" \
- --with-lib='{{pkg_install_dir("skalibs")}}/library' \
- --disable-shared --enable-static --enable-allstatic --enable-static-libc
-
-{{make}}
-make DESTDIR="$pthbs_destdir" install
-{% endblock %}
-{% block genlinks_begin %}
-{% endblock %}
+{% extends "skaware" %}