- replace autotools based build system a simpler rake based one - cleanup up rpmspec, added missing deps, renamed from portal to aggregator, and git moved to contrib dir --- Makefile.am | 56 ------------ Rakefile | 45 ++++++++++ configure.ac | 11 --- contrib/deltacloud-aggregator.spec | 139 +++++++++++++++++++++++++++++++ deltacloud-portal.spec.in | 162 ------------------------------------ 5 files changed, 184 insertions(+), 229 deletions(-) delete mode 100644 Makefile.am create mode 100644 Rakefile delete mode 100644 configure.ac create mode 100644 contrib/deltacloud-aggregator.spec delete mode 100644 deltacloud-portal.spec.in
diff --git a/Makefile.am b/Makefile.am deleted file mode 100644 index e5d97f8..0000000 --- a/Makefile.am +++ /dev/null @@ -1,56 +0,0 @@ -# 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. - -DELTACLOUD_CACHE_DIR ?= $(HOME)/deltacloud-cache - -EXTRA_DIST = \ - .gitignore \ - deltacloud-portal.spec \ - deltacloud-portal.spec.in \ - conf \ - src - -DISTCLEANFILES = $(PACKAGE)-$(VERSION).tar.gz - -# For Release: 0..., set _deltacloud_dev=1 so that we get extra_release.GIT- -# annotated rpm version strings. -_deltacloud_dev = \ - $(shell grep -q '^[[:space:]]*Release:[[:space:]]*0' \ - $(srcdir)/*.spec.in && echo 1 || :) - -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 "deltacloud_cache_dir $(DELTACLOUD_CACHE_DIR)" -RPM_FLAGS += $(if $(_deltacloud_dev),--define "extra_release .$(GIT_RELEASE)") - -rpms: dist - rpmbuild $(RPM_FLAGS) -ta $(distdir).tar.gz - -srpms: dist - rpmbuild $(RPM_FLAGS) -ts $(distdir).tar.gz - -publish: rpms - mkdir -p $(DELTACLOUD_CACHE_DIR) - rsync -aq $(shell rpm --eval '%{_rpmdir}')/ $(DELTACLOUD_CACHE_DIR)/deltacloud/ - rsync -aq $(shell rpm --eval '%{_srcrpmdir}')/ $(DELTACLOUD_CACHE_DIR)/deltacloud/src - createrepo $(DELTACLOUD_CACHE_DIR)/deltacloud - -genlangs: - cd src && rake updatepo && rake makemo - -.PHONY: rpms publish srpms genlangs diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..be8f0ae --- /dev/null +++ b/Rakefile @@ -0,0 +1,45 @@ +# deltacloud rakefile + +require 'rake/gempackagetask' + +PKG_NAME='deltacloud-aggregator' +GEM_NAME=PKG_NAME +PKG_VERSION='0.0.2' +SPEC_FILE="deltacloud-aggregator.spec" + +PKG_FILES = FileList[ + "conf/*", "contrib/*", "src/**/*", + "README", "AUTHORS", "COPYING" +] + +DIST_FILES = FileList[ + "pkg/*.tgz", "pkg/*.gem" +] + +SPEC = Gem::Specification.new do |s| + s.name = GEM_NAME + s.version = PKG_VERSION + s.email = "deltacloud-devel@lists.fedorahosted.org", + s.homepage = "http://deltacloud.org" + s.summary = "An API that abstracts the differences between clouds" + s.files = PKG_FILES + s.required_ruby_version = '>= 1.8.1' + s.description = "An API that abstracts the differences between clouds" +end + +Rake::GemPackageTask.new(SPEC) do |pkg| + pkg.need_tar = true + pkg.need_zip = true +end + +desc "Build (S)RPM for #{PKG_NAME}" +task :rpm => [ :package ] do |t| + system("sed -e 's/@VERSION@/#{PKG_VERSION}/' contrib/#{SPEC_FILE} > pkg/#{SPEC_FILE}") + Dir::chdir("pkg") do |dir| + dir = File::expand_path(".") + system("rpmbuild --define '_topdir #{dir}' --define '_sourcedir #{dir}' --define '_srcrpmdir #{dir}' --define '_rpmdir #{dir}' --define '_builddir #{dir}' -ba #{SPEC_FILE} > rpmbuild.log 2>&1") + if $? != 0 + raise "rpmbuild failed" + end + end +end diff --git a/configure.ac b/configure.ac deleted file mode 100644 index 53f1a2e..0000000 --- a/configure.ac +++ /dev/null @@ -1,11 +0,0 @@ -AC_INIT([deltacloud-portal], [0.0.2], [deltacloud-devel@lists.fedoraproject.org]) -AM_INIT_AUTOMAKE([-Wall -Werror foreign -Wno-portability tar-pax]) -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 deltacloud-portal.spec]) -AC_OUTPUT diff --git a/contrib/deltacloud-aggregator.spec b/contrib/deltacloud-aggregator.spec new file mode 100644 index 0000000..b14db2e --- /dev/null +++ b/contrib/deltacloud-aggregator.spec @@ -0,0 +1,139 @@ +%define app_root %{_datadir}/%{name} +%define doc_root %{_datadir}/%{name}-doc + +Name: deltacloud-aggregator +Version: @VERSION@ +Release: 1%{?dist} +Summary: The Deltacloud Aggregator + +Group: Applications/System +License: GPLv2+ +URL: http://deltacloud.org + +# until official source tarballs exist, checkout from source via +# git clone git://git.fedorahosted.org/deltacloud/portal.git deltacloud-aggregator-0.0.2 +# tar czvf deltacloud-aggregator-0.0.2.tgz deltacloud-aggregator-0.0.2 +Source0: deltacloud-aggregator-%{version}.tgz +BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) +BuildArch: noarch + +Requires: ruby >= 1.8.1 +Requires: ruby(abi) = 1.8 +Requires: rubygem(rails) >= 2.1.1 +Requires: rubygem(daemons) +Requires: rubygem(gettext_rails) +Requires: postgresql +Requires: postgresql-server +Requires: ruby-postgres + +%package daemons +Summary: Deltacloud Aggregator daemons config +Group: Applications/Internet +License: GPLv2+ +Requires: %{name} = %{version}-%{release} +Requires: httpd >= 2.0 +Requires: rubygem(mongrel) >= 1.0.1 +Requires(post): chkconfig +Requires(preun): chkconfig +Requires(preun): initscripts + + +%package doc +Summary: Deltacloud Aggregator documentation and test suite +Group: Documentation +Requires: %{name} = %{version}-%{release} + +%description +The Aggregator for Deltacloud. + +%description daemons +The configuration necessary to run and proxy the Deltacloud Aggregator. + +%description doc +Documentation and tests for the Deltacloud Aggregator + +%prep +%setup -q + +%build + +%install +rm -rf %{buildroot} +mkdir -p %{buildroot} +mkdir -p %{buildroot}%{app_root} +mkdir -p %{buildroot}%{doc_root} +mkdir -p %{buildroot}%{_initrddir} +mkdir -p %{buildroot}%{_sysconfdir}/sysconfig +mkdir -p %{buildroot}%{_sysconfdir}/httpd/conf.d +mkdir -p %{buildroot}%{_sysconfdir}/logrotate.d + +# copy over all of the src directory... +cp -R src/* %{buildroot}/%{app_root} + +# move documentation to the correct place +mv %{buildroot}/%{app_root}/doc %{buildroot}/%{app_root}/test %{buildroot}/%{doc_root} + +# copy over config and init scripts +cp conf/deltacloud-mongrel-rails conf/deltacloud-taskomatic %{buildroot}%{_initrddir} +cp conf/*.sysconf %{buildroot}%{_sysconfdir}/sysconfig +cp conf/deltacloud-portal.conf %{buildroot}%{_sysconfdir}/httpd/conf.d/deltacloud-aggregator.conf +cp conf/deltacloud-portal.logrotate %{buildroot}%{_sysconfdir}/logrotate.d/deltacloud-aggregator + +# remove the files not needed for the installation +rm -f %{buildroot}%{app_root}/task-omatic/.gitignore +rm -f %{buildroot}%{app_root}/vendor/plugins/will_paginate/.gitignore +rm -f %{buildroot}%{app_root}/vendor/plugins/will_paginate/.manifest +rm -rf %{buildroot}%{app_root}/tmp + +%clean +rm -rf %{buildroot} + +#%check +#rake spec + +%pre daemons +getent group dcloud >/dev/null || /usr/sbin/groupadd -g 109 -r dcloud 2>/dev/null || : +getent passwd dcloud >/dev/null || \ + /usr/sbin/useradd -u 109 -g dcloud -c "dcloud" \ + -s /sbin/nologin -r -d /var/dcloud dcloud 2> /dev/null || : + +%post daemons +# Register the httpd service +/sbin/chkconfig --add deltacloud-taskomatic +/sbin/chkconfig --add deltacloud-mongrel-rails + +%preun daemons +if [ $1 = 0 ]; then +/sbin/service deltacloud-taskomatic stop > /dev/null 2>&1 +/sbin/chkconfig --del deltacloud-taskomatic +/sbin/service deltacloud-mongrel-rails stop > /dev/null 2>&1 +/sbin/chkconfig --del deltacloud-mongrel-rails +fi + +%files +%defattr(-,root,root,-) +%{app_root} +%doc README AUTHORS COPYING + +%files daemons +%defattr(-,root,root,-) +%{_initrddir}/deltacloud-mongrel-rails +%{_initrddir}/deltacloud-taskomatic +%config(noreplace) %{_sysconfdir}/logrotate.d/%{name} +%config(noreplace) %{_sysconfdir}/sysconfig/deltacloud-mongrel-rails.sysconf +%config(noreplace) %{_sysconfdir}/sysconfig/deltacloud-rails.sysconf +%config(noreplace) %{_sysconfdir}/httpd/conf.d/%{name}.conf +%doc README AUTHORS COPYING + +%files doc +%defattr(-,root,root,-) +%{doc_root} +%doc README AUTHORS COPYING + +%changelog +* Wed Feb 18 2010 Mohammed Morsi mmorsi@redhat.com - 0.0.2-1 +- renamed portal to aggregator +- updated / cleaned up package + +* Fri Sep 1 2009 sseago@redhat.com - 0.0.1-1 +- Initial build. diff --git a/deltacloud-portal.spec.in b/deltacloud-portal.spec.in deleted file mode 100644 index 642da34..0000000 --- a/deltacloud-portal.spec.in +++ /dev/null @@ -1,162 +0,0 @@ -%define pbuild %{_builddir}/%{name}-%{version} -%define app_root %{_datadir}/%{name} -%define acehome %{_datadir}/ace - -Summary: The Deltacloud Portal -Name: deltacloud-portal -Version: @VERSION@ -Release: 0%{?dist}%{?extra_release} -Source0: http://deltacloud.org/files/%%7Bname%7D-%%7Bversion%7D.tar.gz -#Entire source code is GPL except for vendor/plugins/will_paginate and -#public/javascripts/jquery.*, which is both MIT and GPL -License: GPLv2+ and MIT and BSD -Group: Applications/System -Requires: ruby >= 1.8.1 -Requires: ruby(abi) = 1.8 -Requires: rubygem(activerecord) >= 2.1.1-2 -Requires: rubygem(activeldap) >= 0.10.0 -Requires: rubygem(rails) >= 2.1.1 -Requires: rubygem(mongrel) >= 1.0.1 -%if 0%{?fedora} >= 11 -Requires: rubygem(gettext_rails) -%else -Requires: rubygem(gettext) -%endif -Requires: ruby-flexmock -Requires: postgresql-server -Requires: ruby-postgres -Requires: pwgen -Requires: httpd >= 2.0 -Requires(post): /sbin/chkconfig -Requires(preun): /sbin/chkconfig -Requires(preun): /sbin/service -BuildRequires: ruby >= 1.8.1 -BuildRequires: ruby-devel -BuildRequires: rubygem(gettext) -BuildRequires: rubygem(rake) >= 0.7 -BuildArch: noarch -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot -URL: http://deltacloud.org/ - -%description -The Portal for deltacloud. - -%prep -%setup -q - -%build - -%install -test "x%{buildroot}" != "x" && rm -rf %{buildroot} -mkdir %{buildroot} - -%{__install} -d -m0755 %{buildroot}%{_bindir} -%{__install} -d -m0755 %{buildroot}%{_datadir} -%{__install} -d -m0755 %{buildroot}%{_sbindir} -%{__install} -d -m0755 %{buildroot}%{_initrddir} -%{__install} -d -m0755 %{buildroot}%{_sysconfdir}/sysconfig -%{__install} -d -m0755 %{buildroot}%{_sysconfdir}/httpd/conf.d -%{__install} -d -m0755 %{buildroot}%{_sysconfdir}/%{name} -%{__install} -d -m0755 %{buildroot}%{_sysconfdir}/%{name}/db -%{__install} -d -m0755 %{buildroot}%{_sysconfdir}/logrotate.d -%{__install} -d -m0755 %{buildroot}%{_localstatedir}/lib/%{name} -%{__install} -d -m0755 %{buildroot}%{_localstatedir}/log/%{name} -%{__install} -d -m0755 %{buildroot}%{_localstatedir}/run/%{name} -%{__install} -d -m0755 %{buildroot}%{app_root} -%{__install} -d -m0755 %{buildroot}/%{acehome} - -# Creating these files now to make sure the logfiles will be owned -# by dcloud:dcloud. This is a temporary workaround while we've still -# got root-owned daemon processes. Once we resolve that issue -# these files will no longer be added explicitly here. -touch %{buildroot}%{_localstatedir}/log/%{name}/mongrel.log -touch %{buildroot}%{_localstatedir}/log/%{name}/rails.log -touch %{buildroot}%{_localstatedir}/log/%{name}/taskomatic.log -%{__install} -p -m0644 %{pbuild}/conf/%{name}.conf %{buildroot}%{_sysconfdir}/httpd/conf.d -%{__install} -p -m0644 %{pbuild}/conf/%{name}.logrotate %{buildroot}%{_sysconfdir}/logrotate.d/%{name} - -%{__install} -Dp -m0755 %{pbuild}/conf/deltacloud-mongrel-rails %{buildroot}%{_initrddir} -%{__install} -Dp -m0644 %{pbuild}/conf/deltacloud-mongrel-rails.sysconf %{buildroot}%{_sysconfdir}/sysconfig/deltacloud-mongrel-rails -%{__install} -Dp -m0644 %{pbuild}/conf/deltacloud-rails.sysconf %{buildroot}%{_sysconfdir}/sysconfig/deltacloud-rails -%{__install} -Dp -m0755 %{pbuild}/conf/deltacloud-taskomatic %{buildroot}%{_initrddir} - -# copy over all of the src directory... -%{__cp} -a %{pbuild}/src/* %{buildroot}%{app_root} - - -# move configs to /etc, keeping symlinks for Rails -%{__mv} %{buildroot}%{app_root}/config/database.yml %{buildroot}%{_sysconfdir}/%{name} -%{__mv} %{buildroot}%{app_root}/config/environments/development.rb %{buildroot}%{_sysconfdir}/%{name} -%{__mv} %{buildroot}%{app_root}/config/environments/production.rb %{buildroot}%{_sysconfdir}/%{name} -%{__mv} %{buildroot}%{app_root}/config/environments/test.rb %{buildroot}%{_sysconfdir}/%{name} -%{__ln_s} %{_sysconfdir}/%{name}/database.yml %{buildroot}%{app_root}/config -%{__ln_s} %{_sysconfdir}/%{name}/development.rb %{buildroot}%{app_root}/config/environments -%{__ln_s} %{_sysconfdir}/%{name}/production.rb %{buildroot}%{app_root}/config/environments -%{__ln_s} %{_sysconfdir}/%{name}/test.rb %{buildroot}%{app_root}/config/environments - -# remove the files not needed for the installation -%{__rm} -f %{buildroot}%{app_root}/task-omatic/.gitignore -%{__rm} -f %{buildroot}%{app_root}/vendor/plugins/will_paginate/.gitignore -%{__rm} -f %{buildroot}%{app_root}/vendor/plugins/will_paginate/.manifest - -%{__rm} -rf %{buildroot}%{app_root}/tmp -%{__mkdir} %{buildroot}%{_localstatedir}/lib/%{name}/tmp -%{__ln_s} %{_localstatedir}/lib/%{name}/tmp %{buildroot}%{app_root}/tmp - -%clean -rm -rf %{buildroot} - -%pre -getent group dcloud >/dev/null || /usr/sbin/groupadd -g 109 -r dcloud 2>/dev/null || : -getent passwd dcloud >/dev/null || \ - /usr/sbin/useradd -u 109 -g dcloud -c "dcloud" \ - -s /sbin/nologin -r -d /var/dcloud dcloud 2> /dev/null || : - -%post -# script -%define daemon_chkconfig_post(d:) \ -/sbin/chkconfig --list %{-d*} >& /dev/null \ -LISTRET=$? \ -/sbin/chkconfig --add %{-d*} \ -if [ $LISTRET -ne 0 ]; then \ - /sbin/chkconfig %{-d*} on \ -fi \ -%{nil} - -# if this is the initial RPM install, then we want to turn the new services -# on; otherwise, we respect the choices the administrator already has made. -# check this by seeing if each daemon is already installed -%daemon_chkconfig_post -d deltacloud-mongrel-rails -%daemon_chkconfig_post -d deltacloud-taskomatic - -%preun -if [ "$1" = 0 ] ; then - /sbin/service deltacloud-mongrel-rails stop > /dev/null 2>&1 - /sbin/service deltacloud-taskomatic stop > /dev/null 2>&1 - /sbin/chkconfig --del deltacloud-mongrel-rails - /sbin/chkconfig --del deltacloud-taskomatic -fi - -%files -%defattr(-,root,root,0755) -%{_initrddir}/deltacloud-mongrel-rails -%{_initrddir}/deltacloud-taskomatic -%config(noreplace) %{_sysconfdir}/logrotate.d/%{name} -%config(noreplace) %{_sysconfdir}/sysconfig/deltacloud-mongrel-rails -%config(noreplace) %{_sysconfdir}/sysconfig/deltacloud-rails -%config(noreplace) %{_sysconfdir}/httpd/conf.d/%{name}.conf -%doc README AUTHORS COPYING -%attr(-, dcloud, dcloud) %{_localstatedir}/lib/%{name} -%attr(-, dcloud, dcloud) %{_localstatedir}/run/%{name} -%attr(-, dcloud, dcloud) %{_localstatedir}/log/%{name} -%{app_root} -%dir %{_sysconfdir}/%{name} -%dir %{_sysconfdir}/%{name}/db -%config(noreplace) %{_sysconfdir}/%{name}/database.yml -%config(noreplace) %{_sysconfdir}/%{name}/development.rb -%config(noreplace) %{_sysconfdir}/%{name}/production.rb -%config(noreplace) %{_sysconfdir}/%{name}/test.rb - -%changelog -* Fri Sep 1 2009 sseago@redhat.com - 0.0.1-1 -- Initial build.
Also w/ this patch I'm proposing that we do away w/ the 'src/' subdir in the aggregator project all together, moving its contents into the repository root dir.
All the rails apps I've seen do it this way, and we could easily merge the sysconfig/init-scripts/config contents of the 'conf/' dir into a 'daemons' subdir of the rails conf dir. Also we could merge the top level README, Rakefile, and other shared files w/ their equivalents in the current 'src/' dir.
What do you all think about this? If there are no objections, I'll send out a patch doing this soon.
-Mo
deltacloud-devel@lists.fedorahosted.org