aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Iurt/Urpmi.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Iurt/Urpmi.pm')
-rw-r--r--lib/Iurt/Urpmi.pm31
1 files changed, 14 insertions, 17 deletions
diff --git a/lib/Iurt/Urpmi.pm b/lib/Iurt/Urpmi.pm
index 2343ee8..62156e3 100644
--- a/lib/Iurt/Urpmi.pm
+++ b/lib/Iurt/Urpmi.pm
@@ -445,6 +445,18 @@ sub install_packages {
$ok;
}
+sub get_srpm_name {
+ my ($run, $config, $chroot_tmp, $srpm, $luser, $spec) = @_;
+ if (!perform_command(qq(chroot $chroot_tmp su $luser -c "rpmspec -q --qf %{NVR}.src.rpm --srpm /home/$luser/rpmbuild/SPECS/$spec > /home/$luser/rpmbuild/SPECS/$spec.srpm_name"),
+ $run, $config,
+ use_iurt_root_command => 1,
+ hash => "identify_$srpm")) {
+ plog("ERROR: failed to get the name of the generated src.rpm");
+ return;
+ }
+ return cat_("$chroot_tmp/home/$luser/rpmbuild/SPECS/$spec.srpm_name");
+}
+
# return ("exit_code", srpm, spec)
sub recreate_srpm {
my ($_self, $run, $config, $chroot_tmp, $dir, $srpm, $luser, $b_retry) = @_;
@@ -526,14 +538,7 @@ sub recreate_srpm {
#
return 0 unless $ret;
- if (!perform_command(qq(chroot $chroot_tmp su $luser -c "rpmspec -q --qf %{NVR}.src.rpm --srpm /home/$luser/rpmbuild/SPECS/$spec > /home/$luser/rpmbuild/SPECS/$spec.srpm_name"),
- $run, $config,
- use_iurt_root_command => 1,
- hash => "identify_$srpm")) {
- plog("ERROR: failed to get the name of the generated src.rpm");
- return;
- }
- my $new_srpm = cat_("$chroot_tmp/home/$luser/rpmbuild/SPECS/$spec.srpm_name");
+ my $new_srpm = get_srpm_name($run, $config, $chroot_tmp, $srpm, $luser, $spec);
if (!$new_srpm) {
plog("ERROR: failed to get the name of the generated src.rpm");
return;
@@ -553,7 +558,6 @@ sub recreate_srpm {
($ret, "$prefix$new_srpm", $spec);
}
-# return ("exit_code", srpm, spec)
sub install_dynamic_buildrequires {
my ($self, $run, $config, $chroot_tmp, $luser, $spec, $srpm) = @_;
my $program_name = $run->{program_name};
@@ -566,14 +570,7 @@ sub install_dynamic_buildrequires {
return 1;
}
- if (!perform_command(qq(chroot $chroot_tmp su $luser -c "rpmspec -q --qf %{NVR}.src.rpm --srpm /home/$luser/rpmbuild/SPECS/$spec > /home/$luser/rpmbuild/SPECS/$spec.srpm_name"),
- $run, $config,
- use_iurt_root_command => 1,
- hash => "identify_$srpm")) {
- plog("ERROR: failed to get the name of the generated src.rpm");
- return;
- }
- my $new_srpm = cat_("$chroot_tmp/home/$luser/rpmbuild/SPECS/$spec.srpm_name");
+ my $new_srpm = get_srpm_name($run, $config, $chroot_tmp, $srpm, $luser, $spec);
if (!$new_srpm) {
plog("ERROR: failed to get the name of the generated src.rpm");
return;