fix gbs build error: https://github.sec.samsung.net/RS-tizen-build/issues/issues/913 87/276787/1
authorbiao716.wang <biao716.wang@samsung.com>
Fri, 24 Jun 2022 12:03:16 +0000 (21:03 +0900)
committerbiao716.wang <biao716.wang@samsung.com>
Fri, 24 Jun 2022 12:15:46 +0000 (21:15 +0900)
THis issue is caused that some variables are not re-intialized after used in while loop.
refer to .srcfiles.cache file, linux-kernel-perf info is just before linux-tizen-modules-headers,
and linux-tizen-modules-headers has no require info, it will use the last cache in $pkgR.

Change-Id: I874eca19e99d707b2971c618dd3e37c0bfefeeba
Signed-off-by: biao716.wang <biao716.wang@samsung.com>
expanddeps

index 5a8af47..511a3c5 100755 (executable)
@@ -122,7 +122,7 @@ if ($recipe && $recipe =~ /(^|\/)PKGBUILD$/) {
 # read dist if we can
 my $cf;
 if (defined($dist) && $dist ne '') {
-  $cf = Build::read_config_dist($dist, $archs[0], $configdir);
+  $cf = Build::read_config_dist($dist, $archs[0] || 'noarch', $configdir);
   $binarytype = $cf->{'binarytype'} if $cf->{'binarytype'} && $cf->{'binarytype'} ne 'UNDEFINED';
 }
 
@@ -162,7 +162,7 @@ if (!defined($dist) || $dist eq '') {
   print STDERR "Warning: distribution not specified, assuming '$dist' (see $configdir).\n";
 }
 
-$cf = Build::read_config_dist($dist, $archs[0], $configdir);
+$cf ||= Build::read_config_dist($dist, $archs[0] || 'noarch', $configdir);
 $cf->{'warnings'} = 1;
 
 my $dofileprovides = %{$cf->{'fileprovides'}};
@@ -205,20 +205,20 @@ while(<F>) {
     }
   } elsif (/^P:(.*?)-\d+\/\d+\/\d+: (.*)$/) {
     $pkgP = $2;
-       next if $prov{$1};
-       $prov{$1} = $2
+    next if $prov{$1};
+    $prov{$1} = $2;
   } elsif (/^R:(.*?)-\d+\/\d+\/\d+: (.*)$/) {
     $pkgR = $2;
-       next if $req{$1};
-       $req{$1} = $2;
+    next if $req{$1};
+    $req{$1} = $2;
   } elsif (/^C:(.*?)-\d+\/\d+\/\d+: (.*)$/) {
     $pkgC = $2;
-       next if $con{$1};
-       $con{$1} = $2;
+    next if $con{$1};
+    $con{$1} = $2;
   } elsif (/^O:(.*?)-\d+\/\d+\/\d+: (.*)$/) {
     $pkgO = $2;
-       next if $obs{$1};
-       $obs{$1} = $2;
+    next if $obs{$1};
+    $obs{$1} = $2;
   } elsif (/^r:(.*?)-\d+\/\d+\/\d+: (.*)$/) {
     $pkgr = $2;
   } elsif (/^s:(.*?)-\d+\/\d+\/\d+: (.*)$/) {
@@ -257,24 +257,32 @@ while(<F>) {
       delete $rec{$i};
       delete $con{$i};
       delete $obs{$i};
-         delete $rec{$i};
-         delete $sup{$i};
+      delete $rec{$i};
+      delete $sup{$i};
       $req{$i}  = $pkgR if defined $pkgR;
       $con{$i}  = $pkgC if defined $pkgC;
       $obs{$i}  = $pkgO if defined $pkgO;
-         $rec{$i}  = $pkgr if defined $pkgr;
-         $sup{$i}  = $pkgs if defined $pkgs;
+      $rec{$i}  = $pkgr if defined $pkgr;
+      $sup{$i}  = $pkgs if defined $pkgs;
     } else {
-         next if $ids{$1};
-         $ids{$1} = $2;
+       #also need to clean the below values.
+       undef $pkgF;
+       undef $pkgP;
+       undef $pkgR;
+       undef $pkgC;
+       undef $pkgO;
+       undef $pkgr;
+       undef $pkgs;
+       next if $ids{$1};
+       $ids{$1} = $2;
        }
     undef $pkgF;
     undef $pkgP;
     undef $pkgR;
     undef $pkgC;
     undef $pkgO;
-       undef $pkgr;
-       undef $pkgs;
+    undef $pkgr;
+    undef $pkgs;
   } elsif ($_ eq 'D:') {
     %packs_done = %ids;
   }