<commit_before>namespace :sisyphusarm do
  namespace :update do
    desc "Update *.src.rpm from SisyphusARM to database"
    task :srpms => :environment do
      require 'rpm'
      puts Time.now.to_s + ": update *.src.rpm from SisyphusARM to database"      
      path = "/ALT/Sisyphus/arm/SRPMS.all/*.src.rpm"
      branch = Branch.first :conditions => { :name => 'SisyphusARM', :vendor => 'ALT Linux' }
      Dir.glob(path).each do |file|
        begin
          rpm = RPM::Package::open(file)
          if !$redis.exists branch.name + ":" + rpm.name
            Srpm.import_srpm(branch.vendor, branch.name, file)            
          else
            curr = $redis.get branch.name + ":" + rpm.name
            if curr != (rpm.version.v.to_s + "-" + rpm.version.r.to_s) and curr != (rpm[1003].to_s + ":" + rpm.version.v.to_s + "-" + rpm.version.r.to_s)
              Srpm.update_srpm(branch.vendor, branch.name, file)
            end  
          end
        rescue RuntimeError
          puts "Bad src.rpm -- " + file
        end
      end
      puts Time.now.to_s + ": end"
    end

    desc "Update *.arm.rpm/*.noarch.rpm from SisyphusARM to database"
    task :binary => :environment do
      require 'rpm'
      puts Time.now.to_s + ": update *.i586.rpm/*.x86_64.rpm/*.noarch.rpm from Sisyphus to database"
      path_array = ["/ALT/Sisyphus/files/arm/RPMS/*.rpm"]
      branch = Branch.first :conditions => { :name => 'SisyphusARM', :vendor => 'ALT Linux' }
      path_array.each do |path|
        Dir.glob(path).each do |file|
          begin
            rpm = RPM::Package::open(file)
            if !$redis.exists branch.name + ":" + rpm[1044] + ":" + rpm.arch + ":" + rpm.name
              Package.import_rpm(branch.vendor, branch.name, file)
            end            
          rescue RuntimeError
            puts "Bad src.rpm -- " + file
          end
        end
      end
      puts Time.now.to_s + ": end"
    end
  end
end<commit_msg>update rake task for Sisyphus ARM<commit_after>namespace :sisyphusarm do
  namespace :update do
    desc "Update *.src.rpm from SisyphusARM to database"
    task :srpms => :environment do
      require 'rpm'
      puts Time.now.to_s + ": update *.src.rpm from SisyphusARM to database"      
      path = "/ALT/Sisyphus/arm/SRPMS.all/*.src.rpm"
      branch = Branch.first :conditions => { :name => 'SisyphusARM', :vendor => 'ALT Linux' }
      Dir.glob(path).each do |file|
        begin
          if !$redis.exists branch.name + ":" + file.split('/')[-1]
            puts Time.now.to_s + ": update '" + file.split('/')[-1] + "'"
            Srpm.import_srpm(branch.vendor, branch.name, file)
          end
        rescue RuntimeError
          puts "Bad src.rpm -- " + file
        end
      end
      puts Time.now.to_s + ": end"
    end

    desc "Update *.arm.rpm/*.noarch.rpm from SisyphusARM to database"
    task :binary => :environment do
      require 'rpm'
      puts Time.now.to_s + ": update *.i586.rpm/*.x86_64.rpm/*.noarch.rpm from Sisyphus to database"
      path_array = ["/ALT/Sisyphus/files/arm/RPMS/*.rpm"]
      branch = Branch.first :conditions => { :name => 'SisyphusARM', :vendor => 'ALT Linux' }
      path_array.each do |path|
        Dir.glob(path).each do |file|
          begin
            if !$redis.exists branch.name + ":" + file.split('/')[-1]
              puts Time.now.to_s + ":update '" + file.split('/')[-1] + "'"
              Package.import_rpm(branch.vendor, branch.name, file)
            end
          rescue RuntimeError
            puts "Bad src.rpm -- " + file
          end
        end
      end
      puts Time.now.to_s + ": end"
    end
  end
end
{'fraction_non_alphanumeric': 0.142974527526705, 'fraction_numerical': 0.007121336620104081, 'mean_word_length': 1.9262820512820513, 'pattern_counts': {'":': 18, '<': 3, '<?xml version=': 0, '>': 19, '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': '1764614', 'n_tokens_mistral': 1268, 'n_tokens_neox': 1217, 'n_words': 280}