[dpkg] 102/187: Dpkg::Source::Package: Prefix private functions with _

Reiner Herrmann reiner at reiner-h.de
Sun Nov 6 12:46:29 UTC 2016


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

deki-guest pushed a commit to branch master
in repository dpkg.

commit ea506ec3f20f6c81ce3dcff5cd99ab8146685a35
Author: Guillem Jover <guillem at debian.org>
Date:   Sun Oct 2 19:51:59 2016 +0200

    Dpkg::Source::Package: Prefix private functions with _
---
 debian/changelog                        |  1 +
 scripts/Dpkg/Source/Package/V2.pm       | 24 ++++++++++++------------
 scripts/Dpkg/Source/Package/V3/Bzr.pm   |  6 +++---
 scripts/Dpkg/Source/Package/V3/Git.pm   |  6 +++---
 scripts/Dpkg/Source/Package/V3/Quilt.pm | 16 ++++++++--------
 5 files changed, 27 insertions(+), 26 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 366cd57..74a27e6 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -57,6 +57,7 @@ dpkg (1.18.11) UNRELEASED; urgency=medium
     - Add new set_field_substvars() method to Dpkg::Substvars.
     - Fix reproducible source package support in Dpkg::Source::Archive, by
       sorting the tar contents with --sort=name.
+    - Prefix private Dpkg::Source::Package::* functions with _.
   * Packaging:
     - Add liblocale-gettext-perl to libdpkg-perl Recommends.
     - Wrap and document dependency relationships.
diff --git a/scripts/Dpkg/Source/Package/V2.pm b/scripts/Dpkg/Source/Package/V2.pm
index 610a741..9f5b521 100644
--- a/scripts/Dpkg/Source/Package/V2.pm
+++ b/scripts/Dpkg/Source/Package/V2.pm
@@ -259,7 +259,7 @@ sub get_autopatch_name {
     return 'zz_debian-diff-auto';
 }
 
-sub get_patches {
+sub _get_patches {
     my ($self, $dir, %opts) = @_;
     $opts{skip_auto} //= 0;
     my @patches;
@@ -281,14 +281,14 @@ sub get_patches {
 sub apply_patches {
     my ($self, $dir, %opts) = @_;
     $opts{skip_auto} //= 0;
-    my @patches = $self->get_patches($dir, %opts);
+    my @patches = $self->_get_patches($dir, %opts);
     return unless scalar(@patches);
     my $applied = File::Spec->catfile($dir, 'debian', 'patches', '.dpkg-source-applied');
     open(my $applied_fh, '>', $applied)
         or syserr(g_('cannot write %s'), $applied);
     print { $applied_fh } "# During $opts{usage}\n";
     my $timestamp = fs_time($applied);
-    foreach my $patch ($self->get_patches($dir, %opts)) {
+    foreach my $patch ($self->_get_patches($dir, %opts)) {
         my $path = File::Spec->catfile($dir, 'debian', 'patches', $patch);
         info(g_('applying %s'), $patch) unless $opts{skip_auto};
         my $patch_obj = Dpkg::Source::Patch->new(filename => $path);
@@ -302,7 +302,7 @@ sub apply_patches {
 
 sub unapply_patches {
     my ($self, $dir, %opts) = @_;
-    my @patches = reverse($self->get_patches($dir, %opts));
+    my @patches = reverse($self->_get_patches($dir, %opts));
     return unless scalar(@patches);
     my $applied = File::Spec->catfile($dir, 'debian', 'patches', '.dpkg-source-applied');
     my $timestamp = fs_time($applied);
@@ -317,7 +317,7 @@ sub unapply_patches {
     unlink($applied);
 }
 
-sub upstream_tarball_template {
+sub _upstream_tarball_template {
     my $self = shift;
     my $ext = '{' . join(',',
         sort map {
@@ -332,7 +332,7 @@ sub can_build {
     return 1 if $self->{options}{create_empty_orig} and
                 $self->find_original_tarballs(include_main => 0);
     return (0, sprintf(g_('no upstream tarball found at %s'),
-                       $self->upstream_tarball_template()));
+                       $self->_upstream_tarball_template()));
 }
 
 sub before_build {
@@ -390,7 +390,7 @@ sub check_patches_applied {
     }
 }
 
-sub generate_patch {
+sub _generate_patch {
     my ($self, $dir, %opts) = @_;
     my ($dirname, $updir) = fileparse($dir);
     my $basedirname = $self->get_basename();
@@ -419,7 +419,7 @@ sub generate_patch {
     }
 
     error(g_('no upstream tarball found at %s'),
-          $self->upstream_tarball_template()) unless $tarfile;
+          $self->_upstream_tarball_template()) unless $tarfile;
 
     if ($opts{usage} eq 'build') {
         info(g_('building %s using existing %s'),
@@ -463,7 +463,7 @@ sub generate_patch {
         my $analysis = $header_from->analyze($dir, verbose => 0);
         $diff->set_header($analysis->{patchheader});
     } else {
-        $diff->set_header($self->get_patch_header($dir));
+        $diff->set_header($self->_get_patch_header($dir));
     }
     $diff->add_diff_directory($tmp, $dir, basedirname => $basedirname,
             %{$self->{diff_options}},
@@ -567,7 +567,7 @@ sub do_build {
     # Create a patch
     my $autopatch = File::Spec->catfile($dir, 'debian', 'patches',
                                         $self->get_autopatch_name());
-    my $tmpdiff = $self->generate_patch($dir, order_from => $autopatch,
+    my $tmpdiff = $self->_generate_patch($dir, order_from => $autopatch,
                                         header_from => $autopatch,
                                         handle_binary => $handle_binary,
                                         skip_auto => $self->{options}{auto_commit},
@@ -608,7 +608,7 @@ sub do_build {
     $self->add_file($debianfile);
 }
 
-sub get_patch_header {
+sub _get_patch_header {
     my ($self, $dir) = @_;
     my $ph = File::Spec->catfile($dir, 'debian', 'source', 'local-patch-header');
     unless (-f $ph) {
@@ -708,7 +708,7 @@ sub do_commit {
     };
 
     unless ($tmpdiff) {
-        $tmpdiff = $self->generate_patch($dir, handle_binary => $handle_binary,
+        $tmpdiff = $self->_generate_patch($dir, handle_binary => $handle_binary,
                                          usage => 'commit');
         $binaryfiles->update_debian_source_include_binaries();
     }
diff --git a/scripts/Dpkg/Source/Package/V3/Bzr.pm b/scripts/Dpkg/Source/Package/V3/Bzr.pm
index 058c96b..7264e1e 100644
--- a/scripts/Dpkg/Source/Package/V3/Bzr.pm
+++ b/scripts/Dpkg/Source/Package/V3/Bzr.pm
@@ -52,7 +52,7 @@ sub import {
              'bzr is not in the PATH'));
 }
 
-sub sanity_check {
+sub _sanity_check {
     my $srcdir = shift;
 
     if (! -d "$srcdir/.bzr") {
@@ -106,7 +106,7 @@ sub do_build {
     my $basedirname = $basename;
     $basedirname =~ s/_/-/;
 
-    sanity_check($dir);
+    _sanity_check($dir);
 
     my $old_cwd = getcwd();
     chdir $dir or syserr(g_("unable to chdir to '%s'"), $dir);
@@ -199,7 +199,7 @@ sub do_extract {
     my $tar = Dpkg::Source::Archive->new(filename => "$dscdir$tarfile");
     $tar->extract($newdirectory);
 
-    sanity_check($newdirectory);
+    _sanity_check($newdirectory);
 
     my $old_cwd = getcwd();
     chdir($newdirectory)
diff --git a/scripts/Dpkg/Source/Package/V3/Git.pm b/scripts/Dpkg/Source/Package/V3/Git.pm
index c9a056b..3113ca4 100644
--- a/scripts/Dpkg/Source/Package/V3/Git.pm
+++ b/scripts/Dpkg/Source/Package/V3/Git.pm
@@ -55,7 +55,7 @@ sub import {
              'git is not in the PATH'));
 }
 
-sub sanity_check {
+sub _sanity_check {
     my $srcdir = shift;
 
     if (! -d "$srcdir/.git") {
@@ -119,7 +119,7 @@ sub do_build {
     my ($dirname, $updir) = fileparse($dir);
     my $basenamerev = $self->get_basename(1);
 
-    sanity_check($dir);
+    _sanity_check($dir);
 
     my $old_cwd = getcwd();
     chdir $dir or syserr(g_("unable to chdir to '%s'"), $dir);
@@ -254,7 +254,7 @@ sub do_extract {
         subprocerr('cp') if $?;
     }
 
-    sanity_check($newdirectory);
+    _sanity_check($newdirectory);
 }
 
 1;
diff --git a/scripts/Dpkg/Source/Package/V3/Quilt.pm b/scripts/Dpkg/Source/Package/V3/Quilt.pm
index d3291fe..fdb7635 100644
--- a/scripts/Dpkg/Source/Package/V3/Quilt.pm
+++ b/scripts/Dpkg/Source/Package/V3/Quilt.pm
@@ -80,7 +80,7 @@ sub parse_cmdline_option {
     return 0;
 }
 
-sub build_quilt_object {
+sub _build_quilt_object {
     my ($self, $dir) = @_;
     return $self->{quilt}{$dir} if exists $self->{quilt}{$dir};
     $self->{quilt}{$dir} = Dpkg::Source::Quilt->new($dir);
@@ -96,7 +96,7 @@ sub can_build {
     return (0, g_('non-native package version does not contain a revision'))
         if $v->is_native();
 
-    my $quilt = $self->build_quilt_object($dir);
+    my $quilt = $self->_build_quilt_object($dir);
     $msg = $quilt->find_problems();
     return (0, $msg) if $msg;
     return 1;
@@ -121,7 +121,7 @@ sub apply_patches {
         $opts{verbose} = 0;
     }
 
-    my $quilt = $self->build_quilt_object($dir);
+    my $quilt = $self->_build_quilt_object($dir);
     $quilt->load_series(%opts) if $opts{warn_options}; # Trigger warnings
 
     # Always create the quilt db so that if the maintainer calls quilt to
@@ -166,7 +166,7 @@ sub apply_patches {
 sub unapply_patches {
     my ($self, $dir, %opts) = @_;
 
-    my $quilt = $self->build_quilt_object($dir);
+    my $quilt = $self->_build_quilt_object($dir);
 
     $opts{verbose} //= 1;
 
@@ -199,7 +199,7 @@ sub prepare_build {
 sub do_build {
     my ($self, $dir) = @_;
 
-    my $quilt = $self->build_quilt_object($dir);
+    my $quilt = $self->_build_quilt_object($dir);
     my $version = $quilt->get_db_version();
 
     if (defined($version) and $version != 2) {
@@ -217,7 +217,7 @@ sub do_build {
 
 sub after_build {
     my ($self, $dir) = @_;
-    my $quilt = $self->build_quilt_object($dir);
+    my $quilt = $self->_build_quilt_object($dir);
     my $pc_unapply = $quilt->get_db_file('.dpkg-source-unapply');
     my $opt_unapply = $self->{options}{unapply_patches};
     if (($opt_unapply eq 'auto' and -e $pc_unapply) or $opt_unapply eq 'yes') {
@@ -229,7 +229,7 @@ sub after_build {
 sub check_patches_applied {
     my ($self, $dir) = @_;
 
-    my $quilt = $self->build_quilt_object($dir);
+    my $quilt = $self->_build_quilt_object($dir);
     my $next = $quilt->next();
     return if not defined $next;
 
@@ -243,7 +243,7 @@ sub check_patches_applied {
 sub register_patch {
     my ($self, $dir, $tmpdiff, $patch_name) = @_;
 
-    my $quilt = $self->build_quilt_object($dir);
+    my $quilt = $self->_build_quilt_object($dir);
     my $patch = $quilt->get_patch_file($patch_name);
 
     if (-s $tmpdiff) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/dpkg.git



More information about the Reproducible-commits mailing list