diff options
Diffstat (limited to 'bin/common-functions')
-rwxr-xr-x | bin/common-functions | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/bin/common-functions b/bin/common-functions index e59cac0..bab3757 100755 --- a/bin/common-functions +++ b/bin/common-functions @@ -130,7 +130,7 @@ generate_package_metadata() { package="${package%.*}" fi - file_prefix="${work_dir}/package-infos/${package}.${git_revision}.${mod_git_revision}" + file_prefix="${work_dir}/package-infos/${package}.${git_revision}.${mod_git_revision}.${repository}" if [ -e "${file_prefix}.builds" ] && \ [ -e "${file_prefix}.depends" ] && \ @@ -207,7 +207,7 @@ delete_old_metadata() { ls "${work_dir}/package-infos" | \ sed ' s|\.[^.]\+$|| - s|\.\([^.]\+\)\.\([^.]\+\)$| \1 \2| + s|\.\([^.]\+\)\.\([^.]\+\)\.\([^.]\+\)$| \1 \2 \3| ' | \ sort -u )" @@ -219,14 +219,13 @@ delete_old_metadata() { # package-states should stay ls -1 "${work_dir}/package-states" | \ sed ' - s|\.\([^.]\+\)\.\([^.]\+\)\(\.[^.]\+\)\{2\}$| \1 \2| + s|\.\([^.]\+\)\.\([^.]\+\)\(\.[^.]\+\)\.\([^.]\+\)$| \1 \2 \3| ' | \ sort -u | \ sed 'p' # build-list items should stay - cut -d' ' -f1,2,3 "${work_dir}/build-list" | \ - sed 'p' + sed 'p' "${work_dir}/build-list" tmp_dir="$(mktemp -d)" trap 'rm -rf --one-file-system "${tmp_dir}"' EXIT @@ -250,29 +249,31 @@ delete_old_metadata() { done ) | \ sort -u | \ - join -j 1 -o 2.2,2.3,2.1 - "${tmp_dir}/current-metadata" | \ - sort -k3,3 > \ + join -j 1 -o 2.2,2.3,2.4,2.1 - "${tmp_dir}/current-metadata" | \ + sort -k4,4 > \ "${tmp_dir}/find-newest-revisions" - uniq -uf2 < \ + uniq -uf3 < \ "${tmp_dir}/find-newest-revisions" | \ - awk '{print $3 " " $1 " " $2}' | \ + awk '{print $4 " " $1 " " $2 " " $3}' | \ sed 'p' - uniq -Df2 < \ + uniq -Df3 < \ "${tmp_dir}/find-newest-revisions" | \ - uniq --group=append -f2 | \ + uniq --group=append -f3 | \ ( revs='' mod_revs='' opkg='' - while read -r rev mod_rev pkg; do + orepo='' + while read -r rev mod_rev repo pkg; do if [ -z "${rev}" ] && \ [ -z "${mod_rev}" ] && \ + [ -z "${repo}" ] && \ [ -z "${pkg}" ]; then - printf '%s %s %s\n' \ + printf '%s %s %s %s\n' \ "$( printf '%s\n' ${revs} | \ find_newest_of_git_revisions @@ -281,10 +282,12 @@ delete_old_metadata() { printf '%s\n' ${mod_revs} | \ find_newest_of_git_revisions )" \ + "${orepo}" \ "${opkg}" revs='' mod_revs='' + orepo='' opkg='' continue fi @@ -296,16 +299,17 @@ delete_old_metadata() { printf '%s\n' ${mod_revs} ${mod_rev} | \ sort -u )" + orepo="${repo}" opkg="${pkg}" done ) | \ - awk '{print $3 " " $1 " " $2}' | \ + awk '{print $4 " " $1 " " $2 " " $3}' | \ sed 'p' ) | \ sort | \ uniq -u | \ - while read -r pkg rev mod_rev; do - rm -f "${work_dir}/package-infos/${pkg}.${rev}.${mod_rev}".* + while read -r pkg rev mod_rev repo; do + rm -f "${work_dir}/package-infos/${pkg}.${rev}.${mod_rev}.${repo}."* done } |