Commit 99ffea8a authored by Natanael Copa's avatar Natanael Copa

abuild: use $repo/$arch for abuildrepo

This is so apk-tools-2.1 works
parent 3af17782
...@@ -359,7 +359,7 @@ cleanpkg() { ...@@ -359,7 +359,7 @@ cleanpkg() {
for i in $(listpkgnames); do for i in $(listpkgnames); do
local p="${i%:*}-$pkgver-r$pkgrel" local p="${i%:*}-$pkgver-r$pkgrel"
rm -f "$PKGDEST/$p.apk" "$PKGDEST/$p.src.tar.gz" \ rm -f "$PKGDEST/$p.apk" "$PKGDEST/$p.src.tar.gz" \
"$abuildrepo"/$p.apk "$abuildrepo"/$p.apk "$abuildrepo"/*/$p.apk
done done
# remove given packages from index # remove given packages from index
} }
...@@ -370,9 +370,11 @@ cleanoldpkg() { ...@@ -370,9 +370,11 @@ cleanoldpkg() {
getpkgver || return 1 getpkgver || return 1
msg "Cleaning all packages except $pkgver-r$pkgrel..." msg "Cleaning all packages except $pkgver-r$pkgrel..."
for i in $(listpkgnames); do for i in $(listpkgnames); do
for j in "$PKGDEST"/${i%:*}-[0-9]*.apk; do local pn=${i%:*}
[ "$j" != "$PKGDEST/${i%:*}-$pkgver-r$pkgrel.apk" ] \ for j in "$PKGDEST"/$pn-[0-9]*.apk ; do
&& rm -f "$j" [ "$j" = "$PKGDEST/$pn-$pkgver-r$pkgrel.apk" ] \
&& continue
rm -f "$j" "$abuildrepo"/*/${j##*/}
done done
done done
return 0 return 0
...@@ -769,41 +771,67 @@ create_apks() { ...@@ -769,41 +771,67 @@ create_apks() {
done done
} }
update_abuildrepo() { # fish out the arch from an apk file
if ! apk_up2date || [ -n "$force" ]; then apk_arch_prefix() {
sanitycheck && builddeps && clean && fetch && unpack \ apk index -q "$1" | tar -zxO | awk -F: '$1 == "A" { print $2 }'
&& prepare && mkusers && rootpkg || return 1 }
fi
clean_abuildrepo() {
local apk local apk
mkdir -p "$abuildrepo" || return 1 cd "$abuildrepo" || return 1
cd "$abuildrepo"
# remove compat symlink
for d in "$abuildrepo/$CARCH" "$abuildrepo"/noarch; do
[ -L "$d" ] && rm "$d"
done
# remove broken links # remove broken links from abuildrepo
for apk in *.apk; do for apk in *.apk */*.apk; do
if [ -L "$apk" ] && [ ! -f "$apk" ]; then if [ -L "$apk" ] && [ ! -f "$apk" ]; then
rm -f "$apk" rm -f "$apk"
fi fi
done done
}
mklinks_abuildrepo() {
local apk
mkdir -p "$abuildrepo"
cd "$abuildrepo" || return 1
# create links for this package # create links for this package
for apk in $(listpkg); do for apk in $(listpkg); do
ln -sf "$PKGDEST"/$apk "$abuildrepo"/$apk [ -f "$PKGDEST"/$apk ] || continue
local prefix=$(apk_arch_prefix "$PKGDEST"/$apk)
mkdir -p "$abuildrepo"/$prefix
ln -sf "$PKGDEST"/$apk "$abuildrepo"/$prefix/$apk
done done
}
update_abuildrepo() {
local d apk
if ! apk_up2date || [ -n "$force" ]; then
sanitycheck && builddeps && clean && fetch && unpack \
&& prepare && mkusers && rootpkg || return 1
fi
clean_abuildrepo
mklinks_abuildrepo
cd "$abuildrepo"
local index=$CARCH/APKINDEX.tar.gz
msg "Updating the cached abuild repository index..." msg "Updating the cached abuild repository index..."
local sign=".SIGN.RSA.${SIGN_PUBLIC_KEY##*/}" local sign=".SIGN.RSA.${SIGN_PUBLIC_KEY##*/}"
local oldindex= local oldindex=
if [ -f APKINDEX.tar.gz ]; then if [ -f "$index" ]; then
oldindex="--index APKINDEX.tar.gz" oldindex="--index $index"
fi fi
$APK index $oldindex --output APKINDEX.tar.gz.unsigned \ $APK index --quiet $oldindex --output "$index".unsigned \
--description "$repo $(cd $startdir && git describe)" \ --description "$repo $(cd $startdir && git describe)" \
*.apk || exit 1 noarch/*.apk $CARCH/*.apk || exit 1
msg "Signing the index..." msg "Signing the index..."
abuild-sign -q APKINDEX.tar.gz.unsigned || exit 1 abuild-sign -q "$index".unsigned || exit 1
mv APKINDEX.tar.gz.unsigned APKINDEX.tar.gz mv "$index".unsigned "$index"
chmod 644 APKINDEX.tar.gz chmod 644 "$index"
} }
# predefined splitfunc doc # predefined splitfunc doc
...@@ -969,11 +997,17 @@ apk_up2date() { ...@@ -969,11 +997,17 @@ apk_up2date() {
} }
abuildindex_up2date() { abuildindex_up2date() {
local i apk local i j apk
getpkgver || return 1 getpkgver || return 1
for i in $pkgname $subpackages; do for i in $pkgname $subpackages; do
apk="${i%:*}-$pkgver-r$pkgrel.apk" apk="${i%:*}-$pkgver-r$pkgrel.apk"
[ "$abuildrepo"/APKINDEX.tar.gz -nt "$abuildrepo"/$apk ] || return 1 for j in "$abuildrepo"/*/$apk; do
[ -r "$j" ] || continue # ignore missing files
local idx="${j%/*}"/APKINDEX.tar.gz
if ! [ "$idx" -nt "$j" ]; then
return 1
fi
done
done done
return 0 return 0
} }
......
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