Commit edf5c5fb authored by Natanael Copa's avatar Natanael Copa

Define subpkgdir for sub package funcs

better handling of cleaning subpackages
parent 5bf92320
...@@ -111,7 +111,7 @@ clean() { ...@@ -111,7 +111,7 @@ clean() {
rm -rf "$pkgdir" rm -rf "$pkgdir"
local i local i
for i in $subpackages; do for i in $subpackages; do
INSUB=1 $0 $i clean rm -rf "$pkgdir-$i"
done done
} }
...@@ -132,7 +132,7 @@ cleanpkg() { ...@@ -132,7 +132,7 @@ cleanpkg() {
rm -f "$PKGDEST/$p.apk" "$PKGDEST/$p.src.tar.gz" rm -f "$PKGDEST/$p.apk" "$PKGDEST/$p.src.tar.gz"
local i local i
for i in $subpackages; do for i in $subpackages; do
INSUB=1 $0 $i cleanpkg INSUB=1 subpkgdir="$pkgdir-$i" $0 $i cleanpkg
done done
} }
...@@ -152,15 +152,16 @@ subpkg() { ...@@ -152,15 +152,16 @@ subpkg() {
local i local i
cd "$startdir" cd "$startdir"
for i in $subpackages; do for i in $subpackages; do
INSUB=1 $0 $i package || return 1 INSUB=1 subpkgdir="$pkgdir-$i" $0 $i package || return 1
done done
} }
package_apk() { package_apk() {
local dir=${subpkgdir:-$pkgdir}
local p="$pkgname-$pkgver" local p="$pkgname-$pkgver"
[ "$pkgrel" -ne 0 ] && p="$p-r$pkgrel" [ "$pkgrel" -ne 0 ] && p="$p-r$pkgrel"
local pkg="$p.apk" local pkg="$p.apk"
local db="$pkgdir/var/db/apk/$p" local db="$dir/var/db/apk/$p"
mkdir -p "$db" mkdir -p "$db"
echo "$arch" > "$db/ARCH" echo "$arch" > "$db/ARCH"
echo "$pkgdesc" > "$db/DESC" echo "$pkgdesc" > "$db/DESC"
...@@ -171,7 +172,7 @@ package_apk() { ...@@ -171,7 +172,7 @@ package_apk() {
for i in pre-install post-install pre-deinstall post-deinstall; do for i in pre-install post-install pre-deinstall post-deinstall; do
[ -f ../$i ] && cp ../$i "$db"/ [ -f ../$i ] && cp ../$i "$db"/
done done
( cd "$pkgdir" && tar -zcf "$PKGDEST/$pkg" * ) ( cd "$dir" && tar -zcf "$PKGDEST/$pkg" * )
} }
package() { package() {
...@@ -180,51 +181,43 @@ package() { ...@@ -180,51 +181,43 @@ package() {
# predefined subpackage doc # predefined subpackage doc
doc() { doc() {
local origname="$pkgname"
local origpkgdir="$pkgdir"
pkgname="$pkgname-doc" pkgname="$pkgname-doc"
pkgdir="$pkgdir-doc"
depends="" depends=""
local i local i
for i in doc man info html sgml; do for i in doc man info html sgml; do
if [ -d "$origpkgdir/usr/share/$i" ]; then if [ -d "$pkgdir/usr/share/$i" ]; then
mkdir -p "$pkgdir/usr/share" mkdir -p "$subpkgdir/usr/share"
mv "$origpkgdir/usr/share/$i" "$pkgdir/usr/share" mv "$pkgdir/usr/share/$i" "$subpkgdir/usr/share/"
fi fi
done done
[ -d "$pkgdir/usr/share/man" ] && depends="man" [ -d "$subpkgdir/usr/share/man" ] && depends="man"
return 0 return 0
} }
# predefined subpackage mod # predefined subpackage mod
mod() { mod() {
local origname="$pkgname"
local origpkgdir="$pkgdir"
pkgname="$pkgname-mod" pkgname="$pkgname-mod"
pkgdir="$pkgdir-mod"
depends="$kernel" depends="$kernel"
for i in firmware modules; do for i in firmware modules; do
if [ -d $origpkgdir/lib/$i ]; then if [ -d "$pkgdir/lib/$i" ]; then
mkdir -p $pkgdir/lib rm -rf "$subpkgdir/lib"
mv $origpkgdir/lib/$i $pkgdir/lib mkdir -p "$subpkgdir/lib"
mv "$pkgdir/lib/$i" "$subdir/lib"
fi fi
done done
} }
# predefined subpackage dev # predefined subpackage dev
dev() { dev() {
local origname="$pkgname" depends="$pkgname"
local origpkgdir="$pkgdir"
pkgname="$pkgname-dev" pkgname="$pkgname-dev"
pkgdir="$pkgdir-dev" for i in $(cd "$pkgdir" && find usr/lib -name '*.a' -o \
depends="$origname"
for i in $(cd "$origpkgdir" && find usr/lib -name '*.a' -o \
-name '*.la' -o -name '*.o' 2>/dev/null) \ -name '*.la' -o -name '*.o' 2>/dev/null) \
usr/include usr/lib/pkgconfig usr/share/aclocal; do usr/include usr/lib/pkgconfig usr/share/aclocal; do
if [ -e "$origpkgdir/$i" ] || [ -L "$origpkgdir/$i" ]; then if [ -e "$pkgdir/$i" ] || [ -L "$pkgdir/$i" ]; then
d="$pkgdir/${i%/*}" # dirname $i d="$subpkgdir/${i%/*}" # dirname $i
mkdir -p "$d" mkdir -p "$d"
mv "$origpkgdir/$i" "$d" mv "$pkgdir/$i" "$d"
fi fi
done done
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment