Allow using any branch/tag in BLFS Makefile

Still WIP because of the *_TREE names
This commit is contained in:
Pierre Labastie 2021-05-01 09:22:06 +02:00
parent b3825c3eb8
commit 4ed4a3244d

View file

@ -56,8 +56,11 @@ define INITIAL_TRACK
</sublist> </sublist>
endef endef
# Git locations and branches
LFS-GIT = git://git.linuxfromscratch.org/lfs.git LFS-GIT = git://git.linuxfromscratch.org/lfs.git
LFS-BRANCH = trunk
GIT = git://git.linuxfromscratch.org/blfs.git GIT = git://git.linuxfromscratch.org/blfs.git
BLFS-BRANCH = trunk
ALLXML := $(filter-out $(RENDERTMP)/%, \ ALLXML := $(filter-out $(RENDERTMP)/%, \
$(shell if [ -d $(BLFS_XML) ]; then \ $(shell if [ -d $(BLFS_XML) ]; then \
@ -178,18 +181,34 @@ $(BLFS_FULL): $(BLFS_XML) $(BLFS_XML)/general.ent $(ALLXML) $(ALLXSL)
all: update $(BOOK_XML) all: update $(BOOK_XML)
# If in detached head state, "git pull" returns an error, so switch back to
# trunk before updating, and switch back to the branch/tag afterwards
update: $(BLFS_XML) $(LFS_XML) update: $(BLFS_XML) $(LFS_XML)
@echo Updating the book sources @echo Updating the book sources
$(Q)cd $(LFS_XML) && git pull $(Q)cd $(LFS_XML) && \
$(Q)cd $(BLFS_XML) && git pull if [ $(LFS-BRANCH) != trunk ]; then git switch -; fi && \
git pull && \
git checkout $(LFS-BRANCH)
$(Q)cd $(BLFS_XML) && \
if [ $(BLFS-BRANCH) != trunk ]; then git switch -; fi && \
git pull && \
git checkout $(BLFS-BRANCH)
$(LFS_XML): $(LFS_XML):
@echo Getting the LFS book sources... @echo Getting the LFS book sources...
$(Q)git clone $(LFS-GIT) $@ $(Q)git clone $(LFS-GIT) $@
if [ $(LFS-BRANCH) != trunk ]; then \
cd $@ && \
git checkout $(LFS-BRANCH); \
fi
$(BLFS_XML): $(BLFS_XML):
@echo Getting the BLFS book sources... @echo Getting the BLFS book sources...
$(Q)git clone $(GIT) $@ $(Q)git clone $(GIT) $@
if [ $(BLFS-BRANCH) != trunk ]; then \
cd $@ && \
git checkout $(BLFS-BRANCH); \
fi
# Clean up # Clean up