This is an automated email from the git hooks/post-receive script.

guillem pushed a commit to branch main
in repository dpkg.

View the commit online:
https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=c5738b45148ddba2ab2a277a7ba011717290505c

commit c5738b45148ddba2ab2a277a7ba011717290505c
Author: Guillem Jover <[email protected]>
AuthorDate: Wed Sep 24 05:49:16 2025 +0200

    dselect: Use named variables instead of topic variable in foreach loops
    
    Changelog: internal
---
 dselect/methods/Dselect/Method.pm |  8 ++++----
 dselect/methods/ftp/setup.pl      | 14 +++++++-------
 dselect/methods/ftp/update.pl     | 16 +++++++---------
 dselect/methods/media/install.pl  | 14 +++++++-------
 4 files changed, 25 insertions(+), 27 deletions(-)

diff --git a/dselect/methods/Dselect/Method.pm 
b/dselect/methods/Dselect/Method.pm
index 518156c63..453793435 100644
--- a/dselect/methods/Dselect/Method.pm
+++ b/dselect/methods/Dselect/Method.pm
@@ -102,8 +102,8 @@ sub read_config {
     $conf = eval $code;
     die "couldn't eval $vars content: $@\n" if $@;
     if (ref($conf) =~ /HASH/) {
-        foreach (keys %{$conf}) {
-            $CONFIG{$_} = $conf->{$_};
+        foreach my $var (keys %{$conf}) {
+            $CONFIG{$var} = $conf->{$var};
         }
     } else {
         print "Bad $vars file : removing it.\n";
@@ -137,8 +137,8 @@ sub edit_config {
     while (1) {
         $i = 1;
         print "\n\nList of selected $method sites :\n";
-        foreach (@{$CONFIG{site}}) {
-            print "$i. $method://$_->[0]$_->[1] @{$_->[2]}\n";
+        foreach my $site (@{$CONFIG{site}}) {
+            print "$i. $method://$site->[0]$site->[1] @{$site->[2]}\n";
             $i++;
         }
         print "\nEnter a command (a=add e=edit d=delete q=quit m=mirror list) 
\n";
diff --git a/dselect/methods/ftp/setup.pl b/dselect/methods/ftp/setup.pl
index 0c60931ef..568f8079e 100755
--- a/dselect/methods/ftp/setup.pl
+++ b/dselect/methods/ftp/setup.pl
@@ -110,20 +110,20 @@ edit_config('ftp', $methdir);
 
 my $ftp;
 sub download {
-    foreach (@{$CONFIG{site}}) {
+    foreach my $site (@{$CONFIG{site}}) {
         $ftp = do_connect(
-            ftpsite => $_->[0],
-            ftpdir => $_->[1],
-            passive => $_->[3],
-            username => $_->[4],
-            password => $_->[5],
+            ftpsite => $site->[0],
+            ftpdir => $site->[1],
+            passive => $site->[3],
+            username => $site->[4],
+            password => $site->[5],
             useproxy => $CONFIG{use_auth_proxy},
             proxyhost => $CONFIG{proxyhost},
             proxylogname => $CONFIG{proxylogname},
             proxypassword => $CONFIG{proxypassword},
         );
 
-        my @dists = @{$_->[2]};
+        my @dists = @{$site->[2]};
 
         foreach my $dist (@dists) {
             my $dir = "$dist/binary-$arch";
diff --git a/dselect/methods/ftp/update.pl b/dselect/methods/ftp/update.pl
index b26b0d39a..4c8f690fd 100755
--- a/dselect/methods/ftp/update.pl
+++ b/dselect/methods/ftp/update.pl
@@ -72,22 +72,20 @@ my $ftp;
 my $packages_modified = 0;
 
 sub download {
-    foreach (@{$CONFIG{site}}) {
-        my $site = $_;
-
+    foreach my $site (@{$CONFIG{site}}) {
         $ftp = do_connect(
-            ftpsite => $_->[0],
-            ftpdir => $_->[1],
-            passive => $_->[3],
-            username => $_->[4],
-            password => $_->[5],
+            ftpsite => $site->[0],
+            ftpdir => $site->[1],
+            passive => $site->[3],
+            username => $site->[4],
+            password => $site->[5],
             useproxy => $CONFIG{use_auth_proxy},
             proxyhost => $CONFIG{proxyhost},
             proxylogname => $CONFIG{proxylogname},
             proxypassword => $CONFIG{proxypassword},
         );
 
-        my @dists = @{$_->[2]};
+        my @dists = @{$site->[2]};
         PACKAGE: foreach my $dist (@dists) {
             my $dir = "$dist/binary-$arch";
             my $must_get = 0;
diff --git a/dselect/methods/media/install.pl b/dselect/methods/media/install.pl
index 81496abbf..d9ff528db 100755
--- a/dselect/methods/media/install.pl
+++ b/dselect/methods/media/install.pl
@@ -202,8 +202,8 @@ $line = 0;
             split /^(\S*?):\s*/m,
         );
         foreach my $field (keys %status) {
-            chomp $status{$_};
-            $status{$_} =~ s/^\s*(.*?)\s*$/$1/;
+            chomp $status{$field};
+            $status{$field} =~ s/^\s*(.*?)\s*$/$1/;
         }
         my @pstat = split(/ /, $status{Status});
         next unless ($pstat[0] eq 'install');
@@ -236,8 +236,8 @@ open my $avail_fh, '<', $AVAIL
             split /^(\S*?):\s*/m,
         );
         foreach my $field (keys %avail) {
-            chomp $avail{$_};
-            $avail{$_} =~ s/^\s*(.*?)\s*$/$1/;
+            chomp $avail{$field};
+            $avail{$field} =~ s/^\s*(.*?)\s*$/$1/;
         }
 
         next unless defined $installed{$avail{Package}};
@@ -291,11 +291,11 @@ foreach my $need (@media) {
     unlink <tmp/*>;
 
     print "creating symlinks...\n";
-    foreach (@{$medium{$need}}) {
+    foreach my $pkgname (@{$medium{$need}}) {
         my $basename;
 
-        ($basename = $filename{$_}) =~ s/.*\///;
-        symlink "$p_mountpoint/$p_hierbase/$filename{$_}", "tmp/$basename";
+        ($basename = $filename{$pkgname}) =~ s/.*\///;
+        symlink "$p_mountpoint/$p_hierbase/$filename{$pkgname}", 
"tmp/$basename";
     }
     chdir 'tmp' or die "cannot chdir to tmp: $!\n";
     system 'dpkg', '-iGROEB', q{.};

-- 
Dpkg.Org's dpkg

Reply via email to