From bf725e8b0d75b9c0d3f6d5a26f68e4d84aa403c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Vu=C4=8Dica?= Date: Thu, 7 Dec 2017 20:20:28 +0000 Subject: [PATCH 1/4] git-tag: Support creating a Git tag and exporting tarball from the tag. This commit does not add support to GNUstep Make itself (i.e. you cannot use the new rules to release GNUstep Make). --- ChangeLog | 5 +++ Master/source-distribution.make | 75 +++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+) diff --git a/ChangeLog b/ChangeLog index 7b541e728..1c5d6f398 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2017-12-07 Ivan Vucica + + * Master/source-distribution.make: Allow creating a Git tag and + creating a tarball from a git tag. + 2017-04-14 Richard Frith-Macdonald * Version: 2.7.0 release diff --git a/Master/source-distribution.make b/Master/source-distribution.make index e53e9f7c0..3ab6235e8 100644 --- a/Master/source-distribution.make +++ b/Master/source-distribution.make @@ -26,6 +26,16 @@ # PACKAGE_NAME = gnustep-base # PACKAGE_VERSION = 1.0.0 # +# For Git exports, you may want to define something like: +# +# GIT_MODULE_NAME = libs-base +# +# GIT_MODULE_NAME will default to the value of PACKAGE_NAME. +# GIT_TAG_NAME is the same as GIT_MODULE_NAME if not set, and is used as +# a prefix when creating a tag or exporting a tag. Currently, the Git +# integration does not interact with remote repository, so specifying +# a base URL is not needed. +# # For SVN exports, you may want to define something like: # # SVN_MODULE_NAME = base @@ -87,6 +97,13 @@ ifeq ($(SVN_TAG_NAME),) SVN_TAG_NAME = $(SVN_MODULE_NAME) endif +ifeq ($(GIT_MODULE_NAME),) + GIT_MODULE_NAME = $(SVN_MODULE_NAME) +endif +ifeq ($(GIT_TAG_NAME),) + GIT_TAG_NAME = $(GIT_MODULE_NAME) +endif + # Set the cvs command we use. Most of the times, this is 'cvs' and # you need to do nothing. But you can override 'cvs' with something @@ -98,6 +115,9 @@ endif ifeq ($(SVN),) SVN = svn endif +ifeq ($(GIT),) + GIT = git +endif # # You can set COMPRESSION_PROGRAM and COMPRESSION_EXT by hand if your @@ -345,3 +365,58 @@ ifneq ($(RELEASE_DIR),) fi; \ mv $(ARCHIVE_FILE) $(RELEASE_DIR)$(END_ECHO) endif + +# +# Create an annotated Git tag with the $(GIT_TAG_NAME)-$(VERTAG) tag. +# +# New tag still needs to be published with git push --tags. +# +git-tag: + $(GIT) tag -a $(GIT_TAG_NAME)-$(VERTAG) -m "Tag version $(VERTAG)" + +# +# Build a .tar.gz from the Git sources using revision/tag +# $(GIT_TAG_NAME)-$(VERTAG) as for a new release of the package. +# +# Note: .dist-ignore is unused at this time. +# +git-dist: + $(ECHO_NOTHING)echo "Exporting from branch or tag $(GIT_TAG_NAME)-$(VERTAG) on local Git repository..."; \ + if $(GIT) show $(GIT_TAG_NAME)-$(VERTAG):.dist-ignore 2>/dev/null >/dev/null; then \ + echo "*Error* cannot export: dist-ignore is currently unused"; \ + else \ + $(GIT) archive --format=tar.gz $(GIT_TAG_NAME)-$(VERTAG) -o $(ARCHIVE_FILE) --prefix=$(VERSION_NAME)/ ; \ + fi ; \ + if [ ! -f $(ARCHIVE_FILE) ]; then \ + echo "*Error* creating .tar$(COMPRESSION_EXT) archive"; \ + exit 1; \ + fi;$(END_ECHO) +ifneq ($(RELEASE_DIR),) + $(ECHO_NOTHING)echo "Moving $(ARCHIVE_FILE) to $(RELEASE_DIR)..."; \ + if [ ! -d $(RELEASE_DIR) ]; then \ + $(MKDIRS) $(RELEASE_DIR); \ + fi; \ + if [ -f $(RELEASE_DIR)/$(ARCHIVE_FILE) ]; then \ + echo "$(RELEASE_DIR)/$(ARCHIVE_FILE) already exists:"; \ + echo "Saving old version in $(RELEASE_DIR)/$(ARCHIVE_FILE)~";\ + mv $(RELEASE_DIR)/$(ARCHIVE_FILE) \ + $(RELEASE_DIR)/$(ARCHIVE_FILE)~;\ + fi; \ + mv $(ARCHIVE_FILE) $(RELEASE_DIR)$(END_ECHO) +endif + +git-tag-stable: + $(ECHO_NOTHING)echo "*Error* tagging stable branch in Git is not supported at this time."$(END_ECHO) + exit 1 + +git-bugfix: + $(ECHO_NOTHING)echo "*Error* creating a bugfix release from the stable branch in Git is not supported at this time."$(END_ECHO) + exit 1 + +git-snapshot: + $(ECHO_NOTHING)echo "*Error* creating a snapshot tarball from the current Git master is not supported at this time."$(END_ECHO) + exit 1 + +git-export: + $(ECHO_NOTHING)echo "*Error* creating a tarball from the current Git working copy is not supported at this time."$(END_ECHO) + exit 1 From 720df0d7cf4271b4c6b9cf5792d0a4d9b4b48624 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Vu=C4=8Dica?= Date: Thu, 7 Dec 2017 21:19:33 +0000 Subject: [PATCH 2/4] git-tag: Support annotation files and signing annotated commits. --- Master/source-distribution.make | 56 ++++++++++++++++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) diff --git a/Master/source-distribution.make b/Master/source-distribution.make index 3ab6235e8..a45b0455a 100644 --- a/Master/source-distribution.make +++ b/Master/source-distribution.make @@ -36,6 +36,18 @@ # integration does not interact with remote repository, so specifying # a base URL is not needed. # +# When Git tagging, an ANNOUNCE file can be used to create the annotated Git +# tag's commit message. +# - Passing GIT_TAG_ANNOUNCE_FILE will copy the file, then prefix it with +# a one-line 'Release $(PACKAGE_VERSION).' and an empty line. +# - Additionally passing GIT_TAG_ANNOUNCE_OMIT_PREFACE will use the ANNOUNCE +# file verbatim, without the prefix. +# +# GIT_TAG_SIGN can be used to control whether the annotated Git tag should +# be GPG-signed. Empty value or unspecified means no signature, 'yes' means +# use the default signing key, and another value specifies which key should +# be used; you can use things like key ID or e-mail address. +# # For SVN exports, you may want to define something like: # # SVN_MODULE_NAME = base @@ -157,6 +169,24 @@ endif endif # COMPRESSION +# Whether to GPG sign the Git tag. +# +# - By default (or with empty variable GIT_TAG_SIGN), annotated tag will be +# created without signature. +# - If GIT_TAG_SIGN has value of 'yes', default e-mail address's key will +# be used. +# - If GIT_TAG_SIGN has another value, the value will be used as the signing +# e-mail address. +ifeq ($(GIT_TAG_SIGN), ) +GIT_TAG_ANNOTATION_FLAGS = -a +else + ifeq ($(GIT_TAG_SIGN), yes) + GIT_TAG_ANNOTATION_FLAGS = -s + else + GIT_TAG_ANNOTATION_FLAGS = -u $(GIT_TAG_SIGN) + endif +endif + # Due to peculiarities of some packaging systems or package distribution # systems, we may want to permit customization of tarball version string. @@ -371,8 +401,32 @@ endif # # New tag still needs to be published with git push --tags. # +ifeq ($(GIT_TAG_ANNOUNCE_FILE),) git-tag: - $(GIT) tag -a $(GIT_TAG_NAME)-$(VERTAG) -m "Tag version $(VERTAG)" + $(GIT) tag \ + $(GIT_TAG_ANNOTATION_FLAGS) \ + $(GIT_TAG_NAME)-$(VERTAG) \ + -m "Release $(PACKAGE_VERSION)" +else +ifneq ($(GIT_TAG_ANNOUNCE_OMIT_PREFACE),yes) +.INTERMEDIATE += git-tag-announce-file.tmp +git-tag-announce-file.tmp: + printf "Release $(PACKAGE_VERSION).\n\n" > git-tag-announce-file.tmp + cat $(GIT_TAG_ANNOUNCE_FILE) >> git-tag-announce-file.tmp + +git-tag: git-tag-announce-file.tmp + $(GIT) tag \ + $(GIT_TAG_ANNOTATION_FLAGS) \ + $(GIT_TAG_NAME)-$(VERTAG) \ + -F git-tag-announce-file.tmp +else +git-tag: + $(GIT) tag \ + $(GIT_TAG_ANNOTATION_FLAGS) \ + $(GIT_TAG_NAME)-$(VERTAG) \ + -F $(GIT_TAG_ANNOUNCE_FILE) +endif +endif # # Build a .tar.gz from the Git sources using revision/tag From 50afbfa898767aa591fd29301b1814a159d5807d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Vu=C4=8Dica?= Date: Thu, 7 Dec 2017 21:39:12 +0000 Subject: [PATCH 3/4] git-tag: Make gnustep-make git-tag'gable and git-dist'able. This adds support for git-tag and git-dist into GNUmakefile.in for gnustep-make itself. --- ChangeLog | 2 ++ GNUmakefile.in | 43 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/ChangeLog b/ChangeLog index 1c5d6f398..44e3c517a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,8 @@ * Master/source-distribution.make: Allow creating a Git tag and creating a tarball from a git tag. + * GNUmakefile.in: Allow creating a Git tag and creating a tarball + from a Git tag, for releasing gnustep-make itself. 2017-04-14 Richard Frith-Macdonald diff --git a/GNUmakefile.in b/GNUmakefile.in index 116d4454b..3f507c6e8 100644 --- a/GNUmakefile.in +++ b/GNUmakefile.in @@ -418,6 +418,49 @@ cvs-snapshot: tar --gzip -cf gnustep-make-$(GNUSTEP_MAKE_VERSION).tar.gz gnustep-make-$(GNUSTEP_MAKE_VERSION) rm -rf gnustep-make-$(GNUSTEP_MAKE_VERSION) +ifeq ($(GIT_TAG_SIGN), ) +GIT_TAG_ANNOTATION_FLAGS = -a +else + ifeq ($(GIT_TAG_SIGN), yes) + GIT_TAG_ANNOTATION_FLAGS = -s + else + GIT_TAG_ANNOTATION_FLAGS = -u $(GIT_TAG_SIGN) + endif +endif + +git-tag-stable: + echo "*Error* tagging stable branch in Git is not supported at this time." && exit 1 + +ifeq ($(GIT_TAG_ANNOUNCE_FILE),) +git-tag: + git tag \ + $(GIT_TAG_ANNOTATION_FLAGS) \ + make-$(VERTAG) \ + -m "Release $(GNUSTEP_MAKE_VERSION)." +else +ifneq ($(GIT_TAG_ANNOUNCE_OMIT_PREFACE),yes) +.INTERMEDIATE += git-tag-announce-file.tmp +git-tag-announce-file.tmp: + printf "Release $(GNUSTEP_MAKE_VERSION).\n\n" > git-tag-announce-file.tmp + cat $(GIT_TAG_ANNOUNCE_FILE) >> git-tag-announce-file.tmp + +git-tag: git-tag-announce-file.tmp + git tag \ + $(GIT_TAG_ANNOTATION_FLAGS) \ + make-$(VERTAG) \ + -F git-tag-announce-file.tmp +else +git-tag: + git tag \ + $(GIT_TAG_ANNOTATION_FLAGS) \ + make-$(VERTAG) \ + -F $(GIT_TAG_ANNOUNCE_FILE) +endif +endif + +git-dist: + git archive --format=tar.gz make-$(VERTAG) -o gnustep-make-$(GNUSTEP_MAKE_VERSION).tar.gz --prefix=gnustep-make-$(GNUSTEP_MAKE_VERSION)/ + test-RPM_TOPDIR: @(if [ -z "$(RPM_TOPDIR)" ]; then \ echo "Error - RPM_TOPDIR variable not set."; \ From 88ea3f8589510fe50e0364fe8d6fd6f5a5690842 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Vu=C4=8Dica?= Date: Sun, 10 Dec 2017 16:11:16 +0000 Subject: [PATCH 4/4] git: Fix a bug where old ANNOUNCE text might get added to annotated tag. When adding an ANNOUNCE file to the annotated tag, added dependency on the passed ANNOUNCE file to ensure the temporary file which prepends 'Release x.yz' gets regenerated while tagging. --- ChangeLog | 8 ++++++++ GNUmakefile.in | 12 ++++++------ Master/source-distribution.make | 12 ++++++------ 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 44e3c517a..ff018c144 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2017-12-10 Ivan Vucica + + * Master/source-distribution.make + * GNUmakefile.in: + When adding an ANNOUNCE file to the annotated tag, added dependency + on the passed ANNOUNCE file to ensure the temporary file which + prepends 'Release x.yz' gets regenerated while tagging. + 2017-12-07 Ivan Vucica * Master/source-distribution.make: Allow creating a Git tag and diff --git a/GNUmakefile.in b/GNUmakefile.in index 3f507c6e8..caf34b2d7 100644 --- a/GNUmakefile.in +++ b/GNUmakefile.in @@ -439,16 +439,16 @@ git-tag: -m "Release $(GNUSTEP_MAKE_VERSION)." else ifneq ($(GIT_TAG_ANNOUNCE_OMIT_PREFACE),yes) -.INTERMEDIATE += git-tag-announce-file.tmp -git-tag-announce-file.tmp: - printf "Release $(GNUSTEP_MAKE_VERSION).\n\n" > git-tag-announce-file.tmp - cat $(GIT_TAG_ANNOUNCE_FILE) >> git-tag-announce-file.tmp +.INTERMEDIATE += git-tag-announce-file_$(GNUSTEP_MAKE_VERSION).tmp +git-tag-announce-file_$(GNUSTEP_MAKE_VERSION).tmp: $(GIT_TAG_ANNOUNCE_FILE) + printf "Release $(GNUSTEP_MAKE_VERSION).\n\n" > $@ + cat $(GIT_TAG_ANNOUNCE_FILE) >> $@ -git-tag: git-tag-announce-file.tmp +git-tag: git-tag-announce-file_$(GNUSTEP_MAKE_VERSION).tmp git tag \ $(GIT_TAG_ANNOTATION_FLAGS) \ make-$(VERTAG) \ - -F git-tag-announce-file.tmp + -F $< else git-tag: git tag \ diff --git a/Master/source-distribution.make b/Master/source-distribution.make index a45b0455a..4db9ba603 100644 --- a/Master/source-distribution.make +++ b/Master/source-distribution.make @@ -409,16 +409,16 @@ git-tag: -m "Release $(PACKAGE_VERSION)" else ifneq ($(GIT_TAG_ANNOUNCE_OMIT_PREFACE),yes) -.INTERMEDIATE += git-tag-announce-file.tmp -git-tag-announce-file.tmp: - printf "Release $(PACKAGE_VERSION).\n\n" > git-tag-announce-file.tmp - cat $(GIT_TAG_ANNOUNCE_FILE) >> git-tag-announce-file.tmp +.INTERMEDIATE += git-tag-announce-file-$(VERTAG).tmp +git-tag-announce-file-$(VERTAG).tmp: $(GIT_TAG_ANNOUNCE_FILE) + printf "Release $(PACKAGE_VERSION).\n\n" > $@ + cat $(GIT_TAG_ANNOUNCE_FILE) >> $@ -git-tag: git-tag-announce-file.tmp +git-tag: git-tag-announce-file-$(VERTAG).tmp $(GIT) tag \ $(GIT_TAG_ANNOTATION_FLAGS) \ $(GIT_TAG_NAME)-$(VERTAG) \ - -F git-tag-announce-file.tmp + -F $< else git-tag: $(GIT) tag \