rpm-ostree/Makefile.dist-packaging

38 lines
1.2 KiB
Makefile
Raw Normal View History

2014-01-16 05:05:54 +04:00
# -*- mode: Makefile -*-
GITREV = $$(git describe --always --tags)
GITREV_FOR_PKG = $(shell echo "$(GITREV)" | sed -e 's,-,\.,g' -e 's,^v,,')
2014-01-16 02:41:21 +04:00
srcdir=$(shell pwd)
PACKAGE=$(shell basename $(srcdir))
2014-01-16 05:05:54 +04:00
PKG_VER = $(PACKAGE)-$(GITREV_FOR_PKG)
2014-01-16 02:41:21 +04:00
dist-snapshot:
set -x; \
echo "PACKAGE=$(PACKAGE)"; \
2014-01-16 05:05:54 +04:00
TARFILE_TMP=$(PKG_VER).tar.tmp; \
echo "Archiving $(PACKAGE) at $(GITREV)"; \
(cd $(srcdir); git archive --format=tar --prefix=$(PKG_VER)/ $(GITREV)) > $${TARFILE_TMP}; \
2014-01-16 02:41:21 +04:00
(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}"; \
2014-01-16 05:05:54 +04:00
(cd $(srcdir)/$$path; git archive --format=tar --prefix=$(PKG_VER)/$$path/ $${rev}) > submodule.tar; \
2014-01-16 02:41:21 +04:00
tar -A -f $${TARFILE_TMP} submodule.tar; \
rm submodule.tar; \
done; \
2014-01-16 05:05:54 +04:00
mv $(PKG_VER).tar{.tmp,}; \
rm -f $(PKG_VER).tar.xz; \
xz $(PKG_VER).tar
2014-01-16 02:41:21 +04:00
srpm: dist-snapshot
2014-01-16 05:05:54 +04:00
sed -e "s,^Version:.*,Version: $(GITREV_FOR_PKG)," $(srcdir)/packaging/$(PACKAGE).spec.in > $(PACKAGE).spec
2014-01-16 02:41:21 +04:00
$(srcdir)/packaging/rpmbuild-cwd -bs $(PACKAGE).spec
rpm: srpm
2014-01-16 05:05:54 +04:00
$(srcdir)/packaging/rpmbuild-cwd --rebuild $(PKG_VER)*.src.rpm
2014-01-16 02:41:21 +04:00
buildinstall: rpm
sudo yum localinstall $(PKG_VER)*.src.rpm