summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2009-05-08 15:01:14 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2009-05-08 15:01:14 +0000
commitca65c4b791b11ae2d474a67584816853aad1192d (patch)
tree04277cb4a7cdfcf24665b8ca9a4eedf121edd8ac
parent3d79fb7036e5c42fbe00689f78c222fe66a22a44 (diff)
downloadabuild-ca65c4b791b11ae2d474a67584816853aad1192d.tar.gz
abuild-ca65c4b791b11ae2d474a67584816853aad1192d.tar.bz2
abuild-ca65c4b791b11ae2d474a67584816853aad1192d.tar.xz
abuild-ca65c4b791b11ae2d474a67584816853aad1192d.zip
abuild: prepare pkg dirs/meta files and create packages separately. Dependency speedup.
Run all subpackage functions and prepare the dirs first and create the package itself later on. This will make it possible to automatically trace the dependencies. Also, speed up the detection of which makedeps are installed and which needs to be built/installed. this requires apk-tools_pre11.
-rwxr-xr-xabuild.in48
1 files changed, 34 insertions, 14 deletions
diff --git a/abuild.in b/abuild.in
index 1c58ee1..6354435 100755
--- a/abuild.in
+++ b/abuild.in
@@ -269,7 +269,7 @@ get_split_func() {
echo $func
}
-subpkg() {
+prepare_subpackages() {
if [ -z "$subpackages" ]; then
return 0
fi
@@ -280,11 +280,11 @@ subpkg() {
# call abuild recursively, setting subpkg{dir,name}
msg "Running split function $func..."
subpkgdir="$pkgdirbase/${i%:*}" subpkgname="${i%:*}" \
- $0 $func package || return 1
+ $0 $func prepare_package || return 1
done
}
-package_apk() {
+prepare_metafiles() {
local name=${subpkgname:-$pkgname}
[ -z "${name##* *}" ] && die "package name contains spaces"
local dir=${subpkgdir:-$pkgdir}
@@ -361,15 +361,33 @@ EOF
chmod +x "$dir/$script"
metafiles="$metafiles $script"
done
-
- set *
- [ "$1" = '*' ] && set --
- ( cd "$dir" && tar -zcf "$PKGDEST/$pkg" $metafiles $@ )
+ echo $metafiles | tr ' ' '\n' > "$dir"/.metafiles
}
-package() {
+prepare_package() {
options_has "!strip" || stripbin
- package_apk
+ prepare_metafiles
+}
+
+pkginfo_val() {
+ local key="$1"
+ local file="$2"
+ awk -F ' = ' "\$1 == \"$key\" {print \$2}" "$file"
+}
+
+create_apks() {
+ local file
+ for file in "$pkgdirbase"/*/.PKGINFO; do
+ local dir="${file%/.PKGINFO}"
+ local name=$(pkginfo_val pkgname $file)
+ local ver=$(pkginfo_val pkgver $file)
+ local apk="$PKGDEST"/$name-$ver.apk
+ (
+ set *
+ [ "$1" = '*' ] && set --
+ cd "$dir" && tar -zcf "$apk" $(cat .metafiles) $@
+ )
+ done
}
# predefined splitfunc doc
@@ -446,7 +464,7 @@ dev() {
rootpkg() {
cd "$startdir"
msg "Entering fakeroot..."
- fakeroot $0 build subpkg package
+ fakeroot $0 build prepare_subpackages prepare_package create_apks
}
srcpkg() {
@@ -557,21 +575,23 @@ deptrace() {
# build and install dependencies
builddeps() {
- local deps alldeps pkg i dir ver missing
- msg "Building dependencies..."
+ local deps alldeps pkg i dir ver missing installed_deps
+ msg "Analyzing dependencies..."
deps="$BUILD_BASE $makedepends"
+
# add depends unless it is a subpackage
for i in $depends; do
subpackages_has $i || deps="$deps $i"
done
+ installed_deps=$(apk info -e $deps)
# find which deps are missing
for i in $deps; do
if [ "${i#\!}" != "$i" ]; then
- apk info -e ${i#\!} \
+ list_has ${i#\!} $installed_deps \
&& die "Conflicting package ${i#\!} is installed."
- elif ! apk info -e $i; then
+ elif ! list_has $i $installed_deps; then
if [ -z "$install_deps" ] && [ -z "$recursive" ]; then
die "Missing dependency $i. Use -r to autoinstall or -R to build"
fi