From 84f5388446ed30938f5df37f117543ad8b19e73d Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 20 Apr 2009 14:41:33 -0400 Subject: use $this rather than $self --- Debian/Debhelper/Buildsystem/autotools.pm | 8 +- Debian/Debhelper/Buildsystem/cmake.pm | 16 ++-- Debian/Debhelper/Buildsystem/makefile.pm | 50 ++++++------ Debian/Debhelper/Buildsystem/perl_build.pm | 30 ++++---- Debian/Debhelper/Buildsystem/perl_makemaker.pm | 14 ++-- Debian/Debhelper/Buildsystem/python_distutils.pm | 18 ++--- Debian/Debhelper/Dh_Buildsystem.pm | 96 ++++++++++++------------ 7 files changed, 116 insertions(+), 116 deletions(-) (limited to 'Debian') diff --git a/Debian/Debhelper/Buildsystem/autotools.pm b/Debian/Debhelper/Buildsystem/autotools.pm index 0f112618..edebd98d 100644 --- a/Debian/Debhelper/Buildsystem/autotools.pm +++ b/Debian/Debhelper/Buildsystem/autotools.pm @@ -16,7 +16,7 @@ sub DESCRIPTION { } sub check_auto_buildable { - my $self=shift; + my $this=shift; my ($action)=@_; # Handle configure; the rest - next class @@ -27,7 +27,7 @@ sub check_auto_buildable { } sub configure { - my $self=shift; + my $this=shift; # Standard set of options for configure. my @opts; @@ -49,8 +49,8 @@ sub configure { push @opts, "--host=" . dpkg_architecture_value("DEB_HOST_GNU_TYPE"); } - $self->mkdir_builddir(); - $self->doit_in_builddir($self->get_rel2builddir_path("configure"), @opts, @_); + $this->mkdir_builddir(); + $this->doit_in_builddir($this->get_rel2builddir_path("configure"), @opts, @_); } 1; diff --git a/Debian/Debhelper/Buildsystem/cmake.pm b/Debian/Debhelper/Buildsystem/cmake.pm index f40b020f..fe91503c 100644 --- a/Debian/Debhelper/Buildsystem/cmake.pm +++ b/Debian/Debhelper/Buildsystem/cmake.pm @@ -15,23 +15,23 @@ sub DESCRIPTION { } sub check_auto_buildable { - my $self=shift; + my $this=shift; my ($action)=@_; my $ret = -e "CMakeLists.txt"; - $ret &&= $self->SUPER::check_auto_buildable(@_) if $action ne "configure"; + $ret &&= $this->SUPER::check_auto_buildable(@_) if $action ne "configure"; return $ret; } sub new { my $class=shift; - my $self=$class->SUPER::new(@_); + my $this=$class->SUPER::new(@_); # Enforce outside-source tree builds. - $self->enforce_outside_source_building(); - return $self; + $this->enforce_outside_source_building(); + return $this; } sub configure { - my $self=shift; + my $this=shift; my @flags; # Standard set of cmake flags @@ -42,8 +42,8 @@ sub configure { push @flags, "-DCMAKE_SKIP_RPATH=ON"; push @flags, "-DCMAKE_VERBOSE_MAKEFILE=ON"; - $self->mkdir_builddir(); - $self->doit_in_builddir("cmake", $self->get_rel2builddir_path(), @flags); + $this->mkdir_builddir(); + $this->doit_in_builddir("cmake", $this->get_rel2builddir_path(), @flags); } 1; diff --git a/Debian/Debhelper/Buildsystem/makefile.pm b/Debian/Debhelper/Buildsystem/makefile.pm index 0eab0c4a..2d4c64ca 100644 --- a/Debian/Debhelper/Buildsystem/makefile.pm +++ b/Debian/Debhelper/Buildsystem/makefile.pm @@ -11,16 +11,16 @@ use Debian::Debhelper::Dh_Lib; use base 'Debian::Debhelper::Dh_Buildsystem'; sub get_makecmd_C { - my $self=shift; - if ($self->get_builddir()) { - return $self->{makecmd} . " -C " . $self->get_builddir(); + my $this=shift; + if ($this->get_builddir()) { + return $this->{makecmd} . " -C " . $this->get_builddir(); } - return $self->{makecmd}; + return $this->{makecmd}; } sub exists_make_target { - my ($self, $target) = @_; - my $makecmd=$self->get_makecmd_C(); + my ($this, $target) = @_; + my $makecmd=$this->get_makecmd_C(); # Use make -n to check to see if the target would do # anything. There's no good way to test if a target exists. @@ -30,12 +30,12 @@ sub exists_make_target { } sub make_first_existing_target { - my $self=shift; + my $this=shift; my $targets=shift; foreach my $target (@$targets) { - if ($self->exists_make_target($target)) { - $self->doit_in_builddir($self->{makecmd}, $target, @_); + if ($this->exists_make_target($target)) { + $this->doit_in_builddir($this->{makecmd}, $target, @_); return $target; } } @@ -48,46 +48,46 @@ sub DESCRIPTION { sub new { my $class=shift; - my $self=$class->SUPER::new(@_); - $self->{makecmd} = (exists $ENV{MAKE}) ? $ENV{MAKE} : "make"; - return $self; + my $this=$class->SUPER::new(@_); + $this->{makecmd} = (exists $ENV{MAKE}) ? $ENV{MAKE} : "make"; + return $this; } sub check_auto_buildable { - my $self=shift; + my $this=shift; my ($action) = @_; # Handles build, test, install, clean; configure - next class if (grep /^\Q$action\E$/, qw{build test install clean}) { # This is always called in the source directory, but generally # Makefiles are created (or live) in the the build directory. - return -e $self->get_buildpath("Makefile") || - -e $self->get_buildpath("makefile") || - -e $self->get_buildpath("GNUmakefile"); + return -e $this->get_buildpath("Makefile") || + -e $this->get_buildpath("makefile") || + -e $this->get_buildpath("GNUmakefile"); } return 0; } sub build { - my $self=shift; - $self->doit_in_builddir($self->{makecmd}, @_); + my $this=shift; + $this->doit_in_builddir($this->{makecmd}, @_); } sub test { - my $self=shift; - $self->make_first_existing_target(['test', 'check'], @_); + my $this=shift; + $this->make_first_existing_target(['test', 'check'], @_); } sub install { - my $self=shift; + my $this=shift; my $destdir=shift; - $self->make_first_existing_target(['install'], "DESTDIR=$destdir", @_); + $this->make_first_existing_target(['install'], "DESTDIR=$destdir", @_); } sub clean { - my $self=shift; - if (!$self->clean_builddir()) { - $self->make_first_existing_target(['distclean', 'realclean', 'clean'], @_); + my $this=shift; + if (!$this->clean_builddir()) { + $this->make_first_existing_target(['distclean', 'realclean', 'clean'], @_); } } diff --git a/Debian/Debhelper/Buildsystem/perl_build.pm b/Debian/Debhelper/Buildsystem/perl_build.pm index 03608564..b5ad96df 100644 --- a/Debian/Debhelper/Buildsystem/perl_build.pm +++ b/Debian/Debhelper/Buildsystem/perl_build.pm @@ -15,7 +15,7 @@ sub DESCRIPTION { } sub check_auto_buildable { - my ($self, $action) = @_; + my ($this, $action) = @_; # Handles everything my $ret = -e "Build.PL"; @@ -26,43 +26,43 @@ sub check_auto_buildable { } sub do_perl { - my $self=shift; + my $this=shift; $ENV{MODULEBUILDRC} = "/dev/null"; doit("perl", @_); } sub new { my $class=shift; - my $self= $class->SUPER::new(@_); - $self->enforce_in_source_building(); - return $self; + my $this= $class->SUPER::new(@_); + $this->enforce_in_source_building(); + return $this; } sub configure { - my $self=shift; + my $this=shift; $ENV{PERL_MM_USE_DEFAULT}=1; - $self->do_perl("Build.PL", "installdirs=vendor", @_); + $this->do_perl("Build.PL", "installdirs=vendor", @_); } sub build { - my $self=shift; - $self->do_perl("Build", @_); + my $this=shift; + $this->do_perl("Build", @_); } sub test { - my $self=shift; - $self->do_perl("Build", "test", @_); + my $this=shift; + $this->do_perl("Build", "test", @_); } sub install { - my $self=shift; + my $this=shift; my $destdir=shift; - $self->do_perl("Build", "install", "destdir=$destdir", "create_packlist=0", @_); + $this->do_perl("Build", "install", "destdir=$destdir", "create_packlist=0", @_); } sub clean { - my $self=shift; - $self->do_perl("Build", "--allow_mb_mismatch", 1, "distclean", @_); + my $this=shift; + $this->do_perl("Build", "--allow_mb_mismatch", 1, "distclean", @_); } 1; diff --git a/Debian/Debhelper/Buildsystem/perl_makemaker.pm b/Debian/Debhelper/Buildsystem/perl_makemaker.pm index 74eaf6bf..1d08dd66 100644 --- a/Debian/Debhelper/Buildsystem/perl_makemaker.pm +++ b/Debian/Debhelper/Buildsystem/perl_makemaker.pm @@ -15,7 +15,7 @@ sub DESCRIPTION { } sub check_auto_buildable { - my $self=shift; + my $this=shift; my ($action)=@_; # Handles configure, install; the rest - next class @@ -29,13 +29,13 @@ sub check_auto_buildable { sub new { my $class=shift; - my $self=$class->SUPER::new(@_); - $self->enforce_in_source_building(); - return $self; + my $this=$class->SUPER::new(@_); + $this->enforce_in_source_building(); + return $this; } sub configure { - my $self=shift; + my $this=shift; # If set to a true value then MakeMaker's prompt function will # # always return the default without waiting for user input. $ENV{PERL_MM_USE_DEFAULT}=1; @@ -43,9 +43,9 @@ sub configure { } sub install { - my $self=shift; + my $this=shift; my $destdir=shift; - $self->SUPER::install($destdir, "PREFIX=/usr", @_); + $this->SUPER::install($destdir, "PREFIX=/usr", @_); } 1; diff --git a/Debian/Debhelper/Buildsystem/python_distutils.pm b/Debian/Debhelper/Buildsystem/python_distutils.pm index 0061a442..e34183c6 100644 --- a/Debian/Debhelper/Buildsystem/python_distutils.pm +++ b/Debian/Debhelper/Buildsystem/python_distutils.pm @@ -20,29 +20,29 @@ sub check_auto_buildable { } sub setup_py { - my $self=shift; + my $this=shift; my $act=shift; - if ($self->get_builddir()) { - unshift @_, "--build-base=" . $self->get_builddir(); + if ($this->get_builddir()) { + unshift @_, "--build-base=" . $this->get_builddir(); } doit("python", "setup.py", $act, @_); } sub build { - my $self=shift; - $self->setup_py("build", @_); + my $this=shift; + $this->setup_py("build", @_); } sub install { - my $self=shift; + my $this=shift; my $destdir=shift; - $self->setup_py("install", "--root=$destdir", "--no-compile", "-O0", @_); + $this->setup_py("install", "--root=$destdir", "--no-compile", "-O0", @_); } sub clean { - my $self=shift; - $self->setup_py("clean", "-a", @_); + my $this=shift; + $this->setup_py("clean", "-a", @_); # The setup.py might import files, leading to python creating pyc # files. doit('find', '.', '-name', '*.pyc', '-exec', 'rm', '{}', ';'); diff --git a/Debian/Debhelper/Dh_Buildsystem.pm b/Debian/Debhelper/Dh_Buildsystem.pm index afb13ea1..31e462a3 100644 --- a/Debian/Debhelper/Dh_Buildsystem.pm +++ b/Debian/Debhelper/Dh_Buildsystem.pm @@ -20,8 +20,8 @@ our $DEB_BUILD_GNU_TYPE = dpkg_architecture_value("DEB_BUILD_GNU_TYPE"); # name. Do not override this method unless you know what you are # doing. sub NAME { - my $self=shift; - my $class = ref($self) || $self; + my $this=shift; + my $class = ref($this) || $this; if ($class =~ m/^.+::([^:]+)$/) { return $1; } @@ -57,30 +57,30 @@ sub DEFAULT_BUILD_DIRECTORY { sub new { my ($class, %opts)=@_; - my $self = bless({ builddir => undef, is_buildable => 1 }, $class); + my $this = bless({ builddir => undef, is_buildable => 1 }, $class); if (exists $opts{builddir}) { if ($opts{builddir}) { - $self->{builddir} = $opts{builddir}; + $this->{builddir} = $opts{builddir}; } else { - $self->{builddir} = $self->DEFAULT_BUILD_DIRECTORY(); + $this->{builddir} = $this->DEFAULT_BUILD_DIRECTORY(); } } if (exists $opts{build_action}) { if (defined $opts{build_action}) { - $self->{is_buildable} = $self->check_auto_buildable($opts{build_action}); + $this->{is_buildable} = $this->check_auto_buildable($opts{build_action}); } else { - $self->{is_buildable} = 0; + $this->{is_buildable} = 0; } } - return $self; + return $this; } # Test is_buildable flag of the object. sub is_buildable { - my $self=shift; - return $self->{is_buildable}; + my $this=shift; + return $this->{is_buildable}; } # This instance method is called to check if the build system is capable @@ -91,10 +91,10 @@ sub is_buildable { # used in conjuction with @Dh_Buildsystems::BUILDSYSTEMS. # # This method is supposed to be called with source root directory being -# working directory. Use $self->get_buildpath($path) method to get full +# working directory. Use $this->get_buildpath($path) method to get full # path to the files in the build directory. sub check_auto_buildable { - my $self=shift; + my $this=shift; my ($action) = @_; return 0; } @@ -102,38 +102,38 @@ sub check_auto_buildable { # Derived class can call this method in its constructor # to enforce in-source building even if the user requested otherwise. sub enforce_in_source_building { - my $self=shift; - if ($self->{builddir}) { + my $this=shift; + if ($this->{builddir}) { # Do not emit warning unless the object is buildable. - if ($self->is_buildable()) { - warning("warning: " . $self->NAME() . + if ($this->is_buildable()) { + warning("warning: " . $this->NAME() . " does not support building outside-source. In-source build enforced."); } - $self->{builddir} = undef; + $this->{builddir} = undef; } } # Derived class can call this method in its constructor to enforce # outside-source building even if the user didn't request it. sub enforce_outside_source_building { - my ($self, $builddir) = @_; - if (!defined $self->{builddir}) { - $self->{builddir} = ($builddir && $builddir ne ".") ? $builddir : $self->DEFAULT_BUILD_DIRECTORY(); + my ($this, $builddir) = @_; + if (!defined $this->{builddir}) { + $this->{builddir} = ($builddir && $builddir ne ".") ? $builddir : $this->DEFAULT_BUILD_DIRECTORY(); } } # Get path to the specified build directory sub get_builddir { - my $self=shift; - return $self->{builddir}; + my $this=shift; + return $this->{builddir}; } # Construct absolute path to the file from the given path that is relative # to the build directory. sub get_buildpath { - my ($self, $path) = @_; - if ($self->get_builddir()) { - return File::Spec->catfile($self->get_builddir(), $path); + my ($this, $path) = @_; + if ($this->get_builddir()) { + return File::Spec->catfile($this->get_builddir(), $path); } else { return File::Spec->catfile('.', $path); @@ -145,7 +145,7 @@ sub get_buildpath { # If $path is not given, returns relative path to the root of the # source tree from the build directory. sub get_rel2builddir_path { - my $self=shift; + my $this=shift; my $path=shift; if (defined $path) { @@ -154,8 +154,8 @@ sub get_rel2builddir_path { else { $path = Cwd::getcwd(); } - if ($self->get_builddir()) { - return File::Spec->abs2rel($path, Cwd::abs_path($self->get_builddir())); + if ($this->get_builddir()) { + return File::Spec->abs2rel($path, Cwd::abs_path($this->get_builddir())); } return $path; } @@ -170,22 +170,22 @@ sub _cd { # Creates a build directory. sub mkdir_builddir { - my $self=shift; - if ($self->get_builddir()) { - doit("mkdir", "-p", $self->get_builddir()); + my $this=shift; + if ($this->get_builddir()) { + doit("mkdir", "-p", $this->get_builddir()); } } # Changes working directory the build directory (if needed), calls doit(@_) # and changes working directory back to the source directory. sub doit_in_builddir { - my $self=shift; - if ($self->get_builddir()) { - my $builddir = $self->get_builddir(); - my $sourcedir = $self->get_rel2builddir_path(); - $self->_cd($builddir); + my $this=shift; + if ($this->get_builddir()) { + my $builddir = $this->get_builddir(); + my $sourcedir = $this->get_rel2builddir_path(); + $this->_cd($builddir); doit(@_); - $self->_cd($sourcedir); + $this->_cd($sourcedir); } else { doit(@_); @@ -197,10 +197,10 @@ sub doit_in_builddir { # gets wiped (if it exists) and 1 is returned. Otherwise, nothing # is done and 0 is returned. sub clean_builddir { - my $self=shift; - if ($self->get_builddir()) { - if (-d $self->get_builddir()) { - doit("rm", "-rf", $self->get_builddir()); + my $this=shift; + if ($this->get_builddir()) { + if (-d $this->get_builddir()) { + doit("rm", "-rf", $this->get_builddir()); } return 1; } @@ -212,7 +212,7 @@ sub clean_builddir { # Action name is passed as an argument. Derived classes overriding this # method should also call SUPER implementation of it. sub pre_action { - my $self=shift; + my $this=shift; my ($action)=@_; } @@ -220,7 +220,7 @@ sub pre_action { # Action name is passed as an argument. Derived classes overriding this # method should also call SUPER implementation of it. sub post_action { - my $self=shift; + my $this=shift; my ($action)=@_; } @@ -233,25 +233,25 @@ sub post_action { # source. Arbitary number of custom action arguments might be # passed. Default implementations do nothing. sub configure { - my $self=shift; + my $this=shift; } sub build { - my $self=shift; + my $this=shift; } sub test { - my $self=shift; + my $this=shift; } # destdir parameter specifies where to install files. sub install { - my $self=shift; + my $this=shift; my $destdir=shift; } sub clean { - my $self=shift; + my $this=shift; } 1; -- cgit v1.2.3