summaryrefslogtreecommitdiff
path: root/buildrepo
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2009-05-08 13:33:34 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2009-05-08 13:33:34 +0000
commit3d79fb7036e5c42fbe00689f78c222fe66a22a44 (patch)
treecdcc7545290339ffdbfe438c16120c4753bd2e49 /buildrepo
parent4aee935d8c8d9410f3557be7bc3ee4bce639a6e5 (diff)
downloadabuild-3d79fb7036e5c42fbe00689f78c222fe66a22a44.tar.gz
abuild-3d79fb7036e5c42fbe00689f78c222fe66a22a44.tar.bz2
abuild-3d79fb7036e5c42fbe00689f78c222fe66a22a44.tar.xz
abuild-3d79fb7036e5c42fbe00689f78c222fe66a22a44.zip
use .in files for scripts
Diffstat (limited to 'buildrepo')
-rwxr-xr-xbuildrepo133
1 files changed, 0 insertions, 133 deletions
diff --git a/buildrepo b/buildrepo
deleted file mode 100755
index 5b4133d..0000000
--- a/buildrepo
+++ /dev/null
@@ -1,133 +0,0 @@
-#!/bin/sh
-
-program=${0##*/}
-
-aportsdir=${APORTSDIR:-$HOME/aports}
-repodir=${REPODIR:-$HOME/packages}
-
-
-usage() {
- echo "usage: $program [-a APORTSDIR] [-d REPODIR] [-hp] [-l LOGPREFIX ]"
- echo " [-r DEPREPO] REPOSITORY..."
-
- echo "options:"
- echo " -a Set the aports base dir to APORTSDIR instead of $aportsdir"
- echo " -d Set destination repository base dir to REPODIR instead of $repodir"
- echo " -h Show this help and exit"
- echo " -l Send build to logfile, prefixed by LOGPREFIX"
- echo " -p Purge obsolete packages from REPODIR after build"
- echo " -r Dependencies are found in DEPREPO"
- exit 1
-}
-
-
-listpackages() {
- cd "$aportsdir/$1"
- for i in */APKBUILD; do
- APKBUILD=$i abuild listpkg
- done
-}
-
-build() {
- local repo="$1" i indexupdate needbuild
-
- cd "$aportsdir/$repo" || return 1
- mkdir -p "$repodir/$repo"
- if ! [ -f "$repodir/$repo"/APK_INDEX.gz ]; then
- indexupdate="APK_INDEX.gz"
- fi
-
- # first we try copy everything possible and find out which we need
- # to rebuild. By doing this we might save us for rebuilding
- # needed when running 'abuild -R'
- for i in */APKBUILD; do
- export REPODEST="$repodir"
- cd "$aportsdir/$repo"/${i%/*} || return 1
- if abuild -k -q up2date 2>/dev/null; then
- continue
- fi
-
- # try link or copy the files if they are in the ports dir
- pkgs=$(abuild listpkg)
- if cp -p -l $pkgs "$repodir/$repo"/ 2>/dev/null \
- || cp -p $pkgs "$repodir/$repo"/ 2>/dev/null; then
- echo ">>> Copying " $pkgs
- else
- needbuild="$needbuild $i"
- fi
- indexupdate="$indexupdate $i"
- done
-
- # build the postponed packages if any
- if [ -n "$needbuild" ]; then
- for i in $needbuild; do
- cd "$aportsdir/$repo"/${i%/*} || return 1
- abuild -k -R || return 1
- done
- fi
-
- # kill old packages in repo
- if [ -n "$dopurge" ]; then
- local tmp=$(mktemp /tmp/$program-XXXXXX)
- local purgefiles
- cd "$repodir/$1" || return 1
- trap 'rm -f "$tmp"; exit 1' INT
- ( listpackages "$1") >$tmp
- purge=$(ls *.apk 2>/dev/null | grep -v -w -f $tmp)
- if [ -n "$purge" ]; then
- rm -f $purge
- indexupdate="$indexupdate $purge"
- fi
- rm -f "$tmp"
- fi
-
- # check if we have any .apk newer than our index
- cd "$repodir/$repo"
- if [ -z "$indexupdate" ]; then
- for i in *.apk; do
- if [ $i -nt APK_INDEX.gz ]; then
- indexupdate=1
- break;
- fi
- done
- fi
-
- # generate the repository index if needed
- if [ -z "$indexupdate" ]; then
- echo ">>> Index for $repo is up-to-date"
- else
- echo ">>> Generating Index for $repo..."
- if which apk >/dev/null; then
- local deps
- for i in $deprepo; do
- deps="--repo $repodir/$i"
- done
- apk $deps index *.apk | gzip -9 > APK_INDEX.gz
- fi
- fi
-}
-
-while getopts "a:d:hl:pr:" opt; do
- case "$opt" in
- a) aportsdir=$OPTARG;;
- d) repodir=$OPTARG;;
- h) usage >&2;;
- l) logprefix=$OPTARG;;
- p) dopurge=1;;
- r) deprepo="$deprepo $OPTARG";;
- esac
-done
-shift $(($OPTIND - 1))
-
-[ $# -eq 0 ] && usage >&2
-
-while [ $# -gt 0 ]; do
- if [ -n "$logprefix" ]; then
- build $1 >$logprefix.$1.log 2>&1 || exit 1
- else
- build $1 || exit 1
- fi
- deprepo="$deprepo $1"
- shift
-done
-