ubuntutools.archive: Handle source package in workdir correctly.

Add regression tests. (LP: #706403)
This commit is contained in:
Stefano Rivera 2011-01-22 23:19:31 +02:00
parent b5ede6ab85
commit 4faba7c569
3 changed files with 34 additions and 1 deletions

7
debian/changelog vendored
View File

@ -1,3 +1,10 @@
ubuntu-dev-tools (0.114) UNRELEASED; urgency=low
* ubuntutools.archive: Handle source package in workdir correctly.
Add regression tests. (LP: #706403)
-- Stefano Rivera <stefanor@ubuntu.com> Sat, 22 Jan 2011 23:18:13 +0200
ubuntu-dev-tools (0.113) unstable; urgency=low ubuntu-dev-tools (0.113) unstable; urgency=low
[ Benjamin Drung ] [ Benjamin Drung ]

View File

@ -206,7 +206,10 @@ class SourcePackage(object):
source_is_workdir = (os.path.realpath(os.path.dirname(parsed.path)) source_is_workdir = (os.path.realpath(os.path.dirname(parsed.path))
== os.path.realpath(self.workdir)) == os.path.realpath(self.workdir))
if not (parsed.scheme == 'file' and source_is_workdir): if parsed.scheme == 'file' and source_is_workdir:
# Temporarily rename to the filename we are going to open
os.rename(parsed.path, self.dsc_pathname)
else:
if not self._download_file(self._dsc_source, self.dsc_name): if not self._download_file(self._dsc_source, self.dsc_name):
raise DownloadError('dsc not found') raise DownloadError('dsc not found')
else: else:

View File

@ -136,6 +136,29 @@ class LocalSourcePackageTestCase(mox.MoxTestBase, unittest.TestCase):
pkg.pull() pkg.pull()
pkg.unpack() pkg.unpack()
def test_workdir_srcpkg_noinfo(self):
shutil.copy2('test-data/example_1.0-1.dsc', self.workdir)
shutil.copy2('test-data/example_1.0.orig.tar.gz', self.workdir)
shutil.copy2('test-data/example_1.0-1.debian.tar.gz', self.workdir)
self.mox.ReplayAll()
pkg = self.SourcePackage(dscfile=os.path.join(self.workdir,
'example_1.0-1.dsc'),
workdir=self.workdir)
pkg.pull()
pkg.unpack()
def test_workdir_srcpkg_info(self):
shutil.copy2('test-data/example_1.0-1.dsc', self.workdir)
shutil.copy2('test-data/example_1.0.orig.tar.gz', self.workdir)
shutil.copy2('test-data/example_1.0-1.debian.tar.gz', self.workdir)
self.mox.ReplayAll()
pkg = self.SourcePackage('example', '1.0-1', 'main',
dscfile=os.path.join(self.workdir,
'example_1.0-1.dsc'),
workdir=self.workdir)
pkg.pull()
pkg.unpack()
def test_verification(self): def test_verification(self):
shutil.copy2('test-data/example_1.0-1.dsc', self.workdir) shutil.copy2('test-data/example_1.0-1.dsc', self.workdir)
shutil.copy2('test-data/example_1.0.orig.tar.gz', self.workdir) shutil.copy2('test-data/example_1.0.orig.tar.gz', self.workdir)