Change variable names and logic for BLFS book

Only use BLFS_COMMIT instead of BLFS_BRANCH_ID, BLFS_TREE, BLFS_BOOK
Same for le LFS_BLFS variables
This commit is contained in:
Pierre Labastie 2022-04-01 10:26:17 +02:00
parent 30a444a477
commit 9b99adace9
5 changed files with 38 additions and 79 deletions

View File

@ -216,23 +216,19 @@ menu "BOOK Settings"
endmenu
choice
prompt "BLFS Release"
default BLFS_GIT
prompt "BLFS book version"
default BLFS_BRANCH
config BLFS_GIT
bool "BLFS GIT"
config BLFS_BRANCH
bool "BLFS Branch (default trunk) or any commit"
help
Current development version as in trunk
Use a BLFS book downloaded from the git repository, and
checked out at any commit (branch/tag/sha).
config BLFS_WORKING_COPY
bool "BLFS working copy"
help
A local working copy of the BLFS book.
config BLFS_BRANCH
bool "BLFS Branch or stable book"
help
A supported GIT branch or stable (tag) book release
Use a local working copy of the BLFS book.
endchoice
config BLFS_WC_LOCATION
@ -242,9 +238,9 @@ menu "BOOK Settings"
help
Full path to the BLFS book working copy
config BLFS_BRANCH_ID
string "BLFS Book Version (mandatory)"
default "**EDIT ME**"
config BLFS_COMMIT
string "BLFS Book commit (branch/tag/sha)"
default "trunk"
depends on BLFS_BRANCH
help
Can be any branch, tag, or abbreviated (or not) commit sha.
@ -288,24 +284,20 @@ menu "BOOK Settings"
unless you know what you are doing...
choice
prompt "LFS Release"
default LFS_relGIT
prompt "LFS book version"
default LFS_BRANCH
depends on BOOK_BLFS
config LFS_relGIT
bool "LFS GIT"
config LFS_BRANCH
bool "LFS branch (default trunk) or any commit"
help
Current development version as in trunk
Use an LFS book downloaded from the git repository and
checked out at any commit (branch/tag/sha).
config LFS_WORKING_COPY
bool "LFS working copy"
help
A local working copy of the LFS book.
config LFS_BRANCH
bool "LFS Branch or stable book"
help
A supported GIT branch or stable (tag) book release
Use a local working copy of the LFS book.
endchoice
config BLFS_LFS_BOOK
@ -315,9 +307,9 @@ menu "BOOK Settings"
help
Full path to the LFS book working copy"
config BLFS_LFS_BRANCH_ID
string "LFS Book Version (mandatory)"
default "**EDIT ME**"
config BLFS_LFS_COMMIT
string "LFS Book Commit (mandatory)"
default "trunk"
depends on LFS_BRANCH
help
Any branch, tag or abbreviated (or not) commit sha.

View File

@ -53,7 +53,7 @@ sudo cp -ruT --preserve=timestamps $BOOK \
sudo make -j1 -C $BUILDDIR$BLFS_ROOT \
REV=$INITSYS \
LFS-BRANCH=${COMMIT} \
BLFS-BRANCH=${BLFS_TREE} \
BLFS-BRANCH=${BLFS_COMMIT} \
update
sudo make -j1 -C $BUILDDIR$BLFS_ROOT \
REV=$INITSYS \
@ -61,7 +61,7 @@ sudo make -j1 -C $BUILDDIR$BLFS_ROOT \
LFS_XML=$BUILDDIR$BLFS_ROOT/$LFS_XML \
LFS-BRANCH="${COMMIT}" \
BLFS_XML=$BUILDDIR$BLFS_ROOT/$BLFS_XML \
BLFS-BRANCH=${BLFS_TREE} \
BLFS-BRANCH=${BLFS_COMMIT} \
$BUILDDIR$BLFS_ROOT/packages.xml
# But then $BUILDDIR/var/lib/ is owned by root if just created, which

View File

@ -40,7 +40,7 @@ inline_doc
# Additional variables
local -r blfs_tool_PARAM_LIST="\
BLFS_TREE BLFS_BRANCH_ID BLFS_ROOT BLFS_XML TRACKING_DIR \
BLFS_COMMIT BLFS_ROOT BLFS_XML TRACKING_DIR \
DEP_LIBXML DEP_LIBXSLT DEP_DBXML DEP_LYNX DEP_SUDO DEP_WGET \
DEP_GIT DEP_GPM"
local -r custom_tool_PARAM_LIST="TRACKING_DIR"

View File

@ -10,10 +10,10 @@ TRACKING_DIR : where the installed package file is kept.
INITSYS : which books do you want? 'sysv' or 'systemd' (default sysv)
BLFS_ROOT : where the installed tools will be installed, relative to $HOME.
Must start with a '/' (default /blfs_root)
BLFS_BRANCH_ID: development, branch-xxx, xxx (where xxx is a valid tag)
(default development)
LFS_BRANCH_ID : development, branch-xxx, xxx (where xxx is a valid tag)
(default development)
BLFS_COMMIT : any commit (branch/tag/sha)
(default trunk)
LFS_COMMIT : any commit (branch/tag/sha)
(default trunk)
Examples:
1 - If you plan to use the tools to build BLFS on top of LFS, but you did not
use jhalfs, or forgot to include the jhalfs-blfs tools:
@ -67,18 +67,12 @@ fi
if [ "$BOOK_BLFS" = y ]; then
## Read variables and sanity checks
[[ "$relGIT" = y ]] && BLFS_BRANCH_ID=development
[[ "$BRANCH" = y ]] && BLFS_BRANCH_ID=$BRANCH_ID
[[ "$BRANCH" = y ]] && BLFS_COMMIT=$COMMIT
[[ "$WORKING_COPY" = y ]] && BLFS_BOOK=$BOOK
[[ "$BRANCH_ID" = "**EDIT ME**" ]] &&
echo You have not set the BLFS book version or branch && exit 1
[[ "$BOOK" = "**EDIT ME**" ]] &&
echo You have not set the BLFS working copy location && exit 1
[[ "$LFS_relGIT" = y ]] && LFS_BRANCH_ID=development
[[ "$LFS_BRANCH" = y ]] && LFS_BRANCH_ID=$BLFS_LFS_BRANCH_ID
[[ "$LFS_BRANCH" = y ]] && LFS_COMMIT=$BLFS_LFS_COMMIT
[[ "$LFS_WORKING_COPY" = y ]] && LFS_BOOK=$BLFS_LFS_BOOK
[[ "$LFS_BRANCH_ID" = "**EDIT ME**" ]] &&
echo You have not set the LFS book version or branch && exit 1
[[ "$LFS_BOOK" = "**EDIT ME**" ]] &&
echo You have not set the LFS working copy location && exit 1
fi
@ -90,8 +84,8 @@ BUILDDIR=$(cd ~;pwd)
BLFS_ROOT="${BLFS_ROOT:=/blfs_root}"
TRACKING_DIR="${TRACKING_DIR:=/var/lib/jhalfs/BLFS}"
INITSYS="${INITSYS:=sysv}"
BLFS_BRANCH_ID=${BLFS_BRANCH_ID:=development}
LFS_BRANCH_ID=${LFS_BRANCH_ID:=development}
BLFS_COMMIT=${BLFS_COMMIT:=trunk}
LFS_COMMIT=${LFS_COMMIT:=trunk}
BLFS_XML=${BLFS_XML:=blfs-xml}
LFS_XML=${LFS_XML:=lfs-xml}
@ -100,12 +94,12 @@ PARAMS="BLFS_ROOT TRACKING_DIR INITSYS BLFS_XML LFS_XML"
if [ "$WORKING_COPY" = y ]; then
PARAMS="$PARAMS WORKING_COPY BLFS_BOOK"
else
PARAMS="$PARAMS BLFS_BRANCH_ID"
PARAMS="$PARAMS BLFS_COMMIT"
fi
if [ "$LFS_WORKING_COPY" = y ]; then
PARAMS="$PARAMS LFS_WORKING_COPY LFS_BOOK"
else
PARAMS="$PARAMS LFS_BRANCH_ID"
PARAMS="$PARAMS LFS_COMMIT"
fi
# Format for displaying parameters:
declare -r PARAM_VALS='${config_param}${dotSTR:${#config_param}} ${L_arrow}${BOLD}${!config_param}${OFF}${R_arrow}'
@ -131,17 +125,6 @@ source $COMMON_DIR/libs/func_check_version.sh
[[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}"
case $BLFS_BRANCH_ID in
development ) BLFS_TREE=trunk ;;
branch-* ) BLFS_TREE=${BLFS_BRANCH_ID#branch-} ;;
* ) BLFS_TREE=${BLFS_BRANCH_ID} ;;
esac
case $LFS_BRANCH_ID in
development ) LFS_TREE=trunk ;;
branch-* ) LFS_TREE=${LFS_BRANCH_ID#branch-} ;;
* ) LFS_TREE=${LFS_BRANCH_ID} ;;
esac
# Check for build prerequisites.
echo
check_alfs_tools
@ -193,11 +176,9 @@ make -j1 -C $BUILDDIR$BLFS_ROOT \
TRACKING_DIR=$TRACKING_DIR \
REV=$INITSYS \
LFS_XML=$BUILDDIR$BLFS_ROOT/$LFS_XML \
LFS-GIT=git://git.linuxfromscratch.org/lfs.git \
LFS-BRANCH=${LFS_TREE} \
LFS-BRANCH=${LFS_COMMIT} \
BLFS_XML=$BUILDDIR$BLFS_ROOT/$BLFS_XML \
GIT=git://git.linuxfromscratch.org/blfs.git \
BLFS-BRANCH=${BLFS_TREE} \
BLFS-BRANCH=${BLFS_COMMIT} \
$BUILDDIR$BLFS_ROOT/packages.xml
[[ $VERBOSITY > 0 ]] && echo "... OK"

20
jhalfs
View File

@ -243,27 +243,13 @@ if [[ "${BLFS_TOOL}" = "y" ]] ; then
# simple_message 'Checking supplementary tools for installing BLFS'
# check_blfs_tools
simple_message "${SD_BORDER}${nl_}"
BLFS_GIT=${BLFS_GIT:-n}
BLFS_WORKING_COPY=${BLFS_WORKING_COPY:-n}
BLFS_BRANCH=${BLFS_BRANCH:-n}
if [[ "${BLFS_GIT}" = "y" ]]; then
BLFS_BRANCH_ID=development
BLFS_TREE=trunk
elif [[ "${BLFS_WORKING_COPY}" = "y" ]]; then
if [[ ! -d "$BLFS_WC_LOCATION/postlfs" ]] ; then
BLFS_WORKING_COPY=${BLFS_WORKING_COPY:-n}
if [[ "${BLFS_WORKING_COPY}" = "y" ]] &&
[[ ! -d "$BLFS_WC_LOCATION/postlfs" ]] ; then
echo " BLFS tools: This is not a working copy: $BLFS_WC_LOCATION."
echo " Please rerun make and fix the configuration."
exit 2
fi
BLFS_TREE=$(cd $BLFS_WC_LOCATION; git branch --show-current)
BLFS_BRANCH_ID=${BLFS_TREE/trunk/development}
elif [[ "${BLFS_BRANCH}" = "y" ]] ; then
case $BLFS_BRANCH_ID in
*EDIT* ) echo " You forgot to set the BLFS branch or stable book version."
echo " Please rerun make and fix the configuration."
exit 2 ;;
* ) BLFS_TREE=${BLFS_BRANCH_ID#branch-}
esac
fi
load_file "${COMMON_DIR}/libs/func_install_blfs"
fi