[Ovirt-devel] [PATCH] Added tar-src to ovirt.mk to help automate building SRPM archive to satisfy GPL
Alan Pevec
apevec at redhat.com
Tue Sep 16 20:10:38 UTC 2008
From: Perry Myers <pmyers at redhat.com>
Signed-off-by: Perry Myers <pmyers at redhat.com>
---
misc-scripts/getsrpms.py | 43 +++++++++++++++++++++++++++++++++++++++++++
ovirt-release.spec | 2 +-
ovirt.mk | 37 +++++++++++++++++++++++++++++++++++--
3 files changed, 79 insertions(+), 3 deletions(-)
create mode 100755 misc-scripts/getsrpms.py
diff --git a/misc-scripts/getsrpms.py b/misc-scripts/getsrpms.py
new file mode 100755
index 0000000..3e3b244
--- /dev/null
+++ b/misc-scripts/getsrpms.py
@@ -0,0 +1,43 @@
+#!/usr/bin/python -tt
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Library General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+"""
+NAME
+ getsrpms.py - stripped-down pungi-1.2.18.1 which downloads SRPMs only
+
+SYNOPSIS
+ getsrpms.py kickstart.cfg yum_cache
+
+ kickstart.cfg - kickstart with repo commands and %package section
+ yum_cache - YUM cache directory
+"""
+
+import pypungi.config
+import pypungi.gather
+import pykickstart.parser
+import pykickstart.version
+import sys
+
+config = pypungi.config.Config()
+
+# Set up the kickstart parser and pass in the kickstart file we were handed
+ksparser = pykickstart.parser.KickstartParser(pykickstart.version.makeVersion())
+ksparser.readKickstart(sys.argv[1])
+
+config.set('default', 'version', '')
+config.set('default', 'cachedir', sys.argv[2])
+mygather = pypungi.gather.Gather(config, ksparser)
+mygather.getPackageObjects()
+mygather.getSRPMList()
+mygather.downloadSRPMs()
diff --git a/ovirt-release.spec b/ovirt-release.spec
index 0be355d..851f5b1 100644
--- a/ovirt-release.spec
+++ b/ovirt-release.spec
@@ -22,7 +22,7 @@ which are not yet in Fedora.
Summary: oVirt Build Scripts for developers
Group: Applications/System
Requires: %{name} = %{version}
-Requires: gcc autogen libtool rpm-build createrepo git
+Requires: gcc autogen libtool rpm-build createrepo git pungi
%description -n ovirt-build
Developer makefile and scripts to help automate the building of
oVirt from source repositories.
diff --git a/ovirt.mk b/ovirt.mk
index a52239b..0928e57 100644
--- a/ovirt.mk
+++ b/ovirt.mk
@@ -5,12 +5,16 @@ OVIRT_GIT_SERVER ?= git://ovirt.org
# Set to 'next' to get the latest (unreleased) updates
OVIRT_BRANCH ?= master
-
+OVIRT_URL ?= http://ovirt.org/repos/ovirt
+FEDORA_MIRROR ?= http://mirrors.fedoraproject.org/mirrorlist
SUBDIRS ?= release server node node-image appliance docs
SUBDIR_SEP = ============================================================
export OVIRT_CACHE_DIR ?= $(HOME)/ovirt-cache
+SRC_KS = $(OVIRT_CACHE_DIR)/src.ks
+F_REL = $(shell rpm -q --qf '%{VERSION}' fedora-release)
+BUILD_DIR := $(shell pwd)
define subdir_gen_and_make
echo $(SUBDIR_SEP) $$dir; \
@@ -69,5 +73,34 @@ rel-build: bumprelease build
ver-build: bumpversion build
+tar-src:
+ @mkdir -p $(OVIRT_CACHE_DIR)
+ @( if [ -n "$(FEDORA_URL)" ]; then \
+ echo "repo --name=f$(F_REL) --baseurl=$(FEDORA_URL)/releases/$(F_REL)/Everything/\$$basearch/os" ; \
+ echo "repo --name=f$(F_REL)-updates --baseurl=$(FEDORA_URL)/updates/$(F_REL)/\$$basearch" ; \
+ echo "repo --name=f$(F_REL)-updates-newkey --baseurl=$(FEDORA_URL)/updates/$(F_REL)/\$$basearch.newkey" ; \
+ echo "repo --name=f$(F_REL)-src --baseurl=$(FEDORA_URL)/releases/$(F_REL)/Everything/source/SRPMS" ; \
+ echo "repo --name=f$(F_REL)-updates-src --baseurl=$(FEDORA_URL)/updates/$(F_REL)/SRPMS" ; \
+ echo "repo --name=f$(F_REL)-updates-src-newkey --baseurl=$(FEDORA_URL)/updates/$(F_REL)/SRPMS.newkey" ; \
+ else \
+ echo "repo --name=f$(F_REL) --mirrorlist=$(FEDORA_MIRROR)?repo=fedora-$(F_REL)&arch=\$$basearch" ; \
+ echo "repo --name=f$(F_REL)-updates --mirrorlist=$(FEDORA_MIRROR)?repo=updates-released-f$(F_REL)&arch=\$$basearch" ; \
+ echo "repo --name=f$(F_REL)-updates-newkey --mirrorlist=$(FEDORA_MIRROR)?repo=updates-released-f$(F_REL).newkey&arch=\$$basearch" ; \
+ echo "repo --name=f$(F_REL)-src --mirrorlist=$(FEDORA_MIRROR)?repo=fedora-source-$(F_REL)&arch=src" ; \
+ echo "repo --name=f$(F_REL)-updates-src --mirrorlist=$(FEDORA_MIRROR)?repo=updates-released-source-f$(F_REL)&arch=src" ; \
+ echo "repo --name=f$(F_REL)-updates-src-newkey --mirrorlist=$(FEDORA_MIRROR)?repo=updates-released-source-f$(F_REL).newkey&arch=src" ; \
+ fi ; \
+ echo "%packages --nobase" ; \
+ for dir in $(SUBDIRS); do \
+ if test -f $$dir/common-pkgs.ks ; then \
+ grep -v '^-' $$dir/common-pkgs.ks ; \
+ fi ; \
+ done ; \
+ echo "%end" ) > $(SRC_KS)
+ cd $(OVIRT_CACHE_DIR) && \
+ $(BUILD_DIR)/release/misc-scripts/getsrpms.py $(SRC_KS) $(OVIRT_CACHE_DIR)/yum
+ cd $(OVIRT_CACHE_DIR)/source && \
+ tar cf ovirt-source.tar SRPMS
+
.PHONY: all build clean distclean publish $(SUBDIRS) update status \
- bumpgit bumprelease bumpversion dev-build rel-build ver-build
+ bumpgit bumprelease bumpversion dev-build rel-build ver-build tar-src
--
1.5.5.1
More information about the ovirt-devel
mailing list