Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/nit-picker127
1 files changed, 98 insertions, 29 deletions
diff --git a/bin/nit-picker b/bin/nit-picker
index 22ecdfd..0210356 100755
--- a/bin/nit-picker
+++ b/bin/nit-picker
@@ -271,6 +271,12 @@ while pgrep -x ii >/dev/null \
| sed 's@^@'"${parameters}"' @' \
| tr ' ' '\t' \
>> "${tmp_dir}/remove-those-dependencies"
+ cat "${tmp_dir}/db-deps" "${tmp_dir}/db-deps" "${tmp_dir}/pkg-deps" \
+ | sort \
+ | uniq -u \
+ | sed 's@^@'"${parameters}"' @' \
+ | tr ' ' '\t' \
+ >> "${tmp_dir}/add-those-dependencies"
else
build_date=$(
bsdtar -Oxf "${tmp_dir}/${parameters}" '.PKGINFO' \
@@ -439,10 +445,51 @@ while pgrep -x ii >/dev/null \
sleep 120
done
-if [ -s "${tmp_dir}/remove-those-dependencies" ]; then
+{
+ if [ -s "${tmp_dir}/remove-those-dependencies" ]; then
+ # shellcheck disable=SC2016
+ {
+ printf 'CREATE TEMPORARY TABLE `rd`('
+ 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 `rd`(`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 `rd`'
+ printf ' ON `rd`.`pf`='
+ mysql_package_name_query
+ mysql_join_binary_packages_dependencies '' 'd'
+ printf ' AND `d`.`version_relation`=`rd`.`vr`'
+ mysql_join_dependencies_install_targets 'd' 'it'
+ printf ' AND `it`.`name`=`rd`.`it`'
+ mysql_join_dependencies_versions 'd' 'v'
+ printf ' AND `v`.`epoch`=`rd`.`e`'
+ printf ' AND `v`.`version`=`rd`.`v`'
+ mysql_join_dependencies_dependency_types 'd' 'dt'
+ printf ' AND `dt`.`name`=`rd`.`dt`'
+ printf ';\n'
+ } \
+ | mysql_run_query \
+ | {
+ printf 'DELETE `dependencies`'
+ printf ' FROM `dependencies`'
+ printf ' WHERE `dependencies`.`id` IN ('
+ sed '$! s/$/,/' \
+ | tr -d '\n'
+ printf ');\n'
+ }
+ fi
# shellcheck disable=SC2016
- {
- printf 'CREATE TEMPORARY TABLE `sd`('
+ if [ -s "${tmp_dir}/add-those-dependencies" ]; then
+ rsync "${tmp_dir}/add-those-dependencies" 'buildmaster:/tmp/add-those-dependencies' >/dev/null 2>&1
+
+ printf 'CREATE TEMPORARY TABLE `ad`('
printf '`pf` VARCHAR(128),'
printf '`dt` VARCHAR(32),'
printf '`it` VARCHAR(128),'
@@ -450,32 +497,54 @@ if [ -s "${tmp_dir}/remove-those-dependencies" ]; then
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`'
+
+ printf 'LOAD DATA LOCAL INFILE "%s" INTO TABLE `ad`(`pf`,`dt`,`it`,`vr`,`e`,`v`);\n' \
+ '/tmp/add-those-dependencies'
+
+ printf 'INSERT IGNORE INTO `install_targets`('
+ printf '`name`'
+ printf ')'
+ printf ' SELECT'
+ printf ' `ad`.`it`'
+ printf ' FROM `ad`;\n'
+
+ printf 'INSERT IGNORE INTO `versions`('
+ printf '`epoch`,'
+ printf '`version`'
+ printf ')'
+ printf ' SELECT'
+ printf ' `ad`.`e`,'
+ printf '`ad`.`v`'
+ printf ' FROM `ad`;\n'
+
+ printf 'INSERT IGNORE INTO `dependencies`('
+ printf '`dependent`,'
+ printf '`depending_on`,'
+ printf '`dependency_type`,'
+ printf '`version`,'
+ printf '`version_relation`'
+ printf ')'
+ printf 'SELECT'
+ printf ' `binary_packages`.`id`,'
+ printf '`install_targets`.`id`,'
+ printf '`dependency_types`.`id`,'
+ printf '`versions`.`id`,'
+ printf '`ad`.`vr`'
+ printf ' FROM `binary_packages`'
mysql_join_binary_packages_architectures
- printf ' JOIN `sd`'
- printf ' ON `sd`.`pf`='
+ printf ' JOIN `ad`'
+ printf ' ON `ad`.`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 ' JOIN `install_targets`'
+ printf ' ON `install_targets`.`name`=`ad`.`it`'
+ printf ' JOIN `versions`'
+ printf ' ON `versions`.`epoch`=`ad`.`e`'
+ printf ' AND `versions`.`version`=`ad`.`v`'
+ printf ' JOIN `dependency_types`'
+ printf ' ON `dependency_types`.`name`=`ad`.`dt`'
printf ';\n'
- } \
- | mysql_run_query \
- | {
- printf 'DELETE `dependencies`'
- printf ' FROM `dependencies`'
- printf ' WHERE `dependencies`.`id` IN ('
- sed '$! s/$/,/' \
- | tr -d '\n'
- printf ');\n'
- } \
- | ssh buildmaster 'mysql buildmaster'
-fi
+ fi
+} \
+| ifne ssh buildmaster 'mysql buildmaster
+ rm -f "/tmp/add-those-dependencies"
+'