diff options
author | Peter Wilmott <p@p8952.info> | 2015-08-09 17:22:58 +0100 |
---|---|---|
committer | Peter Wilmott <p@p8952.info> | 2015-08-09 17:22:58 +0100 |
commit | 39379c6c470ee635cab016fc19b5f65bbaab679c (patch) | |
tree | ee2fb978ae9dd13b5677d7ca31e62f8bf290a7a0 /web | |
parent | Update README.md (diff) | |
download | ruby-tinderbox-39379c6c470ee635cab016fc19b5f65bbaab679c.tar.gz ruby-tinderbox-39379c6c470ee635cab016fc19b5f65bbaab679c.tar.bz2 ruby-tinderbox-39379c6c470ee635cab016fc19b5f65bbaab679c.zip |
Resolve issue with duplicate entries in the package table
Diffstat (limited to 'web')
-rw-r--r-- | web/lib/packages.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/web/lib/packages.rb b/web/lib/packages.rb index 22e9259..9d5f64b 100644 --- a/web/lib/packages.rb +++ b/web/lib/packages.rb @@ -1,5 +1,5 @@ def update_packages(ci_image) - cmd = %w(/ruby-tinderbox/packages.py | sort -u) + cmd = %w(/ruby-tinderbox/packages.py) ci_container = Docker::Container.create( Cmd: cmd, Image: ci_image.id @@ -9,7 +9,8 @@ def update_packages(ci_image) packages_txt = ci_container.logs(stdout: true) ci_container.delete - packages_txt.lines.peach do |line| + packages_txt = packages_txt.lines.sort.uniq + packages_txt.peach do |line| line = line.bytes.drop(8).pack('c*') next if line.empty? sha1, category, name, version, revision, slot, amd64_keyword, r19_target, r20_target, r21_target, r22_target = line.split(' ') @@ -36,7 +37,7 @@ def update_packages(ci_image) end Package.peach(8) do |package| - unless packages_txt.include?(package[:sha1]) + unless packages_txt.find { |sha1| /#{package[:sha1]}/ =~ sha1 } package.build.map(&:delete) package.repoman.map(&:delete) package.delete |