aboutsummaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
authorPeter Wilmott <p@p8952.info>2015-05-05 20:21:03 +0100
committerPeter Wilmott <p@p8952.info>2015-05-05 20:21:20 +0100
commitaa59472d13157e4155a7c0f2a1c044bfbcf5a0c4 (patch)
treea95352293506825af19579e2831b2ecc5746b941 /web
parentUpdate URL (diff)
downloadruby-tinderbox-aa59472d13157e4155a7c0f2a1c044bfbcf5a0c4.tar.gz
ruby-tinderbox-aa59472d13157e4155a7c0f2a1c044bfbcf5a0c4.tar.bz2
ruby-tinderbox-aa59472d13157e4155a7c0f2a1c044bfbcf5a0c4.zip
Calculate the sha1 sum earlier in the database population process to prevent duplicates
Diffstat (limited to 'web')
-rw-r--r--web/lib/packages.py5
-rw-r--r--web/lib/packages.rb6
2 files changed, 5 insertions, 6 deletions
diff --git a/web/lib/packages.py b/web/lib/packages.py
index a18fb3b..742750d 100644
--- a/web/lib/packages.py
+++ b/web/lib/packages.py
@@ -1,8 +1,9 @@
-import portage
+import portage, hashlib
def format_output(cpv, slot, iuse, keyword):
category, pkgname, version, revision = portage.catpkgsplit(cpv)
- print (category + ' ' + pkgname + ' ' + version + ' ' + revision + ' ' + slot + ' ' + keyword, end=' ')
+ sha1 = hashlib.sha1(open(porttree.dbapi.findname(cpv), 'rb').read()).hexdigest()
+ print (sha1 + ' ' + category + ' ' + pkgname + ' ' + version + ' ' + revision + ' ' + slot + ' ' + keyword, end=' ')
if 'ruby_targets_ruby19' in iuse:
print('ruby19', end=' ')
else:
diff --git a/web/lib/packages.rb b/web/lib/packages.rb
index a741a9e..fc9044d 100644
--- a/web/lib/packages.rb
+++ b/web/lib/packages.rb
@@ -1,12 +1,10 @@
def update_packages
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(' ')
+ 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?
- ebuild = "/usr/portage/#{category}/#{name}/#{identifier.split('/')[1]}.ebuild"
- sha1 = Digest::SHA1.hexdigest(File.read(ebuild))
Package.find_or_create(
sha1: sha1,
category: category,
@@ -25,7 +23,7 @@ def update_packages
end
Package.peach(8) do |package|
- if packages_txt.include?("#{package[:category]} #{package[:name]} #{package[:version]} #{package[:revision]} #{package[:slot]} #{package[:amd64_keyword]} #{package[:r19_target]} #{package[:r20_target]} #{package[:r21_target]} #{package[:r22_target]}")
+ if packages_txt.include?(package[:sha1])
package.update(dependencies: `python3 lib/deps.py #{package[:identifier]}`)
else
package.build.map(&:delete)