commit:     056de1754eddc251ef41d9ab7afc856f41e7ce5d
Author:     Alex Legler <alex <AT> a3li <DOT> li>
AuthorDate: Sun Oct  4 12:30:11 2015 +0000
Commit:     Alex Legler <a3li <AT> gentoo <DOT> org>
CommitDate: Sun Oct  4 12:30:11 2015 +0000
URL:        https://gitweb.gentoo.org/sites/www.git/commit/?id=056de175

Adapt to pgo updates

 _plugins/packages.rb   | 15 ++++++---------
 bin/update-packages.sh |  4 ++--
 2 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/_plugins/packages.rb b/_plugins/packages.rb
index eab8168..7b406ce 100644
--- a/_plugins/packages.rb
+++ b/_plugins/packages.rb
@@ -15,14 +15,10 @@ module Gentoo
         item.children.each do |tag|
           case tag.name
           when 'title'
-            tag.css('span').each do |span|
-              if span['class'] == 'cpvstr'
-                item_data['atom'] = span.text.strip
-                item_data['atom_c'], pv = item_data['atom'].split('/', 2)
-                item_data['atom_p'], item_data['atom_v'] = pv.rpartition('-')
-              elsif span['class'] == 'description'
-                item_data['description'] = span.text.strip
-              end
+            if tag.text =~ /^Added: (.*) \((.*)\)$/
+              item_data['atom'] = $1.strip
+              item_data['atom_c'], item_data['atom_p'] = 
item_data['atom'].split('/', 2)
+              item_data['description'] = $2
             end
           when 'link'
             item_data['uri'] = tag['href']
@@ -32,6 +28,7 @@ module Gentoo
         site.data['packages']['updates'] << item_data
       end
 
+      puts site.data['packages']['updates']
     end
   end
-end
\ No newline at end of file
+end

diff --git a/bin/update-packages.sh b/bin/update-packages.sh
index 1c4ef31..1140207 100755
--- a/bin/update-packages.sh
+++ b/bin/update-packages.sh
@@ -1,5 +1,5 @@
 #!/bin/bash
 
 echo -n 'Updating Packages information...'
-wget 'http://packages.gentoo.org/feed/newpackage' -O _data/packages.xml 
2>/dev/null
-echo 'done.'
\ No newline at end of file
+wget 'https://packages.gentoo.org/packages/added.atom' -O _data/packages.xml 
2>/dev/null
+echo 'done.'

Reply via email to