Source code for libka.update_vcs_fields
#!/usr/bin/python3
# kate: space-indent on; indent-width 4; replace-tabs on; indent-mode python; remove-trailing-space modified;
# vim: expandtab ts=4
############################################################################
# Copyright © 2016 José Manuel Santamaría Lema <panfaust@gmail.com> #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
############################################################################
#FIXME: this file is obsolete and must be removed at some point but it's still used by ka-debian2kubuntu-merge
#Handle Crtl+C
import signal
from libka.ka_print import *
[docs]
def signal_handler(signal, frame):
ka_print_plain('Aborted by user request')
sys.exit(130) #http://www.tldp.org/LDP/abs/html/exitcodes.html
signal.signal(signal.SIGINT, signal_handler)
import warnings
from libka.control_edit import *
from libka.package_info import *
[docs]
def update_vcs_fields():
#Sanitize the control file
sanitize_control_file('./debian/control')
#Open the control file
src_pkg, bin_pkg_list, bin_pkg_map = parse_control('./debian/control');
warnings.simplefilter('ignore', UserWarning) #Ignore the warnings from python-debian
warnings.simplefilter('ignore', FutureWarning) #Ignore the warnings from python-debian
#Set the Vcs fields
upstream_name = upstreamNameFromWatch()
src_pkg['Vcs-Browser'] = "https://code.launchpad.net/~kubuntu-packagers/kubuntu-packaging/+git/" + upstream_name
src_pkg['Vcs-Git'] = "https://git.launchpad.net/~kubuntu-packagers/kubuntu-packaging/+git/" + upstream_name
warnings.simplefilter('default', FutureWarning) #Reset the future warnings
warnings.simplefilter('default', UserWarning) #Reset the user warnings
#Dump the contents of the control file
dump_control('./debian/control',src_pkg, bin_pkg_list, bin_pkg_map)
if __name__ == "__main__":
#Update the fields
update_vcs_fields()
#Print the git diff
print("=== update-vcs-fields diff start")
subprocess.check_call(["git", "--no-pager", "diff"])
print("=== update-vcs-fields diff end")