aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2011-11-30 13:23:01 +0000
committerDavid Howells <dhowells@redhat.com>2011-11-30 13:23:01 +0000
commit03a42dc76efc21370ff36134f178bc499376c9a8 (patch)
tree96c93e9414c3fa488c9e6ddca1919ae98bc99b95
parentd4dea943947ffe91d3ba1fe05e84fa4c8f46fcdd (diff)
downloadkeyutils-03a42dc76efc21370ff36134f178bc499376c9a8.tar.gz
Build: Add build ID and rpmlint facilities
Add a build ID facility to the specfile and the Makefile and add a make rule to run rpmlint. Signed-off-by: David Howells <dhowells@redhat.com>
-rw-r--r--Makefile37
-rw-r--r--keyutils.spec4
2 files changed, 31 insertions, 10 deletions
diff --git a/Makefile b/Makefile
index 85424d2..b7ba07e 100644
--- a/Makefile
+++ b/Makefile
@@ -27,6 +27,8 @@ MAJOR := $(word 3,$(vermajor))
MINOR := $(word 3,$(verminor))
VERSION := $(MAJOR).$(MINOR)
+TARBALL := keyutils-$(VERSION).tar.bz2
+
###############################################################################
#
# Determine the current library version from the version script
@@ -216,28 +218,45 @@ distclean: clean
# Generate a tarball
#
###############################################################################
-TARBALL := keyutils-$(VERSION).tar.bz2
+$(TARBALL):
+ git archive --prefix=cachefilesd-$(VERSION)/ --format tar -o $(TARBALL) HEAD
+
+tarball: $(TARBALL)
+
+###############################################################################
+#
+# Generate an RPM
+#
+###############################################################################
SRCBALL := rpmbuild/SOURCES/$(TARBALL)
+BUILDID := .local
dist := $(word 2,$(shell grep "%dist" /etc/rpm/macros.dist))
release := $(word 2,$(shell grep ^Release: $(SPECFILE)))
release := $(subst %{?dist},$(dist),$(release))
+release := $(subst %{?buildid},$(BUILDID),$(release))
rpmver := $(VERSION)-$(release)
SRPM := rpmbuild/SRPMS/keyutils-$(rpmver).src.rpm
RPMBUILDDIRS := \
- --define "_srcrpmdir $(PWD)/rpmbuild/SRPMS" \
- --define "_rpmdir $(PWD)/rpmbuild/RPMS" \
- --define "_sourcedir $(PWD)/rpmbuild/SOURCES" \
- --define "_specdir $(PWD)/rpmbuild/SPECS" \
- --define "_builddir $(PWD)/rpmbuild/BUILD" \
- --define "_buildrootdir $(PWD)/rpmbuild/BUILDROOT"
+ --define "_srcrpmdir $(CURDIR)/rpmbuild/SRPMS" \
+ --define "_rpmdir $(CURDIR)/rpmbuild/RPMS" \
+ --define "_sourcedir $(CURDIR)/rpmbuild/SOURCES" \
+ --define "_specdir $(CURDIR)/rpmbuild/SPECS" \
+ --define "_builddir $(CURDIR)/rpmbuild/BUILD" \
+ --define "_buildrootdir $(CURDIR)/rpmbuild/BUILDROOT"
+
+RPMFLAGS := \
+ --define "buildid $(BUILDID)"
rpm:
mkdir -p rpmbuild/{SPECS,SOURCES,BUILD,BUILDROOT,RPMS,SRPMS}
git archive --prefix=keyutils-$(VERSION)/ --format tar -o $(SRCBALL) HEAD
- rpmbuild -ts $(SRCBALL) --define "_srcrpmdir rpmbuild/SRPMS"
- rpmbuild --rebuild $(SRPM) $(RPMBUILDDIRS)
+ rpmbuild -ts $(SRCBALL) --define "_srcrpmdir rpmbuild/SRPMS" $(RPMFLAGS)
+ rpmbuild --rebuild $(SRPM) $(RPMBUILDDIRS) $(RPMFLAGS)
+
+rpmlint: rpm
+ rpmlint $(SRPM) $(CURDIR)/rpmbuild/RPMS/*/keyutils-{,libs-,libs-devel-,debuginfo-}$(rpmver).*.rpm
###############################################################################
#
diff --git a/keyutils.spec b/keyutils.spec
index 6dd8aea..0ec8d3f 100644
--- a/keyutils.spec
+++ b/keyutils.spec
@@ -6,10 +6,12 @@
%define libapivermajor 1
%define libapiversion %{libapivermajor}.4
+# % define buildid .local
+
Summary: Linux Key Management Utilities
Name: keyutils
Version: %{version}
-Release: 1%{?dist}
+Release: 1%{?dist}%{?buildid}
License: GPLv2+ and LGPLv2+
Group: System Environment/Base
ExclusiveOS: Linux