mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-03-12 23:51:08 +00:00
syncpackage: Require -f/--force option to overwrite Ubuntu changes.
This commit is contained in:
parent
87e1cadcb0
commit
0ef30ff665
1
debian/changelog
vendored
1
debian/changelog
vendored
@ -2,6 +2,7 @@ ubuntu-dev-tools (0.129) UNRELEASED; urgency=low
|
|||||||
|
|
||||||
* syncpackage: Convert to new LP API, with --no-lp available for the old
|
* syncpackage: Convert to new LP API, with --no-lp available for the old
|
||||||
style of operation.
|
style of operation.
|
||||||
|
* syncpackage: Require -f/--force option to overwrite Ubuntu changes.
|
||||||
|
|
||||||
-- Colin Watson <cjwatson@ubuntu.com> Tue, 16 Aug 2011 16:40:22 +0100
|
-- Colin Watson <cjwatson@ubuntu.com> Tue, 16 Aug 2011 16:40:22 +0100
|
||||||
|
|
||||||
|
@ -67,6 +67,9 @@ Do not sign the upload.
|
|||||||
\fB\-b\fI BUG\fR, \fB\-\-bug\fR=\fIBUG\fR
|
\fB\-b\fI BUG\fR, \fB\-\-bug\fR=\fIBUG\fR
|
||||||
Mark a Launchpad bug as being fixed by this upload.
|
Mark a Launchpad bug as being fixed by this upload.
|
||||||
.TP
|
.TP
|
||||||
|
\fB\-f\fR, \fB\-\-force\fR
|
||||||
|
Force sync over the top of Ubuntu changes.
|
||||||
|
.TP
|
||||||
.B \-d \fIDEBIAN_MIRROR\fR, \fB\-\-debian\-mirror\fR=\fIDEBIAN_MIRROR\fR
|
.B \-d \fIDEBIAN_MIRROR\fR, \fB\-\-debian\-mirror\fR=\fIDEBIAN_MIRROR\fR
|
||||||
Use the specified mirror.
|
Use the specified mirror.
|
||||||
Should be in the form \fBhttp://ftp.debian.org/debian\fR.
|
Should be in the form \fBhttp://ftp.debian.org/debian\fR.
|
||||||
|
30
syncpackage
30
syncpackage
@ -116,7 +116,7 @@ def add_fixed_bugs(changes, bugs):
|
|||||||
return "\n".join(changes + [""])
|
return "\n".join(changes + [""])
|
||||||
|
|
||||||
def sync_dsc(src_pkg, debian_dist, release, name, email, bugs, ubuntu_mirror,
|
def sync_dsc(src_pkg, debian_dist, release, name, email, bugs, ubuntu_mirror,
|
||||||
keyid=None, simulate=False):
|
keyid=None, simulate=False, force=False):
|
||||||
uploader = name + " <" + email + ">"
|
uploader = name + " <" + email + ">"
|
||||||
|
|
||||||
src_pkg.pull_dsc()
|
src_pkg.pull_dsc()
|
||||||
@ -142,6 +142,10 @@ def sync_dsc(src_pkg, debian_dist, release, name, email, bugs, ubuntu_mirror,
|
|||||||
|
|
||||||
cur_ver = ubuntu_ver.get_related_debian_version()
|
cur_ver = ubuntu_ver.get_related_debian_version()
|
||||||
if ubuntu_ver.is_modified_in_ubuntu():
|
if ubuntu_ver.is_modified_in_ubuntu():
|
||||||
|
if not force:
|
||||||
|
Logger.error('--force is required to discard Ubuntu changes.')
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
Logger.warn('Overwriting modified Ubuntu version %s, '
|
Logger.warn('Overwriting modified Ubuntu version %s, '
|
||||||
'setting current version to %s',
|
'setting current version to %s',
|
||||||
ubuntu_ver.full_version, cur_ver.full_version)
|
ubuntu_ver.full_version, cur_ver.full_version)
|
||||||
@ -300,7 +304,8 @@ def fetch_source_pkg(package, dist, version, component, ubuntu_release, mirror):
|
|||||||
return DebianSourcePackage(package, version.full_version, component,
|
return DebianSourcePackage(package, version.full_version, component,
|
||||||
mirrors=[mirror])
|
mirrors=[mirror])
|
||||||
|
|
||||||
def copy(src_pkg, debian_dist, debian_version, release, simulate=False):
|
def copy(src_pkg, debian_dist, debian_version, release, simulate=False,
|
||||||
|
force=False):
|
||||||
debian = Distribution('debian')
|
debian = Distribution('debian')
|
||||||
ubuntu = Distribution('ubuntu')
|
ubuntu = Distribution('ubuntu')
|
||||||
debian_archive = debian.getArchive()
|
debian_archive = debian.getArchive()
|
||||||
@ -322,21 +327,25 @@ def copy(src_pkg, debian_dist, debian_version, release, simulate=False):
|
|||||||
ubuntu_version = ubuntu_archive.getSourcePackage(
|
ubuntu_version = ubuntu_archive.getSourcePackage(
|
||||||
src_pkg, ubuntu_series, ubuntu_pocket).getVersion()
|
src_pkg, ubuntu_series, ubuntu_pocket).getVersion()
|
||||||
|
|
||||||
|
debian_version = Version(debian_version)
|
||||||
|
ubuntu_version = Version(ubuntu_version)
|
||||||
|
|
||||||
Logger.normal('Source %s -> %s/%s: current version %s, new version %s',
|
Logger.normal('Source %s -> %s/%s: current version %s, new version %s',
|
||||||
src_pkg, ubuntu_series, ubuntu_pocket,
|
src_pkg, ubuntu_series, ubuntu_pocket,
|
||||||
ubuntu_version, debian_version)
|
ubuntu_version, debian_version)
|
||||||
if Version(debian_version) <= Version(ubuntu_version):
|
if debian_version <= ubuntu_version:
|
||||||
Logger.error('Debian version is <= Ubuntu version; nothing to do!')
|
Logger.error('Debian version is <= Ubuntu version; nothing to do!')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
if not force and ubuntu_version.is_modified_in_ubuntu():
|
||||||
|
Logger.error('--force is required to discard Ubuntu changes.')
|
||||||
|
sys.exit(1)
|
||||||
except udtexceptions.PackageNotFoundException:
|
except udtexceptions.PackageNotFoundException:
|
||||||
Logger.normal('Source %s -> %s/%s: not in Ubuntu, new version %s',
|
Logger.normal('Source %s -> %s/%s: not in Ubuntu, new version %s',
|
||||||
src_pkg, ubuntu_series, ubuntu_pocket, debian_version)
|
src_pkg, ubuntu_series, ubuntu_pocket, debian_version)
|
||||||
if simulate:
|
if simulate:
|
||||||
return
|
return
|
||||||
|
|
||||||
if 'ubuntu' in ubuntu_version:
|
|
||||||
print "Ubuntu version had Ubuntu-specific modifications; check them " \
|
|
||||||
"carefully!"
|
|
||||||
answer = YesNoQuestion().ask("Sync this package", "no")
|
answer = YesNoQuestion().ask("Sync this package", "no")
|
||||||
if answer != "yes":
|
if answer != "yes":
|
||||||
return
|
return
|
||||||
@ -344,7 +353,7 @@ def copy(src_pkg, debian_dist, debian_version, release, simulate=False):
|
|||||||
try:
|
try:
|
||||||
ubuntu_archive.copyPackage(
|
ubuntu_archive.copyPackage(
|
||||||
source_name=src_pkg,
|
source_name=src_pkg,
|
||||||
version=debian_version,
|
version=str(debian_version),
|
||||||
from_archive=debian_archive,
|
from_archive=debian_archive,
|
||||||
to_series=ubuntu_series,
|
to_series=ubuntu_series,
|
||||||
to_pocket=ubuntu_pocket,
|
to_pocket=ubuntu_pocket,
|
||||||
@ -405,6 +414,9 @@ def main():
|
|||||||
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("-f", "--force",
|
||||||
|
dest="force", action="store_true", default=False,
|
||||||
|
help="Force sync over the top of Ubuntu changes.")
|
||||||
parser.add_option('-D', '--debian-mirror', metavar='DEBIAN_MIRROR',
|
parser.add_option('-D', '--debian-mirror', metavar='DEBIAN_MIRROR',
|
||||||
dest='debian_mirror',
|
dest='debian_mirror',
|
||||||
help='Preferred Debian mirror '
|
help='Preferred Debian mirror '
|
||||||
@ -473,7 +485,7 @@ def main():
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
copy(args[0], options.dist, options.debversion, options.release,
|
copy(args[0], options.dist, options.debversion, options.release,
|
||||||
options.simulate)
|
options.simulate, options.force)
|
||||||
else:
|
else:
|
||||||
Launchpad.login_anonymously()
|
Launchpad.login_anonymously()
|
||||||
if options.release is None:
|
if options.release is None:
|
||||||
@ -488,7 +500,7 @@ def main():
|
|||||||
|
|
||||||
sync_dsc(src_pkg, options.dist, options.release, options.uploader_name,
|
sync_dsc(src_pkg, options.dist, options.release, options.uploader_name,
|
||||||
options.uploader_email, options.bugs, options.ubuntu_mirror,
|
options.uploader_email, options.bugs, options.ubuntu_mirror,
|
||||||
options.keyid, options.simulate)
|
options.keyid, options.simulate, options.force)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user