From f373ec56e8268fcdcae8508517b84a282dc61763 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Fri, 15 Feb 2019 21:43:38 +0100 Subject: bin/create-build-support-package: some progress --- bin/create-build-support-package | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) (limited to 'bin') 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.' -- cgit v1.2.3-70-g09d2