diff options
author | Luke Shumaker <lukeshu@parabola.nu> | 2018-08-22 22:01:32 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@parabola.nu> | 2018-08-22 22:39:03 -0400 |
commit | 4911c0f9c2bf5037aff112d30ea8f844df7f3d36 (patch) | |
tree | 57bf72bee5ee1029d94eebbe3516259c46f9db6d | |
parent | 4c2f2c8934a876c797b348d63199b0eff6007bca (diff) |
db-import-pkg: Fully populate ${WORKDIR}/dif/
-rwxr-xr-x | db-import-pkg | 41 |
1 files changed, 32 insertions, 9 deletions
diff --git a/db-import-pkg b/db-import-pkg index 6915a4d..aaca371 100755 --- a/db-import-pkg +++ b/db-import-pkg @@ -284,16 +284,39 @@ main() { # and $WORKDIR/new/ describing the way we want them to be. We # now create $WORKDIR/dif/ describing how to get from point A # to point B. + cat "${WORKDIR}"/old/*-*.txt | sort -u > "${WORKDIR}/old/all.txt" + cat "${WORKDIR}"/new/*-*.txt | sort -u > "${WORKDIR}/new/all.txt" + # db-move <repo-from> <repo-to> <pkgname|pkgbase> ... # - # TODO: finish this section - for _tag in "${ARCHTAGS[@]}"; do - comm -23 "${WORKDIR}"/{old,new}/"${_tag}.txt" # take packages that have been "removed" - done | grep -rFx -f /dev/stdin "${WORKDIR}/new/" | # but now appear in another repo - sort -u > "${WORKDIR}/dif/moved.txt" - comm -23 \ - <(cat "${WORKDIR}"/old/* | cut -d' ' -f1 | sort -u) \ - <(cat "${WORKDIR}"/new/* | cut -d' ' -f1 | sort -u) \ - > "${WORKDIR}/dif/removed.txt" + # db-move doesn't allow us to limit the operation to a + # specific arch, but the DBSCRIPTS_CONFIG will limit what + # arches it applies to, and we currently only import 1 arch + # from each upstream. + local tag_from tag_to + for tag_from in "${ARCHTAGS[@]}"; do + for tag_to in "${ARCHTAGS[@]}"; do + [[ $tag_from != $tag_to ]] || continue + comm -12 \ + "${WORKDIR}/old/${tag_from}.txt" \ + "${WORKDIR}/new/${tag_to}.txt" \ + >> "${WORKDIR}/dif/move:${tag_from}:${tag_to}.txt" + done + done + # db-update + local tag + for tag in "${ARCHTAGS[@]}"; do + comm -13 \ + "${WORKDIR}/old/all.txt" \ + "${WORKDIR}/new/${tag}.txt" \ + > "${WORKDIR}/dif/update:${tag}.txt" + done + # db-remove <repo> <arch> <pkgname|pkgbase> ... + for tag in "${ARCHTAGS[@]}"; do + comm -23 \ + "${WORKDIR}/old/${tag}.txt" \ + "${WORKDIR}/new/all.txt" \ + > "${WORKDIR}/dif/remove:${tag}.txt" + done ############################################################## # 3. Fetch the packages we want # |