reverse cleanup test

This commit is contained in:
artoo 2014-11-13 01:53:11 +01:00
parent e1966fe955
commit 956f3c32bc
3 changed files with 27 additions and 18 deletions

View file

@ -78,14 +78,10 @@ chroot_build(){
}
chroot_init(){
if ${clean_first}; then
if ${clean_first} || [[ ! -d "${chrootdir}" ]]; then
msg "Creating chroot for [${branch}] (${arch})..."
clean_up
chroot_clean "${chrootdir}"
chroot_create
elif [[ ! -d "${chrootdir}" ]];then
msg "Creating chroot for [${branch}] (${arch})..."
chroot_create
else
msg "Updating chroot for [${branch}] (${arch})..."
chroot_update
@ -131,14 +127,14 @@ display_settings(){
}
run(){
eval_profile
eval_profile "${profile}"
if ${pretend}; then
display_settings
exit 1
else
# if ${wipe_clean}; then
# clean_up
# fi
if ${wipe_clean}; then
clean_up
fi
display_settings
chroot_init
prepare_dir "${pkgdir}"
@ -160,7 +156,7 @@ load_config '@sysconfdir@'
pacman_conf_arch='default'
clean_first=false
# wipe_clean=false
wipe_clean=false
namcap=false
pretend=false
is_profile=false
@ -179,7 +175,7 @@ usage() {
echo " -b <branch> Set branch [default: ${branch}]"
echo " -r <dir> Chroots directory [default: ${chroots}]"
echo ' -c Clean up and recreate chroot'
# echo ' -w Wipe clean pkgbuild and pkg directory'
echo ' -w Wipe clean pkgbuild and pkg directory'
echo ' -n Run namcap check'
echo ' -s Sign packages'
echo ' -q Query settings and pretend build'
@ -191,7 +187,7 @@ usage() {
orig_argv=("$@")
opts='p:a:b:r:cnsqh'
opts='p:a:b:r:cwnsqh'
while getopts "${opts}" arg; do
case "${arg}" in
@ -200,7 +196,7 @@ while getopts "${opts}" arg; do
b) branch="$OPTARG" ;;
r) chroots="$OPTARG" ;;
c) clean_first=true ;;
# w) wipe_clean=true ;;
w) wipe_clean=true ;;
n) namcap=true; mkchrootpkg_args+=(-n) ;;
s) sign=true ;;
q) pretend=true ;;

View file

@ -52,17 +52,30 @@ clean_up(){
msg "Cleaning up ..."
if [[ -n $LOGDEST ]];then
msg2 "Cleaning logs $LOGDEST ..."
rm $LOGDEST/*.log
rm -r $LOGDEST/*.log
else
msg2 "Cleaning logs $(pwd) ..."
rm $(pwd)/*.log
rm -r $(pwd)/*.log
fi
msg2 "Cleaning ${pkgdir} ..."
rm ${pkgdir}/*.$ext
rm -r ${pkgdir}/*.pkg.tar.xz{,.sig}
if [[ -n $SRCDEST ]];then
msg2 "Cleaning src files $SRCDEST ..."
rm -r $SRCDEST/*.?z
else
msg2 "Cleaning src files $(pwd) ..."
rm -r $(pwd)/*.?z
fi
if [[ -z $BUILDDIR ]];then
msg2 "Cleaning src $(pwd) ..."
rm -r $(pwd)/src
msg2 "Cleaning pkg $(pwd) ..."
rm -r $(pwd)/pkg
fi
}
eval_profile(){
eval "case ${profile} in
eval "case $1 in
$(get_profiles)) is_profile=true ;;
*) is_profile=false ;;
esac"

View file

@ -154,7 +154,7 @@ load_vars() {
[[ -f $mpkg_conf ]] || return 1
for var in {SRC,SRCPKG,PKG,LOG}DEST MAKEFLAGS PACKAGER; do
for var in {SRC,SRCPKG,PKG,LOG}DEST MAKEFLAGS PACKAGER BUILDDIR; do
[[ -z ${!var} ]] && eval $(grep "^${var}=" "$mpkg_conf")
done