summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/create-build-support-package91
1 files changed, 88 insertions, 3 deletions
diff --git a/bin/create-build-support-package b/bin/create-build-support-package
index d1dd998..46620ec 100755
--- a/bin/create-build-support-package
+++ b/bin/create-build-support-package
@@ -251,9 +251,94 @@ elif [ -n "${shim_package}" ]; then
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
+ cp "${shim_package}" "${shim_package}.sig" "${tmp_dir}/"
+ failsafe_rsync \
+ "${master_mirror_rsync_directory}/${repo_arch}/build-support/build-support.db."* \
+ "${master_mirror_rsync_directory}/${repo_arch}/build-support/build-support.files."* \
+ "${tmp_dir}/"
+
+ repo-add \
+ "${tmp_dir}/build-support.db.tar.gz" \
+ "${tmp_dir}/${shim_package##*/}"
+
+ # shellcheck disable=SC2016
+ {
+ printf 'INSERT INTO `binary_packages`('
+ printf '`build_assignment`,'
+ printf '`epoch`,'
+ printf '`pkgver`,'
+ printf '`pkgrel`,'
+ printf '`sub_pkgrel`,'
+ printf '`architecture`,'
+ printf '`sub_pkgrel_omitted`,'
+ printf '`pkgname`,'
+ printf '`has_issues`,'
+ printf '`is_tested`,'
+ printf '`sha512sum`'
+ printf ')'
+ printf ' SELECT '
+ printf '`binary_packages`.`%s`,' \
+ 'build_assignment' \
+ 'epoch' \
+ 'pkgver' \
+ 'pkgrel' \
+ 'sub_pkgrel' \
+ 'architecture' \
+ 'sub_pkgrel_omitted'
+ printf 'CONCAT(`binary_packages`.`pkgname`,"-shim"),'
+ printf '0,0,"%s"' \
+ "$(
+ sha512sum "${tmp_dir}/${shim_package##*/}" \
+ | awk '{print $1}'
+ )"
+ printf ' FROM `binary_packages`'
+ printf ' WHERE `binary_packages`.`id`=%s' \
+ "${original_pkg_id}"
+ printf ' LIMIT 1;\n'
+ printf 'SET @`new_package_id`=LAST_INSERT_ID();\n'
+ printf 'INSERT INTO `binary_packages_in_repositories` (`package`,`repository`,`is_to_be_deleted`)'
+ printf ' SELECT @`new_package_id`,`repositories`.`id`,0'
+ printf ' FROM `repositories`'
+ mysql_join_repositories_architectures
+ printf ' WHERE `repositories`.`name`="build-support"'
+ printf ' AND `architectures`.`name`=from_base64("%s");\n' \
+ "$(
+ printf '%s' "${repo_arch}" \
+ | base64 -w0
+ )"
+ printf 'INSERT INTO `install_target_providers` (`package`,`install_target`,`version`)'
+ printf ' SELECT @`new_package_id`'
+ printf ',`install_target_providers`.`%s`' \
+ 'install_target' \
+ 'version'
+ printf ' FROM `install_target_providers`'
+ printf ' WHERE `install_target_providers`.`package`=%s;\n' \
+ "${original_pkg_id}"
+ # TODO: maybe add (some?) depends here, too?
+ } | \
+ mysql_run_query
+
+ failsafe_rsync \
+ "${tmp_dir}/${shim_package##*/}" \
+ "${tmp_dir}/${shim_package##*/}.sig" \
+ "${master_mirror_rsync_directory}/pool/"
+
+ rm \
+ "${tmp_dir}/${shim_package##*/}" \
+ "${tmp_dir}/${shim_package##*/}.sig"
+ ln -s "../../pool/${shim_package##*/}" "${tmp_dir}/${shim_package##*/}"
+ ln -s "../../pool/${shim_package##*/}.sig" "${tmp_dir}/${shim_package##*/}.sig"
+
+ failsafe_rsync \
+ "${tmp_dir}/${shim_package##*/}" \
+ "${tmp_dir}/${shim_package##*/}.sig" \
+ "${tmp_dir}/build-support.db."* \
+ "${tmp_dir}/build-support.files."* \
+ "${master_mirror_rsync_directory}/${repo_arch}/build-support/"
+
+ rm\
+ "${shim_package}" \
+ "${shim_package}.sig"
else
>&2 echo 'Need either --from or --shim.'