index : builder | |
Archlinux32 build system | gitolite user |
summaryrefslogtreecommitdiff |
-rwxr-xr-x | bin/db-update | 70 |
diff --git a/bin/db-update b/bin/db-update index 52111e7..fa87673 100755 --- a/bin/db-update +++ b/bin/db-update @@ -30,6 +30,17 @@ usage() { >&2 echo ' Do not abort when insane.' >&2 echo ' -n|--no-action:' >&2 echo ' Only print what would be moved.' + >&2 echo ' -o|--only $identifier:' + >&2 echo ' Only try to move packages *from* the given' + >&2 echo ' stability/architecture. $identifier must match one of' + >&2 echo ' the regexes' + >&2 echo ' (testing|staging)' + >&2 echo ' !?(i486|i686|pentium4)' + >&2 echo ' !?(i486|i686|pentium4)/(testing|staging)' + >&2 echo ' where preceding exclamation mark negates the selection' + >&2 echo ' of the architecture (but not the stability!).' + >&2 echo ' Can be given multiple times to aggregate the selected' + >&2 echo ' repositories.' >&2 echo ' -p|--progressive:' >&2 echo ' Move forward any package which replaces no package whose' >&2 echo ' dependencies are all available somewhere.' @@ -40,11 +51,12 @@ usage() { } eval set -- "$( - getopt -o f:hinpw \ + getopt -o f:hino:pw \ --long force \ --long help \ --long ignore-insanity \ --long no-action \ + --long only: \ --long progressive \ --long wait \ -n "$(basename "$0")" -- "$@" || \ @@ -56,6 +68,7 @@ ignore_insanity=false no_action=false progressive=false force_pkgs='' +only='' while true do @@ -77,6 +90,15 @@ do -n|--no-action) no_action=true ;; + -o|--only) + shift + if ! printf '%s\n' "$1" \ + | grep -qx '\(testing\|staging\)\|!\?\(i486\|i686\|pentium4\)\|!\?\(i486\|i686\|pentium4\)/\(testing\|staging\)'; then + >&2 printf 'Syntax error, --only parameter "%s" does not match required regex.\n' "$1" + usage + fi + only="$1 ${only}" + ;; -p|--progressive) progressive=true ;; @@ -113,6 +135,36 @@ if [ -s "${work_dir}/build-master-sanity" ]; then fi fi +if [ -n "${only}" ]; then + only=$( + printf '%s\n' "${only}" \ + | tr ' ' '\n' + ) + only=$( + printf '%s\n' "${only}" \ + | grep '^[^!]' \ + || true + printf '%s\n' "${only}" \ + | sed "$( + for arch in i486 i686 pentium4; do + printf 's@^!%s\\(/.\\+\\)\\?$@' \ + "${arch}" + for arch2 in i486 i686 pentium4; do + if [ "${arch}" == "${arch2}" ]; then + continue + fi + printf '%s\\1\\n' \ + "${arch2}" + done \ + | sed 's/\\n$//' + printf '@\nt\n' + done + )"' + d + ' + ) +fi + if ! ${no_action}; then # Create lock. exec 9> "${package_database_lock_file}" @@ -185,6 +237,22 @@ export TMPDIR="${tmp_dir}" } | \ mysql_run_query | \ while read -r arch_id arch source_stability_id source_stability; do + + if [ -n "${only}" ]; then + does_match=false + for possible_match in ${only}; do + if [ "${arch}/${source_stability}" = "${possible_match}" ] \ + || [ "${source_stability}" = "${possible_match}" ] \ + || [ "${arch}" = "${possible_match}" ]; then + does_match=true + break + fi + done + if ! ${does_match}; then + continue + fi + fi + find "${tmp_dir}" -xdev -mindepth 1 -delete { |