aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Wilmott <p@p8952.info>2015-04-13 19:03:12 +0100
committerPeter Wilmott <p@p8952.info>2015-04-13 19:03:12 +0100
commit5380f6d27f6a04d4ced645f9221b9025bb0f970c (patch)
tree56ddeecdabf7b91d94b8ff71c291cf0667954d55
parentWhen building a package also build it with the next target if possible (diff)
downloadruby-tinderbox-5380f6d27f6a04d4ced645f9221b9025bb0f970c.tar.gz
ruby-tinderbox-5380f6d27f6a04d4ced645f9221b9025bb0f970c.tar.bz2
ruby-tinderbox-5380f6d27f6a04d4ced645f9221b9025bb0f970c.zip
Correct repoman.sh to work better when the next target is unknown; Rubocop style fixes
-rwxr-xr-xbin/repoman.sh23
-rw-r--r--web/.rubocop.yml2
-rw-r--r--web/Rakefile3
-rw-r--r--web/app.rb2
-rw-r--r--web/db/migrations/018_new_targets.rb1
-rw-r--r--web/lib/ci.rb4
-rw-r--r--web/lib/helpers.rb51
-rw-r--r--web/lib/packages.rb2
8 files changed, 72 insertions, 16 deletions
diff --git a/bin/repoman.sh b/bin/repoman.sh
index 25d36b1..923b8b2 100755
--- a/bin/repoman.sh
+++ b/bin/repoman.sh
@@ -22,9 +22,11 @@ function REPOMAN() {
repoman manifest
repoman full > /tmp/repoman_log_current || true
- sed -i -e "/^USE_RUBY/s/$CURR_TARGET/$CURR_TARGET $NEXT_TARGET/" "$NAME-$VERSION.ebuild"
- repoman manifest
- repoman full > /tmp/repoman_log_next || true
+ if [[ "$NEXT_TARGET" != 'unknown' ]]; then
+ sed -i -e "/^USE_RUBY/s/$CURR_TARGET/$CURR_TARGET $NEXT_TARGET/" "$NAME-$VERSION.ebuild"
+ repoman manifest
+ repoman full > /tmp/repoman_log_next || true
+ fi
LOG
}
@@ -32,19 +34,22 @@ function REPOMAN() {
function LOG() {
DATE=$(date +%s)
SHA1=$(sha1sum "/usr/portage/$CATEGORY/$NAME/$NAME-$VERSION.ebuild" | awk '{print $1}')
- mkdir -p "$SCRIPT_DIR/ci-logs/$SHA1/current_target/repomans/$DATE"
- mkdir -p "$SCRIPT_DIR/ci-logs/$SHA1/next_target/repomans/$DATE"
+ mkdir -p "$SCRIPT_DIR/ci-logs/$SHA1/current_target/repomans/$DATE"
cp /tmp/repoman_log_current "$SCRIPT_DIR/ci-logs/$SHA1/current_target/repomans/$DATE/repoman_log"
- cp /tmp/repoman_log_next "$SCRIPT_DIR/ci-logs/$SHA1/next_target/repomans/$DATE/repoman_log"
+
+ if [[ "$NEXT_TARGET" != 'unknown' ]]; then
+ mkdir -p "$SCRIPT_DIR/ci-logs/$SHA1/next_target/repomans/$DATE"
+ cp /tmp/repoman_log_next "$SCRIPT_DIR/ci-logs/$SHA1/next_target/repomans/$DATE/repoman_log"
+ fi
chmod 755 -R "$SCRIPT_DIR/ci-logs"
}
function CLEANUP() {
- rm /tmp/repoman_log_current
- rm /tmp/repoman_log_next
- rm -r "$SCRIPT_DIR/overlay"
+ rm /tmp/repoman_log_current || true
+ rm /tmp/repoman_log_next || true
+ rm -r "$SCRIPT_DIR/overlay" || true
}
ENV_SETUP
diff --git a/web/.rubocop.yml b/web/.rubocop.yml
index 49ef5a1..466714f 100644
--- a/web/.rubocop.yml
+++ b/web/.rubocop.yml
@@ -1,5 +1,7 @@
Metrics/AbcSize:
Enabled: false
+Metrics/ClassLength:
+ Enabled: false
Metrics/CyclomaticComplexity:
Enabled: false
Metrics/LineLength:
diff --git a/web/Rakefile b/web/Rakefile
index e2d5b44..038b34b 100644
--- a/web/Rakefile
+++ b/web/Rakefile
@@ -8,8 +8,6 @@ task :test do
end
namespace :db do
- DB.loggers << Logger.new($stdout)
-
task :migrate do
Sequel.extension :migration
Sequel::Migrator.run(DB, 'db/migrations')
@@ -51,6 +49,7 @@ namespace :docker do
begin
num_of_packages = Integer(num_of_packages)
rescue
+ 'Do not suppress exceptions'
end
desc 'Build a docker image to use with subsequent tasks'
diff --git a/web/app.rb b/web/app.rb
index 1aa3ce8..80379ba 100644
--- a/web/app.rb
+++ b/web/app.rb
@@ -92,7 +92,7 @@ class RubyTinderbox < Sinatra::Base
repoman_next = package.repoman_dataset.where(target: 'next').reverse_order(:timestamp).first
next if repoman_next.nil?
- if repoman_current[:result] == 'passed' and repoman_next[:result] == 'passed'
+ if repoman_current[:result] == 'passed' && repoman_next[:result] == 'passed'
packages << [package, build_current, nil, repoman_current, repoman_next]
end
end
diff --git a/web/db/migrations/018_new_targets.rb b/web/db/migrations/018_new_targets.rb
index b04ccac..7672c05 100644
--- a/web/db/migrations/018_new_targets.rb
+++ b/web/db/migrations/018_new_targets.rb
@@ -18,5 +18,4 @@ Sequel.migration do
add_foreign_key :package_id, :packages
end
end
-
end
diff --git a/web/lib/ci.rb b/web/lib/ci.rb
index bbe0b23..d3d3d31 100644
--- a/web/lib/ci.rb
+++ b/web/lib/ci.rb
@@ -41,9 +41,9 @@ def generate_package_list(ci_type, num_of_packages)
if num_of_packages == 'all'
packages = packages
- elsif num_of_packages == 'untested' and ci_type == 'repoman'
+ elsif num_of_packages == 'untested' && ci_type == 'repoman'
packages = packages
- elsif num_of_packages == 'untested' and ci_type == 'build'
+ elsif num_of_packages == 'untested' && ci_type == 'build'
packages = []
Package.each do |package|
next if package.build.count > 0
diff --git a/web/lib/helpers.rb b/web/lib/helpers.rb
index d7f4f1a..35ecd46 100644
--- a/web/lib/helpers.rb
+++ b/web/lib/helpers.rb
@@ -3,3 +3,54 @@ class String
split(delimiter).map(&:capitalize).join(delimiter)
end
end
+
+# module Archive::Tar::Minitar
+# class << self
+# def pack_file(entry, outputter)
+# outputter = outputter.tar if outputter.kind_of?(Archive::Tar::Minitar::Output)
+#
+# stats = {}
+#
+# if entry.kind_of?(Hash)
+# name = entry[:name]
+#
+# entry.each { |kk, vv| stats[kk] = vv unless vv.nil? }
+# else
+# name = entry
+# end
+#
+# name = name.sub(%r{\./}, '')
+# stat = File.stat(name)
+# stats[:mode] ||= stat.mode
+# stats[:mtime] ||= stat.mtime
+# stats[:size] = stat.size
+#
+# if RUBY_PLATFORM =~ /win32/
+# stats[:uid] = nil
+# stats[:gid] = nil
+# else
+# stats[:uid] ||= stat.uid
+# stats[:gid] ||= stat.gid
+# end
+#
+# case
+# when File.file?(name)
+# outputter.add_file_simple(name, stats) do |os|
+# stats[:current] = 0
+# yield :file_start, name, stats if block_given?
+# File.open(name, "rb") do |ff|
+# until ff.eof?
+# stats[:currinc] = os.write(ff.read(4096))
+# stats[:current] += stats[:currinc]
+# yield :file_progress, name, stats if block_given?
+# end
+# end
+# yield :file_done, name, stats if block_given?
+# end
+# when dir?(name)
+# yield :dir, name, stats if block_given?
+# outputter.mkdir(name, stats)
+# end
+# end
+# end
+# end
diff --git a/web/lib/packages.rb b/web/lib/packages.rb
index 1d4b7ea..a741a9e 100644
--- a/web/lib/packages.rb
+++ b/web/lib/packages.rb
@@ -1,5 +1,5 @@
def update_packages
- packages_txt = `python3 lib/packages.py`.uniq
+ packages_txt = `python3 lib/packages.py | sort -u`
packages_txt.lines.peach do |line|
category, name, version, revision, slot, amd64_keyword, r19_target, r20_target, r21_target, r22_target = line.split(' ')
identifier = category + '/' + name + '-' + version + (revision == 'r0' ? '' : "-#{revision}")