From c4096079f1a116b9130f1c98e331a59e73ebe110 Mon Sep 17 00:00:00 2001 From: Alfredo Deza Date: Tue, 28 Jul 2015 13:58:22 -0400 Subject: [PATCH] check if we have valid tars for pbuilder Signed-off-by: Alfredo Deza --- ceph-build/build/setup_pbuilder | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ceph-build/build/setup_pbuilder b/ceph-build/build/setup_pbuilder index bb3bc30a..c58d8a3f 100755 --- a/ceph-build/build/setup_pbuilder +++ b/ceph-build/build/setup_pbuilder @@ -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 -- 2.39.5