From b69310cdb08356f381fe70aa113d17a558156852 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Tue, 20 Jun 2017 14:47:56 +0200 Subject: bin/common-functions: repository_of_package new --- bin/common-functions | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/bin/common-functions b/bin/common-functions index 7f82042..9b69657 100755 --- a/bin/common-functions +++ b/bin/common-functions @@ -273,11 +273,10 @@ delete_old_metadata() { done } -# official_or_community $package.$repo_revision.$mod_repo_revision.$repository -# print wether the specified package is an official package (print -# nothing) or a community package (print 'community-') +# repository_of_package $package.$repo_revision.$mod_repo_revision.$repository +# print which (stable) repository a package belongs to -official_or_community() { +repository_of_package() { local package="$1" local repository="${package##*.}" package="${package%.*}" @@ -285,19 +284,30 @@ official_or_community() { package="${package%.*.*}" case "${repository}" in - 'community') - echo 'community-' - ;; 'multilib') - if ! git -C "${repo_paths__archlinux32}" archive --format=tar "${a32_rev}" -- 'extra-from-multilib' | \ + if git -C "${repo_paths__archlinux32}" archive --format=tar "${a32_rev}" -- 'extra-from-multilib' | \ tar -Ox | \ grep -qFx "${package%.*.*.*}"; then - echo 'community-' + echo 'extra' + else + echo 'community' fi ;; + *) + echo "${repository}" esac } +# official_or_community $package.$repo_revision.$mod_repo_revision.$repository +# print wether the specified package is an official package (print +# nothing) or a community package (print 'community-') + +official_or_community() { + if [ "$(repository_of_package "$1")" = 'community' ]; then + echo 'community-' + fi +} + # remove_old_package_versions $directory $package_file # removes all other versions of $package_file in $directory on the master mirror -- cgit v1.2.3-54-g00ecf