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

Harald Sitter apachelogger-guest at moszumanska.debian.org
Thu Mar 5 13:16:29 UTC 2015


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

The following commit has been merged in the master branch:
commit 697d07461388f26c46fbbd30414ccbbe0a8eb794
Author: Harald Sitter <sitter at kde.org>
Date:   Thu Mar 5 14:16:05 2015 +0100

    port qml dep verify to new apt, dpkg and qml modules
    
    still contains an unfortunate amount of logic to do with qml though
---
 kci/qml_dep_verify.rb | 132 ++++++++++++++++----------------------------------
 1 file changed, 43 insertions(+), 89 deletions(-)

diff --git a/kci/qml_dep_verify.rb b/kci/qml_dep_verify.rb
index 4854ab6..8f32a14 100755
--- a/kci/qml_dep_verify.rb
+++ b/kci/qml_dep_verify.rb
@@ -1,105 +1,59 @@
 require 'pp'
 
-# Wrapper around dpkg commandline tool.
-module DPKG
-  private
-
-  def self.run(cmd, args)
-    args = [*args]
-    output = `#{cmd} #{args.join(' ')}`
-    return [] if $? != 0
-    output.strip.split($RS).compact
-  end
-
-  def self.dpkg(args)
-    run('dpkg', args)
-  end
-
-  def self.architecture(var)
-    run('dpkg-architecture', [] << '--query' << var)[0]
-  end
-
-  public
+require_relative 'lib/apt'
+require_relative 'lib/dpkg'
+require_relative 'lib/lp'
+require_relative 'lib/qml'
+
+# FIXME: should get moved somewhere and used in builder as well as
+#        ppa-copy-package
+# Build source descriptor
+class Source
+  attr_accessor :name
+  attr_accessor :version
+  attr_accessor :type
+end
 
-  def self.const_missing(name)
-    architecture("DEB_#{name}")
-  end
 
-  module_function
+package_map = {
+  'org.kde.plasma.plasmoid' => 'plasma-framework',
+  'org.kde.plasma.configuration' => 'plasma-framework'
+}
 
-  def list(package)
-    DPKG.dpkg([] << '-L' << package)
+source = JSON.parse(File.read('source.json'), object_class: Source)
+
+# FIXME: lots of logic dup from install_check
+# FIXME: arch hardcode
+host_arch = Launchpad::Rubber.from_url("#{series.self_link}/amd64")
+ppa = Launchpad::Rubber.from_path("~kubuntu-ci/+archive/ubuntu/#{source.type}")
+
+source = ppa.getPublishedSources(status: 'Published',
+                                 source_name: source.name,
+                                 version: source.version)
+fail 'more than one source package match on launchpad' if source.size > 1
+source = source[0]
+binaries = source.getPublishedBinaries
+packages = {}
+binaries.each do |binary|
+  next if binary.binary_package_name.end_with?('-dbg')
+  next if binary.binary_package_name.end_with?('-dev')
+  if binary.architecture_specific
+    next unless binary.distro_arch_series_link == host_arch.self_link
   end
+  packages[binary.binary_package_name] = binary.binary_package_version
 end
 
-# Management construct for QML related bits.
-module QML
-  BUILTINS = %w(QtQuick)
-  SEARCH_PATHS = ["/usr/lib/#{DPKG::HOST_MULTIARCH}/qt5/qml"]
-
-  # Describes a QML module.
-  class Module
-    IMPORT_SEPERATOR = '.'
-
-    attr_reader :identifier
-    attr_reader :version
-    attr_reader :qualifier
-
-    def self.parse(line)
-      new.send(:parse, line)
-    end
-
-    def builtin?
-      BUILTINS.include?(identifier)
-    end
-
-    def import_paths
-      @import_paths if defined?(@import_paths)
-      @import_paths = []
-      base_path = @identifier.gsub(IMPORT_SEPERATOR, File::SEPARATOR)
-      @import_paths << base_path
-      version_parts = @version.split('.')
-      version_parts.each_index do |i|
-        @import_paths << "#{base_path}.#{version_parts[0..i].join('.')}"
-      end
-      @import_paths
-    end
 
-    def to_s
-      "#{@identifier}[#{@version}]"
-    end
+Apt::Repository.new("ppa:kubuntu-ci/#{source.type}").add
+Apt.update
 
-    private
-
-    def parse(line)
-      minsize = 3 # import + name + version
-      return nil unless line && !line.empty?
-      parts = line.split(/\s/)
-      return nil unless parts.size >= minsize
-      parts.delete_if { |str| str.nil? || str.empty? }
-      return nil unless parts.size >= minsize && parts[0] == 'import'
-      @identifier = parts[1]
-      @version = parts[2]
-      # FIXME: what if part 3 is not as?
-      @qualifier = parts[4] if parts.size == 5
-      self
-    end
-  end
-end
-
-package_map = {
-  'org.kde.plasma.plasmoid' => 'plasma-framework',
-  'org.kde.plasma.configuration' => 'plasma-framework'
-}
 
 missing_modules = []
 
-packages = %w(plasma-nm plasma-widgets-addons)
-packages.each do |package|
+packages.each do |package, version|
   if Process.uid == 0
     # FIXME: need to fail otherwise, the results will be skewed
-    `sudo apt-get --purge #{package}`
-    `sudo apt-get --purge autoremove`
+    Apt.install("#{package}=#{version}")
   end
 
   files = DPKG.list(package).select { |f| File.extname(f) == '.qml' }
@@ -137,8 +91,8 @@ packages.each do |package|
 
   if Process.uid == 0
     # FIXME: need to fail otherwise, the results will be skewed
-    `sudo apt-get --purge #{package}`
-    `sudo apt-get --purge autoremove`
+    Apt.purge(package)
+    Apt::Get.autremove(args: '--purge')
   end
 end
 

-- 
ci-tooling packaging



More information about the pkg-kde-commits mailing list