diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2009-03-05 08:39:25 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2009-03-05 08:39:25 +0000 |
commit | 956b40459714687f64d0433e96db7fa5c5f9aa53 (patch) | |
tree | 90b81431b944be4c1ab4860dba536b4c45c2c866 /buildrepo | |
parent | b936522cfde40b0b4825fe65fbb63ab0c73fb8e9 (diff) | |
download | abuild-956b40459714687f64d0433e96db7fa5c5f9aa53.tar.gz abuild-956b40459714687f64d0433e96db7fa5c5f9aa53.tar.bz2 abuild-956b40459714687f64d0433e96db7fa5c5f9aa53.tar.xz abuild-956b40459714687f64d0433e96db7fa5c5f9aa53.zip |
buildrepo: improve index regeneration handling
This will hopefully fix the checksum errors
Diffstat (limited to 'buildrepo')
-rwxr-xr-x | buildrepo | 59 |
1 files changed, 34 insertions, 25 deletions
@@ -28,17 +28,6 @@ listpackages() { done } -# purge obsolete packages -purge() { - [ -z "$dopurge" ] && return 0 - local tmp=$(mktemp /tmp/$program-XXXXXX) - cd "$repodir/$1" || return 1 - trap 'rm -f "$tmp"; exit 1' INT - ( listpackages "$1") >$tmp - ls *.apk 2>/dev/null | grep -v -w -f $tmp | xargs rm 2>/dev/null - return 0 -} - build() { local repo="$1" i indexupdate needbuild @@ -69,11 +58,6 @@ build() { indexupdate="$indexupdate $i" done - if [ -z "$indexupdate" ] && [ -z "$needbuild" ]; then - echo ">>> Repository $repo is up-to-date." - return 0 - fi - # build the postponed packages if any if [ -n "$needbuild" ]; then for i in $needbuild; do @@ -83,18 +67,43 @@ build() { fi # kill old packages in repo - purge "$repo" + if [ -n "$dopurge" ]; then + local tmp=$(mktemp /tmp/$program-XXXXXX) + local purgefiles + cd "$repodir/$1" || return 1 + trap 'rm -f "$tmp"; exit 1' INT + ( listpackages "$1") >$tmp + purge=$(ls *.apk 2>/dev/null | grep -v -w -f $tmp) + if [ -n "$purge" ]; then + rm -f $purge + indexupdate="$indexupdate $purge" + fi + rm -f "$tmp" + fi - # generate the repository index + # check if we have any .apk newer than our index cd "$repodir/$repo" - echo ">>> Generating Index for $repo..." - md5sum *.apk | gzip -9 > INDEX.md5.gz - if which apk >/dev/null; then - local deps - for i in $deprepo; do - deps="--repo $repodir/$i" + if [ -z "$indexupdate" ]; then + for i in *.apk; do + if [ $i -nt APK_INDEX.gz ]; then + indexupdate=1 + break; + fi done - apk $deps index *.apk | gzip -9 > APK_INDEX.gz + fi + + # generate the repository index if needed + if [ -z "$indexupdate" ]; then + echo ">>> Index for $repo is up-to-date" + else + echo ">>> Generating Index for $repo..." + if which apk >/dev/null; then + local deps + for i in $deprepo; do + deps="--repo $repodir/$i" + done + apk $deps index *.apk | gzip -9 > APK_INDEX.gz + fi fi } |