Commit 5d9012c0 authored by Natanael Copa's avatar Natanael Copa

abuild: add support for language packs

parent 21829533
...@@ -322,11 +322,21 @@ cleancache() { ...@@ -322,11 +322,21 @@ cleancache() {
done done
} }
listpkgnames() {
local i
for i in $pkgname $subpackages; do
echo ${i%:*}
done
for i in $linguas; do
echo $pkgname-lang-$i
done
}
cleanpkg() { cleanpkg() {
local i local i
getpkgver || return 1 getpkgver || return 1
msg "Cleaning built packages..." msg "Cleaning built packages..."
for i in $pkgname $subpackages; 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
...@@ -339,7 +349,7 @@ cleanoldpkg() { ...@@ -339,7 +349,7 @@ cleanoldpkg() {
local i j local i j
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 $pkgname $subpackages; do for i in $(listpkgnames); do
for j in "$PKGDEST"/${i%:*}-[0-9]*.apk; do for j in "$PKGDEST"/${i%:*}-[0-9]*.apk; do
[ "$j" != "$PKGDEST/${i%:*}-$pkgver-r$pkgrel.apk" ] \ [ "$j" != "$PKGDEST/${i%:*}-$pkgver-r$pkgrel.apk" ] \
&& rm -f "$j" && rm -f "$j"
...@@ -404,9 +414,6 @@ get_split_func() { ...@@ -404,9 +414,6 @@ get_split_func() {
} }
prepare_subpackages() { prepare_subpackages() {
if [ -z "$subpackages" ]; then
return 0
fi
local i local i
cd "$startdir" cd "$startdir"
for i in $subpackages; do for i in $subpackages; do
...@@ -418,6 +425,28 @@ prepare_subpackages() { ...@@ -418,6 +425,28 @@ prepare_subpackages() {
done done
} }
lang_subpkg() {
if [ -z "$lang" ]; then
error "lang is not set"
return 1
fi
arch="noarch"
install_if="$pkgname=$pkgver-r$pkgrel lang-$lang"
mkdir -p "$subpkgdir"/usr/share/locale
mv "$pkgdir"/usr/share/locale/$lang* \
"$subpkgdir"/usr/share/locale/ \
|| return 1
}
prepare_language_packs() {
for lang in $linguas; do
lang="$lang" \
subpkgname="$pkgname-lang-$lang" \
subpkgdir="$pkgbasedir"/$subpkgname \
$0 lang_subpkg prepare_package || return 1
done
}
prepare_metafiles() { prepare_metafiles() {
getpkgver || return 1 getpkgver || return 1
local name=${subpkgname:-$pkgname} local name=${subpkgname:-$pkgname}
...@@ -506,6 +535,7 @@ EOF ...@@ -506,6 +535,7 @@ EOF
prepare_tracedeps() { prepare_tracedeps() {
local dir=${subpkgdir:-$pkgdir} local dir=${subpkgdir:-$pkgdir}
[ "$arch" = "noarch" ] && return 0
options_has "!tracedeps" && return 0 options_has "!tracedeps" && return 0
# lets tell all the .so files this package provides in .provides-so # lets tell all the .so files this package provides in .provides-so
find -name '*.so' -o -name '*.so.[0-9]*' | sed 's:.*/::' \ find -name '*.so' -o -name '*.so.[0-9]*' | sed 's:.*/::' \
...@@ -600,12 +630,12 @@ trace_apk_deps() { ...@@ -600,12 +630,12 @@ trace_apk_deps() {
fi fi
# special case for libpthread: we need depend on libgcc # special case for libpthread: we need depend on libgcc
if grep -q -w '^libpthread.so.*' "$dir"/.needs-so 2>/dev/null \ if [ -f "$dir"/.needs-so ] && grep -q -w '^libpthread.so.*' "$dir"/.needs-so \
&& ! grep -q -w "^depend = libgcc" "$dir"/.PKGINFO; then && ! grep -q -w "^depend = libgcc" "$dir"/.PKGINFO; then
autodeps="$autodeps libgcc" autodeps="$autodeps libgcc"
msg " added libgcc (due to libpthread)" msg " added libgcc (due to libpthread)"
fi fi
for i in $(cat "$dir"/.needs-so 2>/dev/null); do [ -f "$dir"/.needs-so ] && for i in $(cat "$dir"/.needs-so); do
found= found=
# first check if its provide by same apkbuild # first check if its provide by same apkbuild
for j in "$dir"/../.control.*/.provides-so; do for j in "$dir"/../.control.*/.provides-so; do
...@@ -624,9 +654,11 @@ trace_apk_deps() { ...@@ -624,9 +654,11 @@ trace_apk_deps() {
done done
# find all packages that holds the so files # find all packages that holds the so files
so_files=$(find_so_files "$dir"/.rpaths $missing) || return 1 if [ -f "$dir"/.rpaths ]; then
deppkgs=$($APK info -q -W $so_files) || return 1 so_files=$(find_so_files "$dir"/.rpaths $missing) || return 1
deppkgs=$($APK info -q -W $so_files) || return 1
fi
for found in $self_provided $deppkgs; do for found in $self_provided $deppkgs; do
if grep -w "^depend = ${found}$" "$dir"/.PKGINFO >/dev/null ; then if grep -w "^depend = ${found}$" "$dir"/.PKGINFO >/dev/null ; then
warning "You can remove '$found' from depends" warning "You can remove '$found' from depends"
...@@ -822,6 +854,7 @@ rootpkg() { ...@@ -822,6 +854,7 @@ rootpkg() {
[ -n "$FAKEROOT" ] && msg "Entering fakeroot..." [ -n "$FAKEROOT" ] && msg "Entering fakeroot..."
$FAKEROOT -- "$abuild_path" $color_opt $do_build \ $FAKEROOT -- "$abuild_path" $color_opt $do_build \
prepare_subpackages \ prepare_subpackages \
prepare_language_packs \
prepare_package \ prepare_package \
create_apks create_apks
} }
...@@ -1072,10 +1105,10 @@ stripbin() { ...@@ -1072,10 +1105,10 @@ stripbin() {
# simply list target apks # simply list target apks
listpkg() { listpkg() {
local i local name
getpkgver || return 1 getpkgver || return 1
for i in $pkgname $subpackages; do for name in $(listpkgnames) ; do
echo "${i%:*}-$pkgver-r$pkgrel.apk" echo "$name-$pkgver-r$pkgrel.apk"
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