diff --git a/autodist-repository b/autodist-repository index d79ab3d..e3c2a80 100755 --- a/autodist-repository +++ b/autodist-repository @@ -40,7 +40,7 @@ function get_packages_from_last_build() { local rep=$1 [ "$rep" ] || return [ -r $SRCPKGLIST ] || { - echo "Error: srcpkglist file missing for $origrepository repository; aborting." + echo "ERROR: srcpkglist file missing for $origrepository repository; aborting." >&2 exit 1 } tmpfile=`mktemp` @@ -120,7 +120,7 @@ function get_pkg_buildinfo() { pkg_group pkg_license pkg_size pkg_buildtime pkg_altrep pkg_repository 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; fi @@ -168,7 +168,7 @@ function import_file() { if [ "$ORIG_MODE" = "remote" ]; 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 if [ "$DEST_MODE" = "local" ]; then @@ -177,7 +177,7 @@ function import_file() { echo -n "(L) " # if file exists in a local mirror use it by preference 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 } #chown ftp$DEST_REPOSITORY:users $DEST_URL_ARCH/$f @@ -186,7 +186,7 @@ function import_file() { touch $ORIG_URL_LOCAL_ARCH } || { 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 echo -n "(R) " @@ -194,27 +194,27 @@ function import_file() { --get $ORIG_URL_ARCH/$f \ -o $DEST_URL_ARCH/$f $curl_delete_add || { echo - echo "Error: cannot get file $ORIG_URL_ARCH/$f; aborting." + echo "ERROR: cannot get file $ORIG_URL_ARCH/$f; aborting." >&2 exit 1 } fi else # 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 fi else if [ "$DEST_MODE" = "local" ]; then # local -> local 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 } #chown ftp$DEST_REPOSITORY:users $DEST_URL_ARCH/$f touch $DEST_URL_ARCH if [ "$import_mode" = "backup" ]; then 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 } touch $ORIG_URL_ARCH @@ -226,12 +226,12 @@ function import_file() { -T $ORIG_URL_ARCH/$f \ $DEST_URL_ARCH/ || { echo - echo "Error: cannot send file $ORIG_URL_ARCH/$f; aborting." + echo "ERROR: cannot send file $ORIG_URL_ARCH/$f; aborting." >&2 exit 1 } rm -f $ORIG_URL_ARCH/$f || { 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 fi @@ -250,7 +250,7 @@ function backup_local_file() { echo "backing up $m" if [ "$simulate" != "1" ]; then 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 } touch `dirname $m` @@ -273,7 +273,7 @@ function backup_package() { if [ ! "$pkg_name" ]; then get_pkg_srcinfo $rep $archive_pkg 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 @@ -284,12 +284,12 @@ function backup_package() { if [ -f $DEST_URL_LOCAL/$rep/SRPMS.base/$PKG_FILENAME ]; then backup_local_file $DEST_URL_LOCAL/$rep/SRPMS.base/$PKG_FILENAME 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 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 || { - 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 @@ -301,12 +301,12 @@ function backup_package() { if [ -f $DEST_URL_LOCAL/$rep/RPMS.$a/$PKG_FILENAME ]; then backup_local_file $DEST_URL_LOCAL/$rep/RPMS.$a/$PKG_FILENAME 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 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 || { - 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 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 } 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 } @@ -340,7 +340,7 @@ function restore_local_file() { echo "restoring $r to $restorerepository" if [ "$simulate" != "1" ]; then 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 } touch $restoredest @@ -439,14 +439,14 @@ function import_package() { done if [ "$dest_ver-$dest_rel" != "$pkg_version-$pkg_release" ]; then [ "$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 } if [ "$force" = "1" ]; then - echo "Warning: package $import_pkg for $a is missing in $origrepository but present in $destrepository." - echo "Import forced. You will need to port package to the missing arch." + 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." >&2 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 fi fi @@ -472,7 +472,7 @@ function import_package() { } || origpkgversion="none" [ $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 } @@ -495,7 +495,7 @@ function import_package() { if [ $check_existence = 1 ]; then [ "$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 @@ -539,14 +539,14 @@ function import_package() { # remove distromatic extra files associated with this package [ -e ${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 #for i in ${pkg_obsoletes}; do # PKG_FILENAME="$i-$pkg_version-$pkg_release.$namearch.rpm" # 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 # #echo rm $DEST_URL_ARCH #done @@ -554,7 +554,7 @@ function import_package() { } # ans = y 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 } @@ -569,31 +569,31 @@ function extract_diffinfo() { if [ "$pkg_name" ]; then PKG_FILENAME="${LOCAL_REPS_BASE_DIR}/$REP/SRPMS.base/$pkg_name-$pkg_version-$pkg_release.src.rpm" [ -e "$PKG_FILENAME" ] || { - echo "Error: package $PKG_FILENAME missing in $origrepository; skipping" + echo "ERROR: package $PKG_FILENAME missing in $origrepository; skipping" >&2 return 1 } local filesize=`stat -c %s $PKG_FILENAME` [ $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 } rpm -qp $PKG_FILENAME --requires > $TMP/buildrequires 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 } [ -e "$TMP_SPEC_DIR/$pkg_name.spec" ] || { SPEC_FOUND="`ls $TMP_SPEC_DIR/*.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/provides for i in ${pkg_builds[*]}; do PKG_FILENAME="${LOCAL_REPS_BASE_DIR}/$REP/RPMS.$basearch/$i-$pkg_version-$pkg_release.$pkg_arch.rpm" [ -e "$PKG_FILENAME" ] || { - echo "Error: package $PKG_FILENAME missing in $origrepository; skipping" + echo "ERROR: package $PKG_FILENAME missing in $origrepository; skipping" >&2 return 1 } rpm -qp $PKG_FILENAME --requires >> $TMP/requires @@ -601,7 +601,7 @@ function extract_diffinfo() { rpm -qlp $PKG_FILENAME >> $TMP/files done else - #echo "Warning: can't find package $PKG in $REP repository" + #echo "WARNING: can't find package $PKG in $REP repository" >&2 return 1 fi return 0 @@ -643,13 +643,13 @@ while [ "$1" ]; do ;; "search") [ "$searchstring" ] && { - echo "Error: invalid option $1; aborting." + echo "ERROR: invalid option $1; aborting." >&2 exit 1 } searchstring="$1" ;; *) usage - echo "Error: invalid option $1; aborting." + echo "ERROR: invalid option $1; aborting." >&2 exit 1 ;; esac @@ -710,8 +710,8 @@ done [ "$origrepository" ] || { usage; exit 1; } SRCPKGLIST="${LOCAL_REPS_BASE_DIR}/$origrepository/srcpkglist" -[ "$DEST_MODE" ] || { echo "Error: $destrepository is not a valid repository; aborting."; exit 1; } -[ "$ORIG_MODE" ] || { echo "Error: $origrepository 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." >&2; exit 1; } [ "$DEST_MODE" = "remote" ] && { echo "Waring: destination is a remote repository; this is an EXPERIMENTAL feature."; } [ "$command" = "query" ] && { @@ -754,7 +754,7 @@ SRCPKGLIST="${LOCAL_REPS_BASE_DIR}/$origrepository/srcpkglist" else PKG_FILENAME="$i-$pkg_version-$pkg_release.src.rpm" 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 @@ -763,7 +763,7 @@ SRCPKGLIST="${LOCAL_REPS_BASE_DIR}/$origrepository/srcpkglist" for l in ${pkg_builds[*]}; do PKG_FILENAME="$l-$pkg_version-$pkg_release.$pkg_arch.rpm" 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 fi @@ -787,7 +787,7 @@ SRCPKGLIST="${LOCAL_REPS_BASE_DIR}/$origrepository/srcpkglist" extract_diffinfo $i $origrepository $TMP_SPEC_DIR || continue [ -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 } mv $TMP_SPEC_DIR/$i.spec $TMP_SPEC_DIR/$i.spec.origrep @@ -817,7 +817,7 @@ SRCPKGLIST="${LOCAL_REPS_BASE_DIR}/$origrepository/srcpkglist" continue } [ -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/files $TMP_SPEC_DIR/files.destrep @@ -858,7 +858,7 @@ SRCPKGLIST="${LOCAL_REPS_BASE_DIR}/$origrepository/srcpkglist" for i in $packages; do extract_diffinfo $i $origrepository $TMP_SPEC_DIR [ -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 } 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 extract_diffinfo $i $origrepository $TMP_SPEC_DIR [ -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 } echo "$i: details of package in $origrepository repository" @@ -896,7 +896,7 @@ SRCPKGLIST="${LOCAL_REPS_BASE_DIR}/$origrepository/srcpkglist" [ "$command" = "distromatic" ] && { [ -r $SRCPKGLIST ] || { - echo "Error: srcpkglist file missing for $origrepository repository; aborting." + echo "ERROR: srcpkglist file missing for $origrepository repository; aborting." >&2 exit 1 } [ -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 [ "$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 } [ "$packages" ] || { usage; exit 1; } @@ -985,7 +985,7 @@ DESTREGFILE=${LOCAL_REPS_BASE_DIR}/$destrepository/operations.log.html [ "$command" = "import" -o "$command" = "release" ] && { [ "$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 echo "Importing $1: $origrepository ($ORIG_MODE) => $destrepository ($DEST_MODE)" @@ -1017,5 +1017,5 @@ DESTREGFILE=${LOCAL_REPS_BASE_DIR}/$destrepository/operations.log.html } usage -echo "Error: $command is not a valid command; aborting." +echo "ERROR: $command is not a valid command; aborting." >&2 exit 1