From 661020218e7aea7b28da4185f869aa478e2f19dc Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Mon, 15 Jul 2019 14:57:58 +0200 Subject: bin/return-assignment: update _all_ dependencies when package gets inserted into our repositories --- bin/return-assignment | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/bin/return-assignment b/bin/return-assignment index 1711e59..68bb52f 100755 --- a/bin/return-assignment +++ b/bin/return-assignment @@ -22,10 +22,6 @@ # TODO: it would be nice to check for broken packages (and old broken # packages?) if they are flagged out-of-date upstream -# TODO: we should update make- and run-dependencies according to the -# information in the .PKGINFO (which may differ from what -# `makepkg --printsrcinfo` gave us - # shellcheck disable=SC2119,SC2120 # shellcheck source=../lib/load-configuration @@ -844,9 +840,16 @@ while read -r package_id package_name; do t coda s/\s\S\+$/\t0\0/ :coda - s/^/'"${package_id}"'\t/ + s/^/'"${package_id}"'\tlink\t/ ' >> "${tmp_dir}/so.${lib}" done + # generate list of make-,check-,rundepends according to .PKGINFO + extract_dependencies_from_package \ + "${tmp_dir}/${package_name}" \ + | sed 's/^/'"${package_id}"' /' \ + | tr ' ' '\t' \ + >> "${tmp_dir}/so.needs" +# TODO: this makes sense for provide= entries in .PKGINFO, too done < \ "${tmp_dir}/package-ids" @@ -924,6 +927,9 @@ cut -d' ' -f4,5 "${tmp_dir}/repository-ids" | \ printf 'CREATE TEMPORARY TABLE `%s` (' \ "${lib_link%:*}" printf '`pkgid` BIGINT,' + if [ "${lib_link}" = 'nl:needs' ]; then + printf '`dep_type` VARCHAR(32),' + fi printf '`lib` VARCHAR(128),' printf '`relation` VARCHAR(2),' printf '`epoch` MEDIUMINT,' @@ -951,6 +957,12 @@ cut -d' ' -f4,5 "${tmp_dir}/repository-ids" | \ if [ "${lib_link%:*}" = 'pl' ]; then printf 'INSERT IGNORE INTO `install_target_providers` (`package`,`install_target`,`install_target_is_group`,`version`)' else + # clear out the old dependencies - we will add the ones from the built package + printf 'DELETE `dependencies`' + printf ' FROM `nl`' + printf ' JOIN `dependencies`' + printf ' ON `dependencies`.`depending_on`=`nl`.`pkgid`;\n' + printf 'INSERT IGNORE INTO `dependencies` (`dependent`,`depending_on`,`dependency_type`,`version_relation`,`version`)' fi printf ' SELECT `%s`.`pkgid`,`install_targets`.`id`,' \ @@ -966,7 +978,7 @@ cut -d' ' -f4,5 "${tmp_dir}/repository-ids" | \ printf ' FROM `install_targets`' if [ "${lib_link%:*}" = 'nl' ]; then printf ' JOIN `dependency_types`' - printf ' ON `dependency_types`.`name`="link"' + printf ' ON `dependency_types`.`name`=`nl`.`dep_type`' fi printf ' JOIN `%s`' \ "${lib_link%:*}" -- cgit v1.2.3-54-g00ecf