[PATCH 2/3] autodetect Perl packages
Antonio Terceiro
terceiro at debian.org
Mon Sep 8 00:06:06 UTC 2014
---
lib/testdesc.py | 28 ++++++++++++++++++++++++++++
tests/testdesc | 25 +++++++++++++++++++++++++
2 files changed, 53 insertions(+)
diff --git a/lib/testdesc.py b/lib/testdesc.py
index ffae057..02cd779 100644
--- a/lib/testdesc.py
+++ b/lib/testdesc.py
@@ -487,6 +487,7 @@ def autodetect_implicit_control(srcdir):
some_skipped = False
autodetect_ruby_package(srcdir, tests)
+ autodetect_perl_package(srcdir, tests)
return (tests, some_skipped)
@@ -505,3 +506,30 @@ def autodetect_ruby_package(srcdir, tests):
test = Test('command1', None, command, [], [], depends, [])
tests.append(test)
+
+
+def autodetect_perl_package(srcdir, tests):
+ if (os.path.exists(os.path.join(srcdir, 't')) and
+ (os.path.exists(os.path.join(srcdir, 'Makefile.PL'))) or
+ (os.path.exists(os.path.join(srcdir, 'Build.PL')))
+ ):
+
+ adtlog.info('Perl package detected')
+
+ command = '/usr/share/pkg-perl-autopkgtest/runner build-deps'
+ depends = _parse_debian_depends(command,
+ '@, @builddeps@, pkg-perl-autopkgtest',
+ srcdir)
+ tests.append(Test('build-deps', None, command, [], [], depends, []))
+
+ command = '/usr/share/pkg-perl-autopkgtest/runner runtime-deps'
+ depends = _parse_debian_depends(command,
+ '@, pkg-perl-autopkgtest',
+ srcdir)
+ tests.append(Test('runtime-deps', None, command, [], [], depends, []))
+
+ command = '/usr/share/pkg-perl-autopkgtest/runner heavy-deps'
+ depends = _parse_debian_depends(command,
+ '@, pkg-perl-autopkgtest-heavy',
+ srcdir)
+ tests.append(Test('heavy-deps', None, command, [], [], depends, []))
diff --git a/tests/testdesc b/tests/testdesc
index 85a8ed0..755dd44 100755
--- a/tests/testdesc
+++ b/tests/testdesc
@@ -420,6 +420,31 @@ class Debian(unittest.TestCase):
self.assertTrue('gem2deb-test-runner' in ts[0].depends)
self.assertTrue('ruby-foo' in ts[0].depends)
+ def test_implicit_control_for_perl_packages(self):
+ with open(os.path.join(self.pkgdir, 'Makefile.PL'), 'w') as f:
+ f.write('use ExtUtils::MakeMaker;\n')
+ os.makedirs(os.path.join(self.pkgdir, 't'))
+ with open(os.path.join(self.pkgdir, 'debian', 'control'), 'w') as f:
+ f.write('Source: libfoo-perl\n\n')
+ f.write('Package: libfoo-perl\n')
+ f.write('Architecture: all\n')
+
+ (ts, skipped) = testdesc.parse_debian_source(self.pkgdir, [], control_path='debian/tests/control')
+
+ self.assertEqual(len(ts), 3)
+
+ self.assertRegex(ts[0].command, 'pkg-perl-autopkgtest.*build-deps')
+ self.assertTrue('pkg-perl-autopkgtest' in ts[0].depends)
+ self.assertTrue('libfoo-perl' in ts[0].depends)
+
+ self.assertRegex(ts[1].command, 'pkg-perl-autopkgtest.*runtime-deps')
+ self.assertTrue('pkg-perl-autopkgtest' in ts[1].depends)
+ self.assertTrue('libfoo-perl' in ts[1].depends)
+
+ self.assertRegex(ts[2].command, 'pkg-perl-autopkgtest.*heavy-deps')
+ self.assertTrue('pkg-perl-autopkgtest-heavy' in ts[2].depends)
+ self.assertTrue('libfoo-perl' in ts[2].depends)
+
class Click(unittest.TestCase):
@classmethod
--
2.1.0
More information about the autopkgtest-devel
mailing list