]> git.apps.os.sepia.ceph.com Git - ceph-build.git/commitdiff
check if we have valid tars for pbuilder 109/head
authorAlfredo Deza <adeza@redhat.com>
Tue, 28 Jul 2015 17:58:22 +0000 (13:58 -0400)
committerAlfredo Deza <adeza@redhat.com>
Tue, 28 Jul 2015 17:58:22 +0000 (13:58 -0400)
Signed-off-by: Alfredo Deza <adeza@redhat.com>
ceph-build/build/setup_pbuilder

index bb3bc30a854bfa3f06ee87fbd64b1f8b07c540f5..c58d8a3f665d2420bd075d1593e2ea4ea8b7836a 100755 (executable)
@@ -43,6 +43,15 @@ else
     othermirror="deb http://apt-mirror.sepia.ceph.com/archive.ubuntu.com/ubuntu $DIST main restricted universe multiverse"
 fi
 
+# ensure that the tgz is valid, otherwise remove it so that it can be recreated
+# again
+pbuild_tar="$basedir/$DIST.tgz"
+is_not_tar=`python -c "exec 'try: import tarfile;print not int(tarfile.is_tarfile(\"$pbuild_tar\"))\nexcept IOError: print 1'"`
+
+if $is_not_tar; then
+    rm -f "$pbuild_tar/$DIST.tgz"
+fi
+
 sudo pbuilder --clean
 
 if [ -e $basedir/$DIST.tgz ]; then