Based on request from:
  
https://lists.fedorahosted.org/pipermail/scap-security-guide/2013-October/004210.html

introduce also new RPM versioning scheme also for RHEL6/JBossEAP5 content.

* Makefile changes:
- retrieve necessary values from RHEL-6 spec file,
- organize Makefile into sections (RHEL-6 section,
  Fedora section below, custom macros definition follows,
  then Makefile targets),
- in the 'srpm' target remove explicit setting of following variables:
  - ARCH - not needed, defined in *.spec directly,
  - PKGNAME, VERSION, RELEASE - defined in *.spec directly,
  - VENDOR - defined in *.spec directly,
  - PACKAGER - not needed. When building in Koji, packager will be
    set automatically to "Fedora Project", when building locally it's
    not needed (rpmlint complains when PACKAGER set up directly),
  - _sysconfdir on RHEL-6 system is defined too (as can be double-checked
    by rpm --eval), so no need to re-define it exactly.
  
* scap-security-guide.spec changes:
- introduce 'redhatssgrelease',
- add Vendor && BuildArch,
- update missing %changelog records with proper entries (according
  to the git log)

* the only remaining rpmlint warning to be fixed is exact source location.

Tests:
- a, RHEL-6 (make tarball, srpm, rpm passes), final xccdf eval passes,
     guide is generated correctly,
- b, Fedora (make fedora-{tarball, srpm, rpm}), final xccdf eval pass,
     guide is generated correctly.


Thank you && Regards, Jan.
--
Jan iankko Lieskovsky / Red Hat Security Technologies Team
From 304af92b4e4629333ca8b0479db1e2d5f341b67b Mon Sep 17 00:00:00 2001
From: Jan Lieskovsky <[email protected]>
Date: Mon, 7 Oct 2013 18:50:19 +0200
Subject: [PATCH] Introduce new RPM versioning scheme for RHEL6 / JBossEAP
 content


Signed-off-by: Jan Lieskovsky <[email protected]>
---
 Makefile                 | 32 ++++++++++++--------------------
 scap-security-guide.spec | 23 +++++++++++++++--------
 2 files changed, 27 insertions(+), 28 deletions(-)

diff --git a/Makefile b/Makefile
index 260c833..8a067bc 100644
--- a/Makefile
+++ b/Makefile
@@ -1,43 +1,36 @@
-VERSION := 0.1
-RELEASE := 12.el6
-PKGNAME := scap-security-guide
-PKG := $(PKGNAME)-$(VERSION)
-
-ARCH := noarch
-VENDOR := scap-security-guide
-PACKAGER := scap-security-guide
-
+# Define RHEL6 / JBossEAP5 specific variables below
 ROOT_DIR ?= $(CURDIR)
-
 RPM_SPEC := $(ROOT_DIR)/scap-security-guide.spec
+PKGNAME := $(shell sed -ne 's/Name:\t\t\(.*\)/\1/p' $(RPM_SPEC))
+VERSION := $(shell sed -ne 's/Version:\t\(.*\)/\1/p' $(RPM_SPEC))
+REDHAT_SSG_RELEASE := $(shell sed -ne 's/^\(.*\)redhatssgrelease\t\(.*\)/\2/p' $(RPM_SPEC))
+REDHAT_DIST := $(shell rpm --eval '%{dist}')
+RELEASE := $(REDHAT_SSG_RELEASE)$(REDHAT_DIST)
+PKG := $(PKGNAME)-$(VERSION)-$(REDHAT_SSG_RELEASE)
 
+ARCH := noarch
 TARBALL = $(RPM_TOPDIR)/SOURCES/$(PKG).tar.gz
 
 RPM_DEPS := tarball $(RPM_SPEC) Makefile
-
 RPM_TMPDIR ?= $(ROOT_DIR)/rpmbuild
 RPM_TOPDIR ?= $(RPM_TMPDIR)/src/redhat
 RPM_BUILDROOT ?= $(RPM_TMPDIR)/rpm-buildroot
-
-
-MKDIR = test -d $(1) || mkdir -p $(1)
-
 RPMBUILD_ARGS := --define '_topdir $(RPM_TOPDIR)'  --define '_tmppath $(RPM_TMPDIR)'
 
 # Define Fedora specific variables below
 FEDORA_SPEC := $(ROOT_DIR)/Fedora/scap-security-guide.spec
 FEDORA_RPM_DEPS := $(FEDORA_SPEC) Makefile
-
 FEDORA_NAME := $(PKGNAME)
 FEDORA_VERSION := $(shell sed -ne 's/Version:\t\(.*\)/\1/p' $(FEDORA_SPEC))
 FEDORA_SSG_RELEASE := $(shell sed -ne 's/^\(.*\)\tfedorassgrelease\t\(.*\)/\2/p' $(FEDORA_SPEC))
-
 FEDORA_PKG := $(FEDORA_NAME)-$(FEDORA_VERSION)-$(FEDORA_SSG_RELEASE)
 FEDORA_TARBALL := $(RPM_TOPDIR)/SOURCES/$(FEDORA_PKG).tar.gz
 FEDORA_DIST := $(shell rpm --eval '%{dist}')
 
 # Define custom canned sequences / macros below
 
+MKDIR = test -d $(1) || mkdir -p $(1)
+
 define rpm-prep
 	$(call MKDIR,$(RPM_TMPDIR)/$(PKG))
 	$(call MKDIR,$(RPM_BUILDROOT))
@@ -117,8 +110,7 @@ zipfile:
 
 srpm: $(RPM_DEPS)
 	@echo "Building $(PKGNAME) SRPM..."
-	echo -e "%define arch $(ARCH)\n%define pkgname $(PKGNAME)\n%define _sysconfdir /etc\n%define version $(VERSION)\n%define release $(RELEASE)\n%define vendor $(VENDOR)\n%define packager $(PACKAGER)" > $(RPM_TOPDIR)/SPECS/$(notdir $(RPM_SPEC))
-	cat $(RPM_SPEC) >> $(RPM_TOPDIR)/SPECS/$(notdir $(RPM_SPEC))
+	cat $(RPM_SPEC) > $(RPM_TOPDIR)/SPECS/$(notdir $(RPM_SPEC))
 	cd $(RPM_TOPDIR) && rpmbuild $(RPMBUILD_ARGS) --target=$(ARCH) -bs SPECS/$(notdir $(RPM_SPEC)) --nodeps
 
 fedora-srpm: $(FEDORA_RPM_DEPS)
@@ -140,7 +132,7 @@ fedora-srpm: $(FEDORA_RPM_DEPS)
 
 rpm: srpm
 	 @echo "Building $(PKG) RPM..."
-	 cd $(RPM_TOPDIR)/SRPMS && rpmbuild --rebuild --target=$(ARCH) $(RPMBUILD_ARGS) --buildroot $(RPM_BUILDROOT) -bb $(PKG)-$(RELEASE).src.rpm
+	 cd $(RPM_TOPDIR)/SRPMS && rpmbuild --rebuild --target=$(ARCH) $(RPMBUILD_ARGS) --buildroot $(RPM_BUILDROOT) -bb $(PKG)$(REDHAT_DIST).src.rpm
 
 fedora-rpm: fedora-srpm
 	@echo "Building Fedora $(FEDORA_PKG) RPM package..."
diff --git a/scap-security-guide.spec b/scap-security-guide.spec
index 3f91499..acefbd9 100644
--- a/scap-security-guide.spec
+++ b/scap-security-guide.spec
@@ -1,16 +1,20 @@
-Name:           scap-security-guide
-Version:	%{version}
-Release:	%{release}
+
+%global		redhatssgrelease	14.rc1
+
+Name:		scap-security-guide
+Version:	0.1
+Release:	%{redhatssgrelease}%{?dist}
 Summary:	Security guidance and baselines in SCAP formats
+Vendor:		scap-security-guide
 
 Group:		System Environment/Base
 License:	Public Domain
 URL:		https://fedorahosted.org/scap-security-guide/
 
-Source0:	%{name}-%{version}.tar.gz
+Source0:	%{name}-%{version}-%{redhatssgrelease}.tar.gz
 BuildRoot:	%(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
 
-BuildArch:	%{arch}
+BuildArch:	noarch
 
 BuildRequires:	coreutils, libxslt, expat, python, openscap-utils >= 0.9.1, python-lxml
 Requires:	filesystem, openscap-utils >= 0.9.1
@@ -22,7 +26,7 @@ catalog of practical hardening advice and links it to government requirements
 where applicable. The project bridges the gap between generalized policy
 requirements and specific implementation guidance.
 %prep
-%setup -q 
+%setup -q -n %{name}-%{version}-%{redhatssgrelease}
 
 %build
 cd RHEL6 && make dist
@@ -52,11 +56,14 @@ rm -rf $RPM_BUILD_ROOT
 %lang(en) %{_mandir}/en/man8/scap-security-guide.8.gz
 
 %changelog
+* Mon Oct 07 2013 Jan iankko Lieskovsky <[email protected]> 0.1-14.rc1
+- Change RPM versioning scheme to include release into tarball
+
 * Sat Sep 28 2013 Shawn Wells <[email protected]> 0.1-13
-- test
+- Updated RPM spec file to fix rpmlint warnings
 
 * Wed Jun 26 2013 Shawn Wells <[email protected]> 0.1-12
-- 
+- Updated RPM version to 0.1-12
 
 * Fri Apr 26 2013 Shawn Wells <[email protected]> 0.1-11
 - Significant amount of OVAL bugfixes
-- 
1.7.11.7

_______________________________________________
scap-security-guide mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/scap-security-guide

Reply via email to