[DRE-commits] [SCM] pkg-ruby-extras.git branch, master, updated. 8c98f3d9d93ec2f619680c4008334ad99359607b
Lucas Nussbaum
lucas at lucas-nussbaum.net
Sun Sep 25 08:41:29 UTC 2011
The following commit has been merged in the master branch:
commit 8c98f3d9d93ec2f619680c4008334ad99359607b
Author: Lucas Nussbaum <lucas at lucas-nussbaum.net>
Date: Sun Sep 25 10:39:54 2011 +0200
Several improvements to pkg-overview
- now checks the changelog distribution. That matches the behaviour of
PET
- rework the status computation to match PET
- checks for commits after the last tag, and marks the package as WIP
in that case
- displays the last commiter
diff --git a/pkg-overview b/pkg-overview
index 24b7738..66deee8 100755
--- a/pkg-overview
+++ b/pkg-overview
@@ -53,70 +53,117 @@ def changelog_version(src)
changelog = File.join(src, 'debian/changelog')
return nil unless File.exists?(changelog)
header = File.readlines(changelog).first
- header =~ /\((.*)\)/
+ header =~ /\((.*)\) (\w+);/
v = $1
v.gsub!(/^[0-9]+:/,'') # strip epoch
return DebVersion::new(v)
end
+def changelog_distrib(src)
+ changelog = File.join(src, 'debian/changelog')
+ return nil unless File.exists?(changelog)
+ header = File.readlines(changelog).first
+ header =~ /\((.*)\) (\w+);/
+ d = $2
+ return d
+end
+
def tag_version(src)
res = `cd #{src} && git tag -l 2>/dev/null`
if $?.exitstatus != 0
STDERR.puts "ERROR: #{src}: git tag -l failed."
return nil
end
- tags = res.lines.reject { |l| l =~ /^upstream\// } \
- .map { |l| l.chomp.gsub(/^debian\//, '') } \
- .select { |v| v =~ /^[0-9]/ } \
- .map { |v| v.gsub('_', '~') } \
- .map { |l| DebVersion::new(l) }
- if tags.empty?
- return nil
+ alltags = {}
+ res.lines.reject { |l| l =~ /^upstream\// }.each do |tag|
+ curtag = tag
+ tag = tag.chomp.gsub(/^debian\//, '')
+ next if tag !~ /^[0-9]/
+ tag = tag.gsub('_', '~')
+ tag = DebVersion::new(tag)
+ alltags[tag] = curtag
+ end
+ if alltags.empty?
+ return [nil, true]
else
- return tags.max
+ tag = alltags.keys.max
+ res = `cd #{src} && git log #{alltags[tag].chomp}..master 2>/dev/null`.chomp
+ if res == ''
+ return [tag, false]
+ else
+ return [tag, true]
+ end
end
end
-def compute_status(src, cv, tv, av)
- return '0 ERROR: no changelog version' if cv.nil?
+def last_commiter(src)
+ res = `cd #{src} && git show master 2>/dev/null`
+ return 'INVALID REPO' if not $?.exitstatus == 0
+ res = res.grep(/^Author: /)[0].chomp
+ return res.gsub(/.*<(.*)>.*/, '\1')
+end
- if av.nil?
- if tv and cv == tv
- return '3 Not in Debian, ready to upload'
+def compute_status(src, cv, cd, tv, ts, av)
+# p src, cv, cd, tv, ts, av
+ return '0 ERROR: no changelog version' if cv.nil?
+ return '0 ERROR: unknown distribution in changelog' if not ['UNRELEASED', 'unstable', 'experimental', 'stable'].include?(cd)
+ return '0 ERROR: archive version newer than changelog version' if not av.nil? and av > cv
+ return '0 ERROR: in Debian, but not tag' if not av.nil? and tv.nil?
+ return '0 ERROR: archive version newer than tagged version' if not av.nil? and not tv.nil? and av > tv
+
+ if cd != 'UNRELEASED'
+ if av.nil?
+ if tv.nil? or cv != tv
+ return '2 Ready to upload (new package)'
+ else
+ return '1 Tagged, but not in archive. Waiting in NEW ?'
+ end
else
- return '5 Not in Debian, work in progress'
+ if av == cv and cv == tv
+ if ts
+ return '4 WiP (not UNRELEASED, but new commits)'
+ else
+ return '9 Up to date, nothing to do'
+ end
+ elsif av < cv and cv == tv
+ return '1 Tagged, but not in archive. Waiting in NEW ?'
+ elsif cv == tv and av < cv
+ return '2 Ready to upload'
+ else
+ return '0 Invalid case'
+ end
end
+ else
+ return '3 Work in progress'
end
-
- return '0 ERROR: in Debian, but not tag' if tv.nil?
-
- return '9 Up to date, nothing to do' if av == cv and av == tv
- return '0 ERROR: archive version newer than changelog version' if av > cv
- return '0 ERROR: archive version newer than tagged version' if av > tv
- return '4 Work in progress' if cv > tv
- return '2 Ready to upload' if cv == tv
- return '0 ERROR: unknown status'
end
# get source packages from command line, or all available ones of none passed.
source_packages = ARGV.size > 0 ? ARGV : Dir.glob('*').select { |f| File.directory?(f) && f != 'wheezy-transition-tracker' }.sort
-#
+
# get versions from tags
-tag_ver = source_packages.map { |src| { src => tag_version(src) } }.hash_merge
+tag_ver = {}
+tag_status = {}
+source_packages.each do |src|
+ tag_ver[src], tag_status[src] = tag_version(src)
+end
# get versions from changelog
changelog_ver = source_packages.map { |src| { src => changelog_version(src) } }.hash_merge
+changelog_dist = source_packages.map { |src| { src => changelog_distrib(src) } }.hash_merge
+
+last_commit = source_packages.map { |src| { src => last_commiter(src) } }.hash_merge
# get versions in archive
archive_ver = rmadison_data(source_packages)
-status = source_packages.map { |src| { src => compute_status(src, changelog_ver[src], tag_ver[src], archive_ver[src]) } }.hash_merge
+status = source_packages.map { |src| { src => compute_status(src, changelog_ver[src], changelog_dist[src], tag_ver[src], tag_status[src], archive_ver[src]) } }.hash_merge
-puts "%-27s | %15s | %15s | %15s | %s" % ['Source', 'Changelog', 'Tag', 'Archive', 'Status' ]
+puts "%-27s | %15s | %15s | %15s | %s" % ['Source', 'Changelog', 'Tag', 'Archive', 'Last committer' ]
groups = source_packages.group_by { |src| status[src] }
groups.keys.sort.each do |k|
puts ("="*20) + " #{k} -- #{groups[k].length} packages " + ("="*20)
groups[k].sort.each do |src|
- puts "%-27s | %15s | %15s | %15s | %s" % [src, changelog_ver[src], tag_ver[src], archive_ver[src], status[src]]
+ puts "%-27s | %15s | %15s | %15s | %s" % [src, changelog_ver[src], tag_ver[src], archive_ver[src], last_commit[src]]
end
end
--
pkg-ruby-extras.git
More information about the Pkg-ruby-extras-commits
mailing list