Perry Myers
2008-Sep-19 05:35 UTC
[Ovirt-devel] [PATCH node-image] Restructured makefile and rpmbuilding to simplify it
Removed customized rpm macros that should really be set by users ~/.rpmmacros directory. This removed need for custom tar target, as we can now use dist and rpmbuild -ta instead. Still need to have custom RPM_FLAGS for ovirt specific overrides like OVIRT_CACHE_DIR (used by appliance and node-image spec files) Removed unused bumprelease, bumpversion and setversion targets Removed other unused make variables Simplified publish to just rsync all RPMS frpm the rpmdir. Added seconds granularity to git tag for bumpgit target. Made it so version file is no longer edited by makefile. Instead configure.ac file is used to store version. For developers setting OVIRT_DEV env var causes extra_dist to be passed to rpmbuild adding the git tag onto the RPM. Signed-off-by: Perry Myers <pmyers at redhat.com> --- .gitignore | 20 ++++++-- Makefile | 28 ---------- Makefile.am | 50 ++++++++++++++++++ autogen.sh | 58 +++++++++++++++++++++ configure.ac | 11 ++++ ovirt-node-image.spec => ovirt-node-image.spec.in | 11 ++-- release.mk | 54 ------------------- version | 1 - 8 files changed, 140 insertions(+), 93 deletions(-) delete mode 100644 Makefile create mode 100644 Makefile.am create mode 100755 autogen.sh create mode 100644 configure.ac rename ovirt-node-image.spec => ovirt-node-image.spec.in (94%) delete mode 100644 release.mk delete mode 100644 version diff --git a/.gitignore b/.gitignore index 77f0929..309c35c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,16 @@ -ovirt.iso -tftpboot -rpm-build -repos.ks +Makefile +Makefile.in +aclocal.m4 +autom4te.cache +config.h +config.h.in +config.log +config.status +configure +depcomp +install-sh +missing +stamp-h1 +ovirt-node-image*.gz +ovirt-node-image.spec + diff --git a/Makefile b/Makefile deleted file mode 100644 index 60fa9b4..0000000 --- a/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -pkg_name = ovirt-node-image - -all: rpms -include release.mk - -# FEDORA_URL env var can be set to the root of a fedora mirror -# OVIRT_URL env var can be set to the root of an ovirt.org mirror -RPM_FLAGS += \ - --define "fedora_url $(FEDORA_URL)" \ - --define "ovirt_url $(OVIRT_URL)" - -clean: - rm -rf $(pkg_name)-* - -distclean: clean - rm -rf repos.ks rpm-build - -tar: clean $(pkg_name).ks common-install.ks common-pkgs.ks common-post.ks - mkdir -p $(NV) - cp -a common-install.ks common-pkgs.ks common-post.ks COPYING Makefile \ - ovirt-flash ovirt-flash-static $(pkg_name).spec $(pkg_name).ks \ - ovirt-pxe README.krb5 release.mk $(NV) - mkdir -p rpm-build - tar zcvf rpm-build/$(NV).tar.gz $(NV) - cp version rpm-build/ - rm -rf $(NV) - -.PHONY: all clean tar distclean diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..0651fbd --- /dev/null +++ b/Makefile.am @@ -0,0 +1,50 @@ +# Copyright (C) 2008 Red Hat, Inc. +# +# 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 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., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +OVIRT_CACHE_DIR ?= $(HOME)/ovirt-cache + +EXTRA_DIST = \ + .gitignore \ + ovirt-node-image.spec \ + ovirt-node-image.spec.in \ + README.krb5 \ + common-install.ks \ + common-pkgs.ks \ + common-post.ks \ + ovirt-flash \ + ovirt-flash-static \ + ovirt-node-image.ks \ + ovirt-pxe + +git_head = $$(git log -1 --pretty=format:%h) +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 "git_release .$(GIT_RELEASE)") +# FEDORA_URL env var can be set to the root of a fedora mirror +RPM_FLAGS += $(if $(FEDORA_URL),--define "fedora_url $(FEDORA_URL)") +# OVIRT_URL env var can be set to the root of an ovirt.org mirror +RPM_FLAGS += $(if $(OVIRT_URL),--define "ovirt_url $(OVIRT_URL)") + +rpms: dist + rpmbuild $(RPM_FLAGS) -ta $(distdir).tar.gz + +publish: rpms + rsync -aq $(shell rpm --eval '%{_rpmdir}')/ $(OVIRT_CACHE_DIR)/ovirt/ + createrepo $(OVIRT_CACHE_DIR)/ovirt + +.PHONY: rpms publish diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..a2b0f89 --- /dev/null +++ b/autogen.sh @@ -0,0 +1,58 @@ +#!/bin/sh +# Run this to generate configure and Makefile + +srcdir=`dirname $0` +test -z "$srcdir" && srcdir=. + +THEDIR=`pwd` +( + cd $srcdir + die=0 + + (autoconf --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "You must have autoconf installed." + echo "Download the appropriate package for your distribution," + echo "or see http://www.gnu.org/software/autoconf" + die=1 + } + + (libtool --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "You must have libtool installed." + echo "Download the appropriate package for your distribution," + echo "or see http://www.gnu.org/software/libtool" + die=1 + } + + (automake --version) < /dev/null > /dev/null 2>&1 || { + echo + die=1 + echo "You must have automake installed." + echo "Download the appropriate package for your distribution," + echo "or see http://www.gnu.org/software/automake" + } + + test $die = 1 && exit 1 + + test -f ovirt-node-image.spec.in || { + echo "You must run this script in the top-level directory" + exit 1 + } + + if test -z "$*"; then + echo "I am going to run ./configure with no arguments - if you wish " + echo "to pass any to it, please specify them on the $0 command line." + fi + + aclocal + autoheader + automake --add-missing + autoconf + ./configure "$@" +) + +if test "x$OBJ_DIR" != x; then + mkdir -p "$OBJ_DIR" + cd "$OBJ_DIR" +fi diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..9cfdccf --- /dev/null +++ b/configure.ac @@ -0,0 +1,11 @@ +AC_INIT([ovirt-node-image], [0.93], [ovirt-devel at redhat.com]) +AM_INIT_AUTOMAKE([-Wall -Werror foreign -Wno-portability]) +AC_PROG_CC +AC_CONFIG_HEADERS([config.h]) + +# If using gcc and default CFLAGS, enable some warnings. +test x"$ac_ct_CC:$CFLAGS" = 'xgcc:-g -O2' \ + && CFLAGS="$CFLAGS -Wshadow -Wall -Werror" + +AC_CONFIG_FILES([Makefile]) +AC_OUTPUT(ovirt-node-image.spec) diff --git a/ovirt-node-image.spec b/ovirt-node-image.spec.in similarity index 94% rename from ovirt-node-image.spec rename to ovirt-node-image.spec.in index 0ea5267..b8ce551 100644 --- a/ovirt-node-image.spec +++ b/ovirt-node-image.spec.in @@ -3,13 +3,12 @@ %{!?ovirt_url: %define ovirt_url http://ovirt.org/repos/ovirt} %define fedora_mirror http://mirrors.fedoraproject.org/mirrorlist -Summary: oVirt Node boot ISO image +Summary: oVirt Node ISO image Name: ovirt-node-image -Source1: version -Version: %(echo `awk '{ print $1 }' %{SOURCE1}`) -Release: %(echo `awk '{ print $2 }' %{SOURCE1}`)%{?dist}%{?extra_release} +Version: @VERSION@ +Release: 0%{?git_release}%{?dist}%{?extra_release} Source0: %{name}-%{version}.tar.gz -License: Fedora +License: GPLv2+ Group: Applications/System BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot URL: http://ovirt.org/ @@ -27,7 +26,7 @@ The ISO boot image for oVirt Node booting from CDROM device. At the moment, this RPM just packages prebuilt ISO. %package pxe -Summary: oVirt Node boot PXE image +Summary: oVirt Node PXE image Group: Applications/System %description pxe diff --git a/release.mk b/release.mk deleted file mode 100644 index b89bd86..0000000 --- a/release.mk +++ /dev/null @@ -1,54 +0,0 @@ -# Release/version-related Makefile variables and rules. -# It expects the including Makefile to define the "pkg_name" -# variable, as well as a file named "version" in the current directory. - -ARCH := $(shell uname -i) -VERSION := $(shell awk '{ print $$1 }' version) -RELEASE := $(shell awk '{ print $$2 }' version) -NEWVERSION = $$(awk 'BEGIN { printf "%.2f", $(VERSION) + .01 }') -NEWRELEASE = $$(($(RELEASE) + 1)) -X = $$(awk '{ split($$2,r,"."); \ - printf("%d.%d\n", r[1], r[2]+1) }' version) -git_head = $$(git log -1 --pretty=format:%h) -GITRELEASE = $(X).$$(date --utc +%Y%m%d%H%M)git$(git_head) -DIST = $$(rpm --eval '%{dist}') - -SPEC_FILE = $(pkg_name).spec - -OVIRT_CACHE_DIR ?= $(HOME)/ovirt-cache - -NV = $(pkg_name)-$(VERSION) -RPM_FLAGS = \ - --define "_topdir %(pwd)/rpm-build" \ - --define "_builddir %{_topdir}" \ - --define "_rpmdir %{_topdir}" \ - --define "_srcrpmdir %{_topdir}" \ - --define '_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm' \ - --define "_specdir %{_topdir}" \ - --define "_sourcedir %{_topdir}" \ - --define "ovirt_cache_dir $(OVIRT_CACHE_DIR)" - -bumpgit: - echo "$(VERSION) $(GITRELEASE)" > version - -bumprelease: - echo "$(VERSION) $(NEWRELEASE)" > version - -bumpversion: - echo "$(NEWVERSION) 1" > version - -setversion: - echo "$(VERSION) $(RELEASE)" > version - -new-rpms: bumprelease rpms - -rpms: tar - rpmbuild $(RPM_FLAGS) -ba $(SPEC_FILE) - -publish: rpms - rm -f $(OVIRT_CACHE_DIR)/ovirt/$(pkg_name)* - mkdir -p $(OVIRT_CACHE_DIR)/ovirt - cp -a rpm-build/$(pkg_name)*.rpm $(OVIRT_CACHE_DIR)/ovirt - createrepo $(OVIRT_CACHE_DIR)/ovirt - -.PHONY: rpms new-rpms publish setversion bumprelease bumpversion bumpgit diff --git a/version b/version deleted file mode 100644 index 187ac7a..0000000 --- a/version +++ /dev/null @@ -1 +0,0 @@ -0.92 1 -- 1.5.5.1
Daniel P. Berrange
2008-Sep-19 09:17 UTC
[Ovirt-devel] [PATCH node-image] Restructured makefile and rpmbuilding to simplify it
On Fri, Sep 19, 2008 at 01:35:46AM -0400, Perry Myers wrote:> Removed customized rpm macros that should really be set by users > ~/.rpmmacros directory. This removed need for custom tar target, > as we can now use dist and rpmbuild -ta instead. > > Still need to have custom RPM_FLAGS for ovirt specific overrides > like OVIRT_CACHE_DIR (used by appliance and node-image spec files) > > Removed unused bumprelease, bumpversion and setversion targets > Removed other unused make variables > Simplified publish to just rsync all RPMS frpm the rpmdir. > Added seconds granularity to git tag for bumpgit target. > > Made it so version file is no longer edited by makefile. > Instead configure.ac file is used to store version. For > developers setting OVIRT_DEV env var causes extra_dist to be > passed to rpmbuild adding the git tag onto the RPM. > > Signed-off-by: Perry Myers <pmyers at redhat.com>ACK, with same question about git_release as for other modules.> +Version: @VERSION@ > +Release: 0%{?git_release}%{?dist}%{?extra_release}Regards, Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
Jim Meyering
2008-Sep-19 18:23 UTC
[Ovirt-devel] [PATCH node-image] Restructured makefile and rpmbuilding to simplify it
Perry Myers <pmyers at redhat.com> wrote:> Removed customized rpm macros that should really be set by users > ~/.rpmmacros directory. This removed need for custom tar target, > as we can now use dist and rpmbuild -ta instead. > > Still need to have custom RPM_FLAGS for ovirt specific overrides > like OVIRT_CACHE_DIR (used by appliance and node-image spec files) > > Removed unused bumprelease, bumpversion and setversion targets > Removed other unused make variables > Simplified publish to just rsync all RPMS frpm the rpmdir. > Added seconds granularity to git tag for bumpgit target. > > Made it so version file is no longer edited by makefile. > Instead configure.ac file is used to store version. For > developers setting OVIRT_DEV env var causes extra_dist to be > passed to rpmbuild adding the git tag onto the RPM.ACK, I reviewed it, verified that it applies and passes "make distcheck".