From 41dc4a1d4d7110a4da0fea169176119b8eac6c08 Mon Sep 17 00:00:00 2001 From: Brian Read Date: Wed, 22 Mar 2023 17:53:46 +0000 Subject: [PATCH] Add in make-archive,sh called from makefile.common --- Makefile.common | 2 +- make-archive.sh | 74 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+), 1 deletion(-) create mode 100755 make-archive.sh diff --git a/Makefile.common b/Makefile.common index cd67098..067808d 100644 --- a/Makefile.common +++ b/Makefile.common @@ -346,7 +346,7 @@ test-srpm: srpm # Create the tar file used to transport the source tree archivefile:: - trymake.sh + make-archive.sh verrel: @echo $(NAME)-$(VERSION)-$(RELEASE) diff --git a/make-archive.sh b/make-archive.sh new file mode 100755 index 0000000..ee3caa4 --- /dev/null +++ b/make-archive.sh @@ -0,0 +1,74 @@ +#!/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; \ + 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