summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/nit-picker172
1 files changed, 117 insertions, 55 deletions
diff --git a/bin/nit-picker b/bin/nit-picker
index 48e7e38..08739e0 100755
--- a/bin/nit-picker
+++ b/bin/nit-picker
@@ -20,13 +20,21 @@
if [ $# -ge 1 ] && [ "x$1" = 'x-n' ]; then
>&2 echo 'not joining irc'
irc=false
+ remove_dependencies=false
+ shift
+elif [ $# -ge 1 ] && [ "x$1" = 'x-r' ]; then
+ >&2 echo 'trying to remove all false identities'
+ irc=false
+ remove_dependencies=true
shift
else
irc=true
+ remove_dependencies=false
# shellcheck disable=SC2016
if [ $# -ne 0 ]; then
- >&2 echo 'usage: nit-picker [-n [$single_test]]'
+ >&2 echo 'usage: nit-picker [-n|-r [$single_test]]'
>&2 echo ' -n: do not join irc'
+ >&2 echo ' -r: remove superfluid dependencies in the database'
>&2 echo ' $single_test: only execute the given test'
exit 1
fi
@@ -97,42 +105,44 @@ while pgrep -x ii >/dev/null \
if [ $# -eq 0 ]; then
# shellcheck disable=SC2016
{
- printf 'SELECT DISTINCT'
- printf ' "commit",'
- printf '`git_repositories`.`name`,'
- printf '`git_repositories`.`head`,'
- printf '`package_sources`.`git_revision`'
- printf ' FROM `package_sources`'
- mysql_join_package_sources_upstream_repositories
- mysql_join_upstream_repositories_git_repositories
- printf ';\n'
-
- printf 'SELECT DISTINCT'
- printf ' "commit",'
- printf '"archlinux32",'
- # shellcheck disable=SC2154
- printf '"%s",' \
- "${repo_heads__archlinux32}"
- printf '`package_sources`.`mod_git_revision`'
- printf ' FROM `package_sources`'
- printf ';\n'
+ if ! "${remove_dependencies}"; then
+ printf 'SELECT DISTINCT'
+ printf ' "commit",'
+ printf '`git_repositories`.`name`,'
+ printf '`git_repositories`.`head`,'
+ printf '`package_sources`.`git_revision`'
+ printf ' FROM `package_sources`'
+ mysql_join_package_sources_upstream_repositories
+ mysql_join_upstream_repositories_git_repositories
+ printf ';\n'
- printf 'SELECT DISTINCT'
- printf ' "binary-signature",'
- 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'
+ printf 'SELECT DISTINCT'
+ printf ' "commit",'
+ printf '"archlinux32",'
+ # shellcheck disable=SC2154
+ printf '"%s",' \
+ "${repo_heads__archlinux32}"
+ printf '`package_sources`.`mod_git_revision`'
+ printf ' FROM `package_sources`'
+ printf ';\n'
- if "${check_build_duration}"; then
- printf 'SELECT'
- printf ' "build-duration",'
- printf '`build_slaves`.`name`'
- printf ' FROM `build_slaves`'
+ printf 'SELECT DISTINCT'
+ printf ' "binary-signature",'
+ 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'
+
+ if "${check_build_duration}"; then
+ printf 'SELECT'
+ printf ' "build-duration",'
+ printf '`build_slaves`.`name`'
+ printf ' FROM `build_slaves`'
+ printf ';\n'
+ fi
fi
printf 'SELECT DISTINCT'
@@ -254,26 +264,35 @@ while pgrep -x ii >/dev/null \
| sort -u \
> "${tmp_dir}/db-deps"
if ! diff -q "${tmp_dir}/db-deps" "${tmp_dir}/pkg-deps"; then
- build_date=$(
- bsdtar -Oxf "${tmp_dir}/${parameters}" '.PKGINFO' \
- | sed '
- s/^builddate = //
- t
- d
- '
- )
- build_date=$(
- date -I -d@"${build_date}"
- )
- printf 'dependencies of %s (built on %s) differ between the package and our database\n' \
- "${parameters}" \
- "${build_date}" \
- | irc_say 'deep42thought'
- if ! ${irc}; then
- diff -u --color "${tmp_dir}/db-deps" "${tmp_dir}/pkg-deps" || true
- fi
- if [ $# -eq 0 ]; then
- sleep 60
+ if "${remove_dependencies}"; then
+ cat "${tmp_dir}/db-deps" "${tmp_dir}/pkg-deps" "${tmp_dir}/pkg-deps" \
+ | sort \
+ | uniq -u \
+ | sed 's@^@'"${parameters}"' @' \
+ | tr ' ' '\t' \
+ >> "${tmp_dir}/remove-those-dependencies"
+ else
+ build_date=$(
+ bsdtar -Oxf "${tmp_dir}/${parameters}" '.PKGINFO' \
+ | sed '
+ s/^builddate = //
+ t
+ d
+ '
+ )
+ build_date=$(
+ date -I -d@"${build_date}"
+ )
+ printf 'dependencies of %s (built on %s) differ between the package and our database\n' \
+ "${parameters}" \
+ "${build_date}" \
+ | irc_say 'deep42thought'
+ if ! ${irc}; then
+ diff -u --color "${tmp_dir}/db-deps" "${tmp_dir}/pkg-deps" || true
+ fi
+ if [ $# -eq 0 ]; then
+ sleep 60
+ fi
fi
fi
rm \
@@ -414,8 +433,51 @@ while pgrep -x ii >/dev/null \
;;
esac
done
- if [ $# -ge 1 ]; then
+ if [ $# -ge 1 ] || "${remove_dependencies}"; then
break
fi
sleep 120
done
+
+if [ -s "${tmp_dir}/remove-those-dependencies" ]; then
+ # shellcheck disable=SC2016
+ {
+ printf 'CREATE TEMPORARY TABLE `sd`('
+ printf '`pf` VARCHAR(128),'
+ printf '`dt` VARCHAR(32),'
+ printf '`it` VARCHAR(128),'
+ printf '`vr` VARCHAR(2),'
+ printf '`e` MEDIUMINT,'
+ printf '`v` VARCHAR(64)'
+ printf ');\n'
+ printf 'LOAD DATA LOCAL INFILE "%s" INTO TABLE `sd`(`pf`,`dt`,`it`,`vr`,`e`,`v`);\n' \
+ "${tmp_dir}/remove-those-dependencies"
+ printf 'SELECT `d`.`id` FROM `binary_packages`'
+ mysql_join_binary_packages_architectures
+ printf ' JOIN `sd`'
+ printf ' ON `sd`.`pf`='
+ mysql_package_name_query
+ mysql_join_binary_packages_dependencies '' 'd'
+ printf ' AND `d`.`version_relation`=`sd`.`vr`'
+ mysql_join_dependencies_install_targets 'd' 'it'
+ printf ' AND `it`.`name`=`sd`.`it`'
+ mysql_join_dependencies_versions 'd' 'v'
+ printf ' AND `v`.`epoch`=`sd`.`e`'
+ printf ' AND `v`.`version`=`sd`.`v`'
+ mysql_join_dependencies_dependency_types 'd' 'dt'
+ printf ' AND `dt`.`name`=`sd`.`dt`'
+ printf ';\n'
+ } \
+ | mysql_run_query \
+ | sponge "${tmp_dir}/remove-those-dependencies"
+ # shellcheck disable=SC2016
+ {
+ printf 'DELETE `dependencies`'
+ printf ' FROM `dependencies`'
+ printf ' WHERE `dependencies`.`id` IN ('
+ sed '$! s/$/,/' "${tmp_dir}/remove-those-dependencies" \
+ | tr -d '\n'
+ printf ');\n'
+ } \
+ | ssh buildmaster 'mysql buildmaster'
+fi