<commit_before>desc "Update md5 field for all srpms and rpms"
task :md5 => :environment do
  puts Time.now

  branch = Branch.where(:name => '4.0', :vendor => 'ALT Linux').first

  Srpm.where(:md5 => nil, :branch => branch).each do |srpm|
    file = "/ALT/4.0/files/SRPMS/#{srpm.filename}"
    md5 = `md5 #{file}`.split[3]
    srpm.update_attribute(:md5, md5)
  end

  # TODO:
  # Package.where(:md5 => nil, :branch => branch).each do |package|
  #   file = "/ALT/4.0/files/SRPMS/#{srpm.filename}"<commit_msg>Limit 1000 for md5 rake task<commit_after>desc "Update md5 field for all srpms and rpms"
task :md5 => :environment do
  puts Time.now

  branch = Branch.where(:name => '4.0', :vendor => 'ALT Linux').first

  Srpm.where(:md5 => nil, :branch => branch).limit(1000).each do |srpm|
    file = "/ALT/4.0/files/SRPMS/#{srpm.filename}"
    md5 = `md5 #{file}`.split[3]
    srpm.update_attribute(:md5, md5)
  end

  # TODO:
  # Package.where(:md5 => nil, :branch => branch).each do |package|
  #   file = "/ALT/4.0/files/SRPMS/#{srpm.filename}"
{'fraction_non_alphanumeric': 0.18851674641148325, 'fraction_numerical': 0.03732057416267943, 'mean_word_length': 3.5281385281385282, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '763332', 'n_tokens_mistral': 421, 'n_tokens_neox': 401, 'n_words': 92}