From 6963135c7a5deb26d099f789eccdbbf2e4a6d95e Mon Sep 17 00:00:00 2001 From: Brian Read Date: Thu, 23 Mar 2023 13:18:18 +0000 Subject: [PATCH] Update Makefile.common for change in gitfile directory structure, take out crud in amke-archive.sh --- Makefile.common | 3 +- make-archive.sh | 107 ++++++++++++++++-------------------------------- 2 files changed, 36 insertions(+), 74 deletions(-) mode change 100755 => 100644 make-archive.sh diff --git a/Makefile.common b/Makefile.common index 505dbb5..a2ab332 100644 --- a/Makefile.common +++ b/Makefile.common @@ -88,7 +88,6 @@ RPM_BUILD_DIR ?= $(BUILDDIR)/$(NAME)-$(VERSION) #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//') ARCHIVEFILE := $(shell cat $(NAME).spec | grep Source | head -n 1 | sed -r 's/^Source[0..9]*:\s*//' | xargs basename) ARCHIVEFILE := $(shell rpm --queryformat '$(ARCHIVEFILE)\n' --specfile $(NAME).spec | head -n 1) @@ -346,7 +345,7 @@ test-srpm: srpm # Create the tar file used to transport the source tree archivefile:: - ./common/make-archive.sh + $(shell common/make-archive.sh) verrel: @echo $(NAME)-$(VERSION)-$(RELEASE) diff --git a/make-archive.sh b/make-archive.sh old mode 100755 new mode 100644 index ee3caa4..65ce9a0 --- a/make-archive.sh +++ b/make-archive.sh @@ -1,74 +1,37 @@ #!/bin/sh - # - # s/\$([A-Z]*)/${\1}/ - # s/; */; \\/ - # s/then/then \\/ - # s/else/else \\/ - # - NAME=$(basename `pwd`) - VER_REL=$(rpm -q --qf "%{VERSION}\n" --specfile ${NAME}.spec | head -1) - ARCHIVEFILE=$(cat ${NAME}.spec | grep Source | sed -r 's/^Source[0..9]*:\s*//' | xargs basename) - ARCHIVEFILE=$(rpm --queryformat "${ARCHIVEFILE}\n" --specfile ${NAME}.spec | head -n 1) - TEMPDIR=`mktemp -d` - #TREEPATH=$(echo "$ARCHIVEFILENAME" | cut -f 1 -d '.') - TREEPATH="$NAME-$VER_REL" - echo "$NAME $ARCHIVEFILE $TREEPATH" - - echo "Making archive file ${ARCHIVEFILE} `pwd`" ; \ - if [ "${NAME#smeserver}" = "${NAME}" ] || [ "${NAME#e-smith}" = "${NAME}" ] ; then \ - echo "Building for SME package"; \ - echo "Making archive ${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; \ +# +# Make the archivefile for Make mockbuild +# Called from the arhcivefile rule in common/Makefile.common +# +NAME=$(basename `pwd`) +VER_REL=$(rpm -q --qf "%{VERSION}\n" --specfile ${NAME}.spec | head -1) +ARCHIVEFILE=$(cat ${NAME}.spec | grep Source | sed -r 's/^Source[0..9]*:\s*//' | xargs basename) +ARCHIVEFILE=$(rpm --queryformat "${ARCHIVEFILE}\n" --specfile ${NAME}.spec | head -n 1) +TEMPDIR=`mktemp -d` +TREEPATH="$NAME-$VER_REL" +echo -e "\n$NAME $ARCHIVEFILE $TREEPATH" +echo -e "\nMaking archive file ${ARCHIVEFILE} `pwd`" ; \ +if [ "${NAME#smeserver}" = "${NAME}" ] || [ "${NAME#e-smith}" = "${NAME}" ] ; then \ + echo -e "\nBuilding for SME package"; \ + echo -e "\nMaking archive ${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 \ + echo "3rd party package should already be there"; \ + if [ ! -e "${ARCHIVEFILE}" ] ; then \ + $(error "Can't find 3rd party archive: ${ARCHIVEFILE} "); \ else \ - echo "3rd party package should already be there"; \ - if [ ! -e "${ARCHIVEFILE}" ] ; then \ - $(error "Can't find 3rd party archive: ${ARCHIVEFILE} "); \ - else \ - echo "Found 3rd party ${ARCHIVEFILE}"; \ - fi ; \ - fi - - #EXT=tar.gz - #echo "Making archive file ${ARCHIVEFILE} `pwd`" ; \ - #if [ "${NAME#smeserver}" != "${NAME}" ] || [ "${NAME#e-smith}" != "${NAME}" ] ; then \ - #echo "Building for SME package"; \ - #GOTSOURCE='1'; \ - #else \ - #echo "Building for 3rd party package"; \ - #GOTSOURCE='0'; \ - #fi ; \ - #echo "GOTSOURCE:${GOTSOURCE} TEMPDIR:${TEMPDIR}" ; \ - #if [ ${GOTSOURCE} = '0' ]; then \ - #if [ ! -e ${ARCHIVEFILE} ] ; then echo "Can't find 3rd party archive: ${ARCHIVEFILE} "; \ - #GOTSOURCE='1'; \ - #else \ - #echo "Found ${ARCHIVEFILE}"; \ - #fi \ - #fi ; \ - #if [ ${GOTSOURCE} = '1' ]; then \ - #echo "Making archive ${ARCHIVEFILE}"; \ - #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}; \ - #fi ; \ - #find ${TEMPDIR} -delete; \ No newline at end of file + echo "Found 3rd party ${ARCHIVEFILE}"; \ + fi ; \ +fi \ No newline at end of file