diff options
author | Pascal Terjan <pterjan@mageia.org> | 2021-11-23 22:18:03 +0000 |
---|---|---|
committer | Pascal Terjan <pterjan@mageia.org> | 2021-11-23 22:18:08 +0000 |
commit | cc8c5dc361b0f38af63150fb53edbe2517268463 (patch) | |
tree | 2ed7cb64abc057dee2cc3ccf083abda121266b11 /lib | |
parent | f310a568fd93cd519c08caed4025d5780295129e (diff) | |
download | iurt-cc8c5dc361b0f38af63150fb53edbe2517268463.tar iurt-cc8c5dc361b0f38af63150fb53edbe2517268463.tar.gz iurt-cc8c5dc361b0f38af63150fb53edbe2517268463.tar.bz2 iurt-cc8c5dc361b0f38af63150fb53edbe2517268463.tar.xz iurt-cc8c5dc361b0f38af63150fb53edbe2517268463.zip |
iurt: Allow generated src.rpm to change name
Some packages use macros for Name and those can change based on
the distro version.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Iurt/Urpmi.pm | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/Iurt/Urpmi.pm b/lib/Iurt/Urpmi.pm index eea9c38..c905034 100644 --- a/lib/Iurt/Urpmi.pm +++ b/lib/Iurt/Urpmi.pm @@ -5,6 +5,7 @@ use RPM4::Header; use File::Basename; use File::NCopy qw(copy); use MDV::Distribconf::Build; +use MDK::Common qw(cat_); use Iurt::Chroot qw(add_local_user create_temp_chroot); use Iurt::Process qw(perform_command clean_process sudo); use Iurt::Config qw(get_package_prefix); @@ -525,7 +526,20 @@ sub recreate_srpm { # return 0 unless $ret; - my $file = (glob "$chroot_tmp/home/$luser/rpmbuild/SRPMS/$name-*.src.rpm")[0]; + if (!perform_command(qq(chroot $chroot_tmp su $luser -c "rpmspec -q --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 $generated_srpm_name = cat_("$chroot_tmp/home/$luser/rpmbuild/SPECS/$spec.srpm_name"); + $generated_srpm_name =~ s/\s+$//; + if (!$generated_srpm_name) { + plog("ERROR: failed to get the name of the generated src.rpm"); + return; + } + my $file = "$chroot_tmp/home/$luser/rpmbuild/SRPMS/$generated_srpm_name.src.rpm"; my ($new_srpm) = basename($file); my $prefix = get_package_prefix($srpm); my $newfile = "$chroot_tmp/home/$luser/rpmbuild/SRPMS/$prefix$new_srpm"; |