summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Levsen <holger@layer-acht.org>2015-01-04 12:18:31 +0100
committerHolger Levsen <holger@layer-acht.org>2015-01-04 12:18:31 +0100
commitc87d5c4c946d80a13b6400370ab338b8623835e5 (patch)
tree9310edd95b057cbeec243bcf46e642e44521ef22
parentf9648a1b738d80c6606bbb69349621f4430fb34c (diff)
downloadjenkins.debian.net-c87d5c4c946d80a13b6400370ab338b8623835e5.tar.xz
reproducible: only update meta_pkgsets if the new one aint empty
-rwxr-xr-xbin/reproducible_create_meta_pkg_sets.sh34
1 files changed, 19 insertions, 15 deletions
diff --git a/bin/reproducible_create_meta_pkg_sets.sh b/bin/reproducible_create_meta_pkg_sets.sh
index b38df355..4de36f0a 100755
--- a/bin/reproducible_create_meta_pkg_sets.sh
+++ b/bin/reproducible_create_meta_pkg_sets.sh
@@ -28,23 +28,27 @@ convert_into_source_packages_only() {
update_if_similar() {
# this is mostly done to not accidently overwrite the lists
# with garbage, eg. when external services are down
- TARGET=$TPATH/$1
- if [ -f $TARGET ] ; then
- LENGTH=$(cat $TARGET | wc -w)
- NEWLEN=$(cat $TMPFILE | wc -w)
- PERCENT=$(echo "$LENGTH*100/$NEWLEN"|bc)
- if [ $PERCENT -gt 107 ] || [ $PERCENT -lt 93 ] ; then
- mv $TMPFILE $TARGET.new
- echo
- echo diff $TARGET $TARGET.new
- diff $TARGET $TARGET.new
- echo
- echo "Too much difference, aborting. Please investigate and update manually."
- exit 1
+ if [ -s $TMPFILE ] ; then
+ TARGET=$TPATH/$1
+ if [ -f $TARGET ] ; then
+ LENGTH=$(cat $TARGET | wc -w)
+ NEWLEN=$(cat $TMPFILE | wc -w)
+ PERCENT=$(echo "$LENGTH*100/$NEWLEN"|bc)
+ if [ $PERCENT -gt 107 ] || [ $PERCENT -lt 93 ] ; then
+ mv $TMPFILE $TARGET.new
+ echo
+ echo diff $TARGET $TARGET.new
+ diff $TARGET $TARGET.new
+ echo
+ echo "Too much difference, aborting. Please investigate and update manually."
+ exit 1
+ fi
fi
+ mv $TMPFILE $TARGET
+ echo "$(date) - $TARGET updated."
+ else
+ echo "$(date) - $TARGET not updated, $TMPFILE is empty."
fi
- mv $TMPFILE $TARGET
- echo "$(date) - $TARGET updated."
}