lib/pkg-wizard/rpm.rb in pkg-wizard-0.1.10 vs lib/pkg-wizard/rpm.rb in pkg-wizard-0.1.12
- old
+ new
@@ -1,5 +1,7 @@
+require 'fileutils'
+
module PKGWizard
class NoSpecFound < Exception; end
class RPMBuildError < Exception; end
class RPM
@@ -38,10 +40,10 @@
pkg_name = File.read(specs.first).match(/Name:(.*?)$/)[1].strip.chomp
pkg_ver = File.read(specs.first).match(/Version:(.*?)$/)[1].strip.chomp
pkg_release = File.read(specs.first).match(/Release:(.*?)$/)[1].strip.chomp.gsub(/%\{\?.*\}/, '')
pkg_full_name = "#{pkg_name}-#{pkg_ver}-#{pkg_release}"
%w(SOURCES SRPMS SPECS BUILDROOT RPMS BUILD).each do |d|
- Dir.mkdir File.join(File.expand_path(rpmbuild_dir), d) if not File.exist?(File.join(rpmbuild_dir, d))
+ FileUtils.mkdir_p File.join(File.expand_path(rpmbuild_dir), d) if not File.exist?(File.join(rpmbuild_dir, d))
end
Dir['*'].each do |f|
FileUtils.cp(f, "#{rpmbuild_dir}/SOURCES") if not File.directory?(f)
end
macros << " --define '_topdir #{rpmbuild_dir}'"