Failsafe tests to be sure that we are deleting an existing unpacked sources directory.

Thanks to Petr "Qaxi" Klíma for the report and patch.
This commit is contained in:
Manuel Canales Esparcia 2007-08-10 21:24:02 +00:00
parent 7c6c3556d2
commit 9695fa7cca
2 changed files with 3 additions and 1 deletions

View file

@ -155,7 +155,7 @@ cd xc&#xA;</xsl:text>
<xsl:text>
if [[ -e unpacked ]] ; then
UNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
rm -rf $UNPACKDIR
[[ -n $UNPACKDIR ]] && [[ -d $UNPACKDIR ]] && rm -rf $UNPACKDIR
fi
tar -xvf $PACKAGE > unpacked
UNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`

View file

@ -64,6 +64,7 @@ endef
define remove_existing_dirs
@PKG_PATH=`ls -t $(SRCSDIR)/$(1) | head -n1` && \
ROOT=`tar -tf $$PKG_PATH | head -n1 | sed -e 's@^./@@;s@/.*@@'` && \
test -n "$$ROOT" -a -d $(SRCSDIR)/$$ROOT && \
rm -rf $(SRCSDIR)/$$ROOT && \
rm -rf $(SRCSDIR)/$${ROOT%-*}-build
endef
@ -71,6 +72,7 @@ endef
define remove_existing_dirs2
@PKG_PATH=`ls -t $(SRC)/$(1) | head -n1` && \
ROOT=`tar -tf $$PKG_PATH | head -n1 | sed -e 's@^./@@;s@/.*@@'` && \
test -n "$$ROOT" -a -d $(SRC)/$$ROOT && \
rm -rf $(SRC)/$$ROOT && \
rm -rf $(SRC)/$${ROOT%-*}-build
endef