Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2019-02-15 21:43:38 +0100
committerErich Eckner <git@eckner.net>2019-02-15 21:43:38 +0100
commitf373ec56e8268fcdcae8508517b84a282dc61763 (patch)
tree7736a18ebde9721f7bcd8684e0be07d04effe590 /bin
parentb156f269298da49cdee9157b5c911193fa748651 (diff)
bin/create-build-support-package: some progress
Diffstat (limited to 'bin')
-rwxr-xr-xbin/create-build-support-package32
1 files changed, 27 insertions, 5 deletions
diff --git a/bin/create-build-support-package b/bin/create-build-support-package
index ad0fe30..ed09f87 100755
--- a/bin/create-build-support-package
+++ b/bin/create-build-support-package
@@ -211,16 +211,38 @@ elif [ -n "${shim_package}" ]; then
if [ ! -r "${shim_package}" ]; then
>&2 printf 'Cannot open file %s\n' \
"${shim_package}"
- usage
+ exit 1
fi
exec 8> "${package_database_lock_file}"
verbose_flock ${wait_for_lock} 8
- # TODO: find original package in database, check signature, retrieve
- # db, insert package into db, copy row in `binary_packages`, insert
- # row into `binary_packages_in_repositories`, add package to pool/,
- # send db
+ original_pkg_id=$(
+ # shellcheck disable=SC2016
+ {
+ printf 'SELECT DISTINCT `binary_packages`.`id`'
+ printf ' FROM `binary_packages`'
+ mysql_join_binary_packages_architectures
+ printf ' WHERE '
+ mysql_package_name_query \
+ | sed 's/pkgname`,"/\0-shim/'
+ printf '=from_base64("%s")' \
+ "$(
+ printf '%s' "${shim_package##*/}" \
+ | base64 -w0
+ )"
+ } | \
+ mysql_run_query
+ )
+ if [ -z "${original_pkg_id}" ]; then
+ >&2 printf 'could not find the original package to %s.\n' \
+ "${shim_package##*/}"
+ exit 1
+ fi
+
+ # TODO: check signature, retrieve db, insert package into db, copy
+ # row in `binary_packages`, insert row into
+ # `binary_packages_in_repositories`, add package to pool/, send db
else
>&2 echo 'Need either --from or --shim.'