puke: Build tarballs

This commit is contained in:
Dylan Araps 2019-05-10 09:59:06 +03:00
parent 21cbd5b156
commit f9a38361f5
3 changed files with 36 additions and 9 deletions

27
puke
View File

@ -16,7 +16,7 @@ clean() {
rm -rf -- "$mak_dir" "$pkg_dir"
[ -n "$name" ] &&
rm "$old_pwd/repo/$name/.checksums"
rm "$old_pwd/repo/$name/.checksums" 2>/dev/null
}
pkg_info() {
@ -41,12 +41,8 @@ pkg_sources() {
while read -r src; do
src_name=${src##*/}
if [ -f "$src" ]; then
continue
elif [ -f "$src_dir/$src_name" ]; then
log "Found cached $src_name."
continue
if [ -f "$src" ] || [ -f "$src_dir/$src_name" ]; then
log "Found local $src_name."
elif [ -z "${src##git:*}" ]; then
git clone "${src##git:}" "$mak_dir"
@ -89,6 +85,7 @@ pkg_verify() {
"run '$0 checksum $name' to update checksums"
log "Checksums verified."
rm .checksums
}
pkg_extract() {
@ -123,8 +120,9 @@ pkg_build() {
set -e
. "$OLDPWD/build"
set +e
cd - >/dev/null
cd -
cp -R "$old_pwd/repo/$name" "$old_pwd/pkg/var/db/puke"
log "Sucessfully built $pkg."
}
@ -138,6 +136,15 @@ pkg_manifest() {
cd - >/dev/null
}
pkg_tar() {
cd "$bin_dir"
tar pcvf "$pkg.tar.gz" -C "$pkg_dir" . ||
die "Failed to create package."
log "Package is at $bin_dir/$pkg.tar.gz."
}
args() {
pkg_info "$2"
@ -151,6 +158,7 @@ args() {
pkg_extract
pkg_build
pkg_manifest
pkg_tar
;;
c*)
@ -166,7 +174,7 @@ main() {
trap clean EXIT INT
clean
mkdir -p sources build pkg sys bin ||
mkdir -p sources build pkg/var/db/puke sys bin ||
die "Couldn't create directories at '$PWD'".
old_pwd=$PWD
@ -175,6 +183,7 @@ main() {
pkg_dir=$PWD/pkg
sys_dir=$PWD/sys
bin_dir=$PWD/bin
db_dir=var/db/puke
args "$@"
}

View File

@ -1,8 +1,17 @@
/usr/bin/shutdown
/usr/bin/hummingbird
/usr/bin/reboot
/var/db/puke/hummingbird/sources
/var/db/puke/hummingbird/manifest
/var/db/puke/hummingbird/checksums
/var/db/puke/hummingbird/build
/var/db/puke/hummingbird/version
/etc/rc.shutdown
/etc/rc.init
/var/db/puke/hummingbird
/var/db/puke
/var/db
/var
/usr/bin
/usr
/etc

View File

@ -1,11 +1,20 @@
/usr/share/man/man3/zlib.3
/usr/include/zconf.h
/usr/include/zlib.h
/var/db/puke/zlib/sources
/var/db/puke/zlib/manifest
/var/db/puke/zlib/checksums
/var/db/puke/zlib/build
/var/db/puke/zlib/version
/lib/libz.so.1.2.11
/lib/libz.so.1
/lib/libz.so
/lib/libz.a
/lib/pkgconfig/zlib.pc
/var/db/puke/zlib
/var/db/puke
/var/db
/var
/usr/share/man/man3
/usr/share/man
/usr/share