Skip to content

Commit

Permalink
Merge pull request #97 from armfergom/JENKINS-43849
Browse files Browse the repository at this point in the history
[JENKINS-43849] Sort RPM and DEV packages by date instead of by name
  • Loading branch information
svanoort committed May 18, 2017
2 parents ddd86a8 + 6a1e0c3 commit 84993c2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions bin/list-packages.rb
Expand Up @@ -17,9 +17,9 @@ def list_packages(path,glob,rel)
debs = [];
sftp.dir.glob(path,glob) { |f| debs << f }

p=/^[^_-]+/
debs.sort {|x,y| y.name.gsub(p,"")<=>x.name.gsub(p,"")}.each do |f|
versionRE=/^([^\d]+[-_])(.*)([-_].+)$/

debs.sort {|x,y| Gem::Version.new(y.name.match(versionRE).captures[1])<=>Gem::Version.new(x.name.match(versionRE).captures[1])}.each do |f|
puts "<tr><td><a href='#{rel}/#{f.name}'>#{f.name}</a></td>"

t=Time.at(f.attributes.mtime).strftime('%Y/%m/%d')
Expand Down

0 comments on commit 84993c2

Please sign in to comment.