Upgrade to build the source tree in /tmp and then create archive file from it.

This commit is contained in:
Brian Read 2023-06-01 12:35:27 +02:00
parent 8b6fb4d523
commit 93b6199e31

View File

@ -89,6 +89,7 @@ RPM_BUILD_DIR ?= $(BUILDDIR)/$(NAME)-$(VERSION)
#needed for archivefile rule #needed for archivefile rule
TREEPATH := $(NAME)-$(VERSION) TREEPATH := $(NAME)-$(VERSION)
CODEDIR := "root" CODEDIR := "root"
TEMPDIR := $(shell mktemp -d)
EXT := $(shell cat $(NAME).spec | grep -e '^[S|s]ource' | head -n 1 | sed 's/Source: //' | sed -E 's/^([^.]*\.)(.*)$/\2//') EXT := $(shell cat $(NAME).spec | grep -e '^[S|s]ource' | head -n 1 | sed 's/Source: //' | sed -E 's/^([^.]*\.)(.*)$/\2//')
#ARCHIVEFILE=$(cat ${NAME}.spec | grep -e '^[S|s]ource' | sed -r 's/^[S|s]ource[0-9]?:\s?//' | xargs basename) #ARCHIVEFILE=$(cat ${NAME}.spec | grep -e '^[S|s]ource' | sed -r 's/^[S|s]ource[0-9]?:\s?//' | xargs basename)
#ARCHIVEFILE=$(rpm --queryformat "${ARCHIVEFILE}\n" --specfile ${NAME}.spec | head -n 1) #ARCHIVEFILE=$(rpm --queryformat "${ARCHIVEFILE}\n" --specfile ${NAME}.spec | head -n 1)
@ -347,15 +348,15 @@ endif
# Create the .tar.gz or whatever file # Create the .tar.gz or whatever file
$(ARCHIVEFILE): $(ARCHIVEFILE):
$(info "${NAME} $(ARCHIVEFILE) $(TREEPATH)") $(info "Making archive file ${ARCHIVEFILE}")
$(info "Making archive file ${ARCHIVEFILE}") mkdir -p "${TEMPDIR}/${TREEPATH}" ;\
if [ -d ${TREEPATH} ] ; then rm -Rf ${TREEPATH} ; fi ; \ if [ -d ${CODEDIR} ] ; then cp -R "${CODEDIR}" "${TEMPDIR}/${TREEPATH}" ; fi ; \
mkdir -p ${TREEPATH} ; \ if [ -e createlinks ] ; then cp createlinks "${TEMPDIR}/${TREEPATH}/." ; fi ; \
if [ -d ${CODEDIR} ] ; then cp -R "${CODEDIR}" "${TREEPATH}/root" ; fi ; \ if [ -d additional ] ; then cp additional/* "${TEMPDIR}/${TREEPATH}/." ; fi ; \
if [ -e createlinks ] ; then cp createlinks "${TREEPATH}/." ; fi ; \ rm -f ${ARCHIVEFILE} ;\
if [ -d additional ] ; then cp additional/* "${TREEPATH}/." ; fi ; \ tar -czf "${ARCHIVEFILE}" -C "${TEMPDIR}" "${TREEPATH}" ;\
tar -czf ${ARCHIVEFILE} ${TREEPATH} ;\ ls -l ${ARCHIVEFILE} ;\
ls -l ${ARCHIVEFILE} ; rm -Rf "${TEMPDIR}/${TREEPATH}/"
test-srpm: srpm test-srpm: srpm