summaryrefslogtreecommitdiff
path: root/abuild.in
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2016-07-26 08:05:17 +0000
committerTimo Teräs <timo.teras@iki.fi>2016-08-01 14:28:44 +0300
commitf7e2b48d1cdcbd2c84705de20669b94c62ab6371 (patch)
tree12473e808a51531e4f3233070c92c22a43f85c90 /abuild.in
parentf459607da762d2b574583939ff2bb834d66a47f3 (diff)
downloadabuild-f7e2b48d1cdcbd2c84705de20669b94c62ab6371.tar.gz
abuild-f7e2b48d1cdcbd2c84705de20669b94c62ab6371.tar.bz2
abuild-f7e2b48d1cdcbd2c84705de20669b94c62ab6371.tar.xz
abuild-f7e2b48d1cdcbd2c84705de20669b94c62ab6371.zip
abuild: remove PKGDEST and install_after features
supporting these features with cross building is non-trivial and they do are generally not useful features, so remove them. as result the abuildrepo is also removed to write out paths. all package generation paths now use $REPODEST/$repo/$CARCH which allows easily writing packages to correct $subpkgarch in future commits.
Diffstat (limited to 'abuild.in')
-rw-r--r--abuild.in147
1 files changed, 43 insertions, 104 deletions
diff --git a/abuild.in b/abuild.in
index 6fcdb4c..34f1c64 100644
--- a/abuild.in
+++ b/abuild.in
@@ -2,13 +2,13 @@
# abuild - build apk packages (light version of makepkg)
# Copyright (c) 2008-2015 Natanael Copa <ncopa@alpinelinux.org>
+# Copyright (c) 2016 Timo Teräs <timo.teras@iki.fi>
#
# Distributed under GPL-2
#
program_version=@VERSION@
sysconfdir=@sysconfdir@
-abuildrepo_base=@abuildrepo@
datadir=@datadir@
abuild_path=$(readlink -f $0)
@@ -472,8 +472,8 @@ cleanpkg() {
msg "Cleaning built packages..."
for i in $(listpkgnames); do
local p="${i%%:*}-$pkgver-r$pkgrel"
- rm -f "$PKGDEST/$p.apk" "$PKGDEST/$p.src.tar.gz" \
- "$abuildrepo"/$p.apk "$abuildrepo"/*/$p.apk
+ rm -f "$REPODEST/$repo/$CARCH/$p.apk" \
+ "$REPODEST/$repo/src/$p.src.tar.gz"
done
# remove given packages from index
update_abuildrepo_index
@@ -486,10 +486,10 @@ cleanoldpkg() {
msg "Cleaning all packages except $pkgver-r$pkgrel..."
for i in $(listpkgnames); do
local pn=${i%%:*}
- for j in "$PKGDEST"/$pn-[0-9]*.apk ; do
- [ "$j" = "$PKGDEST/$pn-$pkgver-r$pkgrel.apk" ] \
+ for j in "$REPODEST"/$repo/*/$pn-[0-9]*.apk ; do
+ [ "${j##*/}" = "$pn-$pkgver-r$pkgrel.apk" ] \
&& continue
- rm -f "$j" "$abuildrepo"/*/${j##*/}
+ rm -f "$j"
done
done
update_abuildrepo_index
@@ -586,8 +586,8 @@ build() {
# generate a simple tar.gz package of pkgdir
targz() {
cd "$pkgdir" || return 1
- mkdir -p "$PKGDEST"
- tar -czf "$PKGDEST"/$pkgname-$pkgver-r$pkgrel.tar.gz *
+ mkdir -p "$REPODEST"/src
+ tar -czf "$REPODEST"/src/$pkgname-$pkgver-r$pkgrel.tar.gz *
}
postcheck() {
@@ -1297,7 +1297,6 @@ human_size() {
create_apks() {
local file= dir= name= ver= apk= datadir= size=
getpkgver || return 1
- mkdir -p "$PKGDEST"
if ! options_has "!tracedeps"; then
for file in "$pkgbasedir"/.control.*/.PKGINFO; do
dir="${file%/.PKGINFO}"
@@ -1313,13 +1312,13 @@ create_apks() {
fi
for file in "$pkgbasedir"/.control.*/.PKGINFO; do
- dir="${file%/.PKGINFO}"
- name=$(pkginfo_val pkgname $file)
- ver=$(pkginfo_val pkgver $file)
- size=$(pkginfo_val size $file | human_size)
- apk=$name-$ver.apk
- datadir="$pkgbasedir"/$name
- subpkgname=$name
+ local dir="${file%/.PKGINFO}"
+ local name=$(pkginfo_val pkgname $file)
+ local ver=$(pkginfo_val pkgver $file)
+ local size=$(pkginfo_val size $file | human_size)
+ local apk=$name-$ver.apk
+ local datadir="$pkgbasedir"/$name
+ local subpkgname=$name
trace_apk_deps "$name" "$dir" || return 1
msg "Package size: ${size}"
@@ -1347,39 +1346,10 @@ create_apks() {
msg "Create $apk"
# create the final apk
- cat control.tar.gz data.tar.gz > "$PKGDEST"/$apk
+ mkdir -p "$REPODEST"/$repo/$CARCH
+ cat control.tar.gz data.tar.gz > "$REPODEST"/$repo/$CARCH/$apk
)
done
- subpkgname=
-}
-
-clean_abuildrepo() {
- local apk
- cd "$abuildrepo" || return 1
-
- # remove compat symlink
- for d in "$abuildrepo/$CARCH"; do
- [ -L "$d" ] && rm "$d"
- done
-
- # remove broken links from abuildrepo
- for apk in *.apk */*.apk; do
- if [ -L "$apk" ] && [ ! -f "$apk" ]; then
- rm -f "$apk"
- fi
- done
-}
-
-mklinks_abuildrepo() {
- [ -n "$REPODEST" ] && return 0
- local apk
- mkdir -p "$abuildrepo"/$CARCH
- cd "$abuildrepo" || return 1
- # create links for this package
- for apk in $(listpkg); do
- [ -f "$PKGDEST"/$apk ] || continue
- ln -sf "$PKGDEST"/$apk "$abuildrepo"/$CARCH/$apk
- done
}
build_abuildrepo() {
@@ -1391,7 +1361,7 @@ build_abuildrepo() {
if ! apk_up2date || [ -n "$force" ]; then
# check early if we have abuild key
abuild-sign --installed || return 1
- logcmd "building ${abuildrepo##*/}/$pkgname-$pkgver-r$pkgrel"
+ logcmd "building $repo/$pkgname-$pkgver-r$pkgrel"
sanitycheck && builddeps && clean && fetch && unpack \
&& prepare && mkusers && $_build && rootpkg \
&& cleanup $CLEANUP \
@@ -1401,10 +1371,7 @@ build_abuildrepo() {
}
update_abuildrepo_index() {
- clean_abuildrepo
- mklinks_abuildrepo
-
- cd "$abuildrepo"
+ cd "$REPODEST/$repo"
local index=$CARCH/APKINDEX.tar.gz
msg "Updating the cached abuild repository index..."
@@ -1620,9 +1587,9 @@ srcpkg() {
files="$files $prefix/$f"
done
- mkdir -p "$PKGDEST"
+ mkdir -p "$REPODEST/src"
msg "Creating source package $p.src.tar.gz..."
- (cd .. && tar -zcf "$PKGDEST/$p.src.tar.gz" $files)
+ (cd .. && tar -zcf "$REPODEST/src/$p.src.tar.gz" $files)
}
# return true if arch is supported or noarch
@@ -1647,11 +1614,11 @@ check_libc() {
# check if package is up to date
apk_up2date() {
getpkgver || return 1
- local pkg="$PKGDEST/$pkgname-$pkgver-r$pkgrel.apk"
+ local pkg="$REPODEST/$repo/$CARCH/$pkgname-$pkgver-r$pkgrel.apk"
local i s
cd "$startdir"
for i in $pkgname $subpackages; do
- [ -f "$PKGDEST/${i%%:*}-$pkgver-r$pkgrel.apk" ] || return 1
+ [ -f "$REPODEST/$repo/$CARCH/${i%:*}-$pkgver-r$pkgrel.apk" ] || return 1
done
[ -n "$keep" ] && return 0
@@ -1672,7 +1639,7 @@ apk_up2date() {
abuildindex_up2date() {
local i
getpkgver || return 1
- local dir="$abuildrepo"/$CARCH
+ local dir="$REPODEST"/$repo/$CARCH
local apk="${pkgname%%:*}-$pkgver-r$pkgrel.apk"
local idx="$dir"/APKINDEX.tar.gz
local file="$dir"/$apk
@@ -1837,14 +1804,14 @@ builddeps() {
if [ -n "$install_deps" ] && [ -z "$recursive" ]; then
# make a --simulate run first to detect missing deps
# apk-tools --virtual is no goot at reporting those.
- $SUDO_APK add --repository "$abuildrepo" $apk_opt_wait \
+ $SUDO_APK add --repository "$REPODEST/$repo" $apk_opt_wait \
--simulate --quiet $builddeps || return 1
- $SUDO_APK add --repository "$abuildrepo" $apk_opt_wait \
+ $SUDO_APK add --repository "$REPODEST/$repo" $apk_opt_wait \
--virtual .makedepends-$pkgname $builddeps || return 1
if cross_compiling; then
- $SUDO_APK add --root "$CBUILDROOT" --repository "$abuildrepo" $apk_opt_wait \
+ $SUDO_APK add --root "$CBUILDROOT" --repository "$REPODEST/$repo" $apk_opt_wait \
--simulate --quiet $hostdeps || return 1
- $SUDO_APK add --root "$CBUILDROOT" --repository "$abuildrepo" $apk_opt_wait \
+ $SUDO_APK add --root "$CBUILDROOT" --repository "$REPODEST/$repo" $apk_opt_wait \
--no-scripts --virtual .makedepends-$pkgname $hostdeps || return 1
fi
return 0
@@ -1858,7 +1825,7 @@ builddeps() {
# find dependencies that are installed but missing in repo.
for i in $builddeps; do
- local m=$($APK search --repository "$abuildrepo" ${i%%[<>=]*})
+ local m=$($APK search --repository "$REPODEST/$repo" ${i%%[<>=]*})
if [ -z "$m" ]; then
missing="$missing $i"
fi
@@ -1886,7 +1853,7 @@ builddeps() {
cd "$dir" && $0 $forceroot $keep $quiet $install_deps \
$recursive $upgrade $color_opt abuildindex || return 1
done
- $SUDO_APK add --upgrade --repository "$abuildrepo" \
+ $SUDO_APK add --upgrade --repository "$REPODEST/$repo" \
$apk_opt_wait \
--virtual .makedepends-$pkgname $builddeps
}
@@ -2024,32 +1991,13 @@ install_has() {
list_has "$1" $install
}
-# install package after build
-post_add() {
- getpkgver || return 1
- local pkgf="$PKGDEST/$1-$pkgver-r$pkgrel.apk"
- local deps i
- if ! subpackages_has $1 && [ "$1" != "$pkgname" ]; then
- die "$1 is not built by this APKBUILD"
- fi
- # recursively install dependencies that are provided by this APKBUILD
- deps=$($APK index "$pkgf" 2>/dev/null | awk -F: '$1=="D" { print $2 }')
- for i in $deps; do
- if subpackages_has $i || [ "$i" = "$pkgname" ]; then
- post_add $i || return 1
- fi
- done
- $SUDO_APK add $apk_opt_wait --upgrade "$pkgf" \
- || die "Failed to install $1"
-}
-
deps() {
local builddeps= i
for i in $depends $makedepends; do
[ "$pkgname" = "${i%%[<>=]*}" ] && continue
subpackages_has ${i%%[<>=]*} || builddeps="$builddeps $i"
done
- $SUDO_APK add $apk_opt_wait --repository "$abuildrepo" \
+ $SUDO_APK add $apk_opt_wait --repository "$REPODEST/$repo" \
--virtual .makedepends-$pkgname \
$builddeps
}
@@ -2143,8 +2091,7 @@ snapshot() {
usage() {
echo "$program $program_version"
cat << EOF
-usage: $program [options] [-i PKG] [-P REPODEST] [-p PKGDEST]
- [-s SRCDEST] [cmd] ...
+usage: $program [options] [-P REPODEST] [-s SRCDEST] [cmd] ...
$program [-c] -n PKGNAME[-PKGVER]
Options:
-A Print CARCH and exit
@@ -2157,8 +2104,7 @@ Options:
-k Keep built packages, even if APKBUILD or sources are newer
-K Keep buildtime temp dirs and files (srcdir/pkgdir/deps)
-m Disable colors (monochrome)
- -p Set package destination directory
- -P Set PKGDEST to REPODEST/<repo>/\$CARCH, where repo is the parents dir name
+ -P Set REPODEST as the repository location for created packages
-q Quiet
-r Install missing dependencies from system repository (using sudo)
-R Recursively build and install missing dependencies (using sudo)
@@ -2174,9 +2120,9 @@ Commands:
cleanpkg Remove already built binary and source package
deps Install packages listed in makedepends and depends
fetch Fetch sources to \$SRCDEST and verify checksums
- index Regenerate the APKINDEX for abuildrepo
+ index Regenerate indexes in \$REPODEST
listpkg List target packages
- package Create package in \$PKGDEST
+ package Create package in \$REPODEST
prepare Apply patches
rootpkg Run 'package', the split functions and create apks as fakeroot
sanitycheck Basic sanity check of APKBUILD
@@ -2199,7 +2145,7 @@ EOF
APKBUILD="${APKBUILD:-./APKBUILD}"
unset force
unset recursive
-while getopts "AcdfFhi:kKimnp:P:qrRs:u" opt; do
+while getopts "AcdfFhkKimnp:P:qrRs:u" opt; do
case $opt in
'A') echo "$CARCH"; exit 0;;
'c') enable_colors
@@ -2208,13 +2154,11 @@ while getopts "AcdfFhi:kKimnp:P:qrRs:u" opt; do
'f') force="-f";;
'F') forceroot="-F";;
'h') usage;;
- 'i') install_after="$install_after $OPTARG";;
'k') keep="-k";;
'K') CLEANUP="" ERROR_CLEANUP="" ;;
'm') disable_colors
color_opt="-m";;
'n') die "Use newapkbuild to create new aports";;
- 'p') PKGDEST=$OPTARG;;
'P') REPODEST=$OPTARG;;
'q') quiet="-q";;
'r') install_deps="-r";;
@@ -2244,7 +2188,6 @@ repo=${startdir%/*}
repo=${repo##*/}
SRCDEST=${SRCDEST:-$startdir}
-PKGDEST=${PKGDEST:-$startdir}
# set a default CC
: ${CC:=gcc}
@@ -2254,15 +2197,15 @@ cd "$startdir" || die
. "$APKBUILD"
# If REPODEST is set then it will override the PKGDEST
-if [ -n "$REPODEST" ]; then
- PKGDEST="$REPODEST/$repo/$CARCH"
- # for recursive action
- export REPODEST
- abuildrepo="$REPODEST"/$repo
-else
- abuildrepo="$abuildrepo_base"/$repo
+if [ -z "$REPODEST" ]; then
+ warning "REPODEST is not set and is now required. Defaulting to ~/packages"
+ [ -n "$PKGDEST" ] && die "PKGDEST is no longer supported."
+ REPODEST="~/packages"
fi
+# for recursive action
+export REPODEST
+
# if we want build debug package
if [ -n "$DEBUG" ] || subpackage_types_has "dbg"; then
CFLAGS="$CFLAGS -g"
@@ -2295,8 +2238,4 @@ while [ $# -gt 0 ]; do
shift
done
-for i in $install_after; do
- post_add $i
-done
-
cleanup