diff options
author | Allan McRae <allan@archlinux.org> | 2015-05-13 07:46:33 +0200 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2015-05-19 15:43:00 +0200 |
commit | 23e3c4852649a8803d049f81a6eab660f036f9cd (patch) | |
tree | 3acc4d1f2f3f3cf29c8346eeb158e81458298d61 /scripts/libmakepkg/util/pkgbuild.sh | |
parent | 15b6cecdd5353d1ce8d8a9747ea9e55477ceb3fb (diff) | |
download | pacman-23e3c4852649a8803d049f81a6eab660f036f9cd.tar.gz pacman-23e3c4852649a8803d049f81a6eab660f036f9cd.tar.xz |
libmakepkg: move more functions for extracting information from PKGBIULDs
Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'scripts/libmakepkg/util/pkgbuild.sh')
-rw-r--r-- | scripts/libmakepkg/util/pkgbuild.sh | 47 |
1 files changed, 46 insertions, 1 deletions
diff --git a/scripts/libmakepkg/util/pkgbuild.sh b/scripts/libmakepkg/util/pkgbuild.sh index 17e4cc56..2423a83d 100644 --- a/scripts/libmakepkg/util/pkgbuild.sh +++ b/scripts/libmakepkg/util/pkgbuild.sh @@ -18,7 +18,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # -[ -n "$LIBMAKEPKG_UTIL_PKGBUILD_SH" ] && return +[[ -n "$LIBMAKEPKG_UTIL_PKGBUILD_SH" ]] && return LIBMAKEPKG_UTIL_PKGBUILD_SH=1 @@ -144,3 +144,48 @@ get_pkg_arch() { fi fi } + +print_all_package_names() { + local version=$(get_full_version) + local architecture pkg opts a + for pkg in ${pkgname[@]}; do + get_pkgbuild_attribute "$pkg" 'arch' 1 architecture + get_pkgbuild_attribute "$pkg" 'options' 1 opts + for a in ${architecture[@]}; do + printf "%s-%s-%s\n" "$pkg" "$version" "$a" + if in_opt_array "debug" ${opts[@]} && in_opt_array "strip" ${opts[@]}; then + printf "%s-%s-%s-%s\n" "$pkg" "@DEBUGSUFFIX@" "$version" "$a" + fi + done + done +} + +get_all_sources() { + local aggregate l a + + if array_build l 'source'; then + aggregate+=("${l[@]}") + fi + + for a in "${arch[@]}"; do + if array_build l "source_$a"; then + aggregate+=("${l[@]}") + fi + done + + array_build "$1" "aggregate" +} + +get_all_sources_for_arch() { + local aggregate l + + if array_build l 'source'; then + aggregate+=("${l[@]}") + fi + + if array_build l "source_$CARCH"; then + aggregate+=("${l[@]}") + fi + + array_build "$1" "aggregate" +} |