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

Commit

Permalink
Merge branch 'ticket/master/6840-remove-version-file'
Browse files Browse the repository at this point in the history
* ticket/master/6840-remove-version-file:
  (#7567) Refactor dashboard packaging to allow for nightly builds
  (#6840) Remove need for VERSION file in puppet-dashboard
  • Loading branch information
jhelwig committed Jul 15, 2011
2 parents d9a384f + 82eeea7 commit 9f11f67
Show file tree
Hide file tree
Showing 10 changed files with 236 additions and 166 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.

2 changes: 1 addition & 1 deletion app/views/shared/_global_nav.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
- else
%a{:href => root_path, :id => "logo", :style => "text-indent: -9000px;"} Puppet Dashboard
%li{:class => active_if(request.url == release_notes_url)}
= link_to "v#{APP_VERSION}", 'https://github.com/puppetlabs/puppet-dashboard'
= link_to APP_VERSION, "https://github.com/puppetlabs/puppet-dashboard/blob/#{APP_VERSION.sub(/.*?g([0-9a-f]*)/, "\\1")}/CHANGELOG"
%li »
%li{:class => active_if(request.url == root_url)}
= link_to "Home", root_path
Expand Down
18 changes: 17 additions & 1 deletion config/initializers/app_version_init.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
# Get the Dashboard version number.
#
# Any officially released package or tarball of dashboard
# will have a VERSION file that is generated at tarball
# build time.
#
# This allows for the APP_VERSION to be determined by git, so
# developers can run out of master after a git checkout.
def get_app_version
if File.exists?(Rails.root.join('VERSION'))
return File.read(Rails.root.join('VERSION')).strip
elsif File.directory?(Rails.root.join('.git'))
return `cd #{Rails.root}; git describe`.strip! rescue 'unknown'
end

APP_VERSION = File.read(Rails.root.join('VERSION')).strip.sub(/^v/, '')
'unknown'
end

APP_VERSION = get_app_version
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 9f11f67

Please sign in to comment.