autodist-repository: direct error and warning message to stderr

This commit is contained in:
Silvan Calarco 2014-05-29 15:35:40 +02:00
parent 9643cf4103
commit e6ee8dbd5b

View File

@ -40,7 +40,7 @@ function get_packages_from_last_build() {
local rep=$1 local rep=$1
[ "$rep" ] || return [ "$rep" ] || return
[ -r $SRCPKGLIST ] || { [ -r $SRCPKGLIST ] || {
echo "Error: srcpkglist file missing for $origrepository repository; aborting." echo "ERROR: srcpkglist file missing for $origrepository repository; aborting." >&2
exit 1 exit 1
} }
tmpfile=`mktemp` tmpfile=`mktemp`
@ -120,7 +120,7 @@ function get_pkg_buildinfo() {
pkg_group pkg_license pkg_size pkg_buildtime pkg_altrep pkg_repository pkg_group pkg_license pkg_size pkg_buildtime pkg_altrep pkg_repository
if [ "$buildarch" = "any" ]; then if [ "$buildarch" = "any" ]; then
# echo "Error: package $pkg does not exist in $rep; aborting." # echo "ERROR: package $pkg does not exist in $rep; aborting." >&2
return; return;
fi fi
@ -168,7 +168,7 @@ function import_file() {
if [ "$ORIG_MODE" = "remote" ]; then if [ "$ORIG_MODE" = "remote" ]; then
if [ $ORIG_URL_LOCAL_ARCH -a ! -f $ORIG_URL_LOCAL_ARCH/$f ]; then if [ $ORIG_URL_LOCAL_ARCH -a ! -f $ORIG_URL_LOCAL_ARCH/$f ]; then
echo "Warning: package missing in local mirror; setting copy from remote repository." echo "WARNING: package missing in local mirror; setting copy from remote repository." >&2
fi fi
if [ "$DEST_MODE" = "local" ]; then if [ "$DEST_MODE" = "local" ]; then
@ -177,7 +177,7 @@ function import_file() {
echo -n "(L) " echo -n "(L) "
# if file exists in a local mirror use it by preference # if file exists in a local mirror use it by preference
cp $ORIG_URL_LOCAL_ARCH/$f $DEST_URL_ARCH/ || { cp $ORIG_URL_LOCAL_ARCH/$f $DEST_URL_ARCH/ || {
echo "Error: cannot move file $ORIG_URL_LOCAL_ARCH/$f to $DEST_URL_ARCH/$f; aborting." echo "ERROR: cannot move file $ORIG_URL_LOCAL_ARCH/$f to $DEST_URL_ARCH/$f; aborting." >&2
exit 1 exit 1
} }
#chown ftp$DEST_REPOSITORY:users $DEST_URL_ARCH/$f #chown ftp$DEST_REPOSITORY:users $DEST_URL_ARCH/$f
@ -186,7 +186,7 @@ function import_file() {
touch $ORIG_URL_LOCAL_ARCH touch $ORIG_URL_LOCAL_ARCH
} || { } || {
echo echo
echo "Warning: cannot delete remote file $ORIG_URL_ARCH/$f; you'll have to delete it." echo "WARNING: cannot delete remote file $ORIG_URL_ARCH/$f; you'll have to delete it." >&2
} }
else else
echo -n "(R) " echo -n "(R) "
@ -194,27 +194,27 @@ function import_file() {
--get $ORIG_URL_ARCH/$f \ --get $ORIG_URL_ARCH/$f \
-o $DEST_URL_ARCH/$f $curl_delete_add || { -o $DEST_URL_ARCH/$f $curl_delete_add || {
echo echo
echo "Error: cannot get file $ORIG_URL_ARCH/$f; aborting." echo "ERROR: cannot get file $ORIG_URL_ARCH/$f; aborting." >&2
exit 1 exit 1
} }
fi fi
else else
# remote -> remote # remote -> remote
echo "Error: remote to remote file import is not implemented yet; aborting." echo "ERROR: remote to remote file import is not implemented yet; aborting." >&2
exit 1 exit 1
fi fi
else else
if [ "$DEST_MODE" = "local" ]; then if [ "$DEST_MODE" = "local" ]; then
# local -> local # local -> local
cp $ORIG_URL_ARCH/$f $DEST_URL_ARCH/ || { cp $ORIG_URL_ARCH/$f $DEST_URL_ARCH/ || {
echo "Error: cannot copy file $ORIG_URL_ARCH/$f to $DEST_URL_ARCH/$f; aborting." echo "ERROR: cannot copy file $ORIG_URL_ARCH/$f to $DEST_URL_ARCH/$f; aborting." >&2
exit 1 exit 1
} }
#chown ftp$DEST_REPOSITORY:users $DEST_URL_ARCH/$f #chown ftp$DEST_REPOSITORY:users $DEST_URL_ARCH/$f
touch $DEST_URL_ARCH touch $DEST_URL_ARCH
if [ "$import_mode" = "backup" ]; then if [ "$import_mode" = "backup" ]; then
rm -f $ORIG_URL_ARCH/$f || { rm -f $ORIG_URL_ARCH/$f || {
echo "Error: cannot remove file $ORIG_URL_ARCH/$f; aborting." echo "ERROR: cannot remove file $ORIG_URL_ARCH/$f; aborting." >&2
exit 1 exit 1
} }
touch $ORIG_URL_ARCH touch $ORIG_URL_ARCH
@ -226,12 +226,12 @@ function import_file() {
-T $ORIG_URL_ARCH/$f \ -T $ORIG_URL_ARCH/$f \
$DEST_URL_ARCH/ || { $DEST_URL_ARCH/ || {
echo echo
echo "Error: cannot send file $ORIG_URL_ARCH/$f; aborting." echo "ERROR: cannot send file $ORIG_URL_ARCH/$f; aborting." >&2
exit 1 exit 1
} }
rm -f $ORIG_URL_ARCH/$f || { rm -f $ORIG_URL_ARCH/$f || {
echo echo
echo "Warning: cannot delete local file $ORIG_URL_ARCH/$f; you'll have to delete it." echo "WARNING: cannot delete local file $ORIG_URL_ARCH/$f; you'll have to delete it." >&2
} }
touch $ORIG_URL_ARCH touch $ORIG_URL_ARCH
fi fi
@ -250,7 +250,7 @@ function backup_local_file() {
echo "backing up $m" echo "backing up $m"
if [ "$simulate" != "1" ]; then if [ "$simulate" != "1" ]; then
mv $m $LOCAL_BACKUP/ || { mv $m $LOCAL_BACKUP/ || {
echo "Error: can't move $m to $LOCAL_BACKUP; aborting." echo "ERROR: can't move $m to $LOCAL_BACKUP; aborting." >&2
exit 1 exit 1
} }
touch `dirname $m` touch `dirname $m`
@ -273,7 +273,7 @@ function backup_package() {
if [ ! "$pkg_name" ]; then if [ ! "$pkg_name" ]; then
get_pkg_srcinfo $rep $archive_pkg get_pkg_srcinfo $rep $archive_pkg
if [ "$pkg_name" ]; then if [ "$pkg_name" ]; then
echo "Warning: only source package has been found in repository" echo "WARNING: only source package has been found in repository" >&2
fi fi
fi fi
@ -284,12 +284,12 @@ function backup_package() {
if [ -f $DEST_URL_LOCAL/$rep/SRPMS.base/$PKG_FILENAME ]; then if [ -f $DEST_URL_LOCAL/$rep/SRPMS.base/$PKG_FILENAME ]; then
backup_local_file $DEST_URL_LOCAL/$rep/SRPMS.base/$PKG_FILENAME backup_local_file $DEST_URL_LOCAL/$rep/SRPMS.base/$PKG_FILENAME
else else
echo "Warning: package $PKG_FILENAME does not exist in local repository" echo "WARNING: package $PKG_FILENAME does not exist in local repository">&2
fi fi
if [ "$simulate" != "1" -a "$DEST_MODE" = "remote" ]; then if [ "$simulate" != "1" -a "$DEST_MODE" = "remote" ]; then
curl -s -u${AUTODIST_REPOSITORIES_REMOTE_FTPUSER}:${AUTODIST_REPOSITORIES_REMOTE_FTPPASS} $DEST_URL/$rep/SRPMS.base/ -Q "-DELE $PKG_FILENAME" >/dev/null || { curl -s -u${AUTODIST_REPOSITORIES_REMOTE_FTPUSER}:${AUTODIST_REPOSITORIES_REMOTE_FTPPASS} $DEST_URL/$rep/SRPMS.base/ -Q "-DELE $PKG_FILENAME" >/dev/null || {
echo "Warning: cannot delete remote file $DEST_URL/$rep/SRPMS.base/$PKG_FILENAME; you'll have to delete it." echo "WARNING: cannot delete remote file $DEST_URL/$rep/SRPMS.base/$PKG_FILENAME; you'll have to delete it." >&2
} }
fi fi
@ -301,12 +301,12 @@ function backup_package() {
if [ -f $DEST_URL_LOCAL/$rep/RPMS.$a/$PKG_FILENAME ]; then if [ -f $DEST_URL_LOCAL/$rep/RPMS.$a/$PKG_FILENAME ]; then
backup_local_file $DEST_URL_LOCAL/$rep/RPMS.$a/$PKG_FILENAME backup_local_file $DEST_URL_LOCAL/$rep/RPMS.$a/$PKG_FILENAME
else else
echo "Warning: package $PKG_FILENAME does not exist in local repository" echo "WARNING: package $PKG_FILENAME does not exist in local repository" >&2
fi fi
if [ "$simulate" != "1" -a "$DEST_MODE" = "remote" ]; then if [ "$simulate" != "1" -a "$DEST_MODE" = "remote" ]; then
curl -s -u${AUTODIST_REPOSITORIES_REMOTE_FTPUSER}:${AUTODIST_REPOSITORIES_REMOTE_FTPPASS} $DEST_URL/$rep/RPMS.$a/ -Q "-DELE $PKG_FILENAME" >/dev/null || { curl -s -u${AUTODIST_REPOSITORIES_REMOTE_FTPUSER}:${AUTODIST_REPOSITORIES_REMOTE_FTPPASS} $DEST_URL/$rep/RPMS.$a/ -Q "-DELE $PKG_FILENAME" >/dev/null || {
echo "Warning: cannot delete remote file $DEST_URL/$rep/RPMS.$pkg_arch/$PKG_FILENAME; you'll have to delete it." echo "WARNING: cannot delete remote file $DEST_URL/$rep/RPMS.$pkg_arch/$PKG_FILENAME; you'll have to delete it." >&2
} }
fi fi
done done
@ -320,7 +320,7 @@ function backup_package() {
# echo "`date +%Y%m%d%H%M` \"\" \"package $pkg_name ($pkg_version-$pkg_release) archived from $rep\"" >> $reg # echo "`date +%Y%m%d%H%M` \"\" \"package $pkg_name ($pkg_version-$pkg_release) archived from $rep\"" >> $reg
} }
else else
echo "Warning: package $archive_pkg does not exists in $rep; skipping." echo "WARNING: package $archive_pkg does not exists in $rep; skipping." >&2
fi fi
} }
@ -340,7 +340,7 @@ function restore_local_file() {
echo "restoring $r to $restorerepository" echo "restoring $r to $restorerepository"
if [ "$simulate" != "1" ]; then if [ "$simulate" != "1" ]; then
cp ${backupprefix}/$r $restoredest || { cp ${backupprefix}/$r $restoredest || {
echo "Error: can't copy $p to $restoredest; aborting." echo "ERROR: can't copy $p to $restoredest; aborting." >&2
exit 1 exit 1
} }
touch $restoredest touch $restoredest
@ -439,14 +439,14 @@ function import_package() {
done done
if [ "$dest_ver-$dest_rel" != "$pkg_version-$pkg_release" ]; then if [ "$dest_ver-$dest_rel" != "$pkg_version-$pkg_release" ]; then
[ "$a" == "$basearch" -a "$force" != "1" ] && { [ "$a" == "$basearch" -a "$force" != "1" ] && {
echo "Error: package $import_pkg for $a does not exist in $origrepository and can't merge due to different versions; skipping." echo "ERROR: package $import_pkg for $a does not exist in $origrepository and can't merge due to different versions; skipping." >&2
return 255 return 255
} }
if [ "$force" = "1" ]; then if [ "$force" = "1" ]; then
echo "Warning: package $import_pkg for $a is missing in $origrepository but present in $destrepository." echo "WARNING: package $import_pkg for $a is missing in $origrepository but present in $destrepository." >&2
echo "Import forced. You will need to port package to the missing arch." echo "Import forced. You will need to port package to the missing arch." >&2
else else
echo "Error: package $import_pkg for $a is missing in $origrepository. This would break package in $destrepository($a) repository." echo "ERROR: package $import_pkg for $a is missing in $origrepository. This would break package in $destrepository($a) repository." >&2
return 255 return 255
fi fi
fi fi
@ -472,7 +472,7 @@ function import_package() {
} || origpkgversion="none" } || origpkgversion="none"
[ $origpkgname ] || { [ $origpkgname ] || {
echo "Error: package $import_pkg does not exist in $origrepository; aborting." echo "ERROR: package $import_pkg does not exist in $origrepository; aborting." >&2
exit 1 exit 1
} }
@ -495,7 +495,7 @@ function import_package() {
if [ $check_existence = 1 ]; then if [ $check_existence = 1 ]; then
[ "$destpkgversion" = "$origpkgversion" ] && { [ "$destpkgversion" = "$origpkgversion" ] && {
echo "Warning: same version of $origpkgname exists in destination" echo "WARNING: same version of $origpkgname exists in destination" >&2
} }
if [ "$assume_yes" != "1" ]; then if [ "$assume_yes" != "1" ]; then
@ -539,14 +539,14 @@ function import_package() {
# remove distromatic extra files associated with this package # remove distromatic extra files associated with this package
[ -e ${LOCAL_REPS_BASE_DIR}/distromatic/$rep/warnings/$import_pkg.in ] && { [ -e ${LOCAL_REPS_BASE_DIR}/distromatic/$rep/warnings/$import_pkg.in ] && {
rm -f ${LOCAL_REPS_BASE_DIR}/distromatic/$rep/warnings/$import_pkg.in || rm -f ${LOCAL_REPS_BASE_DIR}/distromatic/$rep/warnings/$import_pkg.in ||
echo "Warning: cannot remove file ${LOCAL_REPS_BASE_DIR}/distromatic/$rep/warnings/$import_pkg.in" echo "WARNING: cannot remove file ${LOCAL_REPS_BASE_DIR}/distromatic/$rep/warnings/$import_pkg.in" >&2
} }
# fi # fi
#for i in ${pkg_obsoletes}; do #for i in ${pkg_obsoletes}; do
# PKG_FILENAME="$i-$pkg_version-$pkg_release.$namearch.rpm" # PKG_FILENAME="$i-$pkg_version-$pkg_release.$namearch.rpm"
# DEST_URL_ARCH=$DEST_URL/$destrepository/RPMS.$namearch/$PKG_FILENAME # DEST_URL_ARCH=$DEST_URL/$destrepository/RPMS.$namearch/$PKG_FILENAME
# [ -e $DEST_URL_ARCH ] && echo "Warning: obsoleted package $i exists" # [ -e $DEST_URL_ARCH ] && echo "WARNING: obsoleted package $i exists" >&2
# backup_package $i $destrepository $DESTREGFILE # backup_package $i $destrepository $DESTREGFILE
# #echo rm $DEST_URL_ARCH # #echo rm $DEST_URL_ARCH
#done #done
@ -554,7 +554,7 @@ function import_package() {
} # ans = y } # ans = y
else # check_existence != 1 else # check_existence != 1
echo "Warning: $import_pkg reported by distromatic does no longer exist" echo "WARNING: $import_pkg reported by distromatic does no longer exist" >&2
fi fi
} }
@ -569,31 +569,31 @@ function extract_diffinfo() {
if [ "$pkg_name" ]; then if [ "$pkg_name" ]; then
PKG_FILENAME="${LOCAL_REPS_BASE_DIR}/$REP/SRPMS.base/$pkg_name-$pkg_version-$pkg_release.src.rpm" PKG_FILENAME="${LOCAL_REPS_BASE_DIR}/$REP/SRPMS.base/$pkg_name-$pkg_version-$pkg_release.src.rpm"
[ -e "$PKG_FILENAME" ] || { [ -e "$PKG_FILENAME" ] || {
echo "Error: package $PKG_FILENAME missing in $origrepository; skipping" echo "ERROR: package $PKG_FILENAME missing in $origrepository; skipping" >&2
return 1 return 1
} }
local filesize=`stat -c %s $PKG_FILENAME` local filesize=`stat -c %s $PKG_FILENAME`
[ $filesize -gt 1073741824 ] && { [ $filesize -gt 1073741824 ] && {
echo "Warning: $PKG_FILENAME size of $filesize is more than 1GB; skipping" echo "WARNING: $PKG_FILENAME size of $filesize is more than 1GB; skipping" >&2
return 1 return 1
} }
rpm -qp $PKG_FILENAME --requires > $TMP/buildrequires rpm -qp $PKG_FILENAME --requires > $TMP/buildrequires
autospec -q -x $PKG_FILENAME -F \*.spec --destdir $TMP >/dev/null || { autospec -q -x $PKG_FILENAME -F \*.spec --destdir $TMP >/dev/null || {
echo "Error: could not extract specfile from $PKG_FILENAME; skipping package" echo "ERROR: could not extract specfile from $PKG_FILENAME; skipping package" >&2
return 1 return 1
} }
[ -e "$TMP_SPEC_DIR/$pkg_name.spec" ] || { [ -e "$TMP_SPEC_DIR/$pkg_name.spec" ] || {
SPEC_FOUND="`ls $TMP_SPEC_DIR/*.spec`" SPEC_FOUND="`ls $TMP_SPEC_DIR/*.spec`"
mv $SPEC_FOUND $TMP_SPEC_DIR/$pkg_name.spec mv $SPEC_FOUND $TMP_SPEC_DIR/$pkg_name.spec
echo "Warning: specfile name should be $pkg_name.spec instead of ${SPEC_FOUND/*\//} in $REP repository" echo "WARNING: specfile name should be $pkg_name.spec instead of ${SPEC_FOUND/*\//} in $REP repository" >&2
} }
> $TMP/requires > $TMP/requires
> $TMP/provides > $TMP/provides
for i in ${pkg_builds[*]}; do for i in ${pkg_builds[*]}; do
PKG_FILENAME="${LOCAL_REPS_BASE_DIR}/$REP/RPMS.$basearch/$i-$pkg_version-$pkg_release.$pkg_arch.rpm" PKG_FILENAME="${LOCAL_REPS_BASE_DIR}/$REP/RPMS.$basearch/$i-$pkg_version-$pkg_release.$pkg_arch.rpm"
[ -e "$PKG_FILENAME" ] || { [ -e "$PKG_FILENAME" ] || {
echo "Error: package $PKG_FILENAME missing in $origrepository; skipping" echo "ERROR: package $PKG_FILENAME missing in $origrepository; skipping" >&2
return 1 return 1
} }
rpm -qp $PKG_FILENAME --requires >> $TMP/requires rpm -qp $PKG_FILENAME --requires >> $TMP/requires
@ -601,7 +601,7 @@ function extract_diffinfo() {
rpm -qlp $PKG_FILENAME >> $TMP/files rpm -qlp $PKG_FILENAME >> $TMP/files
done done
else else
#echo "Warning: can't find package $PKG in $REP repository" #echo "WARNING: can't find package $PKG in $REP repository" >&2
return 1 return 1
fi fi
return 0 return 0
@ -643,13 +643,13 @@ while [ "$1" ]; do
;; ;;
"search") "search")
[ "$searchstring" ] && { [ "$searchstring" ] && {
echo "Error: invalid option $1; aborting." echo "ERROR: invalid option $1; aborting." >&2
exit 1 exit 1
} }
searchstring="$1" searchstring="$1"
;; ;;
*) usage *) usage
echo "Error: invalid option $1; aborting." echo "ERROR: invalid option $1; aborting." >&2
exit 1 exit 1
;; ;;
esac esac
@ -710,8 +710,8 @@ done
[ "$origrepository" ] || { usage; exit 1; } [ "$origrepository" ] || { usage; exit 1; }
SRCPKGLIST="${LOCAL_REPS_BASE_DIR}/$origrepository/srcpkglist" SRCPKGLIST="${LOCAL_REPS_BASE_DIR}/$origrepository/srcpkglist"
[ "$DEST_MODE" ] || { echo "Error: $destrepository is not a valid repository; aborting."; exit 1; } [ "$DEST_MODE" ] || { echo "ERROR: $destrepository is not a valid repository; aborting." >&2; exit 1; }
[ "$ORIG_MODE" ] || { echo "Error: $origrepository is not a valid repository; aborting."; exit 1; } [ "$ORIG_MODE" ] || { echo "ERROR: $origrepository is not a valid repository; aborting." >&2; exit 1; }
[ "$DEST_MODE" = "remote" ] && { echo "Waring: destination is a remote repository; this is an EXPERIMENTAL feature."; } [ "$DEST_MODE" = "remote" ] && { echo "Waring: destination is a remote repository; this is an EXPERIMENTAL feature."; }
[ "$command" = "query" ] && { [ "$command" = "query" ] && {
@ -754,7 +754,7 @@ SRCPKGLIST="${LOCAL_REPS_BASE_DIR}/$origrepository/srcpkglist"
else else
PKG_FILENAME="$i-$pkg_version-$pkg_release.src.rpm" PKG_FILENAME="$i-$pkg_version-$pkg_release.src.rpm"
rpm2cpio ${LOCAL_REPS_BASE_DIR}/${origrepository}/SRPMS.base/$PKG_FILENAME &>/dev/null || { rpm2cpio ${LOCAL_REPS_BASE_DIR}/${origrepository}/SRPMS.base/$PKG_FILENAME &>/dev/null || {
echo "Warning: source package $PKG_FILENAME is empty or corrupted." echo "WARNING: source package $PKG_FILENAME is empty or corrupted." >&2
} }
for a in ${AUTODIST_ARCHS[*]}; do for a in ${AUTODIST_ARCHS[*]}; do
@ -763,7 +763,7 @@ SRCPKGLIST="${LOCAL_REPS_BASE_DIR}/$origrepository/srcpkglist"
for l in ${pkg_builds[*]}; do for l in ${pkg_builds[*]}; do
PKG_FILENAME="$l-$pkg_version-$pkg_release.$pkg_arch.rpm" PKG_FILENAME="$l-$pkg_version-$pkg_release.$pkg_arch.rpm"
rpm2cpio ${LOCAL_REPS_BASE_DIR}/${origrepository}/RPMS.$a/$PKG_FILENAME &>/dev/null || { rpm2cpio ${LOCAL_REPS_BASE_DIR}/${origrepository}/RPMS.$a/$PKG_FILENAME &>/dev/null || {
echo "Warning: package $PKG_FILENAME($a) is empty or corrupted." echo "WARNING: package $PKG_FILENAME($a) is empty or corrupted." >&2
} }
done done
fi fi
@ -787,7 +787,7 @@ SRCPKGLIST="${LOCAL_REPS_BASE_DIR}/$origrepository/srcpkglist"
extract_diffinfo $i $origrepository $TMP_SPEC_DIR || continue extract_diffinfo $i $origrepository $TMP_SPEC_DIR || continue
[ -e $TMP_SPEC_DIR/$i.spec ] || { [ -e $TMP_SPEC_DIR/$i.spec ] || {
echo "Error: could not extract specfile for $i in $origrepository repository; skipping" echo "ERROR: could not extract specfile for $i in $origrepository repository; skipping" >&2
continue continue
} }
mv $TMP_SPEC_DIR/$i.spec $TMP_SPEC_DIR/$i.spec.origrep mv $TMP_SPEC_DIR/$i.spec $TMP_SPEC_DIR/$i.spec.origrep
@ -817,7 +817,7 @@ SRCPKGLIST="${LOCAL_REPS_BASE_DIR}/$origrepository/srcpkglist"
continue continue
} }
[ -e $TMP_SPEC_DIR/$i.spec ] || { [ -e $TMP_SPEC_DIR/$i.spec ] || {
echo "Error: could not extract specfile for $i in $destrepository repository; skipping" echo "ERROR: could not extract specfile for $i in $destrepository repository; skipping" >&2
} }
mv $TMP_SPEC_DIR/$i.spec $TMP_SPEC_DIR/$i.spec.destrep mv $TMP_SPEC_DIR/$i.spec $TMP_SPEC_DIR/$i.spec.destrep
mv $TMP_SPEC_DIR/files $TMP_SPEC_DIR/files.destrep mv $TMP_SPEC_DIR/files $TMP_SPEC_DIR/files.destrep
@ -858,7 +858,7 @@ SRCPKGLIST="${LOCAL_REPS_BASE_DIR}/$origrepository/srcpkglist"
for i in $packages; do for i in $packages; do
extract_diffinfo $i $origrepository $TMP_SPEC_DIR extract_diffinfo $i $origrepository $TMP_SPEC_DIR
[ -e $TMP_SPEC_DIR/$i.spec ] || { [ -e $TMP_SPEC_DIR/$i.spec ] || {
echo "Error: could not extract specfile for $i in $origrepository repository; aborting." echo "ERROR: could not extract specfile for $i in $origrepository repository; aborting." >&2
exit 1 exit 1
} }
echo "$warningtext" > ${LOCAL_REPS_BASE_DIR}/distromatic/$origrepository/warnings/$i.in echo "$warningtext" > ${LOCAL_REPS_BASE_DIR}/distromatic/$origrepository/warnings/$i.in
@ -873,7 +873,7 @@ SRCPKGLIST="${LOCAL_REPS_BASE_DIR}/$origrepository/srcpkglist"
for i in $packages; do for i in $packages; do
extract_diffinfo $i $origrepository $TMP_SPEC_DIR extract_diffinfo $i $origrepository $TMP_SPEC_DIR
[ -e $TMP_SPEC_DIR/$i.spec ] || { [ -e $TMP_SPEC_DIR/$i.spec ] || {
echo "Error: could not extract specfile for $i in $origrepository repository; aborting." echo "ERROR: could not extract specfile for $i in $origrepository repository; aborting." >&2
exit 1 exit 1
} }
echo "$i: details of package in $origrepository repository" echo "$i: details of package in $origrepository repository"
@ -896,7 +896,7 @@ SRCPKGLIST="${LOCAL_REPS_BASE_DIR}/$origrepository/srcpkglist"
[ "$command" = "distromatic" ] && { [ "$command" = "distromatic" ] && {
[ -r $SRCPKGLIST ] || { [ -r $SRCPKGLIST ] || {
echo "Error: srcpkglist file missing for $origrepository repository; aborting." echo "ERROR: srcpkglist file missing for $origrepository repository; aborting." >&2
exit 1 exit 1
} }
[ -d ${LOCAL_REPS_BASE_DIR}/$origrepository/specs ] || mkdir ${LOCAL_REPS_BASE_DIR}/$origrepository/specs [ -d ${LOCAL_REPS_BASE_DIR}/$origrepository/specs ] || mkdir ${LOCAL_REPS_BASE_DIR}/$origrepository/specs
@ -969,7 +969,7 @@ DESTREGFILE=${LOCAL_REPS_BASE_DIR}/$destrepository/operations.log.html
DEST_MODE=$ORIG_MODE DEST_MODE=$ORIG_MODE
[ "$ORIG_MODE" = "remote" ] && { [ "$ORIG_MODE" = "remote" ] && {
echo "Error: restore is only implemented in local repository; exiting." echo "ERROR: restore is only implemented in local repository; exiting." >&2
exit 1 exit 1
} }
[ "$packages" ] || { usage; exit 1; } [ "$packages" ] || { usage; exit 1; }
@ -985,7 +985,7 @@ DESTREGFILE=${LOCAL_REPS_BASE_DIR}/$destrepository/operations.log.html
[ "$command" = "import" -o "$command" = "release" ] && { [ "$command" = "import" -o "$command" = "release" ] && {
[ "$origrepository" = "$destrepository" ] && { [ "$origrepository" = "$destrepository" ] && {
echo "Error: source and destination repository cannot be the same; aborting."; exit 1; } echo "ERROR: source and destination repository cannot be the same; aborting." >&2; exit 1; }
if [ "$command" = "import" ]; then if [ "$command" = "import" ]; then
echo "Importing $1: $origrepository ($ORIG_MODE) => $destrepository ($DEST_MODE)" echo "Importing $1: $origrepository ($ORIG_MODE) => $destrepository ($DEST_MODE)"
@ -1017,5 +1017,5 @@ DESTREGFILE=${LOCAL_REPS_BASE_DIR}/$destrepository/operations.log.html
} }
usage usage
echo "Error: $command is not a valid command; aborting." echo "ERROR: $command is not a valid command; aborting." >&2
exit 1 exit 1