From ef371d2d1da29f2cdf284935fef162ca2ad0cf4f Mon Sep 17 00:00:00 2001 From: Mark Huang Date: Wed, 7 Apr 2004 21:13:51 +0000 Subject: [PATCH] This commit was generated by cvs2svn to compensate for changes in r17, which included commits to RCS files with non-trunk default branches. --- Makefile | 127 +++++++++++++++++++++++++++++++++++++++ Makerules | 174 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ Rules.mk | 174 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 475 insertions(+) create mode 100644 Makefile create mode 100644 Makerules create mode 100644 Rules.mk diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..d4933673 --- /dev/null +++ b/Makefile @@ -0,0 +1,127 @@ +# +# PlanetLab RPM generation +# +# Copyright (c) 2003 The Trustees of Princeton University (Trustees). +# All Rights Reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * Neither the name of the copyright holder nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE TRUSTEES OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# $Id$ +# + +# +# CVSROOT: CVSROOT to use +# INITIAL: CVS tag to use for Source0 tarball +# TAG: CVS tag to patch to +# MODULE: CVS module name to use +# SPEC: RPM spec file template +# RPMFLAGS: Miscellaneous RPM flags +# ALL: default targets +# +# If INITIAL is different than TAG, PatchSets will be generated +# automatically with cvsps(1) to bring Source0 up to TAG. If TAG is +# HEAD, a %{date} variable will be defined in the generated spec +# file. If a Patch: tag in the spec file matches a generated PatchSet +# number, the name of the patch will be as specified. Otherwise, the +# name of the patch will be the PatchSet number. %patch tags in the +# spec file are generated automatically. +# + +# +# kernel-planetlab +# + +kernel-planetlab-CVSROOT := pup-pl_kernel@cvs.planet-lab.org:/cvs +kernel-planetlab-INITIAL := linux-2_4_22 +kernel-planetlab-TAG := HEAD +kernel-planetlab-MODULE := linux-2.4 +kernel-planetlab-SPEC := linux-2.4/scripts/kernel-planetlab.spec +ALL += kernel-planetlab + +# +# plkmod +# + +plkmod-CVSROOT := pup-silk@cvs.planet-lab.org:/cvs +plkmod-INITIAL := HEAD +plkmod-TAG := HEAD +plkmod-MODULE := sys-v3 +plkmod-SPEC := sys-v3/rpm/plkmod.spec +plkmod-RPMFLAGS = --define "kernelver $(shell rpmquery --queryformat '%{VERSION}-%{RELEASE}\n' --specfile SPECS/$(notdir $(kernel-planetlab-SPEC)) | head -1)" +ALL += plkmod + +# Build kernel-planetlab first so we can bootstrap off of its build +plkmod: kernel-planetlab + +# +# vdk +# + +vdk-CVSROOT := pup-pl_kernel@cvs.planet-lab.org:/cvs +vdk-INITIAL := vdk_918 +vdk-TAG := HEAD +vdk-MODULE := vdk +vdk-SPEC := vdk/vtune_driver.spec +vdk-RPMFLAGS = --define "kernelver $(shell rpmquery --queryformat '%{VERSION}-%{RELEASE}\n' --specfile SPECS/$(notdir $(kernel-planetlab-SPEC)) | head -1)" +ALL += vdk + +# Build kernel-planetlab first so we can bootstrap off of its build +vdk: kernel-planetlab + +ifeq ($(findstring $(package),$(ALL)),) + +# Build all packages +all: $(ALL) + +# Recurse +$(ALL): + $(MAKE) package=$@ all + +.PHONY: all $(ALL) + +else + +# Define variables for Makerules +CVSROOT := $($(package)-CVSROOT) +INITIAL := $($(package)-INITIAL) +TAG := $($(package)-TAG) +MODULE := $($(package)-MODULE) +SPEC := $($(package)-SPEC) +RPMFLAGS := $($(package)-RPMFLAGS) +CVS_RSH := $(if $($(package)-CVS_RSH),$($(package)-CVS_RSH),ssh) + +include Makerules + +endif + +# Remove generated files +clean: + rm -rf BUILD RPMS SOURCES SPECS SRPMS .rpmmacros .cvsps + +.PHONY: clean diff --git a/Makerules b/Makerules new file mode 100644 index 00000000..40dd487f --- /dev/null +++ b/Makerules @@ -0,0 +1,174 @@ +# +# PlanetLab RPM generation +# +# Copyright (c) 2003 The Trustees of Princeton University (Trustees). +# All Rights Reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * Neither the name of the copyright holder nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE TRUSTEES OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# $Id$ +# + +# Base cvsps and rpmbuild in the current directory +export HOME := $(shell pwd) +export CVSROOT CVS_RSH + +# +# Parse spec file template +# + +MK := SPECS/$(patsubst %.spec,%.mk,$(notdir $(SPEC))) + +$(MK): SPECS/$(notdir $(SPEC)).in + # Substitute '$' for '%' and '%define name value' or 'name: value' for 'name := value' + sed -n \ + -e 's/%{/$${/g' \ + -e 's/^%define[ ]*\([^ ]*\)[ ]*\([^ ]*\)/\1 := \2/p' \ + -e 's/^\([^ ]*\):[ ]*\([^ ]*\)/\1 := \2/p' \ + $< > $@ +ifneq ($(INITIAL),$(TAG)) + # Get list of PatchSets + cvsps --root $(CVSROOT) -r $(INITIAL) $(if $(TAG:HEAD=),-r $(TAG)) $(MODULE) | \ + sed -ne 's|^PatchSet[ ]*\([0-9]*\)|PATCHES += \1|p' >> $@ +endif + +SPECS/$(notdir $(SPEC)).in: + mkdir -p SPECS + cvs -d $(CVSROOT) checkout -r $(TAG) -p $(SPEC) > $@ + +include $(MK) + +# +# Generate tarball +# + +# Add tarball to the list of sources +SOURCES += SOURCES/$(Source0) + +# Get rid of .tar.bz2 or .tar.gz or .tgz +Base0 := $(basename $(basename $(Source0))) + +# Export module +SOURCES/$(Base0): + mkdir -p SOURCES + cd SOURCES && cvs -d $(CVSROOT) export -r $(INITIAL) -d $(Base0) $(MODULE) + +.SECONDARY: $(SOURCES)/$(Base0) + +# Generate tarball +SOURCES/$(Base0).tar.bz2: SOURCES/$(Base0) + tar cpjf $@ -C SOURCES $(Base0) + +SOURCES/$(Base0).tar.gz SOURCES/$(Base0).tgz: SOURCES/$(Base0) + tar cpzf $@ -C SOURCES $(Base0) + +SOURCES/$(Base0).tar: SOURCES/$(Base0) + tar cpf $@ -C SOURCES $(Base0) + +# +# Generate patches +# + +define PATCH_template + +# In case the spec file did not explicitly list the PatchSet +ifeq ($$(origin Patch$(1)),undefined) +Patch$(1) := $(1).patch.bz2 +endif + +# Add patch to the list of sources +SOURCES += SOURCES/$$(Patch$(1)) + +# Generate uncompressed patch +SOURCES/$$(patsubst %.gz,%,$$(patsubst %.bz2,%,$$(Patch$(1)))): + mkdir -p SOURCES + cvsps --root $(CVSROOT) -g -s $(1) $(MODULE) > $$@ + +endef + +# bzip2 +%.bz2: % + bzip2 -c $< > $@ + +# gzip +%.gz: % + gzip -c $< > $@ + +# Generate rules to generate patches +$(foreach n,$(PATCHES),$(eval $(call PATCH_template,$(n)))) + +# +# Generate spec file +# + +ifeq ($(TAG),HEAD) +# Define date for untagged builds +DATE := $(shell date +%Y.%m.%d) +endif + +# Generate spec file +SPECS/$(notdir $(SPEC)): SPECS/$(notdir $(SPEC)).in + rm -f $@ +ifeq ($(TAG),HEAD) + # Define date for untagged builds + echo "%define date $(DATE)" >> $@ +endif + # Rewrite patch sections of spec file + perl -n -e ' \ + next if /^Patch.*/; \ + next if /^%patch.*/; \ + print; \ + if (/^Source.*/) { $(foreach n,$(PATCHES),print "Patch$(n): $(Patch$(n))\n";) } \ + if (/^%setup.*/) { $(foreach n,$(PATCHES),print "%patch$(n) -p1\n";) } \ + ' $< >> $@ + +# +# Build +# + +NVR := $(shell rpmquery $(RPMFLAGS) $(if $(DATE),--define "date $(DATE)") --specfile SPECS/$(notdir $(SPEC)).in | head -1) +ARCH := $(shell rpm $(RPMFLAGS) --showrc | sed -ne 's/^build arch[ ]*:[ ]*\(.*\)/\1/p') + +all: RPMS/$(ARCH)/$(NVR).$(ARCH).rpm SRPMS/$(NVR).src.rpm + +# Build RPM +RPMS/$(ARCH)/$(NVR).$(ARCH).rpm: SPECS/$(notdir $(SPEC)) $(SOURCES) .rpmmacros + mkdir -p BUILD RPMS + rpmbuild $(RPMFLAGS) -bb $< + +# Build SRPM +SRPMS/$(NVR).src.rpm: SPECS/$(notdir $(SPEC)) $(SOURCES) .rpmmacros + mkdir -p SRPMS + rpmbuild $(RPMFLAGS) -bs $< + +# Base rpmbuild in the current directory +.rpmmacros: + echo "%_topdir $(HOME)" > $@ + +.PHONY: all diff --git a/Rules.mk b/Rules.mk new file mode 100644 index 00000000..40dd487f --- /dev/null +++ b/Rules.mk @@ -0,0 +1,174 @@ +# +# PlanetLab RPM generation +# +# Copyright (c) 2003 The Trustees of Princeton University (Trustees). +# All Rights Reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * Neither the name of the copyright holder nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE TRUSTEES OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# $Id$ +# + +# Base cvsps and rpmbuild in the current directory +export HOME := $(shell pwd) +export CVSROOT CVS_RSH + +# +# Parse spec file template +# + +MK := SPECS/$(patsubst %.spec,%.mk,$(notdir $(SPEC))) + +$(MK): SPECS/$(notdir $(SPEC)).in + # Substitute '$' for '%' and '%define name value' or 'name: value' for 'name := value' + sed -n \ + -e 's/%{/$${/g' \ + -e 's/^%define[ ]*\([^ ]*\)[ ]*\([^ ]*\)/\1 := \2/p' \ + -e 's/^\([^ ]*\):[ ]*\([^ ]*\)/\1 := \2/p' \ + $< > $@ +ifneq ($(INITIAL),$(TAG)) + # Get list of PatchSets + cvsps --root $(CVSROOT) -r $(INITIAL) $(if $(TAG:HEAD=),-r $(TAG)) $(MODULE) | \ + sed -ne 's|^PatchSet[ ]*\([0-9]*\)|PATCHES += \1|p' >> $@ +endif + +SPECS/$(notdir $(SPEC)).in: + mkdir -p SPECS + cvs -d $(CVSROOT) checkout -r $(TAG) -p $(SPEC) > $@ + +include $(MK) + +# +# Generate tarball +# + +# Add tarball to the list of sources +SOURCES += SOURCES/$(Source0) + +# Get rid of .tar.bz2 or .tar.gz or .tgz +Base0 := $(basename $(basename $(Source0))) + +# Export module +SOURCES/$(Base0): + mkdir -p SOURCES + cd SOURCES && cvs -d $(CVSROOT) export -r $(INITIAL) -d $(Base0) $(MODULE) + +.SECONDARY: $(SOURCES)/$(Base0) + +# Generate tarball +SOURCES/$(Base0).tar.bz2: SOURCES/$(Base0) + tar cpjf $@ -C SOURCES $(Base0) + +SOURCES/$(Base0).tar.gz SOURCES/$(Base0).tgz: SOURCES/$(Base0) + tar cpzf $@ -C SOURCES $(Base0) + +SOURCES/$(Base0).tar: SOURCES/$(Base0) + tar cpf $@ -C SOURCES $(Base0) + +# +# Generate patches +# + +define PATCH_template + +# In case the spec file did not explicitly list the PatchSet +ifeq ($$(origin Patch$(1)),undefined) +Patch$(1) := $(1).patch.bz2 +endif + +# Add patch to the list of sources +SOURCES += SOURCES/$$(Patch$(1)) + +# Generate uncompressed patch +SOURCES/$$(patsubst %.gz,%,$$(patsubst %.bz2,%,$$(Patch$(1)))): + mkdir -p SOURCES + cvsps --root $(CVSROOT) -g -s $(1) $(MODULE) > $$@ + +endef + +# bzip2 +%.bz2: % + bzip2 -c $< > $@ + +# gzip +%.gz: % + gzip -c $< > $@ + +# Generate rules to generate patches +$(foreach n,$(PATCHES),$(eval $(call PATCH_template,$(n)))) + +# +# Generate spec file +# + +ifeq ($(TAG),HEAD) +# Define date for untagged builds +DATE := $(shell date +%Y.%m.%d) +endif + +# Generate spec file +SPECS/$(notdir $(SPEC)): SPECS/$(notdir $(SPEC)).in + rm -f $@ +ifeq ($(TAG),HEAD) + # Define date for untagged builds + echo "%define date $(DATE)" >> $@ +endif + # Rewrite patch sections of spec file + perl -n -e ' \ + next if /^Patch.*/; \ + next if /^%patch.*/; \ + print; \ + if (/^Source.*/) { $(foreach n,$(PATCHES),print "Patch$(n): $(Patch$(n))\n";) } \ + if (/^%setup.*/) { $(foreach n,$(PATCHES),print "%patch$(n) -p1\n";) } \ + ' $< >> $@ + +# +# Build +# + +NVR := $(shell rpmquery $(RPMFLAGS) $(if $(DATE),--define "date $(DATE)") --specfile SPECS/$(notdir $(SPEC)).in | head -1) +ARCH := $(shell rpm $(RPMFLAGS) --showrc | sed -ne 's/^build arch[ ]*:[ ]*\(.*\)/\1/p') + +all: RPMS/$(ARCH)/$(NVR).$(ARCH).rpm SRPMS/$(NVR).src.rpm + +# Build RPM +RPMS/$(ARCH)/$(NVR).$(ARCH).rpm: SPECS/$(notdir $(SPEC)) $(SOURCES) .rpmmacros + mkdir -p BUILD RPMS + rpmbuild $(RPMFLAGS) -bb $< + +# Build SRPM +SRPMS/$(NVR).src.rpm: SPECS/$(notdir $(SPEC)) $(SOURCES) .rpmmacros + mkdir -p SRPMS + rpmbuild $(RPMFLAGS) -bs $< + +# Base rpmbuild in the current directory +.rpmmacros: + echo "%_topdir $(HOME)" > $@ + +.PHONY: all -- 2.47.0