File: Makefile.dist-packaging

package info (click to toggle)
libgsystem 2015.2+deb-4
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 656 kB
  • ctags: 502
  • sloc: ansic: 5,031; sh: 494; makefile: 36
file content (39 lines) | stat: -rw-r--r-- 1,305 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# -*- mode: Makefile -*-

GITREV = $$(git describe --always --tags)
GITREV_FOR_PKG = $(shell echo "$(GITREV)" | sed -e 's,-,\.,g' -e 's,^v,,')

srcdir=$(shell pwd)
PACKAGE=$(shell basename $(srcdir))

PKG_VER = $(PACKAGE)-$(GITREV_FOR_PKG)

dist-snapshot:
	set -x; \
	echo "PACKAGE=$(PACKAGE)"; \
	TARFILE_TMP=$(PKG_VER).tar.tmp; \
	echo "Archiving $(PACKAGE) at $(GITREV)"; \
	(cd $(srcdir); git archive --format=tar --prefix=$(PKG_VER)/ $(GITREV)) > $${TARFILE_TMP}; \
	(cd $$(git rev-parse --show-toplevel); git submodule status) | while read line; do \
	  rev=$$(echo $$line | cut -f 1 -d ' '); path=$$(echo $$line | cut -f 2 -d ' '); \
	  echo "Archiving $${path} at $${rev}"; \
	  (cd $(srcdir)/$$path; git archive --format=tar --prefix=$(PKG_VER)/$$path/ $${rev}) > submodule.tar; \
	  tar -A -f $${TARFILE_TMP} submodule.tar; \
	  rm submodule.tar; \
	done; \
	mv $(PKG_VER).tar{.tmp,}; \
	rm -f $(PKG_VER).tar.xz; \
	xz $(PKG_VER).tar 

srpm: dist-snapshot
	(cd $(srcdir)/packaging; \
	 cp ../$(PKG_VER).tar.xz . ; \
	 sed -e "s,^Version:.*,Version: $(GITREV_FOR_PKG)," $(PACKAGE).spec.in > $(PACKAGE).spec; \
	 ./rpmbuild-cwd -bs $(PACKAGE).spec)

rpm: srpm
	$(srcdir)/packaging/rpmbuild-cwd --rebuild packaging/$(PKG_VER)*.src.rpm

buildinstall: rpm
	sudo yum localinstall $(PKG_VER)*.src.rpm