[SCM] ci-tooling packaging branch, master, updated. 52c02d5deb81ef1b8d0c692e808e5f7bd7022f9b
Rohan Garg
rohangarg-guest at moszumanska.debian.org
Tue Mar 3 15:42:39 UTC 2015
Gitweb-URL: http://git.debian.org/?p=pkg-kde/ci-tooling.git;a=commitdiff;h=52c02d5
The following commit has been merged in the master branch:
commit 52c02d5deb81ef1b8d0c692e808e5f7bd7022f9b
Author: Rohan Garg <rohan at garg.io>
Date: Tue Mar 3 16:41:51 2015 +0100
Add support for native packages, properly indent code
---
dci/source.rb | 182 +++++++++++++++++++++++++++++++---------------------------
1 file changed, 98 insertions(+), 84 deletions(-)
diff --git a/dci/source.rb b/dci/source.rb
index 3412d0d..78c593f 100644
--- a/dci/source.rb
+++ b/dci/source.rb
@@ -61,101 +61,115 @@ dci_run_cmd('apt-get -y install devscripts lsb-release locales libdistro-info-pe
Dir.chdir(ARGV[1]) do
- # Get source name and what not
- Dir.chdir('packaging') do
- $changelog = Changelog.new
- $control = DebianControl.new
- $control.parse!
- build_depends = []
- $control.source['build-depends'].each do |dep|
- build_depends << dep.name
- end
-
- unless $control.source['build-depends-indep'].nil?
- $control.source['build-depends-indep'].each do |dep|
- build_depends << dep.name
- end
- end
-
- system("apt-get -y install #{build_depends.join(' ')}")
- $logger.fatal("Failed to install build deps!") unless $?.success?
- exit 1 unless $?.success?
+ # Get source name and what not
+ PACKAGING_DIR = nil
+ if File.exist('source/debian/source/format')
+ if File.readlines('source/debian/source/format').contains? 'native'
+ PACKAGING_DIR = 'source/'
+ FORMAT = :native
end
-
- source_name = $changelog.name
- version_suffix = "+git#{DateTime.now().strftime('%Y%m%d.%H%M')}"
- version = "#{$changelog.version(Changelog::EPOCH | Changelog::BASE)}#{version_suffix}" # <-- needs git version and bzr version possibly
- tar_version = "#{$changelog.version(Changelog::BASE)}#{version_suffix}"
- version += '-1'
-
- Dir.chdir('source/') do
- FileUtils.rm_rf(Dir.glob('**/.bzr'))
- FileUtils.rm_rf(Dir.glob('**/.git'))
- FileUtils.rm_rf(Dir.glob('**/.svn'))
+ else
+ PACKAGING_DIR = 'packaging/'
+ FORMAT = :quilt
+ end
+
+ fail 'Source contains packaging but is not a native package' if PACKAGING_DIR.nil?
+
+ Dir.chdir(PACKAGING_DIR) do
+ $changelog = Changelog.new
+ $control = DebianControl.new
+ $control.parse!
+ build_depends = []
+ $control.source['build-depends'].each do |dep|
+ build_depends << dep.name
end
- # create orig tar
- tar = "#{source_name}_#{tar_version}.orig.tar"
- File.delete(tar) if File.exists? tar
- fail 'Failed to create a tarball' unless system("tar -cf #{tar} source")
- fail 'Failed to compress the tarball' unless system("xz -6 #{tar}")
-
- system("cp -aR packaging/debian source/")
-
- Dir.chdir('source/') do
- raise 'Failed to create changelog entry' unless system({'DEBFULLNAME' => 'Debian CI',
- 'DEBEMAIL' => 'null at debian.org'},
- "dch -b -v #{version} -D #{options[:release]} 'Automatic Debian Build'")
+ unless $control.source['build-depends-indep'].nil?
+ $control.source['build-depends-indep'].each do |dep|
+ build_depends << dep.name
+ end
end
- # Rip out locale install and upstream patches
- Dir.chdir('source/') do
- Dir.glob('debian/*.install').each do | install_file_path |
- # Strip localized manpages
- # e.g. usr /share /man / * /man 7 /kf5options.7
- subbed = File.open(install_file_path).read().gsub(/^.*usr\/share\/man\/(\*|\w+)\/man\d\/.*$/, '')
- File.open(install_file_path, 'w') do |f|
- f << subbed
- end
-
- # FIXME: bloody workaround for kconfigwidgets and kdelibs4support containing legit locale data
- next if source_name == 'kconfigwidgets' or source_name == 'kdelibs4support'
- subbed = File.open(install_file_path).read().gsub(/^.*usr\/share\/locale.*$/, '')
- File.open(install_file_path, 'w') do |f|
- f << subbed
- end
- end
+ system("apt-get -y install #{build_depends.join(' ')}")
+ $logger.fatal("Failed to install build deps!") unless $?.success?
+ exit 1 unless $?.success?
+ end
+
+ source_name = $changelog.name
+ version_suffix = "+git#{DateTime.now.strftime('%Y%m%d.%H%M')}"
+ version = "#{$changelog.version(Changelog::EPOCH | Changelog::BASE)}#{version_suffix}" # <-- needs git version and bzr version possibly
+ tar_version = "#{$changelog.version(Changelog::BASE)}#{version_suffix}"
+ version += '-1'
+
+ Dir.chdir('source/') do
+ FileUtils.rm_rf(Dir.glob('**/.bzr'))
+ FileUtils.rm_rf(Dir.glob('**/.git'))
+ FileUtils.rm_rf(Dir.glob('**/.svn'))
+ end
+
+ # create orig tar
+ tar = "#{source_name}_#{tar_version}.orig.tar"
+ File.delete(tar) if File.exists? tar
+ fail 'Failed to create a tarball' unless system("tar -cf --exclude .git #{tar} source")
+ fail 'Failed to compress the tarball' unless system("xz -6 #{tar}")
+
+ system("cp -aR packaging/debian source/") if FORMAT == :quilt
+
+ Dir.chdir('source/') do
+ fail 'Failed to create changelog entry' unless system({ 'DEBFULLNAME' => 'Debian CI',
+ 'DEBEMAIL' => 'null at debian.org' },
+ "dch -b -v #{version} -D #{options[:release]} 'Automatic Debian Build'")
+ end
+
+ # Rip out locale install and upstream patches
+ Dir.chdir('source/') do
+ Dir.glob('debian/*.install').each do |install_file_path|
+ # Strip localized manpages
+ # e.g. usr /share /man / * /man 7 /kf5options.7
+ subbed = File.open(install_file_path).read.gsub(/^.*usr\/share\/man\/(\*|\w+)\/man\d\/.*$/, '')
+ File.open(install_file_path, 'w') do |f|
+ f << subbed
+ end
- # If the package is now empty, lintian override the empty warning to avoid false positives
- Dir.glob('debian/*.install').each do | install_file_path |
- next unless File.open(install_file_path, 'r').read.strip.empty?
- package_name = File.basename(install_file_path, '.install')
- lintian_overrides_path = install_file_path.gsub('.install', '.lintian-overrides')
- $logger.info("#{package_name} is now empty, trying to add lintian override")
- File.open(lintian_overrides_path, 'a') { |file| file.write("#{package_name}: empty-binary-package
") }
- end
+ # FIXME: bloody workaround for kconfigwidgets and kdelibs4support
+ # containing legit locale data
+ next if source_name == 'kconfigwidgets' || source_name == 'kdelibs4support'
+ subbed = File.open(install_file_path).read.gsub(/^.*usr\/share\/locale.*$/, '')
+ File.open(install_file_path, 'w') do |f|
+ f << subbed
+ end
+ end
- # Rip out upstream patches
- if File.exist? 'debian/patches/series'
- series = File.read('debian/patches/series')
- series.gsub!(/^upstream_.*/, '')
- File.write('debian/patches/series', series)
- end
+ # If the package is now empty, lintian override the empty warning to avoid false positives
+ Dir.glob('debian/*.install').each do |install_file_path|
+ next unless File.open(install_file_path, 'r').read.strip.empty?
+ package_name = File.basename(install_file_path, '.install')
+ lintian_overrides_path = install_file_path.gsub('.install', '.lintian-overrides')
+ $logger.info("#{package_name} is now empty, trying to add lintian override")
+ File.open(lintian_overrides_path, 'a') { |file| file.write("#{package_name}: empty-binary-package
") }
end
- Dir.mktmpdir do |dir|
- FileUtils.cp_r("#{ARGV[1]}/source", dir)
- FileUtils.cp_r("#{tar}.xz", dir)
- Dir.chdir("#{dir}/source") do
- # dpkg-buildpackage
- fail 'Failed to build source package' unless system('dpkg-buildpackage -S -uc -us')
- end
+ # Rip out upstream patches
+ if File.exist? 'debian/patches/series'
+ series = File.read('debian/patches/series')
+ series.gsub!(/^upstream_.*/, '')
+ File.write('debian/patches/series', series)
+ end
+ end
+
+ Dir.mktmpdir do |dir|
+ FileUtils.cp_r("#{ARGV[1]}/source", dir)
+ FileUtils.cp_r("#{tar}.xz", dir)
+ Dir.chdir("#{dir}/source") do
+ # dpkg-buildpackage
+ fail 'Failed to build source package' unless system('dpkg-buildpackage -S -uc -us')
+ end
- Dir.chdir(dir) do
- system("dcmd mv #{source_name}*_source.changes /build/")
- system("dcmd chmod 666 /build/#{source_name}*_source.changes")
- end
+ Dir.chdir(dir) do
+ system("dcmd mv #{source_name}*_source.changes /build/")
+ system("dcmd chmod 666 /build/#{source_name}*_source.changes")
end
+ end
end
$logger.close
--
ci-tooling packaging
More information about the pkg-kde-commits
mailing list