package

simple and robust package manager
Log | Files | Refs | README

commit 89c7613377fe8285d0369c4ceaeb15e150d839a5
parent 6b3183b31c81b6628e28ec0cf1c586f6c1a71e09
Author: Josuah Demangeon <mail@josuah.net>
Date:   Tue, 15 Jan 2019 20:15:08 +0100

only keep the downloader implemented as an adptable script

Diffstat:
Mbin/pack-cvs | 8++++----
Dbin/pack-extract | 9---------
Mbin/pack-ftp | 11++++++++---
Mbin/pack-git | 1+
Mbin/pack-http | 11+++++++++--
Dbin/pack-install | 11-----------
Dbin/pack-tar | 9---------
Mpack-build.c | 15+++++++++------
8 files changed, 31 insertions(+), 44 deletions(-)

diff --git a/bin/pack-cvs b/bin/pack-cvs @@ -1,7 +1,7 @@ #!/bin/sh -e -PACK_TAR=${PACK_TAR:-/var/pack/tar} PACK_CVS=${PACK_CVS:-/var/pack/cvs} -cd "$PACK/cvs/$1" -cvs -qd "$2" checkout -P "$path" -tar -cf "$PACK_TAR/$1.tar" . +mkdir -p $PACK_CVS/$1" +cd "$PACK_CVS/$1" +cvs -qd "$2" checkout -P "${1%/*}" +tar -cf - . diff --git a/bin/pack-extract b/bin/pack-extract @@ -1,9 +0,0 @@ -#!/bin/sh -e - -case $1 in -(*.tgz|*.tar.gz) gzip -d - ;; -(*.tbz|*.tar.bz2) bzip2 -d - ;; -(*.txz|*.tar.xz) xz -d - ;; -(*.tlz|*.tar.lz) lzip -d - ;; -(*) exit 1 ;; -esac diff --git a/bin/pack-ftp b/bin/pack-ftp @@ -1,5 +1,10 @@ #!/bin/sh -e -PACK_TAR=${PACK_TAR:-/var/pack/tar} -sleep 10 -wget --no-check-certificate -O- "$2" | pack-extract "$2" >$PACK_TAR/$1/tar +wget --no-check-certificate -O- "$2" | pack-extract "$2" | +case $1 in +(*.tgz|*.tar.gz) gzip -d - ;; +(*.tbz|*.tar.bz2) bzip2 -d - ;; +(*.txz|*.tar.xz) xz -d - ;; +(*.tlz|*.tar.lz) lzip -d - ;; +(*) exit 1 ;; +esac diff --git a/bin/pack-git b/bin/pack-git @@ -1,4 +1,5 @@ #!/bin/sh -e +PACK_GIT=${PACK_GIT:-/var/pack/git} mkdir -p "$PACK_GIT/${1%/*}" ! git clone --bare "$2" "$PACK_GIT/$1" diff --git a/bin/pack-http b/bin/pack-http @@ -1,4 +1,11 @@ #!/bin/sh -e -PACK_TAR=${PACK_TAR:-/var/pack/tar} -wget --no-check-certificate -O- "$2" | pack-extract "$2" >$PACK_TAR/$1/tar +wget --no-check-certificate -O- "$1" | pack-extract "$1" | +case $1 in +(*.tgz|*.tar.gz) gzip -d - ;; +(*.tbz|*.tar.bz2) bzip2 -d - ;; +(*.txz|*.tar.xz) xz -d - ;; +(*.tlz|*.tar.lz) lzip -d - ;; +(*) exit 1 ;; +esac + diff --git a/bin/pack-install b/bin/pack-install @@ -1,11 +0,0 @@ -#!/bin/sh -e -PACK_OUT=${PACK_OUT:-/var/pack/pkg} -PACK_BIN=${PACK_BIN:-/var/pack/bin} -PACK_MAN=${PACK_MAN:-/var/pack/man} - -mkdir -p "$PACK_BIN" "$PACK_MAN" -cd "$PACK_OUT/$1" - -if [ -d bin ]; then cp -RLfp bin/* "$PACK_BIN"; fi -if [ -d man ]; then cp -RLfp man/* "$PACK_MAN"; fi -if [ -d share/man ]; then cp -RLfp share/man/* "$PACK_MAN"; fi diff --git a/bin/pack-tar b/bin/pack-tar @@ -1,9 +0,0 @@ -#!/bin/sh -e -PACK_SRC=${PACK_SRC:-/var/pack/src} -PACK_TAR=${PACK_TAR:-/var/pack/tar} - -tar -xv -f "$PACK_TAR/$1/tar" -C "$PACK_SRC/$1" -if [ "$(ls "$PACK_SRC/$1" | wc -l | tr -cd 0-9)" = 1 ]; then - ! mv "$PACK_SRC/$1/"*/* "$PACK_SRC/$1" - ! rmdir "$PACK_SRC/$1"/* 2>/dev/null -fi diff --git a/pack-build.c b/pack-build.c @@ -25,12 +25,12 @@ untar(void) { char const *argv[] = { "tar", "-x", "-f", "../../source.tar", NULL }; int fd; + int x; if ((fd = open_trunc("../log/1-untar")) == -1) return 0; - if (forkexec_wait_redir(argv, fd) != 0) { close(fd); return 0; } + x = forkexec_wait_redir(argv, fd); close(fd); - - return 1; + return x; } static int @@ -297,8 +297,11 @@ main(int argc, char **argv) log_diesys7(101, "rename ", pkg, "/", p.name, "/", p.ver, "/latest"); if (chdir("source") == -1) log_diesys4(101, "could not change directory to ", pkg, "/", p.name); - if (!untar()) - log_diesys9(101, "untar ", pkg, "/", p.name, "/", p.ver, "/", id, "/source"); + if ((x = untar()) != 0) { + char fmt[50]; + fmt_long(fmt, x); + log_die4(100, "tar of ", p.name, " exited ", fmt); + } if (!patch(&p, def)) log_diesys3(100, "patching ", p.name, "'s source"); if (!data(&p, def)) @@ -308,7 +311,7 @@ main(int argc, char **argv) if ((x = build(&p, def)) != 0) { char fmt[50]; fmt_long(fmt, x); - log_die4(100, "build script of ", p.name, " returned ", fmt); + log_die4(100, "build script of ", p.name, " exited ", fmt); } if (symlink(id, "../current") == -1 && errno != EEXIST) log_diesys9(101, "symlink ", pkg, "/", p.name, "/", p.ver, "/", id, "/current");