summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-03-12 13:50:24 +0100
committerErich Eckner <git@eckner.net>2018-03-12 13:50:24 +0100
commit2a4617fd25cf56e2d81d90c0c2aff81bfd9e9823 (patch)
treeddb677e09051bf93e6c99f1b77fdd068865ea0a3
parent080cfc23228f76825805643079f1a14e2d82fa2b (diff)
downloadbuilder-2a4617fd25cf56e2d81d90c0c2aff81bfd9e9823.tar.xz
bin/delete-packages: repair deletion of packages on the mirror
-rwxr-xr-xbin/delete-packages40
1 files changed, 28 insertions, 12 deletions
diff --git a/bin/delete-packages b/bin/delete-packages
index 258e441..8a4ea4a 100755
--- a/bin/delete-packages
+++ b/bin/delete-packages
@@ -129,6 +129,14 @@ trap 'rm -rf --one-file-system "${tmp_dir}"' EXIT
mysql_join_binary_packages_repositories
printf ';\n'
+ printf ' SELECT "package-file",`repositories`.`name`,'
+ mysql_package_name_query
+ printf ' FROM `to_deletes`'
+ printf ' JOIN `binary_packages` ON `to_deletes`.`id`=`binary_packages`.`id`'
+ mysql_join_binary_packages_repositories
+ mysql_join_binary_packages_architectures
+ printf ';\n'
+
printf ' SELECT "package-id",`to_deletes`.`id`'
printf ' FROM `to_deletes`'
printf ';\n'
@@ -146,6 +154,15 @@ trap 'rm -rf --one-file-system "${tmp_dir}"' EXIT
w '"${tmp_dir}"'/packages
d
}
+ /^package-file /{
+ s/^\S\+ //
+ s, ,/,
+ s/$/.pkg.tar.xz/
+ w '"${tmp_dir}"'/package-files
+ s/$/.sig/
+ w '"${tmp_dir}"'/package-files
+ d
+ }
/^package-id /{
s/^\S\+ //
w '"${tmp_dir}"'/package-ids
@@ -196,22 +213,21 @@ done < \
printf 'CREATE TEMPORARY TABLE `to_deletes` (`id` BIGINT, UNIQUE KEY (`id`));\n'
printf 'LOAD DATA LOCAL INFILE "%s" INTO TABLE `to_deletes`;\n' \
"${tmp_dir}/package-ids"
- printf 'DELETE `binary_packages` FROM `binary_packages` '
+
+ printf 'UPDATE `binary_packages` '
printf ' JOIN `to_deletes` ON `to_deletes`.`id`=`binary_packages`.`id`'
mysql_join_binary_packages_repositories
mysql_join_binary_packages_architectures
- printf ';\n'
+ printf ' SET `repository`=('
+ printf 'SELECT `repositories`.`id`'
+ printf ' FROM `repositories`'
+ printf ' WHERE `repositories`.`name`="deletion-list"'
+ printf ');\n'
} | \
mysql_run_query
-tr ' ' '/' < \
- "${tmp_dir}/packages" | \
- sed '
- p
- s/$/.sig/
- ' | \
- sed '
- s,^,rm "i686/,
- s,$,",
- ' | \
+sed '
+ s,^,rm "i686/,
+ s,$,",
+' "${tmp_dir}/package-files" | \
${master_mirror_sftp_command}