diff options
author | Michael Schroeder <mls@suse.de> | 2012-09-27 19:41:05 +0200 |
---|---|---|
committer | Michael Schroeder <mls@suse.de> | 2012-09-27 19:41:36 +0200 |
commit | 421ec5c4126e32fb65a5d30aaca4dc9b74ac5e07 (patch) | |
tree | 3af3e80faff187f784dbcec824593f291ce08407 | |
parent | 749c6ddd5bd33e3c9e7117f67155f866576e4ace (diff) | |
download | build-421ec5c4126e32fb65a5d30aaca4dc9b74ac5e07.tar.gz build-421ec5c4126e32fb65a5d30aaca4dc9b74ac5e07.tar.bz2 build-421ec5c4126e32fb65a5d30aaca4dc9b74ac5e07.zip |
re-enable the use of cached packages for rpms (untested)
-rwxr-xr-x | init_buildsystem | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/init_buildsystem b/init_buildsystem index 9b39588..1ac7f5e 100755 --- a/init_buildsystem +++ b/init_buildsystem @@ -507,7 +507,7 @@ fail_exit() cleanup_and_exit 1 } -# modify $SRC +# modifies $SRC downloadpkg() { local url="$1" @@ -553,8 +553,13 @@ downloadpkg() getcachedir() { - url=$1 + local url=$1 case $url in + zypp://*) + url=${url#zypp:/} + echo "/var/cache/zypp/packages/${url%/*}" + return 0; + ;; *.pkg.tar.?z) url="arch@$url" ;; esac for repo in "${repos[@]}" ; do @@ -771,8 +776,22 @@ else if [ "${SRC#/}" = "$SRC" ]; then case "$SRC" in zypp://* | http://* | https://* | ftp://* | ftps://*) - echo "$PKG $SRC" >>$BUILD_ROOT/.init_b_cache/rpmlist.download - continue + if test "${SRC%.rpm}" != "$SRC" ; then + # check if we got the correct rpm in the cache + cachepkg="${SRC##*/}" + cachedir="$(getcachedir "$SRC")" + if test -s "$cachedir/$cachepkg" -a -s $BUILD_ROOT/.init_b_cache/rpms/$PKG.id ; then + PKGID=`rpm -qp --qf "$RPMIDFMT" $RPMCHECKOPTS_HOST "$cachedir/$cachepkg"` + read cachepkgid < $BUILD_ROOT/.init_b_cache/rpms/$PKG.id + if test "$cachepkgid" = "$PKGID" ; then + SRC="$cachedir/$cachepkg" + fi + fi + fi + if "${SRC#/}" = "$SRC" ; then + echo "$PKG $SRC" >>$BUILD_ROOT/.init_b_cache/rpmlist.download + continue + fi ;; *) echo "unsupported url for '$PKG': $SRC" >&2 |