diff options
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/get-package-updates | 51 |
1 files changed, 24 insertions, 27 deletions
diff --git a/bin/get-package-updates b/bin/get-package-updates index 18fb835..09da704 100755 --- a/bin/get-package-updates +++ b/bin/get-package-updates @@ -127,13 +127,14 @@ touch "${work_dir}/build-order" while read -r package git_revision mod_git_revision repository; do - # extract infos from PKGBUILD if not existent yet - if [ ! -e "${work_dir}/package-infos/${package}.${git_revision}.${new_repo_revisions["archlinux32"]}.builds" ] || \ - [ ! -e "${work_dir}/package-infos/${package}.${git_revision}.${new_repo_revisions["archlinux32"]}.needs" ] || \ - [ ! -e "${work_dir}/package-infos/${package}.${git_revision}.${new_repo_revisions["archlinux32"]}.packages" ]; then + file_prefix="${work_dir}/package-infos/${package}.${git_revision}.${mod_git_revision}" + # extract infos from PKGBUILD if not existent yet + if [ ! -e "${file_prefix}.builds" ] || \ + [ ! -e "${file_prefix}.needs" ] || \ + [ ! -e "${file_prefix}.packages" ]; then # delete cached values of old versions of this PKGBUILD - ls -1 "${work_dir}/package-infos/${package}."* 2> /dev/null | \ + ls -1 "${file_prefix%.*.*}."* 2> /dev/null | \ sed 's|^.*/||' | \ grep "^${package//./\\.}"'\.\([0-9a-f]\{40\}\.\)\{2\}\(builds\|needs\|packages\)$' | \ while read file; do @@ -150,54 +151,50 @@ while read -r package git_revision mod_git_revision repository; do ( cd "${PKGBUILD%/*}" apply_package_customizations - mksrcinfo -o "${work_dir}/package-infos/${package}.${git_revision}.${new_repo_revisions["archlinux32"]}.SRCINFO" + mksrcinfo -o "${file_prefix}.SRCINFO" ) # extract "builds" = provides \cup pkgname - grep '^\('$'\t''provides\|pkgname\) = ' "${work_dir}/package-infos/${package}.${git_revision}.${new_repo_revisions["archlinux32"]}.SRCINFO" | \ + grep '^\('$'\t''provides\|pkgname\) = ' "${file_prefix}.SRCINFO" | \ cut -d= -f2 | \ sed 's|^\s\+||; s|[<>]$||' | \ sort -u > \ - "${work_dir}/package-infos/${package}.${git_revision}.${new_repo_revisions["archlinux32"]}.builds" + "${file_prefix}.builds" # extract "packages" = pkgname - grep '^pkgname = ' "${work_dir}/package-infos/${package}.${git_revision}.${new_repo_revisions["archlinux32"]}.SRCINFO" | \ + grep '^pkgname = ' "${file_prefix}.SRCINFO" | \ cut -d= -f2 | \ sed 's|^\s\+||; s|[<>]$||' | \ sort -u > \ - "${work_dir}/package-infos/${package}.${git_revision}.${new_repo_revisions["archlinux32"]}.packages" + "${file_prefix}.packages" # extract "needs" = ( makedepends \cup checkdepends ) \setminus "builds" ( ( # this would include runtime dependencies, too: - # sed -n '/^pkgname = /q;/^'$'\t''depends = /p' "${work_dir}/package-infos/${package}.${git_revision}.${new_repo_revisions["archlinux32"]}.SRCINFO" - grep '^'$'\t''\(makedepends\|checkdepends\) = ' "${work_dir}/package-infos/${package}.${git_revision}.${new_repo_revisions["archlinux32"]}.SRCINFO" + # sed -n '/^pkgname = /q;/^'$'\t''depends = /p' "${file_prefix}.SRCINFO" + grep '^'$'\t''\(makedepends\|checkdepends\) = ' "${file_prefix}.SRCINFO" ) | \ cut -d= -f2 | \ sed 's|^\s\+||; s|[<>]$||' | \ sort -u - sed 'p' "${work_dir}/package-infos/${package}.${git_revision}.${new_repo_revisions["archlinux32"]}.builds" + sed 'p' "${file_prefix}.builds" ) | \ sort | \ uniq -u > \ - "${work_dir}/package-infos/${package}.${git_revision}.${new_repo_revisions["archlinux32"]}.needs" + "${file_prefix}.needs" - rm "${work_dir}/package-infos/${package}.${git_revision}.${new_repo_revisions["archlinux32"]}.SRCINFO" + rm "${file_prefix}.SRCINFO" fi # add "$pkgname -> $build-target" to build-order list - while read target; do - echo "${package} ${target}" >> \ - "${work_dir}/build-order" - done < "${work_dir}/package-infos/${package}.${git_revision}.${new_repo_revisions["archlinux32"]}.builds" + sed "s|^|${package} |" "${file_prefix}.builds" >> \ + "${work_dir}/build-order" # add "$dependency -> $pkgname" to build-order list - while read dependency; do - echo "${dependency} ${package}" >> \ - "${work_dir}/build-order" - done < "${work_dir}/package-infos/${package}.${git_revision}.${new_repo_revisions["archlinux32"]}.needs" + sed "s|\$| ${package}|" "${file_prefix}.needs" >> \ + "${work_dir}/build-order" done < "${work_dir}/build-list.new" @@ -221,8 +218,8 @@ echo 'Now actually sort it.' awk '{print $5 " " $7 " " $8 " " $9}' > \ "${work_dir}/build-list.new.new" -rm --one-file-system -rf "${work_dir}/build-order.loops.new" -mkdir "${work_dir}/build-order.loops.new" +rm --one-file-system -rf "${work_dir}/build-list.loops.new" +mkdir "${work_dir}/build-list.loops.new" if [ -s "${work_dir}/tsort.error" ]; then >&2 echo 'WARNING: There is a dependency cycle!' @@ -245,9 +242,9 @@ fi # Move the .new-files to the actual files -rm -rf --one-file-system "${work_dir}/build-order.loops" +rm -rf --one-file-system "${work_dir}/build-list.loops" ( - echo "build-order.loops" "build-list.new" "build-list" "deletion-list" + echo "build-list.loops" "build-list.new" "build-list" "deletion-list" echo "${!repo_paths[@]}" | \ sed 's@\( \|$\)@.revision\1@g' ) | \ |