On 5/5/14, 7:04 AM, Jan Lieskovsky wrote:
Patch summary:
--------------

This change is similar / the same for RHEL like the one:
https://git.fedorahosted.org/cgit/scap-security-guide.git/commit/?id=494df01ad169bcc4b49cea15ba933909009e2125
for Fedora was, i.e.:

* allow flexible versioning scheme (make multiple rc's prior
   new stable release),

* but on the other hand make Release: tag / flag to contain
   only fixed number (as required by Red Hat Enterprise Linux
   build system), so Release: can be easily incremented in
   case RHEL- specific package rebuild without the corresponding
   upstream change would be necessary.

Testing report:
---------------

Tested all combinations of:
   * upper level: make / make srpm (with or without remote tarball fetch)
                  / make rpm / make fedora-srpm / make fedora-rpm

     The change returns PASS in all cases (IOW no regression).

   * RHEL/{6,7}, Fedora: make / make validate

     The change returns PASS in all cases (IOW no regression).


Please review the change (it's necessary / required me to be able to build 
native
RHEL-6 channels RPM package).

Thank you && Regards, Jan.
--
Jan iankko Lieskovsky / Red Hat Security Technologies Team

0001-RHEL-6-Change-naming-scheme-0.1-16-0.1.16.patch


 From 0dbf62df3e0f9d50ea3aceb0a083434055be07ab Mon Sep 17 00:00:00 2001
From: Jan Lieskovsky<[email protected]>
Date: Mon, 5 May 2014 12:51:13 +0200
Subject: [PATCH] [RHEL/6] Change naming scheme (0.1-16 => 0.1.16)

Similar like in 494df01ad169bcc4b49cea15ba933909009e2125 change
for Fedora, this change for RHEL is required to be able:
* on one hand to use flexible versioning scheme (have couple of rc
   candidates prior final stable release),
* but on the other have Release: tag to contain just fixed number,
   so it can be easily incremented (in case RHEL- specific update
   would be required without the corresponding upstream change)

Signed-off-by: Jan Lieskovsky<[email protected]>
---
  Fedora/scap-security-guide.spec |  8 ++++----
  Makefile                        | 28 +++++++++++++++-------------
  scap-security-guide.spec        | 13 ++++++++-----
  3 files changed, 27 insertions(+), 22 deletions(-)

diff --git a/Fedora/scap-security-guide.spec b/Fedora/scap-security-guide.spec
index ef6bf71..c5a8911 100644
--- a/Fedora/scap-security-guide.spec
+++ b/Fedora/scap-security-guide.spec
@@ -10,7 +10,7 @@
# Used to specify RHEL scap-security-guide tarball source
  # (needs to match latest EPEL-6 scap-security-guide RPM release)
-%global        rhelssgsource           0.1-16
+%global        rhelssgversion          0.1.16
Name: scap-security-guide
  Version:      0.1.%{fedorassgversion}
@@ -20,7 +20,7 @@ Group:                Applications/System
  License:      Public Domain
  URL:          https://fedorahosted.org/scap-security-guide/
  Source0:      http://fedorapeople.org/~jlieskov/%{name}-%{version}.tar.gz
-Source1:       
http://repos.ssgproject.org/sources/%{name}-%{rhelssgsource}.tar.gz
+Source1:       
http://repos.ssgproject.org/sources/%{name}-%{rhelssgversion}.tar.gz
  BuildArch:    noarch
  BuildRequires:        libxslt, expat, python, openscap-utils >= 0.9.1, 
python-lxml
  Requires:     xml-common, openscap-utils >= 0.9.1
@@ -46,7 +46,7 @@ further information.
  # Build Fedora distribution content
  (cd Fedora && make dist)
  # Change CWD to point to RHEL content. Build RHEL content
-pushd %{name}-%{rhelssgsource}
+pushd %{name}-%{rhelssgversion}
  (cd RHEL/6 && make dist)
  (cd RHEL/7 && make dist)
  # Restore CWD to old value
@@ -65,7 +65,7 @@ cp -a Fedora/input/auxiliary/scap-security-guide.8 
%{buildroot}%{_mandir}/en/man
# Change CWD to point to RHEL content. Copy
  # datastreams to appropriate buildroot places
-pushd %{name}-%{rhelssgsource}
+pushd %{name}-%{rhelssgversion}
  # Add in datastream form of RHEL-6 benchmark
  cp -a RHEL/6/dist/content/ssg-rhel6-ds.xml 
%{buildroot}%{_datadir}/xml/scap/ssg/rhel6
  # Add in datastream form of RHEL-7 benchmark
diff --git a/Makefile b/Makefile
index cfd9548..44ceae3 100644
--- a/Makefile
+++ b/Makefile
@@ -2,11 +2,12 @@
  ROOT_DIR ?= $(CURDIR)
  RPM_SPEC := $(ROOT_DIR)/scap-security-guide.spec
  PKGNAME := $(shell sed -ne 's/Name:\t\t\(.*\)/\1/p' $(RPM_SPEC))
+REDHAT_SSG_VERSION := $(shell sed -ne 's/^\(.*\)redhatssgversion\t\(.*\)/\2/p' 
$(RPM_SPEC))
+REDHAT_RPM_VERSION := $(shell sed -ne 's/Version:\t\(.*\)/\1/p' $(RPM_SPEC))
+$(eval REDHAT_RPM_VERSION := $(shell echo $(REDHAT_RPM_VERSION) | sed -ne 
's/%{redhatssgversion}/$(REDHAT_SSG_VERSION)/p'))
  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)
+PKG := $(PKGNAME)-$(REDHAT_RPM_VERSION)
ARCH := noarch
  TARBALL = $(RPM_TOPDIR)/SOURCES/$(PKG).tar.gz
@@ -76,7 +77,7 @@ tarball:
        (cd $(RPM_TMPDIR)/$(PKG)/RHEL/6/ && $(MAKE) clean)
        (cd $(RPM_TMPDIR)/$(PKG)/RHEL/7/ && $(MAKE) clean)
- # Create the source tar, copy it to $TARBALL
+       # Create the source tar, copy it to TARBALL
        # (e.g. somewhere in the SOURCES directory)
        cd $(RPM_TMPDIR) && tar -czf $(PKG).tar.gz $(PKG)
        cp $(RPM_TMPDIR)/$(PKG).tar.gz $(TARBALL)
@@ -116,17 +117,16 @@ zipfile:
        # at working directory. Should look into this sometime
        #
        #cd $(RPM_TOPDIR)/ZIP
-       #zip -r $(PKG)-$(RELEASE).zip . * -j
-       zip -r $(PKG)-$(RELEASE).zip $(RPM_TOPDIR)/ZIP/* -j
-       mv $(PKG)-$(RELEASE).zip $(RPM_TOPDIR)/ZIP/
+       #zip -r $(PKG).zip . * -j
+       zip -r $(PKG).zip $(RPM_TOPDIR)/ZIP/* -j
+       mv $(PKG).zip $(RPM_TOPDIR)/ZIP/
srpm: $(RPM_DEPS)
        # Obtain the source from RedHat's spec file
        $(eval SOURCE := $(shell sed -ne 's/Source0:\t\(.*\)/\1/p' $(RPM_SPEC)))
-       # Substitute %{name}, %{version}, and %{redhatssgrelease} with their 
actual values
-       $(eval SOURCE := $(shell echo $(SOURCE) | sed -ne 
"s/%{name}/$(PKGNAME)/p"))
-       $(eval SOURCE := $(shell echo $(SOURCE) | sed -ne 
"s/%{version}/$(VERSION)/p"))
-       $(eval SOURCE := $(shell echo $(SOURCE) | sed -ne 
"s/%{redhatssgrelease}/$(REDHAT_SSG_RELEASE)/p"))
+       # Substitute %{name} and %{version} with their actual values
+       $(eval SOURCE := $(shell echo $(SOURCE) | sed -ne 
's/%{name}/$(PKGNAME)/p'))
+       $(eval SOURCE := $(shell echo $(SOURCE) | sed -ne 
's/%{version}/$(REDHAT_RPM_VERSION)/p'))
        # Download the tarball
        @echo "Downloading the $(SOURCE) tarball..."
        # If performing a real RPM build, uncomment the next line
@@ -158,8 +158,10 @@ fedora-srpm: $(FEDORA_RPM_DEPS)
        cd $(RPM_TOPDIR) && rpmbuild $(RPMBUILD_ARGS) --target=$(ARCH) -bs 
SPECS/$(notdir $(FEDORA_SPEC)) --nodeps
rpm: srpm
-        @echo "Building $(PKG) RPM..."
-        cd $(RPM_TOPDIR)/SRPMS && rpmbuild --rebuild --target=$(ARCH) 
$(RPMBUILD_ARGS) --buildroot $(RPM_BUILDROOT) -bb $(PKG)$(REDHAT_DIST).src.rpm
+       $(eval REDHAT_RPM_RELEASE := $(shell sed -ne 's/Release:\t\(.*\)/\1/p' 
$(RPM_SPEC)))
+       $(eval REDHAT_RPM_RELEASE := $(shell echo $(REDHAT_RPM_RELEASE) | sed 
-ne 's/%{?dist}/$(REDHAT_DIST)/p'))
+       @echo "Building $(PKG) RPM..."
+       cd $(RPM_TOPDIR)/SRPMS && rpmbuild --rebuild --target=$(ARCH) 
$(RPMBUILD_ARGS) --buildroot $(RPM_BUILDROOT) -bb $(PKG)-$(REDHAT_RPM_RELEASE).src.rpm
fedora-rpm: fedora-srpm
        $(eval FEDORA_RPM_RELEASE := $(shell sed -ne 's/Release:\t\(.*\)/\1/p' 
$(FEDORA_SPEC)))
diff --git a/scap-security-guide.spec b/scap-security-guide.spec
index 786a8eb..73f0062 100644
--- a/scap-security-guide.spec
+++ b/scap-security-guide.spec
@@ -1,8 +1,8 @@
-%global                redhatssgrelease        16
+%global                redhatssgversion        16
Name: scap-security-guide
-Version:       0.1
-Release:       %{redhatssgrelease}%{?dist}
+Version:       0.1.%{redhatssgversion}
+Release:       1%{?dist}
  Summary:      Security guidance and baselines in SCAP formats
  Vendor:               scap-security-guide
@@ -10,7 +10,7 @@ Group: System Environment/Base
  License:      Public Domain
  URL:          https://fedorahosted.org/scap-security-guide/
-Source0: http://repos.ssgproject.org/sources/%{name}-%{version}-%{redhatssgrelease}.tar.gz
+Source0:       http://repos.ssgproject.org/sources/%{name}-%{version}.tar.gz
BuildArch: noarch @@ -29,7 +29,7 @@ from the openscap-utils package to verify that the system conforms to provided
  guideline. Refer to scap-security-guide(8) manual page for further 
information.
%prep
-%setup -q -n %{name}-%{version}-%{redhatssgrelease}
+%setup -q -n %{name}-%{version}
%build
  (cd RHEL/6 && make dist)
@@ -53,6 +53,9 @@ cp -a RHEL/6/input/auxiliary/scap-security-guide.8 
%{buildroot}%{_mandir}/en/man
  %doc RHEL/6/LICENSE RHEL/6/output/rhel6-guide.html 
RHEL/6/output/table-rhel6-cces.html 
RHEL/6/output/table-rhel6-nistrefs-common.html 
RHEL/6/output/table-rhel6-nistrefs.html 
RHEL/6/output/table-rhel6-srgmap-flat.html 
RHEL/6/output/table-rhel6-srgmap-flat.xhtml 
RHEL/6/output/table-rhel6-srgmap.html RHEL/6/output/table-rhel6-stig.html 
JBossEAP5/docs/JBossEAP5_Guide.html
%changelog
+* Mon May 05 2014 Jan iankko Lieskovsky <[email protected]) 0.1.16-1
+- Change naming scheme (0.1-16 => 0.1.16-1)
+
  * Fri Feb 21 2014 Jan iankko Lieskovsky<[email protected]>  0.1-16
  - Include datastream files into RHEL6 and RHEL7 RPM packages too
  - Bump version
-- 1.8.3.1



Ack, and thanks for the clean up
_______________________________________________
scap-security-guide mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/scap-security-guide

Reply via email to