Update archivefile rules in Makefile.common and make-archive.sh

This commit is contained in:
Brian Read 2023-04-10 19:15:10 +01:00
parent 7ba14c998d
commit dcf4914ebb
2 changed files with 10 additions and 24 deletions

View File

@ -88,10 +88,9 @@ RPM_BUILD_DIR ?= $(BUILDDIR)/$(NAME)-$(VERSION)
#needed for archivefile rule #needed for archivefile rule
TREEPATH := $(NAME)-$(VERSION) TREEPATH := $(NAME)-$(VERSION)
EXT := $(shell cat $(NAME).spec | grep Source | 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 := $(shell cat $(NAME).spec | grep Source | head -n 1 | sed -r 's/^Source[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 := $(shell rpm --queryformat '$(ARCHIVEFILE)\n' --specfile $(NAME).spec | head -n 1) #ARCHIVEFILE=$(rpm --queryformat "${ARCHIVEFILE}\n" --specfile ${NAME}.spec | head -n 1)
TEMPDIR := $(shell mktemp -d)
ARCHIVEFILE := $(shell cat archivefilename) ARCHIVEFILE := $(shell cat archivefilename)

27
make-archive.sh Executable file → Normal file
View File

@ -4,29 +4,16 @@
# Called from the arhcivefile rule in common/Makefile.common # Called from the arhcivefile rule in common/Makefile.common
# #
NAME=$(basename `pwd`) NAME=$(basename `pwd`)
VER_REL=$(rpm -q --qf "%{VERSION}\n" --specfile ${NAME}.spec | head -1) VER_REL=$(rpm -q --qf "%{VERSION}\n" --specfile ${NAME}.spec | head -n 1)
ARCHIVEFILE=$(cat ${NAME}.spec | grep Source | sed -r 's/^Source[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)
TEMPDIR=`mktemp -d` ARCHIVEFILE := $(shell cat archivefilename)
TREEPATH="$NAME-$VER_REL" TREEPATH="$NAME-$VER_REL"
echo -e "\n$NAME $ARCHIVEFILE $TREEPATH" echo -e "\n$NAME $ARCHIVEFILE $TREEPATH"
echo -e "\nMaking archive file ${ARCHIVEFILE} `pwd`" ; \ echo -e "\nMaking archive file ${ARCHIVEFILE} `pwd`" ; \
if [ "${NAME#smeserver}" = "${NAME}" ] || [ "${NAME#e-smith}" = "${NAME}" ] ; then \ if [ "${NAME#smeserver}" == "${NAME}" ] || [ "${NAME#e-smith}" == "${NAME}" ] ; then \
echo -e "\nBuilding for SME package"; \ tar -czf ${ARCHIVEFILE} ${TREEPATH} ;\
echo -e "\nMaking archive ${ARCHIVEFILE}"; \ ls -l ${ARCHIVEFILE} ;
TEMPDIR=`mktemp -d`; \
mkdir -p ${TEMPDIR}/${TREEPATH}; \
cp -r root ${TEMPDIR}/${TREEPATH}; \
if test -f createlinks ; then cp createlinks ${TEMPDIR}/${TREEPATH} ; fi ; \
if test -f COPYING ; then cp COPYING ${TEMPDIR}/${TREEPATH} ; fi ; \
if test -f LICENSE ; then cp LICENSE ${TEMPDIR}/${TREEPATH} ; fi ; \
if test -f Copying ; then cp Copying ${TEMPDIR}/${TREEPATH} ; fi ; \
if test -f Artistic ; then cp Artistic ${TEMPDIR}/${TREEPATH} ; fi ; \
if test -f *.c ; then cp *.c ${TEMPDIR}/${TREEPATH} ; fi ; \
rm -f ${ARCHIVEFILE}; \
tar -czf ${ARCHIVEFILE} -C ${TEMPDIR} ${TREEPATH}; \
ls -l ${ARCHIVEFILE}; \
find ${TEMPDIR} -delete; \
else \ else \
echo "3rd party package should already be there"; \ echo "3rd party package should already be there"; \
if [ ! -e "${ARCHIVEFILE}" ] ; then \ if [ ! -e "${ARCHIVEFILE}" ] ; then \