From f8d4866cbc29970ec678b66b9a054096216cb966 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Tue, 16 Aug 2011 18:07:58 +0100 Subject: [PATCH] move copyPackage into lpapicache for better encapsulation --- syncpackage | 2 +- ubuntutools/lp/lpapicache.py | 22 +++++++++++++++++++--- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/syncpackage b/syncpackage index 5fa671d..7bd272a 100755 --- a/syncpackage +++ b/syncpackage @@ -340,7 +340,7 @@ def copy(src_pkg, debian_version, release, simulate=False): ubuntu_archive.copyPackage( source_name=src_pkg, version=debian_version, - from_archive=debian_archive.lp_object(), + from_archive=debian_archive, to_series=ubuntu_series, to_pocket=ubuntu_pocket, include_binaries=False) diff --git a/ubuntutools/lp/lpapicache.py b/ubuntutools/lp/lpapicache.py index ea7f17d..b7339ca 100644 --- a/ubuntutools/lp/lpapicache.py +++ b/ubuntutools/lp/lpapicache.py @@ -172,9 +172,6 @@ class BaseWrapper(object): else: return '<%s: %r>' % (self.__class__.__name__, self._lpobject) - def lp_object(self): - return self._lpobject - class Distribution(BaseWrapper): ''' @@ -335,6 +332,25 @@ class Archive(BaseWrapper): return self._srcpkgs[(name, series.name, pocket)] + def copyPackage(self, source_name, version, from_archive, to_pocket, + to_series = None, include_binaries = False): + '''Copy a single named source into this archive. + + Asynchronously copy a specific version of a named source to the + destination archive if necessary. Calls to this method will return + immediately if the copy passes basic security checks and the copy + will happen sometime later with full checking. + ''' + + self._lpobject.copyPackage( + source_name=source_name, + version=version, + from_archive=from_archive._lpobject, + to_pocket=to_pocket, + to_series=to_series, + include_binaries=include_binaries + ) + class SourcePackagePublishingHistory(BaseWrapper): '''