my $opt_old;
my $opt_nosrc;
my $opt_bc;
+my $cachedir = "/var/cache/build";
my $old_seen = ();
"nosrc" => \$opt_nosrc,
"dump" => \$opt_dump,
"old" => \$opt_old,
+ "cachedir=s" => \$cachedir,
) or exit(1);
$opt_bc = 1 unless ($opt_dump || $opt_old);
}
} elsif ($url =~ /^http:\/\/([^\/]*)\/?/) {
my $repoid = md5_hex($url);
- my $cachedir = ($::ENV{'CACHE_DIR'} || '/var/cache/build');
$dir = "$cachedir/$repoid/";
getmetadata($url, $dir);
$baseurl = $url;
test -z "$SRC" && SRC=`pwd`
if [ "${SRC#zypp://}" != "$SRC" ]; then
set -- $BUILD_DIR/createrepomddeps "$SRC"
- elif [ "${SRC#http://}" != "$SRC" ]; then
+ elif [ "${SRC#http://}" != "$SRC" -o "${SRC#https://}" != "$SRC" -o "${SRC#ftp://}" != "$SRC" -o "${SRC#ftps://}" != "$SRC" ]; then
mkdir -p "$(getcachedir "$SRC")"
- set -- env CACHE_DIR="$CACHE_DIR" $BUILD_DIR/createrepomddeps "$SRC"
+ set -- $BUILD_DIR/createrepomddeps --cachedir="$CACHE_DIR" "$SRC"
elif [ ! -e "$SRC" ]; then
echo "*** $SRC does not exist" >&2
cleanup_and_exit 1
cachedir="/var/cache/zypp/packages/"
SRC="$cachedir${url#zypp://}"
mkdir -p "$(dirname $SRC)"
- elif [ "${url:0:7}" == "http://" ] ; then
+ elif [ "${url:0:7}" == "http://" -o "${url:0:8}" == "https://" -o "${url:0:6}" == "ftp://" -o "${url:0:7}" == "ftps://" ] ; then
cachedir="$(getcachedir "$url")"
local name="$(basename "$url")"
SRC="$cachedir/$name"
if [ "${SRC#/}" = "$SRC" ]; then
url="$SRC"
case "$url" in
- zypp://* | http://*)
+ zypp://* | http://* | https://* | ftp://* | ftps://*)
downloadpkg "$url"
;;
*)
;;
esac
fi
- if [ "${SRC:0:7}" == "http://" ] ; then
- target_file=$(get_pkg_filename "$SRC")
- ln -s "$target_file" "$BUILD_ROOT/.init_b_cache/rpms/$PKG.${SRC##*.}"
- else
- ln -s "$SRC" "$BUILD_ROOT/.init_b_cache/rpms/$PKG.${SRC##*.}"
- fi
+ # downloadpkg modified $SRC, so it has a right name for use
+ ln -s "$SRC" "$BUILD_ROOT/.init_b_cache/rpms/$PKG.${SRC##*.}"
PACKAGES_TO_INSTALL="$PACKAGES_TO_INSTALL $PKG"
done < $RPMLIST