mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-05-10 16:31:28 +00:00
[syncpackage] Add support for -y or --yes, noted that it should be used with care.
This commit is contained in:
parent
86a83bf74d
commit
bda85fa6a8
2
debian/changelog
vendored
2
debian/changelog
vendored
@ -4,6 +4,8 @@ ubuntu-dev-tools (0.205) UNRELEASED; urgency=medium
|
|||||||
the sync blocklist, do not exit, simply continue.
|
the sync blocklist, do not exit, simply continue.
|
||||||
* [syncpackage] Within fetch_source_pkg, do not exit(1) on an error or
|
* [syncpackage] Within fetch_source_pkg, do not exit(1) on an error or
|
||||||
exception, simply return None so we can continue to the next package.
|
exception, simply return None so we can continue to the next package.
|
||||||
|
* [syncpackage] Add support for -y or --yes, noted that it should be used
|
||||||
|
with care.
|
||||||
|
|
||||||
-- Simon Quigley <tsimonq2@debian.org> Sat, 01 Mar 2025 11:10:56 -0600
|
-- Simon Quigley <tsimonq2@debian.org> Sat, 01 Mar 2025 11:10:56 -0600
|
||||||
|
|
||||||
|
24
syncpackage
24
syncpackage
@ -329,7 +329,7 @@ def fetch_source_pkg(package, dist, version, component, ubuntu_release, mirror):
|
|||||||
return DebianSourcePackage(package, version.full_version, component, mirrors=mirrors)
|
return DebianSourcePackage(package, version.full_version, component, mirrors=mirrors)
|
||||||
|
|
||||||
|
|
||||||
def copy(src_pkg, release, bugs, sponsoree=None, simulate=False, force=False):
|
def copy(src_pkg, release, bugs, sponsoree=None, simulate=False, force=False, yes=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()
|
||||||
@ -402,9 +402,10 @@ def copy(src_pkg, release, bugs, sponsoree=None, simulate=False, force=False):
|
|||||||
|
|
||||||
if sponsoree:
|
if sponsoree:
|
||||||
Logger.info("Sponsoring this sync for %s (%s)", sponsoree.display_name, sponsoree.name)
|
Logger.info("Sponsoring this sync for %s (%s)", sponsoree.display_name, sponsoree.name)
|
||||||
answer = YesNoQuestion().ask("Sync this package", "no")
|
if not yes:
|
||||||
if answer != "yes":
|
answer = YesNoQuestion().ask("Sync this package", "no")
|
||||||
return
|
if answer != "yes":
|
||||||
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
ubuntu_archive.copyPackage(
|
ubuntu_archive.copyPackage(
|
||||||
@ -426,9 +427,12 @@ def copy(src_pkg, release, bugs, sponsoree=None, simulate=False, force=False):
|
|||||||
if bugs:
|
if bugs:
|
||||||
Logger.info("Launchpad bugs to be closed: %s", ", ".join(str(bug) for bug in bugs))
|
Logger.info("Launchpad bugs to be closed: %s", ", ".join(str(bug) for bug in bugs))
|
||||||
Logger.info("Please wait for the sync to be successful before closing bugs.")
|
Logger.info("Please wait for the sync to be successful before closing bugs.")
|
||||||
answer = YesNoQuestion().ask("Close bugs", "yes")
|
if yes:
|
||||||
if answer == "yes":
|
|
||||||
close_bugs(bugs, src_pkg.source, src_pkg.version.full_version, changes, sponsoree)
|
close_bugs(bugs, src_pkg.source, src_pkg.version.full_version, changes, sponsoree)
|
||||||
|
else:
|
||||||
|
answer = YesNoQuestion().ask("Close bugs", "yes")
|
||||||
|
if answer == "yes":
|
||||||
|
close_bugs(bugs, src_pkg.source, src_pkg.version.full_version, changes, sponsoree)
|
||||||
|
|
||||||
|
|
||||||
def is_blacklisted(query):
|
def is_blacklisted(query):
|
||||||
@ -508,6 +512,12 @@ def parse():
|
|||||||
epilog = f"See {os.path.basename(sys.argv[0])}(1) for more info."
|
epilog = f"See {os.path.basename(sys.argv[0])}(1) for more info."
|
||||||
parser = argparse.ArgumentParser(usage=usage, epilog=epilog)
|
parser = argparse.ArgumentParser(usage=usage, epilog=epilog)
|
||||||
|
|
||||||
|
parser.add_argument(
|
||||||
|
"-y",
|
||||||
|
"--yes",
|
||||||
|
action="store_true",
|
||||||
|
help="Automatically sync without prompting. Use with caution and care."
|
||||||
|
)
|
||||||
parser.add_argument("-d", "--distribution", help="Debian distribution to sync from.")
|
parser.add_argument("-d", "--distribution", help="Debian distribution to sync from.")
|
||||||
parser.add_argument("-r", "--release", help="Specify target Ubuntu release.")
|
parser.add_argument("-r", "--release", help="Specify target Ubuntu release.")
|
||||||
parser.add_argument("-V", "--debian-version", help="Specify the version to sync from.")
|
parser.add_argument("-V", "--debian-version", help="Specify the version to sync from.")
|
||||||
@ -759,7 +769,7 @@ def main():
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
if args.lp:
|
if args.lp:
|
||||||
copy(src_pkg, args.release, args.bugs, sponsoree, args.simulate, args.force)
|
copy(src_pkg, args.release, args.bugs, sponsoree, args.simulate, args.force, args.yes)
|
||||||
else:
|
else:
|
||||||
os.environ["DEB_VENDOR"] = "Ubuntu"
|
os.environ["DEB_VENDOR"] = "Ubuntu"
|
||||||
sync_dsc(
|
sync_dsc(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user