Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/common-functions73
-rwxr-xr-xbin/db-update42
2 files changed, 79 insertions, 36 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 > \
diff --git a/bin/db-update b/bin/db-update
index 7c26b9f..241acf0 100755
--- a/bin/db-update
+++ b/bin/db-update
@@ -490,27 +490,24 @@ printf '%s\n' ${packages_to_force_unstage} > \
# calculate what packages should be unstaged:
-find_biggest_subset_of_packages "${tmp_dir}/done-packages" "${tmp_dir}/build-list-packages" "${tmp_dir}/all-builds" "${tmp_dir}/force-unstage-packages" > \
+find_biggest_subset_of_packages "${tmp_dir}/done-packages" "${tmp_dir}/build-list-packages" "${tmp_dir}/all-builds" "${tmp_dir}/all-depends" "${tmp_dir}/force-unstage-packages" > \
"${tmp_dir}/unstage-packages"
-# no base / base-devel packages on the build list anymore?
+# no base packages on the build list anymore?
if [ -z "$(
join -j 1 \
"${tmp_dir}/base-packages" \
"${tmp_dir}/build-list-packages"
)" ]; then
-
- # we pretend, the group "base" does not exist, so we only fetch 'direct' dependencies on base-packages
-
- mv "${tmp_dir}/all-builds" "${tmp_dir}/really-all-builds"
- grep -v ' base$' "${tmp_dir}/really-all-builds" > \
- "${tmp_dir}/all-builds" || \
- true
-
- find_biggest_subset_of_packages "${tmp_dir}/done-packages" "${tmp_dir}/build-list-packages" "${tmp_dir}/all-builds" "${tmp_dir}/force-unstage-packages" > \
+ >&2 echo 'db-update unstage: we pretend, the group "base" does not exist, so we only fetch "direct" dependencies on base-packages'
+ for s in "${tmp_dir}/all-builds" "${tmp_dir}/all-depends"; do
+ grep -v ' base$' "${s}" > \
+ "${s}.no-base" || \
+ true
+ done
+
+ find_biggest_subset_of_packages "${tmp_dir}/done-packages" "${tmp_dir}/build-list-packages" "${tmp_dir}/all-builds.no-base" "${tmp_dir}/all-depends.no-base" "${tmp_dir}/force-unstage-packages" > \
"${tmp_dir}/unstage-packages"
-
- mv "${tmp_dir}/really-all-builds" "${tmp_dir}/all-builds"
fi
# shellcheck disable=SC2086
@@ -531,8 +528,23 @@ find "${work_dir}/package-states" -maxdepth 1 -type f -name '*.tested' -printf '
sed 's|\.tested$||' > \
"${tmp_dir}/stabilize-packages"
-find_biggest_subset_of_packages "${tmp_dir}/stabilize-packages" "${tmp_dir}/keep-packages" "${tmp_dir}/all-builds" "${tmp_dir}/force-stabilize-packages" | \
- sponge "${tmp_dir}/stabilize-packages"
+# no base packages on the build list or in staging anymore?
+if [ -z "$(
+ cat \
+ "${tmp_dir}/build-list-packages" \
+ "${tmp_dir}/done-packages" | \
+ sort -u | \
+ join -j 1 \
+ "${tmp_dir}/base-packages" \
+ -
+ )" ]; then
+ >&2 echo 'db-update stabilize: we pretend, the group "base" does not exist, so we only fetch "direct" dependencies on base-packages'
+ find_biggest_subset_of_packages "${tmp_dir}/stabilize-packages" "${tmp_dir}/keep-packages" "${tmp_dir}/all-builds.no-base" "${tmp_dir}/all-depends.no-base" "${tmp_dir}/force-stabilize-packages" | \
+ sponge "${tmp_dir}/stabilize-packages"
+else
+ find_biggest_subset_of_packages "${tmp_dir}/stabilize-packages" "${tmp_dir}/keep-packages" "${tmp_dir}/all-builds" "${tmp_dir}/all-depends" "${tmp_dir}/force-stabilize-packages" | \
+ sponge "${tmp_dir}/stabilize-packages"
+fi
# unlock build list