summaryrefslogtreecommitdiff
path: root/bin/common-functions
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2017-11-06 15:21:45 +0100
committerErich Eckner <git@eckner.net>2017-11-06 15:21:45 +0100
commit75f23a993db3427a216703659772793062496eb2 (patch)
tree3452ffcacef13e9c68e6b9192687b639592b24c6 /bin/common-functions
parent7ee072973927941969cdd5a4246c442b224d7831 (diff)
downloadbuilder-75f23a993db3427a216703659772793062496eb2.tar.xz
bin/common-functions, bin/db-update: consider dependencies in both directions
Diffstat (limited to 'bin/common-functions')
-rwxr-xr-xbin/common-functions73
1 files changed, 52 insertions, 21 deletions
diff --git a/bin/common-functions b/bin/common-functions
index c6e821e..ffc2c6f 100755
--- a/bin/common-functions
+++ b/bin/common-functions
@@ -922,15 +922,13 @@ shrink_version() {
'
}
-# TODO: also consider dependencies in the other direction (?)
-
-# find_biggest_subset_of_packages $omega $keep $all_builds [ $force ]
+# find_biggest_subset_of_packages $omega $keep $all_builds $all_depends [ $force ]
# Return (to stdout) the biggest subset A of the packages in $omega whose
# runtime dependencies in $omega \cup $keep are also in A
-# $all_builds either points to an empty file - then it will get filled
-# with cached data for subsequent calls - or to the same file of a previous
+# $all_builds and $all_depends either point to an empty file - then they will get
+# filled with cached data for subsequent calls - or to the same files of a previous
# call
# If non-empty, $force contains packages which are assumed to match the above
@@ -945,12 +943,13 @@ find_biggest_subset_of_packages() {
omega="$1"
keep="$2"
all_builds="$3"
- if [ $# -eq 3 ]; then
+ all_depends="$4"
+ if [ $# -eq 4 ]; then
force='/dev/null'
- elif [ $# -eq 4 ]; then
- force="$4"
+ elif [ $# -eq 5 ]; then
+ force="$5"
else
- >&2 printf 'find_biggest_subset_of_packages: Wrong number of arguments: %s given, 3 or 4 expected.' "$#"
+ >&2 printf 'find_biggest_subset_of_packages: Wrong number of arguments: %s given, 4 or 5 expected.' "$#"
return 2
fi
@@ -965,6 +964,18 @@ find_biggest_subset_of_packages() {
"${all_builds}"
fi
+ if [ ! -s "${all_depends}" ]; then
+ find "${work_dir}/package-infos/" -maxdepth 1 -name '*.run-depends' \
+ -exec sed '
+ s|^|{} |
+ s|^\S\+/||
+ s|\.run-depends | |
+ ' {} \; | \
+ grep -v ' base$' | \
+ sort -k2,2 > \
+ "${all_depends}"
+ fi
+
sort -u "${omega}" | \
sponge "${omega}"
@@ -985,19 +996,39 @@ find_biggest_subset_of_packages() {
sort -u | \
sponge "${temp_dir}/keep"
- sed '
- s|^|'"${work_dir}"'/package-infos/|
- s|$|.run-depends|
- ' "${temp_dir}/keep" | \
- xargs -r grep -HF '' | \
+ {
+ # we append all packages which are run-dependencies of keep-packages
+ # to the keep-list
sed '
- s|^.*/||
- s|\.run-depends:| |
- ' | \
- sort -u | \
- sort -k2,2 | \
- uniq -f1 | \
- join -1 2 -2 2 -o 2.1 - "${all_builds}" | \
+ s|^|'"${work_dir}"'/package-infos/|
+ s|$|.run-depends|
+ ' "${temp_dir}/keep" | \
+ xargs -r grep -HF '' | \
+ sed '
+ s|^.*/||
+ s|\.run-depends:| |
+ ' | \
+ sort -u | \
+ sort -k2,2 | \
+ uniq -f1 | \
+ join -1 2 -2 2 -o 2.1 - "${all_builds}"
+
+ # we append all packages with run-dependencies on the keep-list
+ # to the keep-list
+ sed '
+ s|^|'"${work_dir}"'/package-infos/|
+ s|$|.builds|
+ ' "${temp_dir}/keep" | \
+ xargs -r grep -HF '' | \
+ sed '
+ s|^.*/||
+ s|\.builds:| |
+ ' | \
+ sort -u | \
+ sort -k2,2 | \
+ uniq -f1 | \
+ join -1 2 -2 2 -o 2.1 - "${all_depends}"
+ } | \
sort -u | \
join -1 1 -2 1 -o 2.1 - "${omega}" | \
sort -u > \