mock build.Part 4
This commit is contained in:
@@ -4,6 +4,19 @@ require "rpm"
|
||||
|
||||
require_relative "runner"
|
||||
|
||||
class RPMReader
|
||||
def get_rpm_info(path_to_rpm)
|
||||
res = { :error => nil }
|
||||
if File.exist?(path_to_rpm)
|
||||
pkg = RPM::Package.open(path_to_rpm)
|
||||
res[:pkginfo] = pkg
|
||||
else
|
||||
res[:error] = "#{path_to_rpm} не существует"
|
||||
end
|
||||
res
|
||||
end
|
||||
end
|
||||
|
||||
class RepoManager
|
||||
attr :path, :error, :last_status, :last_pid
|
||||
|
||||
@@ -13,6 +26,7 @@ class RepoManager
|
||||
Dir.mkdir(path)
|
||||
end
|
||||
@path = path
|
||||
@reader = RPMReader.new
|
||||
end
|
||||
|
||||
def create_repo
|
||||
@@ -28,13 +42,6 @@ class RepoManager
|
||||
end
|
||||
|
||||
def get_rpm_info(path_to_rpm)
|
||||
res = { :error => nil }
|
||||
if File.exist?(path_to_rpm)
|
||||
pkg = RPM::Package.open(path_to_rpm)
|
||||
res[:pkginfo] = pkg
|
||||
else
|
||||
res[:error] = "#{path_to_rpm} не существует"
|
||||
end
|
||||
res
|
||||
@reader.get_rpm_info(path_to_rpm)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user