aboutsummaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
authorPeter Wilmott <p@p8952.info>2015-06-16 16:35:01 +0100
committerPeter Wilmott <p@p8952.info>2015-06-16 16:35:01 +0100
commitfb02fbb0d5ecf48f34be63187890ad8482ae924d (patch)
tree62dfa5e8e96a2a9fa668245a2ebd54543507aec4 /web
parentAdd rake to Gemfile to allow bundle exec to be used (diff)
downloadruby-tinderbox-fb02fbb0d5ecf48f34be63187890ad8482ae924d.tar.gz
ruby-tinderbox-fb02fbb0d5ecf48f34be63187890ad8482ae924d.tar.bz2
ruby-tinderbox-fb02fbb0d5ecf48f34be63187890ad8482ae924d.zip
#13 : Run update packages from inside a container
Diffstat (limited to 'web')
-rw-r--r--web/Rakefile10
-rw-r--r--web/lib/packages.rb13
2 files changed, 16 insertions, 7 deletions
diff --git a/web/Rakefile b/web/Rakefile
index ab8f78c..47dd524 100644
--- a/web/Rakefile
+++ b/web/Rakefile
@@ -13,11 +13,6 @@ namespace :db do
Sequel::Migrator.run(DB, 'db/migrations')
end
- desc 'Update the packages database with new versions and targets'
- task :update_packages do
- update_packages
- end
-
desc 'Clear the packages database'
task :clear_packages do
clear_packages
@@ -84,6 +79,11 @@ namespace :docker do
@volume_image.delete
end
+ desc 'Update the packages database with new versions and targets'
+ task :update_packages do
+ update_packages(@ci_image)
+ end
+
desc 'Build test packages ( NUM_OF_PACKAGES={5,all,untested} )'
task :run_build do
run_ci(@volume_container, @ci_image, 'build', num_of_packages)
diff --git a/web/lib/packages.rb b/web/lib/packages.rb
index fc9044d..fa4f079 100644
--- a/web/lib/packages.rb
+++ b/web/lib/packages.rb
@@ -1,5 +1,14 @@
-def update_packages
- packages_txt = `python3 lib/packages.py | sort -u`
+def update_packages(ci_image)
+ cmd = %W[python3 /ruby-tinderbox/packages.py | sort -u]
+ ci_container = Docker::Container.create(
+ Cmd: cmd,
+ Image: ci_image.id
+ )
+ ci_container.start
+ ci_container.wait(36_000)
+ packages_txt = ci_container.logs(stdout: true)
+ ci_container.delete
+
packages_txt.lines.peach do |line|
sha1, category, name, version, revision, slot, amd64_keyword, r19_target, r20_target, r21_target, r22_target = line.split(' ')
identifier = category + '/' + name + '-' + version + (revision == 'r0' ? '' : "-#{revision}")