From 59f80fd5aa4a5a57a537c9a310e4b94e9d8f0323 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Wed, 7 Dec 2022 18:07:07 +0000 Subject: [PATCH] perl: Behave like the other dependency scripts The only argument will be the BUILDROOT path and the filelist will be passed to stdin. Signed-off-by: Michael Tremer --- src/scripts/perl.prov | 18 ++++++++---------- src/scripts/perl.req | 29 ++++++++++++----------------- 2 files changed, 20 insertions(+), 27 deletions(-) diff --git a/src/scripts/perl.prov b/src/scripts/perl.prov index ba34130c3..955bde486 100644 --- a/src/scripts/perl.prov +++ b/src/scripts/perl.prov @@ -28,18 +28,16 @@ my $perl_ns = "perl"; -if ("@ARGV") { - foreach (@ARGV) { - process_file($_); - } -} else { +my $BUILDROOT = shift; - # notice we are passed a list of filenames NOT as common in unix the - # contents of the file. +# Check if BUILDROOT is set +unless ($BUILDROOT) { + die "BUILDROOT is not set"; +} - foreach (<>) { - process_file($_); - } +# Process the passed filelist +foreach (<>) { + process_file("${BUILDROOT}/$_"); } diff --git a/src/scripts/perl.req b/src/scripts/perl.req index 6a0346e9a..493200108 100644 --- a/src/scripts/perl.req +++ b/src/scripts/perl.req @@ -22,6 +22,13 @@ my $perl_ns = "perl"; +my $BUILDROOT = shift; + +# Check if BUILDROOT is set +unless ($BUILDROOT) { + die "BUILDROOT is not set"; +} + $HAVE_VERSION = 0; eval { require version; $HAVE_VERSION = 1; }; @@ -33,25 +40,13 @@ if ( -e "$dir/perl.prov" ) { $prov_script = "$dir/perl.prov"; } -if ("@ARGV") { - foreach my $file (@ARGV) { - process_file($file); - process_file_provides($file); - compute_global_requires(); - } -} else { - - # notice we are passed a list of filenames NOT as common in unix the - # contents of the file. - - foreach my $file (<>) { - process_file($file); - process_file_provides($file); - compute_global_requires(); - } +# Process the passed filelist +foreach (<>) { + process_file("${BUILDROOT}/$_"); + process_file_provides("${BUILDROOT}/$_"); + compute_global_requires(); } - foreach $perlver (sort keys %perlreq) { print "$perl_ns(:VERSION) >= $perlver\n"; } -- 2.39.5