abuild: use amove more often

This commit is contained in:
Sertonix 2024-04-11 22:20:41 +02:00 committed by Natanael Copa
parent 98dd63bf11
commit e236b4b854
2 changed files with 20 additions and 56 deletions

View File

@ -963,11 +963,7 @@ default_lang() {
install_if="$pkgname=$pkgver-r$pkgrel lang" install_if="$pkgname=$pkgver-r$pkgrel lang"
depends="$depends_lang" depends="$depends_lang"
local dir amove ${langdir:-/usr/share/locale}
for dir in ${langdir:-/usr/share/locale}; do
mkdir -p "$subpkgdir"/${dir%/*}
mv "$pkgdir"/"$dir" "$subpkgdir"/"$dir" || return 1
done
} }
lang() { lang() {
@ -984,10 +980,7 @@ default_lang_subpkg() {
local dir local dir
for dir in ${langdir:-/usr/share/locale}; do for dir in ${langdir:-/usr/share/locale}; do
mkdir -p "$subpkgdir"/$dir amove "$dir/$lang*"
mv "$pkgdir"/$dir/$lang* \
"$subpkgdir"/$dir/ \
|| return 1
done done
} }
@ -1947,10 +1940,7 @@ default_doc() {
local i local i
for i in doc man info html sgml licenses gtk-doc ri help; do for i in doc man info html sgml licenses gtk-doc ri help; do
if [ -d "$pkgdir/usr/share/$i" ]; then amove usr/share/"$i" || :
mkdir -p "$subpkgdir/usr/share"
mv "$pkgdir/usr/share/$i" "$subpkgdir/usr/share/"
fi
done done
# compress man pages # compress man pages
@ -1987,9 +1977,6 @@ default_doc() {
done done
rm -f "$subpkgdir/usr/share/info/dir" rm -f "$subpkgdir/usr/share/info/dir"
# remove if empty, ignore error (not empty)
rmdir "$pkgdir/usr/share" "$pkgdir/usr" 2>/dev/null || :
} }
doc() { doc() {
@ -2050,18 +2037,12 @@ default_dev() {
$(find $libdirs -name '*.[cho]' \ $(find $libdirs -name '*.[cho]' \
-o -name '*.prl' 2>/dev/null); do -o -name '*.prl' 2>/dev/null); do
if [ -e "$pkgdir/$i" ] || [ -L "$pkgdir/$i" ]; then if [ -e "$pkgdir/$i" ] || [ -L "$pkgdir/$i" ]; then
d="$subpkgdir/${i%/*}" # dirname $i amove "$i"
mkdir -p "$d"
mv "$pkgdir/$i" "$d"
rmdir "$pkgdir/${i%/*}" 2>/dev/null || :
fi fi
done done
# move *.so links needed when linking the apps to -dev packages # move *.so links needed when linking the apps to -dev packages
for i in lib/*.so usr/lib/*.so; do for i in lib/*.so usr/lib/*.so; do
if [ -L "$i" ]; then [ -L "$i" ] && amove "$i"
mkdir -p "$subpkgdir"/"${i%/*}"
mv "$i" "$subpkgdir/$i" || return 1
fi
done done
return 0 return 0
} }
@ -2092,10 +2073,8 @@ default_static() {
[ -d lib/ ] && libdirs="lib/ $libdirs" [ -d lib/ ] && libdirs="lib/ $libdirs"
# move *.a static library # move *.a static library
for i in $(find $libdir -name '*.a'); do amove $(find $libdir -name '*.a')
mkdir -p "$subpkgdir"/"${i%/*}"
mv "$i" "$subpkgdir/$i" || return 1
done
return 0 return 0
} }
@ -2107,14 +2086,8 @@ static() {
default_libs() { default_libs() {
depends="$depends_libs" depends="$depends_libs"
pkgdesc="$pkgdesc (libraries)" pkgdesc="$pkgdesc (libraries)"
local dir= file=
for dir in lib usr/lib; do amove 'lib/lib*.so.[0-9]*' 'usr/lib/lib*.so.[0-9]*'
for file in "$pkgdir"/$dir/lib*.so.[0-9]*; do
[ -f "$file" ] || continue
mkdir -p "$subpkgdir"/$dir
mv "$file" "$subpkgdir"/$dir/
done
done
} }
libs() { libs() {
@ -2126,14 +2099,8 @@ default_openrc() {
depends="$depends_openrc" depends="$depends_openrc"
pkgdesc="$pkgdesc (OpenRC init scripts)" pkgdesc="$pkgdesc (OpenRC init scripts)"
install_if="openrc ${subpkgname%-openrc}=$pkgver-r$pkgrel" install_if="openrc ${subpkgname%-openrc}=$pkgver-r$pkgrel"
local dir file
for dir in conf.d init.d; do amove etc/conf.d etc/init.d || :
if [ -d "$pkgdir/etc/$dir" ]; then
mkdir -p "$subpkgdir"/etc
mv "$pkgdir/etc/$dir" "$subpkgdir"/etc/
fi
done
return 0
} }
openrc() { openrc() {
@ -2144,6 +2111,7 @@ default_devhelp() {
depends="" depends=""
pkgdesc="$pkgname - devhelp files" pkgdesc="$pkgname - devhelp files"
install_if="$pkgname=$pkgver-r$pkgrel devhelp" install_if="$pkgname=$pkgver-r$pkgrel devhelp"
amove usr/share/devhelp amove usr/share/devhelp
} }
@ -2182,15 +2150,12 @@ default_fishcomp() {
install_if="$pkgname=$pkgver-r$pkgrel fish" install_if="$pkgname=$pkgver-r$pkgrel fish"
cd "$pkgdir" || return 0 cd "$pkgdir" || return 0
amove usr/share/fish/vendor_completions.d || :
if [ -d usr/share/fish/vendor_completions.d ]; then amove usr/share/fish/completions &&
amove usr/share/fish/vendor_completions.d
fi
if [ -d usr/share/fish/completions ]; then
warning "fish completions for programs should be in /usr/share/fish/vendor_completions.d" warning "fish completions for programs should be in /usr/share/fish/vendor_completions.d"
amove usr/share/fish/completions
fi return 0
} }
fishcomp() { fishcomp() {

View File

@ -87,7 +87,7 @@ abuild_simple_pkg_without_deps_body() {
init_keys init_keys
cp -r "$testrepo"/pkg1 . cp -r "$testrepo"/pkg1 .
cd pkg1 cd pkg1
atf_check -s exit:0 \ atf_check -s exit:0 -o ignore \
-e not-match:"WARNING" \ -e not-match:"WARNING" \
-e not-match:"fatal" \ -e not-match:"fatal" \
abuild abuild
@ -503,7 +503,7 @@ abuild_large_doc_subpackage_body() {
init_keys init_keys
cp -ra "$testrepo"/large-doc-subpkg . cp -ra "$testrepo"/large-doc-subpkg .
cd large-doc-subpkg cd large-doc-subpkg
atf_check -s exit:0 \ atf_check -s exit:0 -o ignore \
-e match:"-doc subpackage is unusually large" \ -e match:"-doc subpackage is unusually large" \
abuild all abuild all
} }
@ -512,7 +512,7 @@ abuild_bigdocs_body() {
init_keys init_keys
cp -ra "$testrepo"/large-doc-subpkg . cp -ra "$testrepo"/large-doc-subpkg .
cd large-doc-subpkg cd large-doc-subpkg
options=bigdocs atf_check -s exit:0 \ options=bigdocs atf_check -s exit:0 -o ignore \
-e not-match:"-doc subpackage is unusually large" \ -e not-match:"-doc subpackage is unusually large" \
abuild all abuild all
} }
@ -739,8 +739,7 @@ abuild_amove_body() {
_usr() { _usr() {
# glob * # glob *
amove usr/share/* amove usr/share/*
amove no-glob-match/* && return 1 ! amove no-glob-match/*
return 0
} }
_space() { _space() {
# with space # with space