[Pkg-bazaar-commits] r211 ./bzr-builddeb/people/jdw/dev: Look for the upstream tarball in the archives.
James Westby
jw+debian at jameswestby.net
Tue Oct 30 14:34:51 UTC 2007
------------------------------------------------------------
revno: 211
committer: James Westby <jw+debian at jameswestby.net>
branch nick: dev
timestamp: Tue 2007-10-30 14:34:51 +0000
message:
Look for the upstream tarball in the archives.
modified:
builder.py
debian/changelog
-------------- next part --------------
=== modified file 'builder.py'
--- a/builder.py 2007-10-29 18:00:52 +0000
+++ b/builder.py 2007-10-30 14:34:51 +0000
@@ -25,6 +25,10 @@
import tempfile
import os
+import apt_pkg
+
+from debian_bundle.changelog import Version
+
from bzrlib.branch import Branch
from bzrlib.errors import NoWorkingTree
from bzrlib.export import export
@@ -205,6 +209,27 @@
target_dir=self._properties.tarball_dir())
os.unlink(fetched_tarball)
+ def _get_upstream_from_archive(self):
+ apt_pkg.init()
+ sources = apt_pkg.GetPkgSrcRecords()
+ sources.Restart()
+ package = self._properties.package()
+ version = self._properties.upstream_version()
+ found = False
+ while sources.Lookup(package):
+ if version == Version(sources.Version).upstream_version:
+ tarball_dir = self._properties.tarball_dir()
+ command = 'apt-get source -y --tar-only %s=%s' % \
+ (package, sources.Version)
+ proc = subprocess.Popen(command, shell=True, cwd=tarball_dir)
+ proc.wait()
+ if proc.returncode != 0:
+ return False
+ return True
+ if not found:
+ return False
+
+
def _find_tarball(self):
"""Find the upstream tarball and return it's location.
@@ -215,6 +240,8 @@
tarball = os.path.join(tarballdir,self._tarball_name())
info("Looking for %s to use as upstream source", tarball)
if not os.path.exists(tarball):
+ if self._get_upstream_from_archive():
+ return tarball
if not self._has_watch():
raise DebianError('Could not find upstream tarball at '+tarball)
else:
=== modified file 'debian/changelog'
--- a/debian/changelog 2007-10-29 22:04:19 +0000
+++ b/debian/changelog 2007-10-30 14:34:51 +0000
@@ -2,8 +2,10 @@
* Support incremental imports of normal mode packages from source packages
for uploads done outside the VCS.
+ * Also look for upstream tarballs in the archives. Do this in preference
+ to the watch file, for the case where the upstream was repacked.
- -- James Westby <jw+debian at jameswestby.net> Mon, 29 Oct 2007 22:03:26 +0000
+ -- James Westby <jw+debian at jameswestby.net> Tue, 30 Oct 2007 14:33:50 +0000
bzr-builddeb (0.91) unstable; urgency=low
More information about the Pkg-bazaar-commits
mailing list