[Reproducible-builds] [dh-python] 104/183: pybuild: fix problem with relative paths and --sourcedirectory

Jérémy Bobbio lunar at moszumanska.debian.org
Fri Sep 19 15:30:26 UTC 2014


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

lunar pushed a commit to branch pu/reproducible_builds
in repository dh-python.

commit 6649c79fb8c843c9af2c8ac365491b61bfb9d43e
Author: Piotr Ożarowski <piotr at debian.org>
Date:   Sun Sep 1 00:56:05 2013 +0200

    pybuild: fix problem with relative paths and --sourcedirectory
---
 debian/changelog |  1 +
 dh/pybuild.pm    | 19 +++++++++----------
 pybuild          | 18 ++++++++----------
 3 files changed, 18 insertions(+), 20 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index cb27671..243703e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -16,6 +16,7 @@ dh-python (1.20130830-1) UNRELEASED; urgency=low
     - distutils build plugin: use default interpreter symlink in install step
       (if interpreter version matches the default one) - this will force
       distutils to not hardcode interpreter version in shebangs
+    - fix problem with relative paths when dh's --sourcedirectory is used
   * Disable two tests in test201 dir if /usr/bin/python2.6 is not available
 
   [ Dmitry Shachnev ]
diff --git a/dh/pybuild.pm b/dh/pybuild.pm
index 1f9c3b9..277e0a1 100644
--- a/dh/pybuild.pm
+++ b/dh/pybuild.pm
@@ -9,8 +9,7 @@
 package Debian::Debhelper::Buildsystem::pybuild;
 
 use strict;
-use Cwd ();
-use Debian::Debhelper::Dh_Lib qw(error);
+use Debian::Debhelper::Dh_Lib qw(error doit);
 use base 'Debian::Debhelper::Buildsystem';
 
 sub DESCRIPTION {
@@ -19,7 +18,7 @@ sub DESCRIPTION {
 
 sub check_auto_buildable {
 	my $this=shift;
-	return $this->doit_in_sourcedir('pybuild', '--detect', '--really-quiet');
+	return doit('pybuild', '--detect', '--really-quiet', '--dir', $this->get_sourcedir());
 }
 
 sub new {
@@ -46,14 +45,14 @@ sub new {
 sub configure {
 	my $this=shift;
 	foreach my $command ($this->pybuild_commands('configure', @_)) {
-		$this->doit_in_sourcedir(@$command);
+		doit(@$command, '--dir', $this->get_sourcedir());
 	}
 }
 
 sub build {
 	my $this=shift;
 	foreach my $command ($this->pybuild_commands('build', @_)) {
-		$this->doit_in_sourcedir(@$command);
+		doit(@$command, '--dir', $this->get_sourcedir());
 	}
 }
 
@@ -61,24 +60,24 @@ sub install {
 	my $this=shift;
 	my $destdir=shift;
 	foreach my $command ($this->pybuild_commands('install', @_)) {
-		$this->doit_in_sourcedir(@$command, '--dest-dir', $destdir);
+		doit(@$command, '--dir', $this->get_sourcedir(), '--dest-dir', $destdir);
 	}
 }
 
 sub test {
 	my $this=shift;
 	foreach my $command ($this->pybuild_commands('test', @_)) {
-		$this->doit_in_sourcedir(@$command);
+		doit(@$command, '--dir', $this->get_sourcedir());
 	}
 }
 
 sub clean {
 	my $this=shift;
 	foreach my $command ($this->pybuild_commands('clean', @_)) {
-		$this->doit_in_sourcedir(@$command);
+		doit(@$command, '--dir', $this->get_sourcedir());
 	}
-	$this->doit_in_sourcedir('rm', '-rf', '.pybuild/');
-	$this->doit_in_sourcedir('find', '.', '-name', '*.pyc', '-exec', 'rm', '{}', ';');
+	doit('rm', '-rf', '.pybuild/');
+	doit('find', '.', '-name', '*.pyc', '-exec', 'rm', '{}', ';');
 }
 
 sub pybuild_commands {
diff --git a/pybuild b/pybuild
index e11982a..837b51e 100755
--- a/pybuild
+++ b/pybuild
@@ -24,7 +24,7 @@ import logging
 import argparse
 import sys
 from os import environ, getcwd, makedirs
-from os.path import exists, join
+from os.path import abspath, exists, join
 
 logging.basicConfig(format='%(levelname).1s: pybuild '
                            '%(module)s:%(lineno)d: %(message)s')
@@ -121,26 +121,24 @@ def main(cfg):
 
     def get_args(context, step, version, interpreter):
         i = interpreter.format(version=version)
-        home_dir = '.pybuild/{}_{}'.format(interpreter.format(version='X.Y'), version)
+        home_dir = abspath('.pybuild/{}_{}'.format(interpreter.format(version='X.Y'), version))
         build_dir = get_option('build_dir', interpreter, version,
                                default=join(home_dir, 'build'))
         args = dict(context['args'])
         args.update({
             'interpreter': Interpreter(i),
+            'version': version,
             'args': get_option("%s_args" % step, interpreter, version, ''),
-            'dir': context['dir'].format(version=version, interpreter=i),
-            'destdir': (join(context['dir'], context['destdir'])).format(
-                version=version, interpreter=i),
-            'home_dir': (join(context['dir'], home_dir)).format(
-                version=version, interpreter=i),
-            'build_dir': (join(context['dir'], build_dir)).format(
-                version=version, interpreter=i),
+            'dir': abspath(context['dir'].format(version=version, interpreter=i)),
+            'destdir': abspath(context['destdir'].format(
+                version=version, interpreter=i)),
+            'build_dir': abspath(build_dir.format(version=version, interpreter=i)),
             # versioned dist-packages even for Python 3.X - dh_python3 will fix it later
             # (and will have a chance to compare files)
             'install_dir': get_option('install_dir', interpreter, version,
                                       '/usr/lib/python{version}/dist-packages'
                                       ).format(version=version, interpreter=i),
-            'version': version})
+            'home_dir': home_dir})
         if interpreter == 'pypy':
             args['install_dir'] = '/usr/lib/pypy/dist-packages/'
         if step == 'test':

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



More information about the Reproducible-builds mailing list