Quellcode durchsuchen

Dpkg: Use identifiers as key names whenever possible

The fixed key names are either inside unstable modules, internal to
them or for keys in code never released, so should not cause much of
an issue.
Guillem Jover vor 13 Jahren
Ursprung
Commit
8db43e1c6c

+ 1 - 1
scripts/Dpkg/BuildFlags.pm

@@ -71,7 +71,7 @@ sub load_vendor_defaults {
     $self->{'source'} = {};
     $self->{'source'} = {};
     $self->{'features'} = {};
     $self->{'features'} = {};
     my $build_opts = Dpkg::BuildOptions->new();
     my $build_opts = Dpkg::BuildOptions->new();
-    $self->{'build-options'} = $build_opts;
+    $self->{'build_options'} = $build_opts;
     my $default_flags = $build_opts->has("noopt") ? "-g -O0" : "-g -O2";
     my $default_flags = $build_opts->has("noopt") ? "-g -O0" : "-g -O2";
     $self->{flags} = {
     $self->{flags} = {
 	CPPFLAGS => '',
 	CPPFLAGS => '',

+ 2 - 2
scripts/Dpkg/Deps.pm

@@ -1219,7 +1219,7 @@ sub add_installed_package {
 	"package" => $pkg,
 	"package" => $pkg,
 	"version" => $ver,
 	"version" => $ver,
 	"architecture" => $arch,
 	"architecture" => $arch,
-	"multi-arch" => $multiarch || "no",
+	"multiarch" => $multiarch || "no",
     };
     };
     $self->{pkg}{"$pkg:$arch"} = $p if defined $arch;
     $self->{pkg}{"$pkg:$arch"} = $p if defined $arch;
     push @{$self->{pkg}{$pkg}}, $p;
     push @{$self->{pkg}{$pkg}}, $p;
@@ -1277,7 +1277,7 @@ sub _find_package {
     my $build_arch = $dep->{build_arch};
     my $build_arch = $dep->{build_arch};
     foreach my $p (@{$self->{pkg}{$pkg}}) {
     foreach my $p (@{$self->{pkg}{$pkg}}) {
 	my $a = $p->{"architecture"};
 	my $a = $p->{"architecture"};
-	my $ma = $p->{"multi-arch"};
+	my $ma = $p->{"multiarch"};
 	if (not defined $a) {
 	if (not defined $a) {
 	    $$lackinfos = 1;
 	    $$lackinfos = 1;
 	    next;
 	    next;

+ 7 - 7
scripts/Dpkg/Source/Package/V3/git.pm

@@ -76,10 +76,10 @@ sub parse_cmdline_option {
     my ($self, $opt) = @_;
     my ($self, $opt) = @_;
     return 1 if $self->SUPER::parse_cmdline_option($opt);
     return 1 if $self->SUPER::parse_cmdline_option($opt);
     if ($opt =~ /^--git-ref=(.*)$/) {
     if ($opt =~ /^--git-ref=(.*)$/) {
-        push @{$self->{'options'}{'git-ref'}}, $1;
+        push @{$self->{'options'}{'git_ref'}}, $1;
         return 1;
         return 1;
     } elsif ($opt =~ /^--git-depth=(\d+)$/) {
     } elsif ($opt =~ /^--git-depth=(\d+)$/) {
-        $self->{'options'}{'git-depth'} = $1;
+        $self->{'options'}{'git_depth'} = $1;
         return 1;
         return 1;
     }
     }
     return 0;
     return 0;
@@ -138,7 +138,7 @@ sub do_build {
     # bundle that.
     # bundle that.
     my $tmp;
     my $tmp;
     my $shallowfile;
     my $shallowfile;
-    if ($self->{'options'}{'git-depth'}) {
+    if ($self->{'options'}{'git_depth'}) {
         chdir($old_cwd) ||
         chdir($old_cwd) ||
                 syserr(_g("unable to chdir to `%s'"), $old_cwd);
                 syserr(_g("unable to chdir to `%s'"), $old_cwd);
         $tmp = tempdir("$dirname.git.XXXXXX", DIR => $updir);
         $tmp = tempdir("$dirname.git.XXXXXX", DIR => $updir);
@@ -147,8 +147,8 @@ sub do_build {
         # file:// is needed to avoid local cloning, which does not
         # file:// is needed to avoid local cloning, which does not
         # create a shallow clone.
         # create a shallow clone.
         info(_g("creating shallow clone with depth %s"),
         info(_g("creating shallow clone with depth %s"),
-                $self->{'options'}{'git-depth'});
-        system("git", "clone", "--depth=".$self->{'options'}{'git-depth'},
+                $self->{'options'}{'git_depth'});
+        system("git", "clone", "--depth=" . $self->{'options'}{'git_depth'},
                 "--quiet", "--bare", "file://" . abs_path($dir), $clone_dir);
                 "--quiet", "--bare", "file://" . abs_path($dir), $clone_dir);
         $? && subprocerr("git clone");
         $? && subprocerr("git clone");
         chdir($clone_dir) ||
         chdir($clone_dir) ||
@@ -160,8 +160,8 @@ sub do_build {
 
 
     # Create the git bundle.
     # Create the git bundle.
     my $bundlefile = "$basenamerev.git";
     my $bundlefile = "$basenamerev.git";
-    my @bundle_arg=$self->{'options'}{'git-ref'} ?
-        (@{$self->{'options'}{'git-ref'}}) : "--all";
+    my @bundle_arg = $self->{'options'}{'git_ref'} ?
+        (@{$self->{'options'}{'git_ref'}}) : "--all";
     info(_g("bundling: %s"), join(" ", @bundle_arg));
     info(_g("bundling: %s"), join(" ", @bundle_arg));
     system("git", "bundle", "create", "$old_cwd/$bundlefile",
     system("git", "bundle", "create", "$old_cwd/$bundlefile",
            @bundle_arg,
            @bundle_arg,

+ 8 - 8
scripts/Dpkg/Source/Package/V3/quilt.pm

@@ -38,10 +38,10 @@ our $CURRENT_MINOR_VERSION = "0";
 
 
 sub init_options {
 sub init_options {
     my ($self) = @_;
     my ($self) = @_;
-    $self->{'options'}{'single-debian-patch'} = 0
-        unless exists $self->{'options'}{'single-debian-patch'};
-    $self->{'options'}{'allow-version-of-quilt-db'} = []
-        unless exists $self->{'options'}{'allow-version-of-quilt-db'};
+    $self->{'options'}{'single_debian_patch'} = 0
+        unless exists $self->{'options'}{'single_debian_patch'};
+    $self->{'options'}{'allow_version_of_quilt_db'} = []
+        unless exists $self->{'options'}{'allow_version_of_quilt_db'};
 
 
     $self->SUPER::init_options();
     $self->SUPER::init_options();
 }
 }
@@ -50,12 +50,12 @@ sub parse_cmdline_option {
     my ($self, $opt) = @_;
     my ($self, $opt) = @_;
     return 1 if $self->SUPER::parse_cmdline_option($opt);
     return 1 if $self->SUPER::parse_cmdline_option($opt);
     if ($opt =~ /^--single-debian-patch$/) {
     if ($opt =~ /^--single-debian-patch$/) {
-        $self->{'options'}{'single-debian-patch'} = 1;
+        $self->{'options'}{'single_debian_patch'} = 1;
         # For backwards compatibility.
         # For backwards compatibility.
         $self->{'options'}{'auto_commit'} = 1;
         $self->{'options'}{'auto_commit'} = 1;
         return 1;
         return 1;
     } elsif ($opt =~ /^--allow-version-of-quilt-db=(.*)$/) {
     } elsif ($opt =~ /^--allow-version-of-quilt-db=(.*)$/) {
-        push @{$self->{'options'}{'allow-version-of-quilt-db'}}, $1;
+        push @{$self->{'options'}{'allow_version_of_quilt_db'}}, $1;
         return 1;
         return 1;
     }
     }
     return 0;
     return 0;
@@ -80,7 +80,7 @@ sub can_build {
 
 
 sub get_autopatch_name {
 sub get_autopatch_name {
     my ($self) = @_;
     my ($self) = @_;
-    if ($self->{'options'}{'single-debian-patch'}) {
+    if ($self->{'options'}{'single_debian_patch'}) {
         return "debian-changes";
         return "debian-changes";
     } else {
     } else {
         return "debian-changes-" . $self->{'fields'}{'Version'};
         return "debian-changes-" . $self->{'fields'}{'Version'};
@@ -178,7 +178,7 @@ sub do_build {
 
 
     if (defined($version) and $version != 2) {
     if (defined($version) and $version != 2) {
         if (scalar grep { $version eq $_ }
         if (scalar grep { $version eq $_ }
-            @{$self->{'options'}{'allow-version-of-quilt-db'}})
+            @{$self->{'options'}{'allow_version_of_quilt_db'}})
         {
         {
             warning(_g("unsupported version of the quilt metadata: %s"), $version);
             warning(_g("unsupported version of the quilt metadata: %s"), $version);
         } else {
         } else {

+ 8 - 8
scripts/Dpkg/Source/Quilt.pm

@@ -82,7 +82,7 @@ sub load_db {
     my ($self) = @_;
     my ($self) = @_;
 
 
     my $pc_applied = $self->get_db_file("applied-patches");
     my $pc_applied = $self->get_db_file("applied-patches");
-    $self->{'applied-patches'} = [ $self->read_patch_list($pc_applied) ];
+    $self->{'applied_patches'} = [ $self->read_patch_list($pc_applied) ];
 }
 }
 
 
 sub write_db {
 sub write_db {
@@ -92,7 +92,7 @@ sub write_db {
     my $pc_applied = $self->get_db_file("applied-patches");
     my $pc_applied = $self->get_db_file("applied-patches");
     open(my $applied_fh, ">", $pc_applied) or
     open(my $applied_fh, ">", $pc_applied) or
         syserr(_g("cannot write %s"), $pc_applied);
         syserr(_g("cannot write %s"), $pc_applied);
-    foreach my $patch (@{$self->{'applied-patches'}}) {
+    foreach my $patch (@{$self->{'applied_patches'}}) {
         print $applied_fh "$patch\n";
         print $applied_fh "$patch\n";
     }
     }
     close($applied_fh);
     close($applied_fh);
@@ -112,19 +112,19 @@ sub series {
 
 
 sub applied {
 sub applied {
     my ($self) = @_;
     my ($self) = @_;
-    return @{$self->{'applied-patches'}};
+    return @{$self->{'applied_patches'}};
 }
 }
 
 
 sub top {
 sub top {
     my ($self) = @_;
     my ($self) = @_;
-    my $count = scalar @{$self->{'applied-patches'}};
-    return $self->{'applied-patches'}[$count - 1] if $count;
+    my $count = scalar @{$self->{'applied_patches'}};
+    return $self->{'applied_patches'}[$count - 1] if $count;
     return;
     return;
 }
 }
 
 
 sub next {
 sub next {
     my ($self) = @_;
     my ($self) = @_;
-    my $count_applied = scalar @{$self->{'applied-patches'}};
+    my $count_applied = scalar @{$self->{'applied_patches'}};
     my $count_series = scalar @{$self->{'series'}};
     my $count_series = scalar @{$self->{'series'}};
     return $self->{'series'}[$count_applied] if ($count_series > $count_applied);
     return $self->{'series'}[$count_applied] if ($count_series > $count_applied);
     return;
     return;
@@ -158,7 +158,7 @@ sub push {
         erasedir($self->get_db_file($patch));
         erasedir($self->get_db_file($patch));
         die $@;
         die $@;
     }
     }
-    CORE::push @{$self->{'applied-patches'}}, $patch;
+    CORE::push @{$self->{'applied_patches'}}, $patch;
     $self->write_db();
     $self->write_db();
 }
 }
 
 
@@ -189,7 +189,7 @@ sub pop {
     }
     }
 
 
     erasedir($backup_dir);
     erasedir($backup_dir);
-    pop @{$self->{'applied-patches'}};
+    pop @{$self->{'applied_patches'}};
     $self->write_db();
     $self->write_db();
 }
 }
 
 

+ 1 - 1
scripts/Dpkg/Vendor/Debian.pm

@@ -135,7 +135,7 @@ sub add_hardening_flags {
     }
     }
 
 
     # Mask features that might be influenced by other flags.
     # Mask features that might be influenced by other flags.
-    if ($flags->{'build-options'}->has('noopt')) {
+    if ($flags->{'build_options'}->has('noopt')) {
       # glibc 2.16 and later warn when using -O0 and _FORTIFY_SOURCE.
       # glibc 2.16 and later warn when using -O0 and _FORTIFY_SOURCE.
       $use_feature{'fortify'} = 0;
       $use_feature{'fortify'} = 0;
     }
     }