[SCM] ci-tooling packaging branch, master, updated. f55197dd85b4dc43611ba69d97b19acf06ad922c

Harald Sitter apachelogger-guest at moszumanska.debian.org
Fri Oct 16 08:40:07 UTC 2015


Gitweb-URL: http://git.debian.org/?p=pkg-kde/ci-tooling.git;a=commitdiff;h=f2b32a3

The following commit has been merged in the master branch:
commit f2b32a377157c2b91d9a38bd5c02d0fd722117dc
Author: Harald Sitter <sitter at kde.org>
Date:   Fri Oct 16 10:07:39 2015 +0200

    expand on orig_sourcer to encapsulate tar lookup (currently broken)
---
 kci/orig_sourcer.rb                                |  47 +++++++++++++++++++--
 .../test_tarball}/http/dragon-15.08.1.tar.xz       | Bin
 .../test_tarball}/packaging/debian/changelog       |   0
 .../test_tarball}/packaging/debian/compat          |   0
 .../test_tarball}/packaging/debian/control         |   0
 .../test_tarball}/packaging/debian/rules           |   0
 .../test_tarball}/packaging/debian/source/format   |   0
 .../test_tarball/packaging}/debian/watch           |   0
 .../test_url/dragon-15.08.1.tar.xz                 |   1 +
 test/test_kci_orig_sourcer.rb                      |  43 +++++++++++++++++++
 10 files changed, 88 insertions(+), 3 deletions(-)

diff --git a/kci/orig_sourcer.rb b/kci/orig_sourcer.rb
index cc05f48..4d9ac47 100755
--- a/kci/orig_sourcer.rb
+++ b/kci/orig_sourcer.rb
@@ -1,7 +1,48 @@
 #!/usr/bin/env ruby
 
 require_relative '../lib/ci/orig_source_builder'
+require_relative '../lib/ci/tar_fetcher'
 
-sourcer = CI::OrigSourceBuilder.new
-sourcer.get_tar
-sourcer.build
+module KCI
+  class OrigSourcer
+    class << self
+      def tarball
+        Dir.mkdir('source') unless Dir.exist?('source')
+        tarball ||= KCI::OrigSourcer.lookup_tarball
+        tarball ||= KCI::OrigSourcer.fetch_url
+        tarball ||= KCI::OrigSourcer.fetch_watch
+        return tarball if tarball
+        fail 'Could not find a tarball'
+      end
+
+      def lookup_tarball
+        tar = Dir.glob('source/*.tar.*')
+        return nil unless tar.size == 1
+        tarball = CI::Tarball.new(tar[0])
+        tarball.origify if tarball
+      end
+
+      def fetch_url
+        return nil unless File.exist?('source/url')
+        fetcher = CI::URLTarFetcher.new(File.read('source/url').strip)
+        tarball = fetcher.fetch('source')
+        tarball.origify if tarball
+      end
+
+      def fetch_watch
+        return nil unless File.exist?('packaging/debian/watch')
+        fetcher = CI::WatchTarFetcher.new('packaging/debian/watch')
+        tarball = fetcher.fetch('source')
+        tarball.origify if tarball
+      end
+    end
+  end
+end
+
+# :nocov:
+if __FILE__ == $PROGRAM_NAME
+  tarball = KCI::OrigSourcer.tarball
+  sourcer = CI::OrigSourceBuilder.new(tarball)
+  sourcer.build
+end
+# :nocov:
diff --git a/test/data/test_ci_tar_fetcher/test_watch_fetch/http/dragon-15.08.1.tar.xz b/test/data/test_kci_orig_sourcer/test_tarball/http/dragon-15.08.1.tar.xz
similarity index 100%
copy from test/data/test_ci_tar_fetcher/test_watch_fetch/http/dragon-15.08.1.tar.xz
copy to test/data/test_kci_orig_sourcer/test_tarball/http/dragon-15.08.1.tar.xz
diff --git a/test/data/test_ci_orig_source_builder/test_run/packaging/debian/changelog b/test/data/test_kci_orig_sourcer/test_tarball/packaging/debian/changelog
similarity index 100%
copy from test/data/test_ci_orig_source_builder/test_run/packaging/debian/changelog
copy to test/data/test_kci_orig_sourcer/test_tarball/packaging/debian/changelog
diff --git a/test/data/test_ci_build_source/test_build_fail/packaging/debian/compat b/test/data/test_kci_orig_sourcer/test_tarball/packaging/debian/compat
similarity index 100%
copy from test/data/test_ci_build_source/test_build_fail/packaging/debian/compat
copy to test/data/test_kci_orig_sourcer/test_tarball/packaging/debian/compat
diff --git a/test/data/test_ci_orig_source_builder/test_run/packaging/debian/control b/test/data/test_kci_orig_sourcer/test_tarball/packaging/debian/control
similarity index 100%
copy from test/data/test_ci_orig_source_builder/test_run/packaging/debian/control
copy to test/data/test_kci_orig_sourcer/test_tarball/packaging/debian/control
diff --git a/test/data/test_ci_build_source/test_locale_kdelibs4support/packaging/debian/rules b/test/data/test_kci_orig_sourcer/test_tarball/packaging/debian/rules
similarity index 100%
copy from test/data/test_ci_build_source/test_locale_kdelibs4support/packaging/debian/rules
copy to test/data/test_kci_orig_sourcer/test_tarball/packaging/debian/rules
diff --git a/test/data/test_ci_build_source/test_build_fail/packaging/debian/source/format b/test/data/test_kci_orig_sourcer/test_tarball/packaging/debian/source/format
similarity index 100%
copy from test/data/test_ci_build_source/test_build_fail/packaging/debian/source/format
copy to test/data/test_kci_orig_sourcer/test_tarball/packaging/debian/source/format
diff --git a/test/data/test_ci_tar_fetcher/test_watch_fetch/debian/watch b/test/data/test_kci_orig_sourcer/test_tarball/packaging/debian/watch
similarity index 100%
copy from test/data/test_ci_tar_fetcher/test_watch_fetch/debian/watch
copy to test/data/test_kci_orig_sourcer/test_tarball/packaging/debian/watch
diff --git a/test/data/test_kci_orig_sourcer/test_url/dragon-15.08.1.tar.xz b/test/data/test_kci_orig_sourcer/test_url/dragon-15.08.1.tar.xz
new file mode 120000
index 0000000..e3b2a65
--- /dev/null
+++ b/test/data/test_kci_orig_sourcer/test_url/dragon-15.08.1.tar.xz
@@ -0,0 +1 @@
+../test_tarball/http/dragon-15.08.1.tar.xz
\ No newline at end of file
diff --git a/test/test_kci_orig_sourcer.rb b/test/test_kci_orig_sourcer.rb
new file mode 100644
index 0000000..dffedde
--- /dev/null
+++ b/test/test_kci_orig_sourcer.rb
@@ -0,0 +1,43 @@
+require_relative 'lib/serve'
+require_relative 'lib/testcase'
+
+require_relative '../kci/orig_sourcer.rb'
+
+module KCI
+  class OrigSourcerTestCase < TestCase
+    def test_tarball # also tests watch
+      FileUtils.cp_r(Dir.glob("#{data}/*"), Dir.pwd)
+      Test.http_serve(data('http')) do
+        tarball = KCI::OrigSourcer.tarball
+        assert_not_equal(nil, tarball)
+        assert_equal('dragon_15.08.1.orig.tar.xz', File.basename(tarball.path))
+      end
+    end
+
+    def test_tarball_fail
+      assert_raise RuntimeError do
+        KCI::OrigSourcer.tarball
+      end
+    end
+
+    def test_lookup
+      Dir.mkdir('source')
+      File.write('source/foo_1.orig.tar.gz', '')
+      tarball = KCI::OrigSourcer.tarball
+      assert_not_equal(nil, tarball)
+      assert_equal('foo_1.orig.tar.gz', File.basename(tarball.path))
+    end
+
+    def test_url
+      Dir.mkdir('source')
+      File.write('source/url',
+                 "http://localhost:9473/dragon-15.08.1.tar.xz
")
+      Test.http_serve(data) do
+        tarball = KCI::OrigSourcer.tarball
+        assert_not_equal(nil, tarball)
+        assert_equal('dragon_15.08.1.orig.tar.xz',
+                     File.basename(tarball.path))
+      end
+    end
+  end
+end

-- 
ci-tooling packaging



More information about the pkg-kde-commits mailing list