Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/nit-picker96
1 files changed, 90 insertions, 6 deletions
diff --git a/bin/nit-picker b/bin/nit-picker
index c80cc42..d88b3f2 100755
--- a/bin/nit-picker
+++ b/bin/nit-picker
@@ -28,6 +28,13 @@ if [ $# -ne 0 ]; then
exit 1
fi
+clean_up() {
+ rm -rf --one-file-system "${tmp_dir}"
+}
+
+tmp_dir=$(mktemp -d 'tmp.nit-picker.XXXXXXXXXX' --tmpdir)
+trap 'clean_up' EXIT
+
if ${irc}; then
if pgrep -x ii; then
>&2 echo 'ii is already running - this will not work'
@@ -39,7 +46,10 @@ if ${irc}; then
ii -s irc.freenode.net -n nit-picker -f nit-picker >/dev/null 2>&1 &
ii_pid=$!
- trap 'kill "${ii_pid}"' EXIT
+ clean_up() {
+ rm -rf --one-file-system "${tmp_dir}"
+ kill "${ii_pid}"
+ }
# wait for nickserv complaint
while ! grep -qF 'This nickname is registered. Please choose a different nickname' "${irc_dir}/nickserv/out"; do
@@ -62,6 +72,10 @@ if ${irc}; then
while [ ! -f "${irc_dir}/#archlinux32/out" ]; do
sleep 1
done
+else
+ irc_say() {
+ sed 's/^/irc: /'
+ }
fi
mysql_load_min_and_max_versions
@@ -85,6 +99,16 @@ while pgrep -x ii >/dev/null \
printf '`package_sources`.`mod_git_revision`'
printf ' FROM `package_sources`'
printf ';\n'
+
+ printf 'SELECT DISTINCT'
+ printf ' "binary-dependencies",'
+ mysql_package_name_query
+ printf ' FROM `binary_packages`'
+ mysql_join_binary_packages_architectures
+ mysql_join_binary_packages_binary_packages_in_repositories
+ mysql_join_binary_packages_in_repositories_repositories
+ printf ' WHERE `repositories`.`is_on_master_mirror`'
+ printf ';\n'
} | \
mysql_run_query | \
tr '\t' ' ' | \
@@ -110,13 +134,73 @@ while pgrep -x ii >/dev/null \
printf 'commit %s is missing from repository %s\n' \
"${git_rev}" \
"${git_repo}" \
- | if ${irc}; then
- irc_say
- else
- sed 's/^/irc: /'
- fi
+ | irc_say
+ fi
+ fi
+ ;;
+ 'binary-dependencies')
+ ${master_mirror_rsync_command} \
+ "${master_mirror_rsync_directory}/pool/${parameters}" \
+ "${tmp_dir}/"
+ bsdtar -Oxf "${tmp_dir}/${parameters}" '.PKGINFO' \
+ | sed -n '
+ s/^\(\(make\)\?depend\) = /\1 /
+ T
+ p
+ ' \
+ | sed '
+ s/\(=\|[<>]=\?\)\(\S\+\)$/ \1 \2/
+ t
+ s/$/ >= '"${min_version}"'/
+ ' \
+ | sed '
+ s/:\(\S\+\)$/ \1/
+ t
+ s/ \(\S\+\)$/ 0 \1/
+ ' \
+ | sort -u \
+ > "${tmp_dir}/pkg-deps"
+ {
+ printf 'SELECT'
+ printf ' IF(`dependency_types`.`name`="run","depend","makedepend"),'
+ printf '`install_targets`.`name`,'
+ printf '`dependencies`.`version_relation`,'
+ printf '`versions`.`epoch`,'
+ printf '`versions`.`version`'
+ printf ' FROM `binary_packages`'
+ mysql_join_binary_packages_dependencies
+ mysql_join_binary_packages_architectures
+ mysql_join_dependencies_dependency_types
+ mysql_join_dependencies_versions
+ mysql_join_dependencies_install_targets
+ printf ' WHERE '
+ mysql_package_name_query
+ printf '="%s"' \
+ "${parameters}"
+ printf ' AND `dependency_types`.`name` IN ("run","make")'
+ printf ';\n'
+ } \
+ | mysql_run_query \
+ | tr '\t' ' ' \
+ | sed '
+ /^depend base >= '"${min_version%:*}"' '"${min_version#*:}"'$/d
+ /^makedepend base-devel >= '"${min_version%:*}"' '"${min_version#*:}"'$/d
+ ' \
+ | sort -u \
+ > "${tmp_dir}/db-deps"
+ if ! diff -q "${tmp_dir}/db-deps" "${tmp_dir}/pkg-deps"; then
+ printf 'dependencies of %s differ between the package and our database\n' \
+ "${parameters}" \
+ | irc_say
+ if ! ${irc}; then
+ diff -u --color "${tmp_dir}/db-deps" "${tmp_dir}/pkg-deps" || true
fi
+ sleep 60
fi
+ rm \
+ "${tmp_dir}/${parameters}" \
+ "${tmp_dir}/db-deps" \
+ "${tmp_dir}/pkg-deps"
;;
*)
>&2 printf 'action "%s" is not yet implemented ...\n' "${action}"