$dir = "$cachedir/$repoid/";
$baseurl .= '/' unless $baseurl =~ /\/$/;
mkpath("${dir}repodata");
- #my $sem;
+ #my $sem;
#my $key = IPC::SysV::ftok($dir, '1');
#if ($sem = IPC::Semaphore->new($key, 1, S_IRUSR | S_IWUSR | IPC_CREAT | IPC_EXCL)) {
# $sem->setval(0, 1);
#$sem->op(0, -1, SEM_UNDO);
#if (!-f "${dir}repodata/repomd.xml") {
system($INC[0].'/download', "${dir}repodata", "${baseurl}repodata/repomd.xml");
- #}
- #$sem->op(0, 1, SEM_UNDO);
- #$sem->remove();
+ #}
+ #$sem->op(0, 1, SEM_UNDO);
+ #$sem->remove();
} else {
$dir = $url;
}
die("download failed\n");
}
} else {
- die("inconsistent repodata in $url\n");
+ die("inconsistent repodata in $url\n");
}
}
#$sem->op(0, 1, SEM_UNDO);
if test -e "$BUILD_ROOT/.init_b_cache/rpms/$PKG.$PSUF" -a ! -s "$BUILD_ROOT/.init_b_cache/rpms/$PKG.$PSUF" ; then
# preinstallimage package, make sure it's in the image
if ! test -e "$BUILD_ROOT"/.preinstall_image/$PKG ; then
- echo "Package $PKG is missing from the preinstall image"
+ echo "Package $PKG is missing from the preinstall image"
cleanup_and_exit 1
fi
read PKG_HDRMD5 PKGID < "$BUILD_ROOT"/.preinstall_image/$PKG
# get the hdrmd5 if we want to create a preinstall image
PKG_HDRMD5=
- if test -d "$BUILD_ROOT"/.preinstall_image -a ! -e "$BUILD_ROOT"/.preinstall_image/$PKG ; then
+ if test -d "$BUILD_ROOT"/.preinstall_image -a ! -e "$BUILD_ROOT"/.preinstall_image/$PKG ; then
PKG_HDRMD5=`perl -I$BUILD_DIR -MBuild -e 'print Build::queryhdrmd5($ARGV[0])' "$BUILD_ROOT"/.init_b_cache/rpms/$PKG.$PSUF`
- test -n "$PKG_HDRMD5" || cleanup_and_exit 1
+ test -n "$PKG_HDRMD5" || cleanup_and_exit 1
fi
- test -L "$BUILD_ROOT"/.init_b_cache/rpms/$PKG.$PSUF || continue
+ test -L "$BUILD_ROOT"/.init_b_cache/rpms/$PKG.$PSUF || continue
# check if we can keep an already installed package
- if test "$VERIFY_BUILD_SYSTEM" != true -a -f "$BUILD_ROOT"/.init_b_cache/rpms/$PKG.id -a -f "$BUILD_ROOT"/.init_b_cache/alreadyinstalled/$PKG ; then
+ if test "$VERIFY_BUILD_SYSTEM" != true -a -f "$BUILD_ROOT"/.init_b_cache/rpms/$PKG.id -a -f "$BUILD_ROOT"/.init_b_cache/alreadyinstalled/$PKG ; then
read PKGID < "$BUILD_ROOT"/.init_b_cache/rpms/$PKG.id
read OLDPKGID < "$BUILD_ROOT"/.init_b_cache/alreadyinstalled/$PKG
if test "$PKGID" = "$OLDPKGID" ; then
echo "keeping ${PKGID%% *}"
rm -f "$BUILD_ROOT"/.init_b_cache/$PKG.$PSUF
- echo "$PKGID" > "$BUILD_ROOT"/installed-pkg/$PKG
- test -n "$PKG_HDRMD5" && echo "$PKG_HDRMD5 $PKGID" > "$BUILD_ROOT"/.preinstall_image/$PKG
- continue
+ echo "$PKGID" > "$BUILD_ROOT"/installed-pkg/$PKG
+ test -n "$PKG_HDRMD5" && echo "$PKG_HDRMD5 $PKGID" > "$BUILD_ROOT"/.preinstall_image/$PKG
+ continue
fi
fi
if test "$PSUF" != "rpm" ; then
PKGID=$(perl -I$BUILD_DIR -MBuild -e Build::showquery "$BUILD_ROOT/.init_b_cache/rpms/$PKG.$PSUF" buildid)
else
- ep=$(rpm -qp --qf "%{EPOCH}" "'$BUILD_ROOT'/.init_b_cache/rpms/$PKG.$PSUF")
- if test "$ep" != "(none)"; then
+ ep=$(rpm -qp --qf "%{EPOCH}" "'$BUILD_ROOT'/.init_b_cache/rpms/$PKG.$PSUF")
+ if test "$ep" != "(none)"; then
RPMIDFMT_EP="%{NAME}-%{EPOCH}:%{VERSION}-%{RELEASE} %{BUILDTIME}-%{ARCH}\n"
- PKGID=`rpm -qp --qf "${RPMIDFMT_EP}" $RPMCHECKOPTS_HOST "'$BUILD_ROOT'/.init_b_cache/rpms/$PKG.$PSUF"`
- else
- PKGID=`rpm -qp --qf "${RPMIDFMT}" $RPMCHECKOPTS_HOST "'$BUILD_ROOT'/.init_b_cache/rpms/$PKG.$PSUF"`
+ PKGID=`rpm -qp --qf "${RPMIDFMT_EP}" $RPMCHECKOPTS_HOST "'$BUILD_ROOT'/.init_b_cache/rpms/$PKG.$PSUF"`
+ else
+ PKGID=`rpm -qp --qf "${RPMIDFMT}" $RPMCHECKOPTS_HOST "'$BUILD_ROOT'/.init_b_cache/rpms/$PKG.$PSUF"`
fi
fi
- if test -f "$BUILD_ROOT"/.init_b_cache/alreadyinstalled/$PKG ; then
+ if test -f "$BUILD_ROOT"/.init_b_cache/alreadyinstalled/$PKG ; then
read OLDPKGID < "$BUILD_ROOT"/.init_b_cache/alreadyinstalled/$PKG
if test "$PKGID" != "$OLDPKGID" ; then
echo "deleting unwanted ${OLDPKGID%% *}"
# work around for cross-build installs, we must not overwrite the running rpm
if test "$PKG" = rpm ; then
for i in "$BUILD_ROOT"/.init_b_cache/preinstalls/rpm-x86-* ; do
- test -e "$i" && ADDITIONAL_PARAMS="$ADDITIONAL_PARAMS --justdb"
+ test -e "$i" && ADDITIONAL_PARAMS="$ADDITIONAL_PARAMS --justdb"
done
fi
echo "installing ${PKGID%% *}"
if ! test "$BUILD_ROOT/.init_b_cache/rpms/$PKG.$PSUF" -ef "$BUILD_ROOT/.init_b_cache/$PKG.$PSUF" ; then
rm -f "$BUILD_ROOT"/.init_b_cache/$PKG.$PSUF
- cp "$BUILD_ROOT"/.init_b_cache/rpms/$PKG.$PSUF "$BUILD_ROOT"/.init_b_cache/$PKG.$PSUF || cleanup_and_exit 1
- fi
+ cp "$BUILD_ROOT"/.init_b_cache/rpms/$PKG.$PSUF "$BUILD_ROOT"/.init_b_cache/$PKG.$PSUF || cleanup_and_exit 1
+ fi
pkg_install
check_exit
- rm -f "$BUILD_ROOT"/.init_b_cache/$PKG.$PSUF
- echo "$PKGID" > "$BUILD_ROOT"/installed-pkg/$PKG
- test -n "$PKG_HDRMD5" && echo "$PKG_HDRMD5 $PKGID" > "$BUILD_ROOT"/.preinstall_image/$PKG
+ rm -f "$BUILD_ROOT"/.init_b_cache/$PKG.$PSUF
+ echo "$PKGID" > "$BUILD_ROOT"/installed-pkg/$PKG
+ test -n "$PKG_HDRMD5" && echo "$PKG_HDRMD5 $PKGID" > "$BUILD_ROOT"/.preinstall_image/$PKG
+
done
# do post-installation work