[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[sysvinit-devel] [PATCH 4/6] build: Fix dist targets

From: Guillem Jover
Subject: [sysvinit-devel] [PATCH 4/6] build: Fix dist targets
Date: Fri, 4 May 2018 23:31:43 +0200

Simply use «git describe» to fetch the current version, based on the
nearest tag.

Do not try to infer the remote user from the remote URL, just rely on
ssh having been properly configured locally.

Use «git archive» instead of messing around with temporary directories
and source tree copies, which can leave cruft behind.

Signed-off-by: Guillem Jover <address@hidden>
 Makefile | 26 +++++++-------------------
 1 file changed, 7 insertions(+), 19 deletions(-)

diff --git a/Makefile b/Makefile
index 052faa2..52b96a9 100644
--- a/Makefile
+++ b/Makefile
@@ -2,21 +2,15 @@ all install clean distclean:
        $(MAKE) -C src $@
-VERSION=$(shell sed -rn '1s/.*[[:blank:]]\((.*)\)[[:blank:]].*/\1/p' 
-GITLOGIN=$(shell git remote -v | head -n 1 | cut -f 3 -d '/' | cut -f 1 -d '@')
-override TMP:=$(shell mktemp -d $(VERSION).XXXXXXXX)
-override TARBALL:=$(TMP)/$(PACKAGE)-$(VERSION).tar.bz2
-override SFTPBATCH:=$(TMP)/$(VERSION)-sftpbatch
-SOURCES=contrib  COPYING  COPYRIGHT  doc  Makefile  man  README  src
+VERSION=$(shell git describe --tags --abbrev=4 HEAD 2>/dev/null | tr %_ :~)
+override TARBALL=$(PACKAGE)-$(VERSION).tar.bz2
+override SFTPBATCH=upload-$(VERSION)-sftpbatch
 dist: $(TARBALL)
-       @cp $(TARBALL) .
-       @echo "tarball $(PACKAGE)-$(VERSION).tar.bz2 ready"
-       rm -rf $(TMP)
+       @echo "tarball $(TARBALL) ready"
 upload: $(SFTPBATCH)
-       echo @sftp -b $< $(GITLOGIN)$(PACKAGE)
-       rm -rf $(TMP)
+       echo @sftp -b $<$(PACKAGE)
        @echo progress > $@
@@ -31,11 +25,5 @@ $(SFTPBATCH): $(TARBALL).sig
        @gpg -q -ba --use-agent -o $@ $<
-       @tar --exclude=.git --bzip2 --owner=nobody --group=nogroup -cf $@ -C 
-       @mkdir $(TMP)/$(PACKAGE)-$(VERSION)
-       @cp -R $(SOURCES) $(TMP)/$(PACKAGE)-$(VERSION)/ 
-       @chmod -R a+r,u+w,og-w $@
-       @find $@ -type d | xargs -r chmod a+rx,u+w,og-w
+$(TARBALL): .git
+       @git archive --prefix=$(PACKAGE)-$(VERSION)/ $(VERSION) -o $(TARBALL)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]