[PATCH] Add support for zipfile creation

Shawn Wells shawn.d.wells at gmail.com
Sat Feb 16 16:50:05 UTC 2013


>From bd4d73795c04559016dcfce2ee12939141e8bc5d Mon Sep 17 00:00:00 2001
From: Shawn Wells <shawn at redhat.com>
Date: Sat, 16 Feb 2013 07:19:14 -0500
Subject: [PATCH] Add support for zipfile creation
 Added new make target to generate a flat zipfile for tools which need/desire
 ZIP packaging of content.

---
 Makefile |   34 ++++++++++++++++++++++++++--------
 1 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/Makefile b/Makefile
index 4cc971d..ddc7cdc 100644
--- a/Makefile
+++ b/Makefile
@@ -25,16 +25,17 @@ MKDIR = test -d $(1) || mkdir -p $(1)
 RPMBUILD_ARGS := --define '_topdir $(RPM_TOPDIR)'  --define '_tmppath $(RPM_TMPDIR)'
 
 define rpm-prep
-	 $(call MKDIR,$(RPM_TMPDIR)/$(PKG))
-	 $(call MKDIR,$(RPM_BUILDROOT))
-	 $(call MKDIR,$(RPM_TOPDIR)/SOURCES)
-	 $(call MKDIR,$(RPM_TOPDIR)/SPECS)
-	 $(call MKDIR,$(RPM_TOPDIR)/BUILD)
-	 $(call MKDIR,$(RPM_TOPDIR)/RPMS/$(ARCH))
-	 $(call MKDIR,$(RPM_TOPDIR)/SRPMS)
+	$(call MKDIR,$(RPM_TMPDIR)/$(PKG))
+	$(call MKDIR,$(RPM_BUILDROOT))
+	$(call MKDIR,$(RPM_TOPDIR)/SOURCES)
+	$(call MKDIR,$(RPM_TOPDIR)/SPECS)
+	$(call MKDIR,$(RPM_TOPDIR)/BUILD)
+	$(call MKDIR,$(RPM_TOPDIR)/RPMS/$(ARCH))
+	$(call MKDIR,$(RPM_TOPDIR)/SRPMS)
+	$(call MKDIR,$(RPM_TOPDIR)/ZIP)
 endef
 
-all: rhel6 rpm
+all: rhel6 rpm zipfile
 
 rhel6:
 	cd RHEL6 && $(MAKE)
@@ -56,6 +57,23 @@ tarball:
 	cd $(RPM_TMPDIR) && tar -czf $(PKG).tar.gz $(PKG)
 	cp $(RPM_TMPDIR)/$(PKG).tar.gz $(TARBALL)
 
+zipfile:
+	# Create a zipfile release, since many SCAP
+	# tools desire content in that format
+	# (Note: By default zip will store the full path
+	#	 relative to the current directory, need
+	#	 to cd into $(RPM_TMPDIR)
+	cp RHEL6/output/ssg-* $(RPM_TOPDIR)/ZIP/
+	cp JBossEAP5/eap5-* $(RPM_TOPDIR)/ZIP/
+	# Originally attempted to `cd $(RPM_TOPDIR/ZIP` and
+	# make the zip from there, however it still placed it
+	# 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/
+
 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))
-- 
1.7.1



More information about the scap-security-guide mailing list