Skip to content

Commit 0ef6192

Browse files
committed
mkbaselibs: modernize generated specfiles and add sh quoting
1 parent 1a6e973 commit 0ef6192

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

mkbaselibs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -778,27 +778,27 @@ sub handle_rpms {
778778
print SPEC "%prep\n";
779779
print SPEC "%build\n";
780780
print SPEC "%install\n";
781-
print SPEC "rm -rf \$RPM_BUILD_ROOT\n";
782-
print SPEC "mkdir \$RPM_BUILD_ROOT\n";
783-
print SPEC "cd \$RPM_BUILD_ROOT\n";
781+
print SPEC "rm -Rf \"\%buildroot\"\n";
782+
print SPEC "mkdir \"\%buildroot\"\n";
783+
print SPEC "cd \"\%buildroot\"\n";
784784
my @cfl = grep {!$cfiles{$_} && !$moves{$_}} sort keys %files;
785785
if (@cfl) {
786786
if ($prefix ne '') {
787-
print SPEC "mkdir -p \$RPM_BUILD_ROOT$prefix\n";
788-
print SPEC "cd \$RPM_BUILD_ROOT$prefix\n";
787+
print SPEC "mkdir -p \"\%buildroot/$prefix\"\n";
788+
print SPEC "cd \"\%buildroot/$prefix\"\n";
789789
}
790790
print SPEC "cat <<EOFL >.filelist\n";
791791
print SPEC "$_\n" for map {$cpiopre.substr($_, 1)} @cfl;
792792
print SPEC "EOFL\n";
793-
print SPEC "mkdir -p \$RPM_BUILD_ROOT$prefix$_\n" for sort keys %cpiodirs;
794-
print SPEC "rpm2cpio $rpm | cpio -i -d -v -E .filelist\n";
793+
print SPEC "mkdir -p \"\%buildroot/$prefix$_\"\n" for sort keys %cpiodirs;
794+
print SPEC "rpm2cpio \"$rpm\" | cpio -i -d -v -E .filelist\n";
795795
print SPEC "rm .filelist\n";
796796
if (%ghosts) {
797797
for my $fn (grep {$ghosts{$_}} @cfl) {
798798
my $fnm = $fn;
799799
$fnm = '.' unless $fnm =~ s/\/[^\/]+$//;
800-
print SPEC "mkdir -p \$RPM_BUILD_ROOT$prefix$fnm\n";
801-
print SPEC "touch \$RPM_BUILD_ROOT$prefix$fn\n";
800+
print SPEC "mkdir -p \"\%buildroot/$prefix$fnm\"\n";
801+
print SPEC "touch \"\%buildroot/$prefix$fn\"\n";
802802
}
803803
}
804804
if ($prefix ne '') {
@@ -811,25 +811,25 @@ sub handle_rpms {
811811
print SPEC "cat <<EOFL >.filelist\n";
812812
print SPEC "$_\n" for map {$cpiopre.substr($_, 1)} grep {$cfiles{$_} || $moves{$_}} sort keys %files;
813813
print SPEC "EOFL\n";
814-
print SPEC "rpm2cpio $rpm | cpio -i -d -v -E .filelist\n";
814+
print SPEC "rpm2cpio \"$rpm\" | cpio -i -d -v -E .filelist\n";
815815
print SPEC "cd -\n";
816816
if (%cfiles) {
817-
print SPEC "mkdir -p \$RPM_BUILD_ROOT$configdir\n";
818-
print SPEC "mv .cfiles$_ \$RPM_BUILD_ROOT$configdir\n" for sort keys %cfiles;
817+
print SPEC "mkdir -p \"\%buildroot/$configdir\"\n";
818+
print SPEC "mv \".cfiles$_\" \"\%buildroot/$configdir\"\n" for sort keys %cfiles;
819819
}
820820
for my $fn (sort keys %moves) {
821821
my $fnm = $moves{$fn};
822822
$fnm = '.' unless $fnm =~ s/\/[^\/]+$//;
823-
print SPEC "mkdir -p \$RPM_BUILD_ROOT$fnm\n";
824-
print SPEC "mv .cfiles$fn \$RPM_BUILD_ROOT$moves{$fn}\n";
823+
print SPEC "mkdir -p \"\%buildroot/$fnm\"\n";
824+
print SPEC "mv \".cfiles$fn\" \"\%buildroot/$moves{$fn}\"\n";
825825
}
826826
print SPEC "rm -rf .cfiles\n";
827827
}
828828
for my $fn (sort keys %symlinks) {
829829
my $fnm = $fn;
830830
$fnm = '.' unless $fnm =~ s/\/[^\/]+$//;
831-
print SPEC "mkdir -p \$RPM_BUILD_ROOT$fnm\n";
832-
print SPEC "ln -s $symlinks{$fn} \$RPM_BUILD_ROOT$fn\n";
831+
print SPEC "mkdir -p \"\%buidroot/$fnm\"\n";
832+
print SPEC "ln -s \"$symlinks{$fn}\" \"\%buildroot/$fn\"\n";
833833
}
834834
if ($prefix ne '' && grep {/\.so.*$/} @cfl) {
835835
@postin = () if @postin == 1 && $postin[0] =~ /^\"-p.*ldconfig/;

0 commit comments

Comments
 (0)