[SCM] patch-parser packaging branch, master, updated. 43474b21f016a6c6ceaa1bd528e34a0ab6b65fbb

Harald Sitter apachelogger-guest at moszumanska.debian.org
Tue Apr 14 07:56:01 UTC 2015


Gitweb-URL: http://git.debian.org/?p=pkg-kde/patch-parser.git;a=commitdiff;h=b6376fe

The following commit has been merged in the master branch:
commit b6376feb6753cf343dd595c5478c459f19cfa606
Author: Harald Sitter <sitter at kde.org>
Date:   Mon Apr 13 16:34:16 2015 +0200

    add multi-branch support and generate different html files based on branch
---
 lib/patch.rb | 10 +++++-----
 render.rb    | 37 ++++++++++++++++++++++++-------------
 2 files changed, 29 insertions(+), 18 deletions(-)

diff --git a/lib/patch.rb b/lib/patch.rb
index 3956987..b9ff983 100644
--- a/lib/patch.rb
+++ b/lib/patch.rb
@@ -16,9 +16,9 @@ class Patch
   # [String] Date the patch was last updated
   attr_reader :last_update
 
-  def initialize(file, repo)
+  def initialize(file, repo, branch:)
     @name = File.basename(file)
-    @url = self.class.url(file, repo)
+    @url = self.class.url(file, repo, branch: branch)
     @origin = 'other'
     @origin = 'kubuntu' if @name.start_with?('kubuntu_')
     @origin = 'upstream' if @name.start_with?('upstream_')
@@ -30,12 +30,12 @@ class Patch
 
   private
 
-  def self.url(file, repo)
-    format('%<base>s/%<repo>s.git/tree/%<file>s?h=%<branch>s',
+  def self.url(file, repo, branch:)
+    format('%<base>s/%<repo>s/tree/%<file>s?h=%<branch>s',
            base: 'http://anonscm.debian.org/cgit/pkg-kde',
            repo: repo,
            file: file.slice(%r{debian/patches/.+}),
-           branch: 'kubuntu_unstable')
+           branch: branch)
   end
 
   def parse_dep3(file)
diff --git a/render.rb b/render.rb
index 3bd1d65..64f4ce8 100644
--- a/render.rb
+++ b/render.rb
@@ -4,7 +4,7 @@ require 'haml'
 require_relative 'lib/patch'
 require_relative 'lib/repo'
 
-repos = []
+BRANCHES = %w(kubuntu_vivid_archive kubuntu_unstable)
 
 Dir.mkdir('cache') unless Dir.exist?('cache')
 Dir.chdir('cache') do
@@ -13,18 +13,29 @@ Dir.chdir('cache') do
     Git::Base.clone(repo, repo_name) unless Dir.exist?(repo_name)
     g = Git::Base.open(repo_name)
     g.fetch
-    g.checkout('origin/kubuntu_unstable')
-    patches = []
-    patch_files = Dir.glob("#{repo_name}/debian/patches/**/**")
-    patch_files.each do |file|
-      # Filter out what's not a patch
-      next if File.directory?(file) || File.basename(file) == 'series'
-      patches << Patch.new(file, repo.split(':').last)
+  end
+
+  BRANCHES.each do |branch|
+    repos = []
+    ARGV.each do |repo|
+      g = Git::Base.open(repo_name)
+      begin
+        g.checkout("origin/#{branch}")
+      rescue Git::GitExecuteError
+        warn "#{repo_name} has no #{branch} branch"
+      end
+      patches = []
+      patch_files = Dir.glob("#{repo_name}/debian/patches/**/**")
+      patch_files.each do |file|
+        # Filter out what's not a patch
+        next if File.directory?(file) || File.basename(file) == 'series'
+        # TODO: Patch presently does not fall back to git if a patch is not dep3
+        patches << Patch.new(file, repo.split(':').last, branch: branch)
+      end
+      next if patches.empty?
+      repos << Repo.new(repo, patches)
     end
-    next if patches.empty?
-    repos << Repo.new(repo, patches)
+    html = Haml::Engine.new(File.read('views/patches.html.haml')).render(repos)
+    File.write("#{branch}.html", html)
   end
 end
-
-a = Haml::Engine.new(File.read('views/patches.html.haml')).render(repos)
-File.write('patches.html', a)

-- 
patch-parser packaging



More information about the pkg-kde-commits mailing list