diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2010-12-30 12:53:44 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2010-12-30 12:53:44 +0000 |
commit | 21730b7864253f4da7bc35ad544693b193ace8f3 (patch) | |
tree | da73a3c6e663e540973a1c77b7d426c514eef702 | |
parent | 650c0344fffd2136631ca614ed915901d7f4bd14 (diff) | |
download | abuild-21730b7864253f4da7bc35ad544693b193ace8f3.tar.gz abuild-21730b7864253f4da7bc35ad544693b193ace8f3.tar.bz2 abuild-21730b7864253f4da7bc35ad544693b193ace8f3.tar.xz abuild-21730b7864253f4da7bc35ad544693b193ace8f3.zip |
abuild: fix check for arch specific binaries
we now fail if noarch is set wrong
-rwxr-xr-x | abuild.in | 50 |
1 files changed, 32 insertions, 18 deletions
@@ -483,10 +483,38 @@ prepare_tracedeps() { done } +# check if dir has arch specific binaries +dir_has_arch_binaries() { + local dir="$1" + # if scanelf returns something, then we have binaries + [ -n "$(scanelf -R "$dir" | head -n 1)" ] && return 0 + + # look for static *.a + [ -n "$(find "$dir" -type f -name '*.a' | head -n 1)" ] && return 0 + + return 1 +} + +# check that noarch is set if needed +archcheck() { + options_has "!archcheck" && return 0 + if dir_has_arch_binaries "${subpkgdir:-$pkgdir}"; then + [ "$arch" != "noarch" ] && return 0 + error "Arch specific binaries found so arch must not be set to \"noarch\"" + return 1 + else + [ "$arch" = "noarch" ] && return 0 + error "No arch specific binaries found so arch should be set to \"noarch\"" + return 1 + fi + return 0 +} + prepare_package() { msg "Preparing ${subpkgname:+sub}package ${subpkgname:-$pkgname}..." stripbin - prepare_metafiles && prepare_tracedeps + prepare_metafiles && prepare_tracedeps || return 1 + archcheck } pkginfo_val() { @@ -576,21 +604,6 @@ trace_apk_deps() { done } -# check that noarch is set if needed -arch_check() { - local name=$1 - local dir="$2" - if [ -z "$(scanelf -R "$dir" | head -n 1)" ]; then - [ "$arch" = "noarch" ] && return 0 - warning "No elf files found for $name so arch should probably be set to \"noarch\"" - else - [ "$arch" != "noarch" ] && return 0 - error "Elf files found so arch must not be set to \"noarch\"" - return 1 - fi - return 0 -} - create_apks() { local file getpkgver || return 1 @@ -601,7 +614,6 @@ create_apks() { local apk=$name-$ver.apk local datadir="$pkgbasedir"/$name - arch_check "$name" "$datadir" || return 1 trace_apk_deps "$name" "$dir" || return 1 msg "Creating $apk..." ( @@ -1007,7 +1019,9 @@ checksum() { stripbin() { local bin - options_has "!strip" && return 0 + if options_has "!strip" || [ "$arch" = "noarch" ]; then + return 0 + fi cd "${subpkgdir:-$pkgdir}" || return 1 msg "Stripping binaries" scanelf --recursive --nobanner --etype "ET_DYN,ET_EXEC" . \ |