Permalink
Browse files

Update Debian packaging: get rid of gem2deb dependency and make mizuh…

…o work properly with any Ruby interpreter
  • Loading branch information...
1 parent 960d71e commit 3f361f0732ec59dd9f8f047aa4ea4943be8ba700 @FooBarWidget committed Dec 13, 2013
View
22 Rakefile
@@ -51,7 +51,8 @@ end
PKG_DIR = string_option('PKG_DIR', "pkg")
DEBIAN_NAME = PACKAGE_NAME
-ALL_DISTRIBUTIONS = ["raring", "precise", "lucid"]
+DEBIAN_PACKAGE_REVISION = 1
+ALL_DISTRIBUTIONS = string_option('DEBIAN_DISTROS', 'saucy precise lucid').split(/[ ,]/)
ORIG_TARBALL_FILES = lambda do
require 'mizuho/packaging'
Dir[*MIZUHO_FILES] - Dir[*MIZUHO_DEBIAN_EXCLUDE_FILES]
@@ -411,7 +412,7 @@ def create_debian_package_dir(distribution)
sh "mv #{root}/debian.template #{root}/debian"
changelog = File.read("#{root}/debian/changelog")
changelog =
- "#{DEBIAN_NAME} (#{PACKAGE_VERSION}-1~#{distribution}1) #{distribution}; urgency=low\n" +
+ "#{DEBIAN_NAME} (#{PACKAGE_VERSION}-#{DEBIAN_PACKAGE_REVISION}~#{distribution}1) #{distribution}; urgency=low\n" +
"\n" +
" * Package built.\n" +
"\n" +
@@ -429,7 +430,8 @@ task 'debian:orig_tarball' do
sh "rm -rf #{PKG_DIR}/#{DEBIAN_NAME}_#{PACKAGE_VERSION}"
sh "mkdir -p #{PKG_DIR}/#{DEBIAN_NAME}_#{PACKAGE_VERSION}"
recursive_copy_files(ORIG_TARBALL_FILES.call, "#{PKG_DIR}/#{DEBIAN_NAME}_#{PACKAGE_VERSION}")
- sh "cd #{PKG_DIR} && tar -c #{DEBIAN_NAME}_#{PACKAGE_VERSION} | gzip --best > #{DEBIAN_NAME}_#{PACKAGE_VERSION}.orig.tar.gz"
+ sh "cd #{PKG_DIR} && find #{DEBIAN_NAME}_#{PACKAGE_VERSION} -print0 | xargs -0 touch -d '2013-10-27 00:00:00 UTC'"
+ sh "cd #{PKG_DIR} && tar -c #{DEBIAN_NAME}_#{PACKAGE_VERSION} | gzip --no-name --best > #{DEBIAN_NAME}_#{PACKAGE_VERSION}.orig.tar.gz"
end
end
@@ -455,8 +457,18 @@ task 'debian:dev' do
end
end
-desc "Build Debian source packages to be uploaded to repositories"
-task 'debian:production' => 'debian:orig_tarball' do
+desc "Build Debian source packages"
+task 'debian:source_packages' => 'debian:orig_tarball' do
+ ALL_DISTRIBUTIONS.each do |distribution|
+ create_debian_package_dir(distribution)
+ end
+ ALL_DISTRIBUTIONS.each do |distribution|
+ sh "cd #{PKG_DIR}/#{distribution} && debuild -S -us -uc"
+ end
+end
+
+desc "Build Debian source packages to be uploaded to Launchpad"
+task 'debian:launchpad' => 'debian:orig_tarball' do
ALL_DISTRIBUTIONS.each do |distribution|
create_debian_package_dir(distribution)
sh "cd #{PKG_DIR}/#{distribution} && dpkg-checkbuilddeps"
View
6 debian.template/control.template
@@ -2,20 +2,18 @@ Source: mizuho
Section: text
Priority: extra
Maintainer: Hongli Lai <hongli@phusion.nl>
-Build-Depends: debhelper (>= 7.0.50~), gem2deb (>= 0.2.0~), sed (>= 1.0.0)
+Build-Depends: debhelper (>= 7.0.50~), sed (>= 1.0.0)
Standards-Version: 3.9.3
Homepage: https://github.com/FooBarWidget/mizuho
Vcs-Git: git://github.com/FooBarWidget/mizuho.git
Vcs-Browser: https://github.com/FooBarWidget/mizuho
-XS-Ruby-Versions: all
Package: mizuho
Architecture: all
-XB-Ruby-Versions: ${ruby:Versions}
#if is_distribution?('>= precise')
Depends: ${shlibs:Depends}, ${misc:Depends}, ruby2.0 | ruby1.9.1 | ruby1.8 | ruby-interpreter, ruby-nokogiri (>= 1.4.0), source-highlight, asciidoc (>= 8.6.0)
#else
- Depends: ${shlibs:Depends}, ${misc:Depends}, ruby2.0 | ruby1.9.1 | ruby1.8 | ruby-interpreter, libnokogiri-ruby (>= 1.4.0), python, source-highlight
+ Depends: ${shlibs:Depends}, ${misc:Depends}, ruby, libnokogiri-ruby (>= 1.4.0), python, source-highlight
#endif
Breaks: ruby-mizuho
Replaces: ruby-mizuho
View
2 debian.template/mizuho.install.template
@@ -1,3 +1,5 @@
+bin/* usr/bin/
+lib/* usr/lib/ruby/vendor_ruby/
templates/* usr/share/mizuho/templates
#if is_distribution?('< precise')
asciidoc/* usr/share/mizuho/asciidoc
View
14 debian.template/ruby-interpreter
@@ -0,0 +1,14 @@
+#!/bin/sh
+if test -e /usr/bin/ruby; then
+ exec /usr/bin/ruby "$@"
+elif test -e /usr/bin/ruby2.0; then
+ exec /usr/bin/ruby2.0 "$@"
+elif test -e /usr/bin/ruby1.9.3; then
+ exec /usr/bin/ruby1.9.3 "$@"
+elif test -e /usr/bin/ruby1.9.1; then
+ exec /usr/bin/ruby1.9.1 "$@"
+elif test -e /usr/bin/ruby1.8; then
+ exec /usr/bin/ruby1.8 "$@"
+else
+ exec ruby "$@"
+fi
View
12 debian.template/rules
@@ -1,12 +0,0 @@
-#!/usr/bin/make -f
-export DH_VERBOSE=1
-
-%:
- dh $@ --buildsystem=ruby
-
-override_dh_install:
- dh_install
- #if is_distribution?(">= precise")
- sed -i 's/NATIVELY_PACKAGED = .*/NATIVELY_PACKAGED = true/' debian/mizuho/usr/lib/ruby/vendor_ruby/mizuho.rb
- #endif
- sed -i 's/\/usr\/bin\/env ruby/\/usr\/bin\/ruby/' debian/mizuho/usr/bin/mizuho
View
26 debian.template/rules.template
@@ -0,0 +1,26 @@
+#!/usr/bin/make -f
+export DH_VERBOSE=1
+
+%:
+ dh $@
+
+override_dh_auto_configure:
+ # Do nothing
+
+override_dh_auto_build:
+ # Do nothing
+
+override_dh_install:
+ dh_install
+ sed -i 's/NATIVELY_PACKAGED = .*/NATIVELY_PACKAGED = true/' debian/mizuho/usr/lib/ruby/vendor_ruby/mizuho.rb
+#if is_distribution?(">= precise")
+ cp debian/ruby-interpreter debian/mizuho/usr/share/mizuho/
+ sed -i 's/\/usr\/bin\/env ruby/\/usr\/share\/mizuho\/ruby-interpreter/' debian/mizuho/usr/bin/mizuho
+ sed -i 's/\/usr\/bin\/env ruby/\/usr\/share\/mizuho\/ruby-interpreter/' debian/mizuho/usr/bin/mizuho-asciidoc
+#else
+ sed -i 's/\/usr\/bin\/env ruby/\/usr\/bin\/ruby/' debian/mizuho/usr/bin/mizuho
+ sed -i 's/\/usr\/bin\/env ruby/\/usr\/bin\/ruby/' debian/mizuho/usr/bin/mizuho-asciidoc
+#endif
+
+override_dh_auto_clean:
+ # Do nothing

0 comments on commit 3f361f0

Please sign in to comment.