From 7e3a8f32a4d99b042e914d382e37e8e31f3a1832 Mon Sep 17 00:00:00 2001 From: Peter Wilmott Date: Sat, 15 Aug 2015 19:51:00 +0100 Subject: List what new target was added on the new targets page --- bin/repoman.sh | 5 ++--- bin/tinder.sh | 7 +++---- web/db/migrations/020_add_next_target.rb | 5 +++++ web/lib/ci.rb | 26 +++++++------------------- web/lib/packages.rb | 11 ++++++++++- web/views/bumps/new_targets.erb | 2 +- 6 files changed, 28 insertions(+), 28 deletions(-) create mode 100644 web/db/migrations/020_add_next_target.rb diff --git a/bin/repoman.sh b/bin/repoman.sh index 32e9fc9..f76d514 100755 --- a/bin/repoman.sh +++ b/bin/repoman.sh @@ -23,7 +23,7 @@ function REPOMAN() { repoman full > /tmp/repoman_log_current || true if [[ "$NEXT_TARGET" != 'unknown' ]]; then - sed -i -e "/^USE_RUBY/s/$CURR_TARGET/$CURR_TARGET $NEXT_TARGET/" "$NAME-$VERSION.ebuild" + sed -i -e "/^USE_RUBY/s/=\"/=\"$NEXT_TARGET /" "$NAME-$VERSION.ebuild" repoman manifest repoman full > /tmp/repoman_log_next || true fi @@ -63,8 +63,7 @@ else VERSION="${PKG_ARR[2]}-${PKG_ARR[3]}" fi -CURR_TARGET=$2 -NEXT_TARGET=$3 +NEXT_TARGET=$2 SETUP REPOMAN CLEANUP diff --git a/bin/tinder.sh b/bin/tinder.sh index 4c75533..6e78e54 100755 --- a/bin/tinder.sh +++ b/bin/tinder.sh @@ -35,7 +35,7 @@ function SETUP () { ( cd "$SCRIPT_DIR/overlay/$CATEGORY/$NAME" - sed -i -e "/^USE_RUBY/s/$CURR_TARGET/$CURR_TARGET $NEXT_TARGET/" "$NAME-$VERSION.ebuild" + sed -i -e "/^USE_RUBY/s/=\"/=\"$NEXT_TARGET /" "$NAME-$VERSION.ebuild" repoman manifest repoman full ) @@ -113,7 +113,7 @@ if [[ $# -eq 1 ]]; then SETUP EMERGE CLEANUP -elif [[ $# -eq 3 ]]; then +elif [[ $# -eq 2 ]]; then TYPE="current_target" PACKAGE=$1 SETUP @@ -122,8 +122,7 @@ elif [[ $# -eq 3 ]]; then TYPE="next_target" PACKAGE=$1 - CURR_TARGET=$2 - NEXT_TARGET=$3 + NEXT_TARGET=$2 SETUP EMERGE CLEANUP diff --git a/web/db/migrations/020_add_next_target.rb b/web/db/migrations/020_add_next_target.rb new file mode 100644 index 0000000..eae3ec3 --- /dev/null +++ b/web/db/migrations/020_add_next_target.rb @@ -0,0 +1,5 @@ +Sequel.migration do + change do + add_column :packages, :next_target, String + end +end diff --git a/web/lib/ci.rb b/web/lib/ci.rb index 2388160..c899e4f 100644 --- a/web/lib/ci.rb +++ b/web/lib/ci.rb @@ -4,13 +4,12 @@ def run_ci(volume_container, ci_image, ci_type, num_of_packages) packages.peach(8) do |package| package = package.split(' ') identifier = package[0] - current_target = package[1] - next_target = package[2] + next_target = package[1] if ci_type == 'build' - cmd = %W(/ruby-tinderbox/tinder.sh #{identifier} #{current_target} #{next_target}) + cmd = %W(/ruby-tinderbox/tinder.sh #{identifier} #{next_target}) elsif ci_type == 'repoman' - cmd = %W(/ruby-tinderbox/repoman.sh #{identifier} #{current_target} #{next_target}) + cmd = %W(/ruby-tinderbox/repoman.sh #{identifier} #{next_target}) end ci_container = Docker::Container.create( Cmd: cmd, @@ -29,7 +28,7 @@ def run_ci(volume_container, ci_image, ci_type, num_of_packages) tar.close tar.unlink - ci_container.delete + #ci_container.delete end end @@ -64,7 +63,8 @@ def generate_package_list(ci_type, num_of_packages) end end elsif num_of_packages.is_a?(Integer) - packages = packages.sample(num_of_packages) + puts packages.count + packages = packages[25..(25 + num_of_packages)] else puts 'ERROR: Invalid value for NUM_OF_PACKAGES' puts ci_type @@ -75,19 +75,7 @@ def generate_package_list(ci_type, num_of_packages) packages_with_targets = [] packages.uniq.each do |package| package = Package.where(identifier: package).first - - target = 'unknown' - target = package[:r19_target] unless package[:r19_target] == 'nil' - target = package[:r20_target] unless package[:r20_target] == 'nil' - target = package[:r21_target] unless package[:r21_target] == 'nil' - target = package[:r22_target] unless package[:r22_target] == 'nil' - - next_target = 'unknown' - next_target = 'ruby20' if target == 'ruby19' - next_target = 'ruby21' if target == 'ruby20' - next_target = 'ruby22' if target == 'ruby21' - - packages_with_targets << "#{package[:identifier]} #{target} #{next_target}" + packages_with_targets << "#{package[:identifier]} #{package[:next_target]}" end packages_with_targets diff --git a/web/lib/packages.rb b/web/lib/packages.rb index 7a3e8db..f8bc4a6 100644 --- a/web/lib/packages.rb +++ b/web/lib/packages.rb @@ -13,9 +13,17 @@ def update_packages(ci_image) packages_txt.peach do |line| next if line.empty? 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}") + gem_version = Gems.info(name)['version'] gem_version = 'nil' if gem_version.nil? + + next_target = 'nil' + next_target = 'ruby20' if r19_target == 'ruby19' && r20_target == 'nil' + next_target = 'ruby21' if r20_target == 'ruby20' && r21_target == 'nil' + next_target = 'ruby22' if r21_target == 'ruby21' && r22_target == 'nil' + package = Package.find_or_create( sha1: sha1, category: category, @@ -29,7 +37,8 @@ def update_packages(ci_image) r20_target: r20_target, r21_target: r21_target, r22_target: r22_target, - gem_version: gem_version + next_target: next_target, + gem_version: gem_version, ) deps = line.split(' ').drop(11).join.gsub(';', ' ') package.update(dependencies: deps) diff --git a/web/views/bumps/new_targets.erb b/web/views/bumps/new_targets.erb index d5a605b..c2084dc 100644 --- a/web/views/bumps/new_targets.erb +++ b/web/views/bumps/new_targets.erb @@ -29,7 +29,7 @@ <%packages.each do |package|%> - <%=package[0][:identifier]%> + <%=package[0][:identifier]%> +<%=package[0][:next_target]%> <%=package[1][:result].camelcase%> -- cgit v1.2.3-65-gdbad