diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2009-06-04 12:22:48 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2009-06-04 12:22:48 +0000 |
commit | 896c436e140a4888c59135c7a2238e2ec4861632 (patch) | |
tree | 44906c0e92d94ecb1cc53755d7b3ca8742c4b070 /buildrepo.in | |
parent | 494960f2917123b5edf8f388462812d8e72f0dc1 (diff) | |
download | abuild-896c436e140a4888c59135c7a2238e2ec4861632.tar.gz abuild-896c436e140a4888c59135c7a2238e2ec4861632.tar.bz2 abuild-896c436e140a4888c59135c7a2238e2ec4861632.tar.xz abuild-896c436e140a4888c59135c7a2238e2ec4861632.zip |
buildrepo: check if all files exist before try copy anything
seems like copy removes destination if source does not exist so
we ended up with a buildrepo that removed all packages
Diffstat (limited to 'buildrepo.in')
-rwxr-xr-x | buildrepo.in | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/buildrepo.in b/buildrepo.in index 5b4133d..2be50e1 100755 --- a/buildrepo.in +++ b/buildrepo.in @@ -28,6 +28,14 @@ listpackages() { done } +all_exist() { + while [ $# -gt 0 ]; do + [ -e "$1" ] || return 1 + shift 1 + done + return 0 +} + build() { local repo="$1" i indexupdate needbuild @@ -47,15 +55,18 @@ build() { continue fi + indexupdate="$indexupdate $i" + # try link or copy the files if they are in the ports dir pkgs=$(abuild listpkg) - if cp -p -l $pkgs "$repodir/$repo"/ 2>/dev/null \ - || cp -p $pkgs "$repodir/$repo"/ 2>/dev/null; then + if all_exist $pkgs; then echo ">>> Copying " $pkgs + cp -p -l $pkgs "$repodir/$repo"/ 2>/dev/null \ + || cp -p $pkgs "$repodir/$repo"/ \ + || needbuild="$needbuild $i" else needbuild="$needbuild $i" fi - indexupdate="$indexupdate $i" done # build the postponed packages if any |