[SCM] ci-tooling packaging branch, master, updated. c35f744808f9469927a08f105f8ea68e77a93931
Rohan Garg
rohangarg-guest at moszumanska.debian.org
Tue Jan 27 13:32:59 UTC 2015
Gitweb-URL: http://git.debian.org/?p=pkg-kde/ci-tooling.git;a=commitdiff;h=c35f744
The following commit has been merged in the master branch:
commit c35f744808f9469927a08f105f8ea68e77a93931
Author: Rohan Garg <rohan at kde.org>
Date: Tue Jan 27 14:28:43 2015 +0100
Major rewrite of mozilla CI
* Add support for Thunderbird
* Make things alot more generic
* Break up steps into separate functions that can be reused across Firefox
and Thunderbird
---
dci/mozilla.rb | 337 ++++++++++++++++++++++++++++-----------------------------
1 file changed, 168 insertions(+), 169 deletions(-)
diff --git a/dci/mozilla.rb b/dci/mozilla.rb
index f31f995..e42b787 100644
--- a/dci/mozilla.rb
+++ b/dci/mozilla.rb
@@ -15,193 +15,192 @@ $logger = DCILogger.instance
PACKAGE = ARGV[1]
RELEASE = ARGV[2]
-def firefox_releases
- require 'nokogiri'
- threads = []
- ubuntu_versions = []
- upstream_versions = []
- threads << Thread.new do
- # Find the latest release from the Mozilla releases page
- begin
- doc = Nokogiri::HTML(open("https://www.mozilla.org/en-US/firefox/releases"))
- rescue
- sleep 30
- retry
- end
-
- doc.css('li').each do |node|
- text = node.text
- match_data = text.match('(\d+[.]\d+)')
- upstream_versions << match_data.string.to_f unless match_data.nil?
- end
-
- upstream_versions.uniq!
- upstream_versions.sort!
- puts "Upstream #{upstream_versions}"
+$logger.info("Building #{PACKAGE}")
+
+def package_releases
+ require 'nokogiri'
+ threads = []
+ ubuntu_versions = []
+ upstream_versions = []
+ threads << Thread.new do
+ # Find the latest release from the Mozilla releases page
+ begin
+ doc = Nokogiri::HTML(open("https://www.mozilla.org/en-US/#{PACKAGE}/releases"))
+ rescue
+ sleep 30
+ retry
end
- threads << Thread.new do
- `rmadison -u ubuntu -a amd64 -s #{RELEASE} firefox`.to_str.each_line { |line|
- match_data = line.match('(\d+[.]\d+)')
- ubuntu_versions << match_data[0].to_f unless match_data.nil?
- }
-
- # Make sure we take the updates suite into account too
- `rmadison -u ubuntu -a amd64 -s #{RELEASE}-updates firefox`.to_str.each_line { |line|
- match_data = line.match('(\d+[.]\d+)')
- ubuntu_versions << match_data[0].to_f unless match_data.nil?
- }
-
- ubuntu_versions.uniq!
- ubuntu_versions.sort!
- puts "Ubuntu #{ubuntu_versions}"
+ doc.css('li').each do |node|
+ text = node.text
+ match_data = text.match('(\d+[.]\d+)')
+ upstream_versions << match_data.string.to_f unless match_data.nil?
end
- ThreadsWait.all_waits(threads)
- return { ubuntu: ubuntu_versions[-1], upstream: upstream_versions[-1] }
-end
+ upstream_versions.uniq!
+ upstream_versions.sort!
+ $logger.info("Upstream #{upstream_versions}")
+ end
-def run_cmd(cmd)
- retry_count = 0
- begin
- if retry_count <= 5
- fail unless system(cmd)
- else
- $logger.fatal("#{cmd} keeps failing! :(")
- exit 1
- end
- rescue RuntimeError
- $logger.warn("Trying to run #{cmd} again!")
- retry_count += 1
- sleep(retry_count * 20)
- retry
+ threads << Thread.new do
+ `rmadison -u ubuntu -a amd64 -s #{RELEASE} #{PACKAGE}`.to_str.each_line do | line |
+ match_data = line.match('(\d+[.]\d+)')
+ ubuntu_versions << match_data[0].to_f unless match_data.nil?
end
+
+ # Make sure we take the updates suite into account too
+ `rmadison -u ubuntu -a amd64 -s #{RELEASE}-updates #{PACKAGE}`.to_str.each_line do | line |
+ match_data = line.match('(\d+[.]\d+)')
+ ubuntu_versions << match_data[0].to_f unless match_data.nil?
+ end
+
+ ubuntu_versions.uniq!
+ ubuntu_versions.sort!
+ puts "Ubuntu #{ubuntu_versions}"
+ end
+
+ ThreadsWait.all_waits(threads)
+ { ubuntu: ubuntu_versions[-1], upstream: upstream_versions[-1] }
+end
+
+def bump_version
+ changelog = Changelog.new
+ version = "1000~#{changelog.version(Changelog::BASE)}"
+ if DEBIAN_RELEASES.include? RELEASE
+ version += '-1'
+ File.open('debian/config/mozconfig.in', 'a') { |f|
+ f.puts("ac_add_options --enable-gstreamer=1.0
")
+ }
+ else
+ version += '-0ubuntu1'
+ end
+ version += "~#{DateTime.now.strftime('%Y%m%d.%H%M')}"
+ $logger.info("New version is going to be #{version}")
+ `dch -v "#{version}" "[CI Build] #{PACKAGE} with KDE integration"`
+
+ # Rename orig
+ File.rename("../#{PACKAGE}_#{changelog.version(Changelog::BASE)}.orig.tar.bz2",
+ "../#{PACKAGE}_#{new_changelog.version(Changelog::BASE)}.orig.tar.bz2")
+end
+
+def install_kde_js
+ $logger.info('Modifying debian/rules')
+ rules = File.read('debian/rules')
+ rules.gsub!(/pre-build.*$/) do | m |
+ m += "
mkdir -p $(MOZ_DISTDIR)/bin/defaults/pref/
cp $(CURDIR)/debian/kde.js $(MOZ_DISTDIR)/bin/defaults/pref/kde.js"
+ end
+ File.write('debian/rules', rules)
+end
+
+def add_dummy_package
+ # Add dummy package
+ control = File.read('debian/control.in')
+ control += "
Package: @MOZ_PKG_NAME at -plasma
+ Architecture: any
+ Depends: @MOZ_PKG_NAME@ (= ${binary:Version}), firefox-kde-support
+ Description:
+ Install this package if you'd like #{PACKAGE} with Plasma integration
+ "
+ File.write('debian/control.in', control)
+
+ File.open("debian/#{PACKAGE}-plasma.pref", 'w') do |f|
+ f.puts("Package: *
+ Pin: release o=LP-PPA-moz-plasma-builds
+ Pin-Priority: 1000
+
+ Package: *
+ Pin: release o=LP-PPA-moz-plasma-releases
+ Pin-Priority: 1000
+ ")
+ end
+
+ File.open("debian/#{PACKAGE}-plasma.install", 'w') do |f|
+ f.puts("debian/#{PACKAGE}-plasma.pref etc/apt/preferences.d/")
+ end
end
def build_firefox
- release_info = firefox_releases
- if release_info[:ubuntu] < release_info[:upstream]
- $logger.error("Can't build new firefox, Ubuntu hasn't updated the package!")
- exit 0
- end
+ system("hg clone http://www.rosenauer.org/hg/mozilla/#firefox#{release_info[:ubuntu].to_i} suse")
+
+ firefox_dir = Dir["firefox-*"][0]
+ Dir.chdir(firefox_dir) do
+ bump_version
+
+ `cp ../suse/firefox-kde.patch ../suse/mozilla-kde.patch debian/patches/`
+ `cp ../suse/MozillaFirefox/kde.js debian/`
+
+ system("quilt pop -a")
+ # Need to remove unity menubar from patches first since it interferes with the KDE patches
+ system("quilt delete unity-menubar.patch")
- `rm -rf build`
- Dir.mkdir('build')
- Dir.chdir('build') {
- dci_run_cmd("pull-lp-source -m http://127.0.0.1:3142/ubuntu firefox #{RELEASE}")
-
- system("hg clone http://www.rosenauer.org/hg/mozilla/#firefox#{release_info[:ubuntu].to_i} suse")
-
- firefox_dir = Dir["firefox-*"][0]
- Dir.chdir(firefox_dir) {
- changelog = Changelog.new
- version = "1000~#{changelog.version(Changelog::BASE)}"
- if DEBIAN_RELEASES.include? RELEASE
- version += '-1'
- File.open('debian/config/mozconfig.in', 'a') { |f|
- f.puts("ac_add_options --enable-gstreamer=1.0
")
- }
- else
- version += '-0ubuntu1'
- end
- version += "~#{DateTime.now.strftime('%Y%m%d.%H%M')}"
- $logger.info("New version is going to be #{version}")
- `dch -v "#{version}" "Firefox with KDE integration [CI Build]"`
-
- new_changelog = Changelog.new
-
- `cp ../suse/firefox-kde.patch ../suse/mozilla-kde.patch debian/patches/`
- `cp ../suse/MozillaFirefox/kde.js debian/`
-
- # Rename orig
- File.rename("../firefox_#{changelog.version(Changelog::BASE)}.orig.tar.bz2", "../firefox_#{new_changelog.version(Changelog::BASE)}.orig.tar.bz2")
-
- system("quilt pop -a")
- # Need to remove unity menubar from patches first since it interferes with the KDE patches
- system("quilt delete unity-menubar.patch")
-
- $logger.info("Adding Firefox KDE patches")
- File.open('debian/patches/series', 'a') { |f|
- # Please preserve this order of patch
- f.puts("mozilla-kde.patch
firefox-kde.patch
unity-menubar.patch
")
- }
-
- system("quilt push -fa")
- system("quilt refresh")
- $logger.info("Modifying debian/rules")
- rules = File.read('debian/rules')
- rules.gsub!(/pre-build.*$/) {|m|
- m += "
mkdir -p $(MOZ_DISTDIR)/bin/defaults/pref/
cp $(CURDIR)/debian/kde.js $(MOZ_DISTDIR)/bin/defaults/pref/kde.js"
- }
- File.write('debian/rules', rules)
-
- # Add dummy package
- control = File.read('debian/control.in')
- control += "
Package: @MOZ_PKG_NAME at -plasma
-Architecture: any
-Depends: @MOZ_PKG_NAME@ (= ${binary:Version}), firefox-kde-support
-Description: Safe and easy web browser from Mozilla - Plasma edition
- Firefox delivers safe, easy web browsing. A familiar user interface,
- enhanced security features including protection from online identity theft,
- and integrated search let you get the most out of the web.
- .
- Install this package if you'd like Firefox with Plasma integration
- "
- File.write('debian/control.in', control)
-
- File.open('debian/firefox-plasma.pref', 'w') { |f|
- f.puts("Package: *
-Pin: release o=LP-PPA-moz-plasma-builds
-Pin-Priority: 1000
-
-Package: *
-Pin: release o=LP-PPA-moz-plasma-releases
-Pin-Priority: 1000
-")
- }
-
- File.open('debian/firefox-plasma.install', 'w') { |f|
- f.puts('debian/firefox-plasma.pref etc/apt/preferences.d/')
- }
-
- $logger.info("Building the source package")
- # TODO: Fix the control file parser to take optional build-deps into account
- # control = DebianControl.new
- # control.parse!
- # build_depends = []
- # control.source['build-depends'].each do |dep|
- # build_depends << dep.name
- # end
- # fail "Failed to install build deps!" unless system("apt-get -y install #{build_depends.join(' ')}")
- system("apt-get -y build-dep firefox")
- system("debian/rules debian/control")
- `dch --release --distribution #{RELEASE} ""`
- }
-
- # Need to sync since tar goes a bit bonkers about things being
- # named differently
- `sync`
-
- # Run dpkg-buildpackage in new dir
- firefox_dir = Dir["firefox-*"][0]
- Dir.chdir(firefox_dir) {
- dci_run_cmd("dpkg-buildpackage -S -sa -uc -us")
- }
-
- system("dcmd cp firefox*.changes /build/")
+ $logger.info("Adding Firefox KDE patches")
+ File.open('debian/patches/series', 'a') { |f|
+ # Please preserve this order of patch
+ f.puts("mozilla-kde.patch
firefox-kde.patch
unity-menubar.patch
")
}
+
+ system('quilt push -fa')
+ system('quilt refresh')
+ install_kde_js
+ add_dummy_package
+ end
end
def build_thunderbird
- $logger.info("Needs implementing")
+ thunderbird_dir = Dir["thunderbird-*"][0]
+ Dir.chdir(thunderbird_dir) do
+ bump_version
+
+ open('debian/patches/mozilla-kde.patch', 'wb') do | file |
+ file << open('https://build.opensuse.org/source/openSUSE:Factory/MozillaThunderbird/mozilla-kde.patch').read
+ end
+ filterdiff = `filterdiff --addprefix=mozilla/ --strip 1 debian/patches/mozilla-kde.patch`
+ File.write('debian/patches/mozilla-kde.patch', filterdiff)
+ File.write('debian/patches/series', "mozilla-kde.patch -p0
", mode: 'a')
+ system('quilt push -fa')
+ system('quilt refresh')
+
+ open('debian/kde.js', 'wb') do | file |
+ file << open('https://build.opensuse.org/source/openSUSE:Factory/MozillaThunderbird/kde.js').read
+ end
+ install_kde_js
+ end
end
-dci_run_cmd("apt-get update")
-system("apt-get -y install ubuntu-dev-tools mercurial ruby-nokogiri distro-info")
+dci_run_cmd('apt-get update')
+system('apt-get -y install ubuntu-dev-tools mercurial ruby-nokogiri distro-info')
+
+# TODO: Fix the control file parser to take optional build-deps into account
+# control = DebianControl.new
+# control.parse!
+# build_depends = []
+# control.source['build-depends'].each do |dep|
+# build_depends << dep.name
+# end
+# fail "Failed to install build deps!" unless system("apt-get -y install #{build_depends.join(' ')}")
+system("apt-get -y build-dep #{PACKAGE}")
UBUNTU_RELEASES = `ubuntu-distro-info -a`.split
DEBIAN_RELEASES = `debian-distro-info -a`.split
+release_info = package_releases
+if release_info[:ubuntu] < release_info[:upstream]
+ $logger.error("Can't build new #{PACKAGE}, Ubuntu hasn't updated the package!")
+ exit 0
+end
+
+`rm -rf build`
+Dir.mkdir('build')
+Dir.chdir('build') do
+ dci_run_cmd("pull-lp-source -m http://127.0.0.1:3142/ubuntu #{PACKAGE} #{RELEASE}")
+
+ build_firefox if PACKAGE == 'firefox'
+ build_thunderbird if PACKAGE == 'thunderbird'
-build_firefox if PACKAGE == 'firefox'
-build_thunderbird if PACKAGE == 'thunderbird'
+ system('debian/rules debian/control')
+ `dch --release --distribution #{RELEASE} ""`
+ src_dir = Dir["#{PACKAGE}-*"][0]
+ Dir.chdir(src_dir) do
+ dci_run_cmd("dpkg-buildpackage -S -sd -uc -us")
+ end
+end
--
ci-tooling packaging
More information about the pkg-kde-commits
mailing list