installer/utils/package_upload/repos.rake in rhoconnect-3.1.0.beta1 vs installer/utils/package_upload/repos.rake in rhoconnect-3.1.0.beta2

- old
+ new

@@ -1,13 +1,14 @@ desc 'Creates and uploads apt and rpm repos.' task "build:repos" => ['build:deb', 'build:rpm'] do require 'find' + require 'fileutils' # CONSTANTS PKG_DIR = '/packages' - START_DIR = PKG_DIR + BETA_PKG_DIR = '/beta-packages' BUCKET = 'rhoconnect' def cmd(cmd) puts cmd unless @raked system(cmd) @@ -38,11 +39,11 @@ distributions = "Origin: Rhomobile, Inc.\n" + "Label: Rhomobile, Inc.\n" + "Codename: rhoconnect\n" + "Architectures: i386 amd64\n" + "Components: main\n" + - "Description: Rhoconnect APT Repository" + "Description: Rhoconnect APT Repository\n" cmd "sudo touch #{filename}/distributions" cmd "sudo chmod 777 #{filename}/distributions" # Write distributions string to corresponding file dist_file = File.new("#{filename}/distributions", "w") @@ -55,20 +56,20 @@ end #prepare_destination def copy_files # Copy the packages to their respective directory Find.find('./pkg') do |file| + puts "File: #{file}" if !FileTest.directory?(file) dest_dir = File.extname(file) - #get rid of '.' before extension name - dest_dir[0] = '' + dest_dir[0] = '' #get rid of '.' before extension name if dest_dir == 'deb' || dest_dir == 'rpm' if dest_dir == 'deb' @deb_pkg = File.basename(file) end #if file_path = File.expand_path(file) - cmd "sudo cp -rf #{file_path} #{PKG_DIR}/#{dest_dir}" + cmd "sudo cp -r #{file_path} #{PKG_DIR}/#{dest_dir}" end #if end #if end #do end #copy_files @@ -81,8 +82,22 @@ # REPOIFY! cmd "sudo reprepro -b #{PKG_DIR}/deb includedeb rhoconnect #{PKG_DIR}/deb/#{@deb_pkg}" cmd "sudo createrepo #{PKG_DIR}/rpm" # Call S3 upload script - cmd "ruby ./installer/utils/package_upload/s3_upload.rb #{START_DIR} #{BUCKET} #{@raked}" - + ['deb', 'rpm'].each do |dir| + beta = 0 + pkg_dir = PKG_DIR + Find.find("#{PKG_DIR}/#{dir}") do |file| + if File.extname(file) =~ /deb|rpm/ + file =~ /.*beta.*/ ? beta += 1 : beta = beta + pkg_dir = BETA_PKG_DIR + cmd "sudo mkdir #{BETA_PKG_DIR}" unless File.directory? BETA_PKG_DIR + cmd "sudo chmod 777 #{BETA_PKG_DIR}" + # If one beta pkg is found, break. + break + end #if + end #do + cmd "sudo cp -rf #{PKG_DIR}/#{dir} #{BETA_PKG_DIR}/#{dir}" + cmd "sudo ruby ./installer/utils/package_upload/s3_upload.rb #{pkg_dir}/#{dir} #{BUCKET} #{@raked}" + end #do end #build:repos