diff options
author | 2015-02-14 18:17:54 +0000 | |
---|---|---|
committer | 2015-02-14 18:17:54 +0000 | |
commit | f5fc394147e038012606a1b8f3415974ce4959a6 (patch) | |
tree | b354862cb3c9a7648298204f45b9781fd463b262 /web/lib | |
parent | Run repoman against all packages in the nightly task (diff) | |
download | ruby-tinderbox-f5fc394147e038012606a1b8f3415974ce4959a6.tar.gz ruby-tinderbox-f5fc394147e038012606a1b8f3415974ce4959a6.tar.bz2 ruby-tinderbox-f5fc394147e038012606a1b8f3415974ce4959a6.zip |
Add timestamps to pages using the 'packages' table
Diffstat (limited to 'web/lib')
-rw-r--r-- | web/lib/models.rb | 4 | ||||
-rw-r--r-- | web/lib/packages.rb | 7 |
2 files changed, 11 insertions, 0 deletions
diff --git a/web/lib/models.rb b/web/lib/models.rb index 667e54f..0618cf0 100644 --- a/web/lib/models.rb +++ b/web/lib/models.rb @@ -1,4 +1,5 @@ DB = Sequel.connect(ENV['DATABASE_URL'], max_connections: 12, pool_timeout: 60) +DB.extension :pg_hstore class Package < Sequel::Model end @@ -8,3 +9,6 @@ end class Repoman < Sequel::Model(:repomans) end + +class Timestamp < Sequel::Model +end diff --git a/web/lib/packages.rb b/web/lib/packages.rb index cd18160..8a032b0 100644 --- a/web/lib/packages.rb +++ b/web/lib/packages.rb @@ -30,4 +30,11 @@ def update_packages package.delete end end + + update_timestamp = Time.now.to_i + portage_timestamp = File.read('/usr/portage/metadata/timestamp.x').split.first + Package.each do |package| + package.update(update_timestamp: update_timestamp) + package.update(portage_timestamp: portage_timestamp) + end end |