mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-03-12 15:41:09 +00:00
[syncpackage] Do not use exit(1) on an error or exception unless it applies to all packages, instead return None so we can continue to the next package.
This commit is contained in:
parent
bda85fa6a8
commit
02d65a5804
5
debian/changelog
vendored
5
debian/changelog
vendored
@ -2,8 +2,9 @@ ubuntu-dev-tools (0.205) UNRELEASED; urgency=medium
|
|||||||
|
|
||||||
* [syncpackage] When syncing multiple packages, if one of the packages is in
|
* [syncpackage] When syncing multiple packages, if one of the packages is in
|
||||||
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] Do not use exit(1) on an error or exception unless it
|
||||||
exception, simply return None so we can continue to the next package.
|
applies to all packages, instead return None so we can continue to the
|
||||||
|
next package.
|
||||||
* [syncpackage] Add support for -y or --yes, noted that it should be used
|
* [syncpackage] Add support for -y or --yes, noted that it should be used
|
||||||
with care.
|
with care.
|
||||||
|
|
||||||
|
28
syncpackage
28
syncpackage
@ -143,7 +143,7 @@ def sync_dsc(
|
|||||||
if ubuntu_ver.is_modified_in_ubuntu():
|
if ubuntu_ver.is_modified_in_ubuntu():
|
||||||
if not force:
|
if not force:
|
||||||
Logger.error("--force is required to discard Ubuntu changes.")
|
Logger.error("--force is required to discard Ubuntu changes.")
|
||||||
sys.exit(1)
|
return None
|
||||||
|
|
||||||
Logger.warning(
|
Logger.warning(
|
||||||
"Overwriting modified Ubuntu version %s, setting current version to %s",
|
"Overwriting modified Ubuntu version %s, setting current version to %s",
|
||||||
@ -157,7 +157,7 @@ def sync_dsc(
|
|||||||
src_pkg.pull()
|
src_pkg.pull()
|
||||||
except DownloadError as e:
|
except DownloadError as e:
|
||||||
Logger.error("Failed to download: %s", str(e))
|
Logger.error("Failed to download: %s", str(e))
|
||||||
sys.exit(1)
|
return None
|
||||||
src_pkg.unpack()
|
src_pkg.unpack()
|
||||||
|
|
||||||
needs_fakesync = not (need_orig or ubu_pkg.verify_orig())
|
needs_fakesync = not (need_orig or ubu_pkg.verify_orig())
|
||||||
@ -166,13 +166,13 @@ def sync_dsc(
|
|||||||
Logger.warning("Performing a fakesync")
|
Logger.warning("Performing a fakesync")
|
||||||
elif not needs_fakesync and fakesync:
|
elif not needs_fakesync and fakesync:
|
||||||
Logger.error("Fakesync not required, aborting.")
|
Logger.error("Fakesync not required, aborting.")
|
||||||
sys.exit(1)
|
return None
|
||||||
elif needs_fakesync and not fakesync:
|
elif needs_fakesync and not fakesync:
|
||||||
Logger.error(
|
Logger.error(
|
||||||
"The checksums of the Debian and Ubuntu packages "
|
"The checksums of the Debian and Ubuntu packages "
|
||||||
"mismatch. A fake sync using --fakesync is required."
|
"mismatch. A fake sync using --fakesync is required."
|
||||||
)
|
)
|
||||||
sys.exit(1)
|
return None
|
||||||
|
|
||||||
if fakesync:
|
if fakesync:
|
||||||
# Download Ubuntu files (override Debian source tarballs)
|
# Download Ubuntu files (override Debian source tarballs)
|
||||||
@ -180,7 +180,7 @@ def sync_dsc(
|
|||||||
ubu_pkg.pull()
|
ubu_pkg.pull()
|
||||||
except DownloadError as e:
|
except DownloadError as e:
|
||||||
Logger.error("Failed to download: %s", str(e))
|
Logger.error("Failed to download: %s", str(e))
|
||||||
sys.exit(1)
|
return None
|
||||||
|
|
||||||
# change into package directory
|
# change into package directory
|
||||||
directory = src_pkg.source + "-" + new_ver.upstream_version
|
directory = src_pkg.source + "-" + new_ver.upstream_version
|
||||||
@ -265,7 +265,7 @@ def sync_dsc(
|
|||||||
returncode = subprocess.call(cmd)
|
returncode = subprocess.call(cmd)
|
||||||
if returncode != 0:
|
if returncode != 0:
|
||||||
Logger.error("Source-only build with debuild failed. Please check build log above.")
|
Logger.error("Source-only build with debuild failed. Please check build log above.")
|
||||||
sys.exit(1)
|
return None
|
||||||
|
|
||||||
|
|
||||||
def fetch_source_pkg(package, dist, version, component, ubuntu_release, mirror):
|
def fetch_source_pkg(package, dist, version, component, ubuntu_release, mirror):
|
||||||
@ -352,7 +352,7 @@ def copy(src_pkg, release, bugs, sponsoree=None, simulate=False, force=False, ye
|
|||||||
"Debian version %s has not been picked up by LP yet. Please try again later.",
|
"Debian version %s has not been picked up by LP yet. Please try again later.",
|
||||||
src_pkg.version,
|
src_pkg.version,
|
||||||
)
|
)
|
||||||
sys.exit(1)
|
return None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
ubuntu_spph = get_ubuntu_srcpkg(src_pkg.source, ubuntu_series, ubuntu_pocket)
|
ubuntu_spph = get_ubuntu_srcpkg(src_pkg.source, ubuntu_series, ubuntu_pocket)
|
||||||
@ -373,7 +373,7 @@ def copy(src_pkg, release, bugs, sponsoree=None, simulate=False, force=False, ye
|
|||||||
base_version = ubuntu_version.get_related_debian_version()
|
base_version = ubuntu_version.get_related_debian_version()
|
||||||
if not force and ubuntu_version.is_modified_in_ubuntu():
|
if not force and ubuntu_version.is_modified_in_ubuntu():
|
||||||
Logger.error("--force is required to discard Ubuntu changes.")
|
Logger.error("--force is required to discard Ubuntu changes.")
|
||||||
sys.exit(1)
|
return None
|
||||||
|
|
||||||
# Check whether a fakesync would be required.
|
# Check whether a fakesync would be required.
|
||||||
if not src_pkg.dsc.compare_dsc(ubuntu_pkg.dsc):
|
if not src_pkg.dsc.compare_dsc(ubuntu_pkg.dsc):
|
||||||
@ -381,7 +381,7 @@ def copy(src_pkg, release, bugs, sponsoree=None, simulate=False, force=False, ye
|
|||||||
"The checksums of the Debian and Ubuntu packages "
|
"The checksums of the Debian and Ubuntu packages "
|
||||||
"mismatch. A fake sync using --fakesync is required."
|
"mismatch. A fake sync using --fakesync is required."
|
||||||
)
|
)
|
||||||
sys.exit(1)
|
return None
|
||||||
except udtexceptions.PackageNotFoundException:
|
except udtexceptions.PackageNotFoundException:
|
||||||
base_version = Version("~")
|
base_version = Version("~")
|
||||||
Logger.info(
|
Logger.info(
|
||||||
@ -420,7 +420,7 @@ def copy(src_pkg, release, bugs, sponsoree=None, simulate=False, force=False, ye
|
|||||||
except HTTPError as error:
|
except HTTPError as error:
|
||||||
Logger.error("HTTP Error %s: %s", error.response.status, error.response.reason)
|
Logger.error("HTTP Error %s: %s", error.response.status, error.response.reason)
|
||||||
Logger.error(error.content)
|
Logger.error(error.content)
|
||||||
sys.exit(1)
|
return None
|
||||||
|
|
||||||
Logger.info("Request succeeded; you should get an e-mail once it is processed.")
|
Logger.info("Request succeeded; you should get an e-mail once it is processed.")
|
||||||
bugs = sorted(set(bugs))
|
bugs = sorted(set(bugs))
|
||||||
@ -769,10 +769,11 @@ def main():
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
if args.lp:
|
if args.lp:
|
||||||
copy(src_pkg, args.release, args.bugs, sponsoree, args.simulate, args.force, args.yes)
|
if not copy(src_pkg, args.release, args.bugs, sponsoree, args.simulate, args.force, args.yes):
|
||||||
|
continue
|
||||||
else:
|
else:
|
||||||
os.environ["DEB_VENDOR"] = "Ubuntu"
|
os.environ["DEB_VENDOR"] = "Ubuntu"
|
||||||
sync_dsc(
|
if not sync_dsc(
|
||||||
src_pkg,
|
src_pkg,
|
||||||
args.distribution,
|
args.distribution,
|
||||||
args.release,
|
args.release,
|
||||||
@ -784,7 +785,8 @@ def main():
|
|||||||
args.simulate,
|
args.simulate,
|
||||||
args.force,
|
args.force,
|
||||||
args.fakesync,
|
args.fakesync,
|
||||||
)
|
):
|
||||||
|
continue
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
Loading…
x
Reference in New Issue
Block a user