From 331c908cb8bc5b12278d8afd48acc7161c3a329d Mon Sep 17 00:00:00 2001 From: Trevor Batley Date: Mon, 25 Mar 2024 08:24:32 +1100 Subject: [PATCH] add makefile and tag in getperl --- git-getperl.sh | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/git-getperl.sh b/git-getperl.sh index 06bac4c..f2fe74f 100755 --- a/git-getperl.sh +++ b/git-getperl.sh @@ -337,6 +337,31 @@ fi cd $GITFiles/$RepoName cp $perlFiles/$RepoName/* . +# create the Makefile +cat > Makefile <<- _EOT +# Makefile for source rpm: daemontools +# $Id: Makefile,v 1.1 2016/02/04 12:24:52 vip-ire Exp $ +NAME := daemontools +SPECFILE = $(firstword $(wildcard *.spec)) + +define find-makefile-common +for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done +endef + +MAKEFILE_COMMON := $(shell $(find-makefile-common)) + +ifeq ($(MAKEFILE_COMMON),) +# attept a checkout +define checkout-makefile-common +test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2 +endef + +MAKEFILE_COMMON := $(shell $(checkout-makefile-common)) +endif + +include $(MAKEFILE_COMMON) +_EOT + # Add file indicating which release and contribs or base - this is matched by the makefile with the contents of the branch file in the common directory # to give the details of the release (EL7/8/9/ etc) # This assumes SME10 and contribs10 or sme10 directory names, later releases can update the value in the file and Makefile should still work. @@ -590,6 +615,23 @@ git push --force -u $QUIET origin master #TAG=$VERSION"-"${RELEASE%.*} #git tag -a $TAG -m "$COMMENT" #git push origin $TAG $QUIET +# Now create the version and release tag from the specfile +VERSION_RELEASE_LONG=`rpm --queryformat '%{version} %{release}\n' --specfile $SPECFILE` +VERSION_RELEASE=${VERSION_RELEASE_LONG%%$'\n'*} +VERSION=${VERSION_RELEASE% *} +VERSION=${VERSION//./_} +RELEASE=${VERSION_RELEASE#* } +TAG=$VERSION"-"${RELEASE%.*} +if [ $DEBUG ] ; then + echo "VERSION_RELEASE=$VERSION_RELEASE" + echo "VERSION=$VERSION" + echo "RELEASE=$RELEASE" + echo "TAG=$TAG" +fi +git pull +git tag -a $TAG -m "Setting tag to current Version-Release in spec file: $TAG" +git push origin --tag $TAG $QUIET + echo "Created $RepoName Repo: $HTTP_URL - Comment:$COMMENT tag:$TAG" exit 0