mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-05-09 16:01:28 +00:00
Add sponsorship support
This commit is contained in:
parent
1f2d2e8d62
commit
dc9d6b5bf3
49
syncpackage
49
syncpackage
@ -41,7 +41,7 @@ from ubuntutools.requestsync.mail import (
|
|||||||
get_debian_srcpkg as requestsync_mail_get_debian_srcpkg)
|
get_debian_srcpkg as requestsync_mail_get_debian_srcpkg)
|
||||||
from ubuntutools.requestsync.lp import get_debian_srcpkg, get_ubuntu_srcpkg
|
from ubuntutools.requestsync.lp import get_debian_srcpkg, get_ubuntu_srcpkg
|
||||||
from ubuntutools.lp import udtexceptions
|
from ubuntutools.lp import udtexceptions
|
||||||
from ubuntutools.lp.lpapicache import (Distribution, Launchpad,
|
from ubuntutools.lp.lpapicache import (Distribution, Launchpad, PersonTeam,
|
||||||
SourcePackagePublishingHistory)
|
SourcePackagePublishingHistory)
|
||||||
from ubuntutools.misc import split_release_pocket
|
from ubuntutools.misc import split_release_pocket
|
||||||
from ubuntutools.question import YesNoQuestion
|
from ubuntutools.question import YesNoQuestion
|
||||||
@ -334,7 +334,7 @@ def fetch_source_pkg(package, dist, version, component, ubuntu_release,
|
|||||||
mirrors=mirrors)
|
mirrors=mirrors)
|
||||||
|
|
||||||
|
|
||||||
def copy(src_pkg, release, bugs, simulate=False, force=False):
|
def copy(src_pkg, release, bugs, sponsoree=None, simulate=False, force=False):
|
||||||
"""Copy a source package from Debian to Ubuntu using the Launchpad API."""
|
"""Copy a source package from Debian to Ubuntu using the Launchpad API."""
|
||||||
ubuntu = Distribution('ubuntu')
|
ubuntu = Distribution('ubuntu')
|
||||||
debian_archive = Distribution('debian').getArchive()
|
debian_archive = Distribution('debian').getArchive()
|
||||||
@ -396,6 +396,9 @@ def copy(src_pkg, release, bugs, simulate=False, force=False):
|
|||||||
if simulate:
|
if simulate:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if sponsoree:
|
||||||
|
Logger.normal("Sponsoring this sync for %s (%s)",
|
||||||
|
sponsoree.display_name, sponsoree.name)
|
||||||
answer = YesNoQuestion().ask("Sync this package", "no")
|
answer = YesNoQuestion().ask("Sync this package", "no")
|
||||||
if answer != "yes":
|
if answer != "yes":
|
||||||
return
|
return
|
||||||
@ -407,7 +410,8 @@ def copy(src_pkg, release, bugs, simulate=False, force=False):
|
|||||||
from_archive=debian_archive,
|
from_archive=debian_archive,
|
||||||
to_series=ubuntu_series,
|
to_series=ubuntu_series,
|
||||||
to_pocket=ubuntu_pocket,
|
to_pocket=ubuntu_pocket,
|
||||||
include_binaries=False)
|
include_binaries=False,
|
||||||
|
sponsoree=sponsoree)
|
||||||
except HTTPError, error:
|
except HTTPError, error:
|
||||||
Logger.error("HTTP Error %s: %s", error.response.status,
|
Logger.error("HTTP Error %s: %s", error.response.status,
|
||||||
error.response.reason)
|
error.response.reason)
|
||||||
@ -511,6 +515,10 @@ def parse():
|
|||||||
dest="bugs", action="append", default=list(),
|
dest="bugs", action="append", default=list(),
|
||||||
help="Mark Launchpad bug BUG as being fixed by this "
|
help="Mark Launchpad bug BUG as being fixed by this "
|
||||||
"upload.")
|
"upload.")
|
||||||
|
parser.add_option("-s", "--sponsor", metavar="USERNAME",
|
||||||
|
dest="sponsoree", default=None,
|
||||||
|
help="Sponsor the sync for USERNAME (a launchpad "
|
||||||
|
"username).")
|
||||||
parser.add_option("-v", "--verbose",
|
parser.add_option("-v", "--verbose",
|
||||||
action="store_true", default=False,
|
action="store_true", default=False,
|
||||||
help="Display more progress information.")
|
help="Display more progress information.")
|
||||||
@ -608,10 +616,6 @@ def main():
|
|||||||
options.debian_mirror = config.get_value('DEBIAN_MIRROR')
|
options.debian_mirror = config.get_value('DEBIAN_MIRROR')
|
||||||
if options.ubuntu_mirror is None:
|
if options.ubuntu_mirror is None:
|
||||||
options.ubuntu_mirror = config.get_value('UBUNTU_MIRROR')
|
options.ubuntu_mirror = config.get_value('UBUNTU_MIRROR')
|
||||||
if options.uploader_name is None:
|
|
||||||
options.uploader_name = ubu_email(export=False)[0]
|
|
||||||
if options.uploader_email is None:
|
|
||||||
options.uploader_email = ubu_email(export=False)[1]
|
|
||||||
|
|
||||||
if options.lpinstance is None:
|
if options.lpinstance is None:
|
||||||
options.lpinstance = config.get_value('LPINSTANCE')
|
options.lpinstance = config.get_value('LPINSTANCE')
|
||||||
@ -625,6 +629,33 @@ def main():
|
|||||||
ubuntu = Launchpad.distributions["ubuntu"]
|
ubuntu = Launchpad.distributions["ubuntu"]
|
||||||
options.release = ubuntu.current_series.name
|
options.release = ubuntu.current_series.name
|
||||||
|
|
||||||
|
sponsoree = None
|
||||||
|
if options.sponsoree:
|
||||||
|
try:
|
||||||
|
sponsoree = PersonTeam(options.sponsoree)
|
||||||
|
except KeyError:
|
||||||
|
Logger.error('Cannot find the username "%s" in Launchpad.',
|
||||||
|
options.sponsoree)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
if sponsoree and options.uploader_name is None:
|
||||||
|
options.uploader_name = sponsoree.display_name
|
||||||
|
elif options.uploader_name is None:
|
||||||
|
options.uploader_name = ubu_email(export=False)[0]
|
||||||
|
|
||||||
|
if sponsoree and options.uploader_email is None:
|
||||||
|
try:
|
||||||
|
options.uploader_email = sponsoree.preferred_email_address.email
|
||||||
|
except ValueError:
|
||||||
|
if options.lp:
|
||||||
|
# Not needed
|
||||||
|
pass
|
||||||
|
Logger.error("%s doesn't have a publicly visible e-mail address "
|
||||||
|
"in LP, please provide one --uploader-email option",
|
||||||
|
sponsoree.display_name)
|
||||||
|
elif options.uploader_email is None:
|
||||||
|
options.uploader_email = ubu_email(export=False)[1]
|
||||||
|
|
||||||
src_pkg = fetch_source_pkg(package, options.distribution,
|
src_pkg = fetch_source_pkg(package, options.distribution,
|
||||||
options.debian_version,
|
options.debian_version,
|
||||||
options.component,
|
options.component,
|
||||||
@ -671,8 +702,8 @@ def main():
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
if options.lp:
|
if options.lp:
|
||||||
copy(src_pkg, options.release, options.bugs, options.simulate,
|
copy(src_pkg, options.release, options.bugs, sponsoree,
|
||||||
options.force)
|
options.simulate, options.force)
|
||||||
else:
|
else:
|
||||||
os.environ['DEB_VENDOR'] = 'Ubuntu'
|
os.environ['DEB_VENDOR'] = 'Ubuntu'
|
||||||
sync_dsc(src_pkg, options.distribution, options.release,
|
sync_dsc(src_pkg, options.distribution, options.release,
|
||||||
|
@ -383,7 +383,7 @@ class Archive(BaseWrapper):
|
|||||||
return cache[index]
|
return cache[index]
|
||||||
|
|
||||||
def copyPackage(self, source_name, version, from_archive, to_pocket,
|
def copyPackage(self, source_name, version, from_archive, to_pocket,
|
||||||
to_series=None, include_binaries=False):
|
to_series=None, sponsored=None, include_binaries=False):
|
||||||
'''Copy a single named source into this archive.
|
'''Copy a single named source into this archive.
|
||||||
|
|
||||||
Asynchronously copy a specific version of a named source to the
|
Asynchronously copy a specific version of a named source to the
|
||||||
@ -398,6 +398,7 @@ class Archive(BaseWrapper):
|
|||||||
from_archive=from_archive._lpobject,
|
from_archive=from_archive._lpobject,
|
||||||
to_pocket=to_pocket,
|
to_pocket=to_pocket,
|
||||||
to_series=to_series,
|
to_series=to_series,
|
||||||
|
sponsored=sponsored,
|
||||||
include_binaries=include_binaries
|
include_binaries=include_binaries
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user