[Ovirt-devel] [PATCH appliance] Added make source target to build source.iso

David Huff dhuff at redhat.com
Mon Dec 8 17:44:40 UTC 2008


 Workaround which uses pungi to download srpms and create a srpm.iso
 Currently builds $(PWD)/$(PACKAGE)-source.iso however can also spit our .tar
 and can be easily configured to chose depending on $(PKG_FMT)
---
 Makefile.am |   53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 53 insertions(+), 0 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 52fe026..450ddc2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -57,6 +57,7 @@ GIT_RELEASE	= $$(date --utc +%Y%m%d%H%M%S)git$(git_head)
 RPMDIR		= $$(rpm --eval '%{_rpmdir}')
 RPM_FLAGS	= --define "ovirt_cache_dir $(OVIRT_CACHE_DIR)"
 RPM_FLAGS	+= $(if $(_ovirt_dev),--define "extra_release .$(GIT_RELEASE)")
+SRC_KS = $(OVIRT_CACHE_DIR)/$(PACKAGE)-tmp/src.ks
 
 FEDORA_MIRROR	= http://mirrors.fedoraproject.org/mirrorlist
 FEDORA_URL_DEF	= http://download.fedoraproject.org/pub/fedora/linux
@@ -137,6 +138,58 @@ $(NVR).$(PKG_FMT).$(SUM): $(NVR).$(PKG_FMT)
 
 appliance: $(NVR).$(PKG_FMT).$(SUM)
 
+$(PACKAGE).source source: $(NVR).$(PKG_FMT).$(SUM).source
+
+$(NVR).$(PKG_FMT).$(SUM).source: $(NVR).$(PKG_FMT).source
+
+$(NVR).$(PKG_FMT).source:
+	@mkdir -p $(OVIRT_CACHE_DIR)/$(PACKAGE)-tmp/tree/pungi
+	@sudo rm -Rf $(OVIRT_CACHE_DIR)/$(PACKAGE)-tmp/tree/pungi/*
+	@( if [ -n "$(FEDORA_URL)" ]; then \
+	  echo "repo --name=f$(FEDORA) --baseurl=$(FEDORA_URL)/releases/$(FEDORA)/Everything/\$$basearch/os" ; \
+	  echo "repo --name=f$(FEDORA)-updates --baseurl=$(FEDORA_URL)/updates/$(FEDORA)/\$$basearch" ; \
+	  echo "repo --name=f$(FEDORA)-updates-newkey --baseurl=$(FEDORA_URL)/updates/$(FEDORA)/\$$basearch.newkey" ; \
+	  echo "repo --name=f$(FEDORA)-src --baseurl=$(FEDORA_URL)/releases/$(FEDORA)/Everything/source/SRPMS" ; \
+	  echo "repo --name=f$(FEDORA)-updates-src --baseurl=$(FEDORA_URL)/updates/$(FEDORA)/SRPMS" ; \
+	  echo "repo --name=f$(FEDORA)-updates-src-newkey --baseurl=$(FEDORA_URL)/updates/$(FEDORA)/SRPMS.newkey" ; \
+	else \
+	  echo "repo --name=f$(FEDORA) --mirrorlist=$(FEDORA_MIRROR)?repo=fedora-$(FEDORA)&arch=\$$basearch" ; \
+	  echo "repo --name=f$(FEDORA)-updates --mirrorlist=$(FEDORA_MIRROR)?repo=updates-released-f$(FEDORA)&arch=\$$basearch" ; \
+	  echo "repo --name=f$(FEDORA)-updates-newkey --mirrorlist=$(FEDORA_MIRROR)?repo=updates-released-f$(FEDORA).newkey&arch=\$$basearch" ; \
+	  echo "repo --name=f$(FEDORA)-src --mirrorlist=$(FEDORA_MIRROR)?repo=fedora-source-$(FEDORA)&arch=src" ; \
+	  echo "repo --name=f$(FEDORA)-updates-src --mirrorlist=$(FEDORA_MIRROR)?repo=updates-released-source-f$(FEDORA)&arch=src" ; \
+	  echo "repo --name=f$(FEDORA)-updates-src-newkey --mirrorlist=$(FEDORA_MIRROR)?repo=updates-released-source-f$(FEDORA).newkey&arch=src" ; \
+	fi ; \
+	echo "repo --name=ovirt-org --baseurl=$(OVIRT_URL)/$(FEDORA)/\$$basearch" ; \
+	echo "repo --name=ovirt-org-src --baseurl=$(OVIRT_URL)/$(FEDORA)/src" ; \
+	echo "#repo --name=thincrust-net --baseurl=$(THINCRUST_URL)/noarch" ; \
+	echo "#repo --name=thincrust-net-src --baseurl=$(THINCRUST_URL)/srpms" ; \
+	echo "#repo --name=ovirt-local --baseurl=file://$(OVIRT_CACHE_DIR)/ovirt" ; \
+	echo "%packages --nobase" ; \
+	grep -v '^-' /usr/share/appliance-os/includes/base-pkgs.ks ; \
+	echo "lokkit" ; \
+		for dir in $(SUBDIRS); do \
+	  echo "ovirt-$$dir" ; \
+	  test -f $$dir/common-pkgs.ks && grep -v '^-' $$dir/common-pkgs.ks ; \
+	done ; \
+	echo "%end" ) > $(SRC_KS)
+	cd $(OVIRT_CACHE_DIR)/$(PACKAGE)-tmp/tree/pungi && \
+	  pungi -G --ver=$(PACKAGE)  -c $(SRC_KS) --cachedir=$(OVIRT_CACHE_DIR)/yum 
+	if [ "iso" == "iso" ]; then \
+		cd $(OVIRT_CACHE_DIR)/$(PACKAGE)-tmp/tree/pungi && \
+			sudo pungi --sourceiso --ver=$(PACKAGE)  -c $(SRC_KS) --cachedir=$(OVIRT_CACHE_DIR)/yum ; \
+			sudo mv $(OVIRT_CACHE_DIR)/$(PACKAGE)-tmp/tree/pungi/$(PACKAGE)/source/iso/Fedora-$(PACKAGE)-source.iso $(PWD)/$(PACKAGE)-source.iso ; \
+			sudo sudo chown -R $(USER) $(PWD)/$(PACKAGE)-source.iso ; \
+	else \
+		cd $(OVIRT_CACHE_DIR)/$(PACKAGE)-tmp/tree/pungi/$(PACKAGE)/source && \
+		tar cf ovirt-source.tar SRPMS ; \
+		sudo mv $(OVIRT_CACHE_DIR)/$(PACKAGE)-tmp/tree/pungi/$(PACKAGE)/source/ovirt-source.tar $(PWD)/$(PACKAGE)-source.tar ; \
+		sudo sudo chown -R $(USER) $(PWD)/$(PACKAGE)-source.tar ; \
+	fi;
+	sudo sudo chown -R $(USER) $(OVIRT_CACHE_DIR)/$(PACKAGE)-tmp/tree/pungi 
+	@rm -Rf $(OVIRT_CACHE_DIR)/$(PACKAGE)-tmp/tree/pungi 
+	@rm $(SRC_KS)
+
 rpms: dist appliance
 	rpmbuild $(RPM_FLAGS) -ta $(distdir).tar.gz
 
-- 
1.5.5.1




More information about the ovirt-devel mailing list