Skip to content
This repository has been archived by the owner on Mar 26, 2024. It is now read-only.

Commit

Permalink
(#7567) Refactor dashboard packaging to allow for nightly builds
Browse files Browse the repository at this point in the history
We now allow for builds out of master that utilizes git-describe for
versioning.  The generation of the tarball or package will create a
VERSION file with the proper contents.

The package/tarball will also use erb to substitute versions, dates and
other metadata into the Red Hat spec or Debian changelog.

The Debian package also changed to model more the builds from PE. This
means a newer rules configuration and the addition of the rmshebang
script to comply with Debian packaging guidelines.

The package:deb, package:rpm, and package:srpm rake tasks now use the
tarball generated from the package:tar task, which means that the spec,
changelog, and other packaging inputs are generated from their erb
templates.

Signed-off-by: Michael Stahnke <[email protected]>
  • Loading branch information
stahnma authored and jhelwig committed Jul 15, 2011
1 parent a58f3e0 commit 82eeea7
Show file tree
Hide file tree
Showing 8 changed files with 218 additions and 164 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,5 @@ db/schema.rb
db/migrate/*_plugin_*.rb
config/installed_plugins
*.rpm
pkg/*
VERSION
1 change: 0 additions & 1 deletion VERSION

This file was deleted.

6 changes: 6 additions & 0 deletions ext/packaging/debian/cl.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
puppet-dashboard (<%= version %>-1) intrepid jaunty karmic lucid meerkat narwhal natty lenny squeeze; urgency=low

* build at version <%= version %>

-- Michael Stahnke <stahnma@puppetlabs.com> <%= dt %>

1 change: 0 additions & 1 deletion ext/packaging/debian/install
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ db usr/share/puppet-dashboard
ext usr/share/puppet-dashboard
lib usr/share/puppet-dashboard
public usr/share/puppet-dashboard
VERSION usr/share/puppet-dashboard
CHANGELOG usr/share/puppet-dashboard
COPYING usr/share/puppet-dashboard
LICENSE usr/share/puppet-dashboard
Expand Down
17 changes: 17 additions & 0 deletions ext/packaging/debian/rmshebang.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/sh

for target_dir in $@
do
for f in `find "$target_dir" -type f 2>/dev/null`
do
sed -e '1,1{
/^#!/d
}' < $f > $f.tmp
if ! cmp $f $f.tmp >/dev/null
then
mv -f $f.tmp $f
else
rm -f $f.tmp
fi
done
done
72 changes: 44 additions & 28 deletions ext/packaging/debian/rules
Original file line number Diff line number Diff line change
@@ -1,32 +1,48 @@
#!/usr/bin/make -f
# -*- makefile -*-

# Uncomment these fllowing lines to display lots of debugging information during the build process:
export DH_VERBOSE=1
export DH_OPTIONS=-v
include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/rules/buildcore.mk

%:
dh $@
ruby_ver = 1.8

override_dh_install:
install -d debian/puppet-dashboard/etc/puppet-dashboard
install -d debian/puppet-dashboard/usr/share/puppet-dashboard
install -d debian/puppet-dashboard/usr/share/doc/puppet-dashboard/examples
cp -r app bin config db ext lib public script spec vendor VERSION CHANGELOG COPYING LICENSE README.markdown README_PACKAGES.markdown RELEASE_NOTES.md Rakefile debian/puppet-dashboard/usr/share/puppet-dashboard/
install config/database.yml.example debian/puppet-dashboard/etc/puppet-dashboard/database.yml
install config/database.yml.example debian/puppet-dashboard/usr/share/doc/puppet-dashboard/examples/database.yml.example
# Clean up the "extra" license files
rm -f debian/puppet-dashboard/usr/share/puppet-dashboard/config/database.yml.example
rm -f debian/puppet-dashboard/usr/share/puppet-dashboard/doc/README_FOR_APP
rm -f debian/puppet-dashboard/usr/share/puppet-dashboard/vendor/plugins/*/*LICENSE
rm -f debian/puppet-dashboard/usr/share/puppet-dashboard/vendor/plugins/*/License.txt
rm -f debian/puppet-dashboard/usr/share/puppet-dashboard/vendor/plugins/*/COPYING
rm -f debian/puppet-dashboard/usr/share/puppet-dashboard/vendor/gems/*/COPYING
rm -f debian/puppet-dashboard/usr/share/puppet-dashboard/vendor/gems/*/*LICENSE
rm -f debian/puppet-dashboard/usr/share/puppet-dashboard/vendor/gems/*/License.txt
rm -f debian/puppet-dashboard/usr/share/puppet-dashboard/vendor/rails/*/*LICENSE
# ...and other various files
rm -f debian/puppet-dashboard/.gems
rm -f debian/puppet-dashboard/.autotest
find debian/puppet-dashboard -name '.gitignore' -type f | xargs rm -f
find debian/puppet-dashboard -name '.git' -type d | xargs rm -rf
binary-install/puppet-dashboard::
mkdir -p $(CURDIR)/debian/$(cdbs_curpkg)/etc/puppet-dashboard
mkdir -p $(CURDIR)/debian/$(cdbs_curpkg)/usr/share/puppet-dashboard
mkdir -p $(CURDIR)/debian/$(cdbs_curpkg)/var/$(cdbs_curpkg)/tmp
mkdir -p $(CURDIR)/debian/$(cdbs_curpkg)/var/log/puppet-dashboard
cp -r app \
bin \
config \
db \
ext \
lib \
Rakefile \
script \
spec \
vendor \
RELEASE_NOTES.md \
$(CURDIR)/debian/$(cdbs_curpkg)/usr/share/puppet-dashboard
cp $(CURDIR)/config/database.yml.example $(CURDIR)/debian/$(cdbs_curpkg)/etc/puppet-dashboard/database.yml
cp -r $(CURDIR)/public $(CURDIR)/debian/$(cdbs_curpkg)/var/$(cdbs_curpkg)
chmod -R a+rx $(CURDIR)/debian/$(cdbs_curpkg)/usr/share/puppet-dashboard/script
rm -rf $(CURDIR)/debian/$(cdbs_curpkg)/usr/share/puppet-dashboard/ext/packaging
# Clean up the "extra" files
rm -f $(CURDIR)/debian/$(cdbs_curpkg)/usr/share/puppet-dashboard/config/database.yml.example
rm -f $(CURDIR)/debian/$(cdbs_curpkg)/usr/share/puppet-dashboard/vendor/plugins/*/*LICENSE
rm -f $(CURDIR)/debian/$(cdbs_curpkg)/usr/share/puppet-dashboard/vendor/plugins/*/License.txt
rm -f $(CURDIR)/debian/$(cdbs_curpkg)/usr/share/puppet-dashboard/vendor/gems/*/COPYING
rm -f $(CURDIR)/debian/$(cdbs_curpkg)/usr/share/puppet-dashboard/vendor/gems/*/*LICENSE
rm -f $(CURDIR)/debian/$(cdbs_curpkg)/usr/share/puppet-dashboard/vendor/gems/*/License.txt
rm -f $(CURDIR)/debian/$(cdbs_curpkg)/usr/share/puppet-dashboard/vendor/rails/*/*LICENSE
find $(CURDIR)/debian/$(cdbs_curpkg) -name .gitignore -exec rm {} \;
find $(CURDIR)/debian/$(cdbs_curpkg)/usr/share/puppet-dashboard/vendor -name LICENSE -exec rm {} \;
find $(CURDIR)/debian/$(cdbs_curpkg)/usr/share/puppet-dashboard/vendor -name MIT-LICENSE -exec rm {} \;
find $(CURDIR)/debian/$(cdbs_curpkg)/usr/share/puppet-dashboard/vendor -type f -exec chmod a-x {} \;
find $(CURDIR)/debian/$(cdbs_curpkg)/usr/share/puppet-dashboard/app -type f -exec chmod a-x {} \;
find $(CURDIR)/debian/$(cdbs_curpkg)/usr/share/puppet-dashboard/spec -type f -exec chmod a-x {} \;
# Fixup shebang lines
bash $(CURDIR)/debian/rmshebang.sh \
$(CURDIR)/debian/$(cdbs_curpkg)/usr/share/puppet-dashboard/lib \
$(CURDIR)/debian/$(cdbs_curpkg)/usr/share/puppet-dashboard/app \
$(CURDIR)/debian/$(cdbs_curpkg)/usr/share/puppet-dashboard/spec \
$(CURDIR)/debian/$(cdbs_curpkg)/usr/share/puppet-dashboard/vendor
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
%global confdir ext/packaging/redhat
%global initrddir /etc/rc.d/init.d
# VERSION is subbed out during rake srpm process
%global realversion <%= version %>
%define rpmversion %(echo %{realversion} | sed -e 's/-/_/g')

Name: puppet-dashboard
Version: 1.1.9
Release: 2%{?dist}
Version: %{rpmversion}
Release: <%= release -%>%{?dist}
Summary: Systems Management web application
Group: Applications/System
# Remember to verify this
License: GPLv2
URL: http://www.puppetlabs.com
Source0: http://yum.puppetlabs.com/sources/%{name}-%{version}.tar.gz
Source0: http://yum.puppetlabs.com/sources/%{name}-%{realversion}.tar.gz
BuildArch: noarch
Requires: ruby(abi) = 1.8, rubygems, ruby-mysql
Requires: ruby > 1.8.7, rubygem(rake)
Expand All @@ -33,7 +36,7 @@ getent passwd puppet-dashboard > /dev/null || \
exit 0

%prep
%setup -q
%setup -q -n %{name}-%{realversion}

%build

Expand Down Expand Up @@ -69,12 +72,12 @@ rm timestamp

# Put logs in /var/log and symlink in /usr/share (FHS work)
#mkdir -p $RPM_BUILD_ROOT/var/log/%{name}
#if $(stat $RPM_BUILD_ROOT/%{_datadir}/%{name}/log/*) ; then
#if $(stat $RPM_BUILD_ROOT/%{_datadir}/%{name}/log/*) ; then
# rsync -avx $RPM_BUILD_ROOT/%{_datadir}/%{name}/log/* $RPM_BUILD_ROOT/var/log/%{name}
#fi
#fi
#rm -rf $RPM_BUILD_ROOT/%{_datadir}/%{name}/log
#ls -l $RPM_BUILD_ROOT/%{_datadir}/%{name}
#cd $RPM_BUILD_ROOT/var/log
#cd $RPM_BUILD_ROOT/var/log
#ln -sf %{name} ../..%{_datadir}/%{name}/log


Expand Down Expand Up @@ -132,9 +135,12 @@ fi
#%attr(-,puppet-dashboard,puppet-dashboard) %dir /var/log/%{name}

%changelog
* <%= spec_date %> Michael Stahnke <stahnma@puppetlabs.com> - <%= rpmversion %>-<%= release %>
- Build for <%= version %>

* Mon Jul 04 2011 Michael Stahnke <stahnma@puppetlabs.com> - 1.1.9-2
- Updating spec to fix some rpmlint issues
- Began work on FHS issues, but haven't completed (commented out)
- Began work on FHS issues, but have not completed (commented out)
- Adding a spool directory

* Thu Jun 30 2011 Michael Stahnke <stahnma@puppetlabs.com> - 1.1.9-1
Expand Down Expand Up @@ -184,4 +190,3 @@ fi

* Thu Mar 26 2010 James Turnbull <james@lovedthanlost.net> - 1.0.0-1
- Initial release.

Loading

0 comments on commit 82eeea7

Please sign in to comment.