improve stagefiles encapsulation
- added and used Stagefiles_dir() - added and used Stagefile_exists() pretty self explanatory. Gbp-Dch: Short
This commit is contained in:
parent
b20979334c
commit
2d7ff4934d
|
@ -21,7 +21,7 @@ Exit ()
|
|||
|
||||
# Skip if we have not yet completed the initial bootstrapping (bootstrap_debootstrap)
|
||||
# (nothing to be done; avoids unhelpful messages)
|
||||
if [ ! -e .build/bootstrap ]; then
|
||||
if ! Stagefile_exists bootstrap; then
|
||||
return ${VALUE}
|
||||
fi
|
||||
|
||||
|
@ -43,10 +43,12 @@ Exit ()
|
|||
done
|
||||
fi
|
||||
|
||||
rm -f .build/chroot_devpts
|
||||
rm -f .build/chroot_proc
|
||||
rm -f .build/chroot_selinuxfs
|
||||
rm -f .build/chroot_sysfs
|
||||
STAGEFILES_DIR="$(Stagefiles_dir)"
|
||||
|
||||
rm -f "${STAGEFILES_DIR}"/chroot_devpts
|
||||
rm -f "${STAGEFILES_DIR}"/chroot_proc
|
||||
rm -f "${STAGEFILES_DIR}"/chroot_selinuxfs
|
||||
rm -f "${STAGEFILES_DIR}"/chroot_sysfs
|
||||
|
||||
Echo_message "Saving caches..."
|
||||
|
||||
|
@ -54,7 +56,7 @@ Exit ()
|
|||
# but let's assume that if there's any binary stage file arround
|
||||
# we are in binary stage.
|
||||
|
||||
if ls .build/binary* > /dev/null 2>&1
|
||||
if ls "${STAGEFILES_DIR}"/binary* > /dev/null 2>&1
|
||||
then
|
||||
Save_package_cache binary
|
||||
else
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
Auto_build_config ()
|
||||
{
|
||||
# Automatically build config
|
||||
if [ -x auto/config ] && [ ! -e .build/config ]; then
|
||||
if [ -x auto/config ] && ! Stagefile_exists config; then
|
||||
Echo_message "Automatically populating config tree."
|
||||
lb config
|
||||
fi
|
||||
|
|
|
@ -9,6 +9,11 @@
|
|||
## under certain conditions; see COPYING for details.
|
||||
|
||||
|
||||
Stagefiles_dir ()
|
||||
{
|
||||
echo ".build"
|
||||
}
|
||||
|
||||
# Get the default filename for a script's stagefile (the name of the script
|
||||
# file itself). A suffix can be appended via providing as a param.
|
||||
Stagefile_name ()
|
||||
|
@ -19,6 +24,14 @@ Stagefile_name ()
|
|||
echo ${FILENAME}${SUFFIX:+.$SUFFIX}
|
||||
}
|
||||
|
||||
Stagefile_exists ()
|
||||
{
|
||||
if [ -f ".build/${1:-$(Stagefile_name)}" ]; then
|
||||
return 0
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
Check_stagefile ()
|
||||
{
|
||||
local FILE
|
||||
|
|
|
@ -94,7 +94,7 @@ if In_list "archives" ${HELPERS} && [ -z "${ARCHIVES_PASS}" ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
if In_list "archives" ${HELPERS} && [ ! -e .build/bootstrap ]; then
|
||||
if In_list "archives" ${HELPERS} && ! Stagefile_exists bootstrap; then
|
||||
Echo_warning "The 'archives' helper is selected, but the bootstrap stage has not completed."
|
||||
fi
|
||||
|
||||
|
|
|
@ -46,6 +46,8 @@ else
|
|||
ARGUMENTS="${@}"
|
||||
fi
|
||||
|
||||
STAGEFILES_DIR="$(Stagefiles_dir)"
|
||||
|
||||
for ARGUMENT in ${ARGUMENTS}
|
||||
do
|
||||
case "${ARGUMENT}" in
|
||||
|
@ -85,7 +87,7 @@ do
|
|||
rm -f chroot.packages.live chroot.packages.install
|
||||
rm -f chroot.files
|
||||
|
||||
rm -f .build/chroot*
|
||||
rm -f "${STAGEFILES_DIR}"/chroot*
|
||||
;;
|
||||
|
||||
--binary)
|
||||
|
@ -104,7 +106,7 @@ do
|
|||
rm -rf binary
|
||||
rm -rf tftpboot
|
||||
|
||||
rm -f .build/binary*
|
||||
rm -f "${STAGEFILES_DIR}"/binary*
|
||||
;;
|
||||
|
||||
--remove)
|
||||
|
@ -118,12 +120,12 @@ do
|
|||
|
||||
if [ -e auto/config ]
|
||||
then
|
||||
rm -f .build/config
|
||||
Remove_stagefile config
|
||||
fi
|
||||
;;
|
||||
|
||||
--stage)
|
||||
rm -rf .build/*
|
||||
rm -rf "${STAGEFILES_DIR}"/*
|
||||
;;
|
||||
|
||||
--source)
|
||||
|
@ -136,7 +138,7 @@ do
|
|||
|
||||
rm -rf source
|
||||
|
||||
rm -f .build/source*
|
||||
rm -f "${STAGEFILES_DIR}"/source*
|
||||
;;
|
||||
|
||||
-h|--help)
|
||||
|
|
|
@ -871,7 +871,7 @@ fi
|
|||
|
||||
# Ignoring --config if CWD already has a config
|
||||
# Only print warning from direct execution, not when run from auto script redirection, to avoid repetition
|
||||
if [ -e .build/config ] && [ -n "${_CONFIG}" ]
|
||||
if Stagefile_exists && [ -n "${_CONFIG}" ]
|
||||
then
|
||||
if [ "${1}" != "noauto" ]
|
||||
then
|
||||
|
|
Loading…
Reference in New Issue