aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2017-12-29 13:50:58 -0800
committerRobin H. Johnson <robbat2@gentoo.org>2017-12-29 13:50:58 -0800
commitd18fe5ae827213da75a3f6f4cfc2e0fadddcdaa3 (patch)
tree2a5dc87b533b076e585971636b8e5b8119701b31
parent_plugins/download.rb: Add regex for new timestamp format of stage3 (diff)
downloadwww-d18fe5ae827213da75a3f6f4cfc2e0fadddcdaa3.tar.gz
www-d18fe5ae827213da75a3f6f4cfc2e0fadddcdaa3.tar.bz2
www-d18fe5ae827213da75a3f6f4cfc2e0fadddcdaa3.zip
plugins/downloads: support ISO8601 for ISOs & refactor stage parsing.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
-rw-r--r--_plugins/downloads.rb22
1 files changed, 10 insertions, 12 deletions
diff --git a/_plugins/downloads.rb b/_plugins/downloads.rb
index 8222280..4f88f4a 100644
--- a/_plugins/downloads.rb
+++ b/_plugins/downloads.rb
@@ -13,10 +13,15 @@ module Gentoo
File.readlines(raw_arch + '/iso.txt').each do |line|
next if line.start_with? '#'
- if line =~ /^(\d{8})\/(\S+) (\d+)$/
+ date = nil
+ if line =~ /^(\d{8}T\d{6}Z)\/(\S+) (\d+)$/
+ date = Date.iso8601($1)
+ elsif line =~ /^(\d{8})\/(\S+) (\d+)$/
date = Date.parse('%s-%s-%s' % [$1[0..3], $1[4..5], $1[6..7]])
- site.data['downloads'][arch]['iso'] ||= {}
+ end
+ if date
+ site.data['downloads'][arch]['iso'] ||= {}
if $2.include? 'minimal'
site.data['downloads'][arch]['iso']['minimal'] = { 'date' => date, 'filename' => '%s/%s' % [$1, $2], 'size' => $3 }
else
@@ -29,21 +34,14 @@ module Gentoo
File.readlines(raw_arch + '/stage3.txt').each do |line|
next if line.start_with? '#'
-
+ date = nil
if line =~ /^(\d{8}T\d{6}Z)\/(\w+\/)?stage3-(.*)-\d{8}T\d{6}Z.tar.(\S+) (\d+)$/
date = Date.iso8601($1)
-
- site.data['downloads'][arch]['stage3'] ||= {}
- site.data['downloads'][arch]['stage3'][$3] = {
- 'name' => $3,
- 'date' => date,
- 'filename' => '%s/%sstage3-%s-%s.tar.%s' % [$1, $2, $3, $1, $4],
- 'subdir' => $2,
- 'size' => $5
- }
elsif line =~ /^(\d{8})\/(\w+\/)?stage3-(.*)-\d{8}.tar.(\S+) (\d+)$/
date = Date.parse('%s-%s-%s' % [$1[0..3], $1[4..5], $1[6..7]])
+ end
+ if date
site.data['downloads'][arch]['stage3'] ||= {}
site.data['downloads'][arch]['stage3'][$3] = {
'name' => $3,