diff --git a/.gitignore b/.gitignore index 299cb45..4c8118e 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ /osc-0.163.0.tar.gz /osc-0.164.2.tar.gz /osc-0.165.1.tar.gz +/osc-0.166.2.tar.gz diff --git a/0001-fix-outupt-of-status-on-attribute-deletion.patch b/0001-fix-outupt-of-status-on-attribute-deletion.patch deleted file mode 100644 index 54e2d0a..0000000 --- a/0001-fix-outupt-of-status-on-attribute-deletion.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 260d5f585a78358706662b3acaafa66b1921f2c2 Mon Sep 17 00:00:00 2001 -From: lethliel -Date: Wed, 22 May 2019 12:57:02 +0200 -Subject: [PATCH 1/9] fix outupt of status on attribute deletion - -On osc meta attribute --attribue --delete the returned -data is encoded. Therefore the sys.stdout.write(data) call fails. - -Solution: Decode data - ---> sys.stdout.write(decode_it(data)) ---- - osc/commandline.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/osc/commandline.py b/osc/commandline.py -index 05faaac..8c22002 100644 ---- a/osc/commandline.py -+++ b/osc/commandline.py -@@ -1102,7 +1102,7 @@ class Osc(cmdln.Cmdln): - attributepath.append(opts.attribute) - u = makeurl(apiurl, attributepath) - for data in streamfile(u, http_DELETE): -- sys.stdout.write(data) -+ sys.stdout.write(decode_it(data)) - else: - raise oscerr.WrongOptions('The --delete switch is only for pattern metadata or attributes.') - --- -2.21.0 - diff --git a/0003-fix-offline-build-mode.patch b/0003-fix-offline-build-mode.patch deleted file mode 100644 index fd875f1..0000000 --- a/0003-fix-offline-build-mode.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 178dfd16c316e8483a61100464d369bee33fbd02 Mon Sep 17 00:00:00 2001 -From: lethliel -Date: Tue, 21 May 2019 14:28:55 +0200 -Subject: [PATCH 3/9] fix offline build mode - -The offline mode does not really work offline since -parse_repoarchdescr() uses get_buildconfig to store the -buildconfig in a temporary file. - -Solution: - -Use the same logic as in build.py. If in offline mode(noinit = True) -try to use the local _buildconfig file. If not in offline mode just -download the buildconfig from the server via get_buildconfig ---- - osc/commandline.py | 28 +++++++++++++++++++--------- - 1 file changed, 19 insertions(+), 9 deletions(-) - -diff --git a/osc/commandline.py b/osc/commandline.py -index 05faaac..98a8f10 100644 ---- a/osc/commandline.py -+++ b/osc/commandline.py -@@ -6092,16 +6092,26 @@ Please submit there instead, or use --nodevelproject to force direct submission. - raise oscerr.WrongArgs("Repository is missing. Cannot guess build description without repository") - apiurl = self.get_api_url() - project = store_read_project('.') -- bc = get_buildconfig(apiurl, project, arg_repository) -- with tempfile.NamedTemporaryFile() as f: -- f.write(bc) -- f.flush() -- # some distros like Debian rename and move build to obs-build -- if not os.path.isfile('/usr/lib/build/queryconfig') and os.path.isfile('/usr/lib/obs-build/queryconfig'): -- queryconfig = '/usr/lib/obs-build/queryconfig' -+ # some distros like Debian rename and move build to obs-build -+ if not os.path.isfile('/usr/lib/build/queryconfig') and os.path.isfile('/usr/lib/obs-build/queryconfig'): -+ queryconfig = '/usr/lib/obs-build/queryconfig' -+ else: -+ queryconfig = '/usr/lib/build/queryconfig' -+ if noinit: -+ bc_filename = '_buildconfig-%s-%s' % (arg_repository, arg_arch) -+ if is_package_dir('.'): -+ bc_filename = os.path.join(os.getcwd(), osc.core.store, bc_filename) - else: -- queryconfig = '/usr/lib/build/queryconfig' -- recipe = return_external(queryconfig, '--dist', f.name, 'type') -+ bc_filename = os.path.abspath(bc_filename) -+ if not os.path.isfile(bc_filename): -+ raise oscerr.WrongOptions('--offline is not possible, no local buildconfig file') -+ recipe = return_external(queryconfig, '--dist', bc_filename, 'type') -+ else: -+ bc = get_buildconfig(apiurl, project, arg_repository) -+ with tempfile.NamedTemporaryFile() as f: -+ f.write(bc) -+ f.flush() -+ recipe = return_external(queryconfig, '--dist', f.name, 'type') - recipe = recipe.strip() - if recipe == 'arch': - recipe = 'PKGBUILD' --- -2.21.0 - diff --git a/0004-osc-token-decode-data-from-trigger-url.patch b/0004-osc-token-decode-data-from-trigger-url.patch deleted file mode 100644 index b4a43d3..0000000 --- a/0004-osc-token-decode-data-from-trigger-url.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 7ed9ff32ad0a7eb1708549a1178269f01320d5af Mon Sep 17 00:00:00 2001 -From: Andreas Schwab -Date: Thu, 23 May 2019 09:49:21 +0200 -Subject: [PATCH 4/9] osc token: decode data from trigger url - ---- - osc/commandline.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/osc/commandline.py b/osc/commandline.py -index 8c22002..1666552 100644 ---- a/osc/commandline.py -+++ b/osc/commandline.py -@@ -775,7 +775,7 @@ class Osc(cmdln.Cmdln): - req.add_header('Content-Type', 'application/octet-stream') - req.add_header('Authorization', "Token "+opts.trigger) - fd = urlopen(req, data=None) -- print(fd.read()) -+ print(decode_it(fd.read())) - else: - if args and args[0] in ['create', 'delete', 'trigger']: - raise oscerr.WrongArgs("Did you mean --" + args[0] + "?") --- -2.21.0 - diff --git a/0005-Add-prioritize-as-preferred-alias-for-priorize-comma.patch b/0005-Add-prioritize-as-preferred-alias-for-priorize-comma.patch deleted file mode 100644 index 189e01b..0000000 --- a/0005-Add-prioritize-as-preferred-alias-for-priorize-comma.patch +++ /dev/null @@ -1,78 +0,0 @@ -From b14c9cfd92b19ef8ff3b94dc71b37be34d1af4c1 Mon Sep 17 00:00:00 2001 -From: Stefan Knorr -Date: Fri, 24 May 2019 13:22:30 +0200 -Subject: [PATCH 5/9] Add "prioritize" as (preferred) alias for "priorize" - command - -"priorize" is not an English word, "prioritize" is the correct -version: -* https://www.merriam-webster.com/dictionary/priorize -* https://www.merriam-webster.com/dictionary/prioritize - -The "priorize" command will continue to exist after this commit, but the -documented version will be "prioritize". ---- - osc/commandline.py | 12 ++++++------ - 1 file changed, 6 insertions(+), 6 deletions(-) - -diff --git a/osc/commandline.py b/osc/commandline.py -index 8c22002..888be1d 100644 ---- a/osc/commandline.py -+++ b/osc/commandline.py -@@ -2148,7 +2148,7 @@ Please submit there instead, or use --nodevelproject to force direct submission. - - "checkout" will checkout the request's source package ("submit" requests only). - -- "priorize" change the prioritity of a request to either "critical", "important", "moderate" or "low" -+ "prioritize" change the priority of a request to either "critical", "important", "moderate" or "low" - - - The 'review' command has the following sub commands: -@@ -2177,7 +2177,7 @@ Please submit there instead, or use --nodevelproject to force direct submission. - osc request setincident [-m TEXT] ID INCIDENT - osc request supersede [-m TEXT] ID SUPERSEDING_ID - osc request approvenew [-m TEXT] PROJECT -- osc request priorize [-m TEXT] ID PRIORITY -+ osc request prioritize [-m TEXT] ID PRIORITY - - osc request checkout/co ID - osc request clone [-m TEXT] ID -@@ -2218,7 +2218,7 @@ Please submit there instead, or use --nodevelproject to force direct submission. - return self.do_help(['help', 'request']) - - cmds = ['list', 'ls', 'log', 'show', 'decline', 'reopen', 'clone', 'accept', 'approve', 'cancelapproval', -- 'approvenew', 'wipe', 'setincident', 'supersede', 'revoke', 'checkout', 'co', 'priorize'] -+ 'approvenew', 'wipe', 'setincident', 'supersede', 'revoke', 'checkout', 'co', 'priorize', 'prioritize'] - if subcmd != 'review' and args[0] not in cmds: - raise oscerr.WrongArgs('Unknown request action %s. Choose one of %s.' \ - % (args[0], ', '.join(cmds))) -@@ -2236,7 +2236,7 @@ Please submit there instead, or use --nodevelproject to force direct submission. - - if cmd in ['list']: - min_args, max_args = 0, 2 -- elif cmd in ['supersede', 'setincident', 'priorize']: -+ elif cmd in ['supersede', 'setincident', 'prioritize', 'priorize']: - min_args, max_args = 2, 2 - else: - min_args, max_args = 1, 1 -@@ -2275,7 +2275,7 @@ Please submit there instead, or use --nodevelproject to force direct submission. - elif cmd == 'setincident': - reqid = args[0] - incident = args[1] -- elif cmd == 'priorize': -+ elif cmd in ['prioritize', 'priorize']: - reqid = args[0] - priority = args[1] - elif cmd in ['log', 'add', 'show', 'decline', 'reopen', 'clone', 'accept', 'wipe', 'revoke', 'checkout', -@@ -2302,7 +2302,7 @@ Please submit there instead, or use --nodevelproject to force direct submission. - print(ET.parse(r).getroot().get('code')) - - # change priority -- elif cmd == 'priorize': -+ elif cmd in ['prioritize', 'priorize']: - query = { 'cmd': 'setpriority', 'priority': priority } - url = makeurl(apiurl, ['request', reqid], query) - r = http_POST(url, data=opts.message) --- -2.21.0 - diff --git a/0006-Fix-encode-method-call.patch b/0006-Fix-encode-method-call.patch deleted file mode 100644 index afc4132..0000000 --- a/0006-Fix-encode-method-call.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 13a174bdccec93b68f8a6fc6cae4a16fbda4712a Mon Sep 17 00:00:00 2001 -From: "Bernhard M. Wiedemann" -Date: Sat, 25 May 2019 13:36:10 +0200 -Subject: [PATCH 6/9] Fix encode method call - -This broke with ---define="%_buildhost foo" ---- - osc/build.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/osc/build.py b/osc/build.py -index 457249e..325e2a9 100644 ---- a/osc/build.py -+++ b/osc/build.py -@@ -695,7 +695,7 @@ def main(apiurl, opts, argv): - s = '' - for i in opts.define: - s += "%%define %s\n" % i -- build_descr_data = s.encode + build_descr_data -+ build_descr_data = s.encode() + build_descr_data - - cpiodata = None - servicefile = os.path.join(os.path.dirname(build_descr), "_service") --- -2.21.0 - diff --git a/0007-Random-drive-by-typo-fixes-for-osc-command-line-mess.patch b/0007-Random-drive-by-typo-fixes-for-osc-command-line-mess.patch deleted file mode 100644 index 9ddc7a6..0000000 --- a/0007-Random-drive-by-typo-fixes-for-osc-command-line-mess.patch +++ /dev/null @@ -1,178 +0,0 @@ -From 4c16177ada2bfd13cad07cde0139c8f980d8746f Mon Sep 17 00:00:00 2001 -From: Stefan Knorr -Date: Fri, 24 May 2019 13:42:47 +0200 -Subject: [PATCH 7/9] Random drive-by typo fixes for osc command-line messages - ---- - osc/commandline.py | 40 ++++++++++++++++++++-------------------- - 1 file changed, 20 insertions(+), 20 deletions(-) - -diff --git a/osc/commandline.py b/osc/commandline.py -index 888be1d..0de204b 100644 ---- a/osc/commandline.py -+++ b/osc/commandline.py -@@ -462,8 +462,8 @@ class Osc(cmdln.Cmdln): - def do_addcontainers(self, subcmd, opts, *args): - """${cmd_name}: Add maintained containers for a give package - -- The command adds all containers which are marked as maitained and contain -- an rpm out of the specified source package. -+ The command adds all containers which are marked as maintained and contain -+ an rpm originating from the specified source package. - - Examples: - osc addcontainers [PROJECT PACKAGE] -@@ -1143,7 +1143,7 @@ class Osc(cmdln.Cmdln): - [See http://en.opensuse.org/openSUSE:Build_Service_Collaboration for information - on this topic.] - -- See the "request" command for showing and modifing existing requests. -+ See the "request" command for showing and modifying existing requests. - - usage: - osc submitreq [OPTIONS] -@@ -1664,7 +1664,7 @@ Please submit there instead, or use --nodevelproject to force direct submission. - (project, package, user, role) - - if get_user_meta(apiurl, user) == None: -- raise oscerr.WrongArgs('osc: an error occured.') -+ raise oscerr.WrongArgs('osc: an error occurred.') - - return actionxml - -@@ -1735,7 +1735,7 @@ Please submit there instead, or use --nodevelproject to force direct submission. - actionxml = """ """ % \ - (project, package, group) - if get_group_meta(apiurl, group) == None: -- raise oscerr.WrongArgs('osc: an error occured.') -+ raise oscerr.WrongArgs('osc: an error occurred.') - else: - actionxml = """ """ % \ - (project, package, user) -@@ -2023,7 +2023,7 @@ Please submit there instead, or use --nodevelproject to force direct submission. - [See http://en.opensuse.org/openSUSE:Build_Service_Collaboration - for information on this topic.] - -- See the "request" command for showing and modifing existing requests. -+ See the "request" command for showing and modifying existing requests. - - osc changedevelrequest PROJECT PACKAGE DEVEL_PROJECT [DEVEL_PACKAGE] - """ -@@ -2098,7 +2098,7 @@ Please submit there instead, or use --nodevelproject to force direct submission. - @cmdln.option('-i', '--interactive', action='store_true', - help='interactive review of request') - @cmdln.option('--or-revoke', action='store_true', -- help='For automatisation scripts: accepts (if using with accept argument) a request when it is in new or review state. Or revoke it when it got declined. Otherwise just do nothing.') -+ help='For automation scripts: accepts (if using with accept argument) a request when it is in new or review state. Or revoke it when it got declined. Otherwise just do nothing.') - @cmdln.option('--non-interactive', action='store_true', - help='non-interactive review of request') - @cmdln.option('--exclude-target-project', action='append', -@@ -2624,7 +2624,7 @@ Please submit there instead, or use --nodevelproject to force direct submission. - change_request_state(apiurl, req.reqid, 'superseded', - 'superseded by %s' % rid, rid) - -- # editmeta and its aliases are all depracated -+ # editmeta and its aliases are all deprecated - @cmdln.alias("editprj") - @cmdln.alias("createprj") - @cmdln.alias("editpac") -@@ -3069,7 +3069,7 @@ Please submit there instead, or use --nodevelproject to force direct submission. - [See http://openbuildservice.org/help/manuals/obs-reference-guide/cha.obs.maintenance_setup.html - for information on this topic.] - -- This command is used by the maintence team to start the release process of a maintenance update. -+ This command is used by the maintenance team to start the release process of a maintenance update. - This includes usually testing based on the defined reviewers of the update project. - - usage: -@@ -3115,7 +3115,7 @@ Please submit there instead, or use --nodevelproject to force direct submission. - [See http://openbuildservice.org/help/manuals/obs-reference-guide/cha.obs.maintenance_setup.html - for information on this topic.] - -- This command is asking to open an empty maintence incident. This can usually only be done by a responsible -+ This command is asking to open an empty maintenance incident. This can usually only be done by a responsible - maintenance team. - Please see the "mbranch" command on how to full such a project content and - the "patchinfo" command how add the required maintenance update information. -@@ -3187,7 +3187,7 @@ Please submit there instead, or use --nodevelproject to force direct submission. - [See http://openbuildservice.org/help/manuals/obs-reference-guide/cha.obs.maintenance_setup.html - for information on this topic.] - -- This command is asking the maintence team to start a maintence incident based on a -+ This command is asking the maintenance team to start a maintenance incident based on a - created maintenance update. Please see the "mbranch" command on how to create such a project and - the "patchinfo" command how add the required maintenance update information. - -@@ -3833,9 +3833,9 @@ Please submit there instead, or use --nodevelproject to force direct submission. - baserev = linkinfo.get('baserev') - opts.revision = baserev - if pacs: -- print("diff working copy against last commited version\n") -+ print("diff working copy against last committed version\n") - else: -- print("diff commited package against linked revision %s\n" % baserev) -+ print("diff committed package against linked revision %s\n" % baserev) - run_pager(server_diff(self.get_api_url(), linkinfo.get('project'), linkinfo.get('package'), baserev, - args[0], args[1], linkinfo.get('lsrcmd5'), not opts.plain, opts.missingok)) - return -@@ -4189,7 +4189,7 @@ Please submit there instead, or use --nodevelproject to force direct submission. - def do_prdiff(self, subcmd, opts, *args): - """${cmd_name}: Server-side diff of two projects - -- Compares two projects and either summarises or outputs the -+ Compares two projects and either summarizes or outputs the - differences in full. In the second form, a project is compared - with one of its branches inside a home:$USER project (the branch - is treated as NEWPRJ). The home branch is optional if the current -@@ -5605,7 +5605,7 @@ Please submit there instead, or use --nodevelproject to force direct submission. - - Trigger reasons might be: - - new build (never build yet or rebuild manually forced) -- - source change (eg. on updating sources) -+ - source change (e.g. on updating sources) - - meta change (packages which are used for building have changed) - - rebuild count sync (In case that it is configured to sync release numbers) - -@@ -5756,7 +5756,7 @@ Please submit there instead, or use --nodevelproject to force direct submission. - - The arguments REPOSITORY and ARCH are optional. They can be taken from - the first two columns of the 'osc repos' output. If not specified, -- REPOSITORY defaults to the 'build_repositoy' config entry in your 'oscrc' -+ REPOSITORY defaults to the 'build_repository' config entry in your 'oscrc' - and ARCH defaults to your host architecture. - - usage: -@@ -6244,7 +6244,7 @@ Please submit there instead, or use --nodevelproject to force direct submission. - of the 'osc repos' output. BUILD_DESCR is either a RPM spec file, or a - Debian dsc file. - -- The command honours packagecachedir, build-root and build-uid -+ The command honors packagecachedir, build-root and build-uid - settings in oscrc, if present. You may want to set su-wrapper = 'sudo' - in oscrc, and configure sudo with option NOPASSWD for /usr/bin/build. - -@@ -7190,7 +7190,7 @@ Please submit there instead, or use --nodevelproject to force direct submission. - usage: - osc getbinaries REPOSITORY # works in checked out project/package (check out all archs in subdirs) - osc getbinaries REPOSITORY ARCHITECTURE # works in checked out project/package -- osc getbinaries PROJECT REPOSITORY ARCHITECTRUE -+ osc getbinaries PROJECT REPOSITORY ARCHITECTURE - osc getbinaries PROJECT PACKAGE REPOSITORY ARCHITECTURE - osc getbinaries PROJECT PACKAGE REPOSITORY ARCHITECTURE FILE - ${cmd_option_list} -@@ -8744,10 +8744,10 @@ Please submit there instead, or use --nodevelproject to force direct submission. - to sign the public key with your own existing key. - - If a project has no key, the key from upper level project will -- be used (eg. when dropping "KDE:KDE4:Community" key, the one from -+ be used (e.g. when dropping "KDE:KDE4:Community" key, the one from - "KDE:KDE4" will be used). - -- WARNING: THE OLD KEY WILL NOT BE RESTORABLE WHEN USING DELETE OR CREATE -+ WARNING: THE OLD KEY CANNOT BE RESTORED AFTER USING DELETE OR CREATE - - ${cmd_usage} - ${cmd_option_list} --- -2.21.0 - diff --git a/0008-support-different-token-operations-runservice-releas.patch b/0008-support-different-token-operations-runservice-releas.patch deleted file mode 100644 index ecc3ec5..0000000 --- a/0008-support-different-token-operations-runservice-releas.patch +++ /dev/null @@ -1,60 +0,0 @@ -From 6eac27ec1c54086f8fd92d85e13ec946eec16831 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Adrian=20Schr=C3=B6ter?= -Date: Tue, 12 Feb 2019 10:15:01 +0100 -Subject: [PATCH 8/9] support different token operations (runservice, release - and rebuild) (requires OBS 2.10) - ---- - osc/commandline.py | 14 +++++++++++--- - 1 file changed, 11 insertions(+), 3 deletions(-) - -diff --git a/osc/commandline.py b/osc/commandline.py -index d34f9c9..44cd7db 100644 ---- a/osc/commandline.py -+++ b/osc/commandline.py -@@ -728,6 +728,8 @@ class Osc(cmdln.Cmdln): - help='Create a new token') - @cmdln.option('-d', '--delete', metavar='TOKENID', - help='Delete a token') -+ @cmdln.option('-o', '--operation', metavar='OPERATION', -+ help='Default is "runservice", but "release" or "rebuild" can also be used') - @cmdln.option('-t', '--trigger', metavar='TOKENSTRING', - help='Trigger the action of a token') - def do_token(self, subcmd, opts, *args): -@@ -738,9 +740,9 @@ class Osc(cmdln.Cmdln): - - Usage: - osc token -- osc token --create [ ] -+ osc token --create [--operation ] [ ] - osc token --delete -- osc token --trigger -+ osc token --trigger [--operation ] [ ] - ${cmd_option_list} - """ - -@@ -752,6 +754,8 @@ class Osc(cmdln.Cmdln): - if opts.create: - print("Create a new token") - url += "?cmd=create" -+ if opts.operation: -+ url += "&operation=" + opts.operation - if len(args) > 1: - url += "&project=" + args[0] - url += "&package=" + args[1] -@@ -769,7 +773,11 @@ class Osc(cmdln.Cmdln): - http_DELETE(url) - elif opts.trigger: - print("Trigger token") -- url = apiurl + "/trigger/runservice" -+ operation = opts.operation or "runservice" -+ url = apiurl + "/trigger/" + operation -+ if len(args) > 1: -+ url += "?project=" + args[0] -+ url += "&package=" + args[1] - req = URLRequest(url) - req.get_method = lambda: "POST" - req.add_header('Content-Type', 'application/octet-stream') --- -2.21.0 - diff --git a/0009-cast-bytes-object-to-string-during-os.path.join.patch b/0009-cast-bytes-object-to-string-during-os.path.join.patch deleted file mode 100644 index f7aa9b8..0000000 --- a/0009-cast-bytes-object-to-string-during-os.path.join.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 1c825ec8b6df8168918edce6517a9c260553b231 Mon Sep 17 00:00:00 2001 -From: Maximilian Meister -Date: Tue, 28 May 2019 11:40:49 +0200 -Subject: [PATCH 9/9] cast bytes object to string during os.path.join - -this makes sure not to mix objects to prevent a TypeError - -TypeError: Can't mix strings and bytes in path components - -Fixes#567 - -Signed-off-by: Maximilian Meister ---- - osc/fetch.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/osc/fetch.py b/osc/fetch.py -index 597f7df..d84474e 100644 ---- a/osc/fetch.py -+++ b/osc/fetch.py -@@ -176,7 +176,7 @@ class Fetcher: - sys.exit(1) - canonname = pac_obj.binary - -- fullfilename = os.path.join(destdir, canonname) -+ fullfilename = os.path.join(destdir, decode_it(canonname)) - if pac_obj is not None: - pac_obj.canonname = canonname - pac_obj.fullfilename = fullfilename --- -2.21.0 - diff --git a/0102-Swap-all-usage-of-cgi.escape-with-html.escape.patch b/0102-Swap-all-usage-of-cgi.escape-with-html.escape.patch new file mode 100644 index 0000000..0faf874 --- /dev/null +++ b/0102-Swap-all-usage-of-cgi.escape-with-html.escape.patch @@ -0,0 +1,190 @@ +From 0554557603ee1d2f51f481b9b7f3d827cf5f32d6 Mon Sep 17 00:00:00 2001 +From: Neal Gompa +Date: Mon, 18 Nov 2019 01:01:27 -0500 +Subject: [PATCH] Swap all usage of cgi.escape() with html.escape() + +In Python 3.8, cgi.escape() has been completely removed after +being deprecated since Python 3.2. The suggested replacement +is to use html.escape(). +--- + osc/commandline.py | 28 ++++++++++++++-------------- + osc/core.py | 14 +++++++------- + 2 files changed, 21 insertions(+), 21 deletions(-) + +diff --git a/osc/commandline.py b/osc/commandline.py +index 2b94b142..91f0a419 100644 +--- a/osc/commandline.py ++++ b/osc/commandline.py +@@ -1241,7 +1241,7 @@ class Osc(cmdln.Cmdln): + if len(args) < 2 and is_project_dir(os.getcwd()): + if opts.diff: + raise oscerr.WrongOptions('\'--diff\' is not supported in a project working copy') +- import cgi ++ import html + project = store_read_project(os.curdir) + + sr_ids = [] +@@ -1295,7 +1295,7 @@ class Osc(cmdln.Cmdln): + (project, target_prj_block, options_block) + actionxml += s + xml = """ %s %s """ % \ +- (actionxml, cgi.escape(opts.message or "")) ++ (actionxml, html.escape(opts.message or ""), False) + u = makeurl(apiurl, ['request'], query='cmd=create&addrevision=1') + f = http_POST(u, data=xml) + +@@ -1864,9 +1864,9 @@ Please submit there instead, or use --nodevelproject to force direct submission. + if not opts.message: + opts.message = edit_message() + +- import cgi ++ import html + xml = """ %s %s """ % \ +- (actionsxml, cgi.escape(opts.message or "")) ++ (actionsxml, html.escape(opts.message or ""), False) + u = makeurl(apiurl, ['request'], query='cmd=create') + f = http_POST(u, data=xml) + +@@ -1903,7 +1903,7 @@ Please submit there instead, or use --nodevelproject to force direct submission. + + ${cmd_option_list} + """ +- import cgi ++ import html + args = slash_split(args) + apiurl = self.get_api_url() + +@@ -1958,7 +1958,7 @@ Please submit there instead, or use --nodevelproject to force direct submission. + else: + r.add_action('add_role', tgt_project=project, tgt_package=package, + person_name=user, person_role=role) +- r.description = cgi.escape(opts.message or '') ++ r.description = html.escape(opts.message or '', False) + r.create(apiurl) + print(r.reqid) + +@@ -1983,7 +1983,7 @@ Please submit there instead, or use --nodevelproject to force direct submission. + osc deletereq [-m TEXT] PROJECT [--all|--repository REPOSITORY] + ${cmd_option_list} + """ +- import cgi ++ import html + + args = slash_split(args) + +@@ -2025,7 +2025,7 @@ Please submit there instead, or use --nodevelproject to force direct submission. + + r = Request() + r.add_action('delete', tgt_project=project, tgt_package=package, tgt_repository=repository) +- r.description = cgi.escape(opts.message) ++ r.description = html.escape(opts.message, False) + if opts.accept_in_hours: + r.accept_at_in_hours(int(opts.accept_in_hours)) + r.create(self.get_api_url()) +@@ -2046,7 +2046,7 @@ Please submit there instead, or use --nodevelproject to force direct submission. + + osc changedevelrequest PROJECT PACKAGE DEVEL_PROJECT [DEVEL_PACKAGE] + """ +- import cgi ++ import html + + if len(args) == 0 and is_package_dir('.') and find_default_project(): + wd = os.curdir +@@ -2075,7 +2075,7 @@ Please submit there instead, or use --nodevelproject to force direct submission. + r = Request() + r.add_action('change_devel', src_project=devel_project, src_package=devel_package, + tgt_project=project, tgt_package=package) +- r.description = cgi.escape(opts.message) ++ r.description = html.escape(opts.message, False) + r.create(self.get_api_url()) + print(r.reqid) + +@@ -2601,7 +2601,7 @@ Please submit there instead, or use --nodevelproject to force direct submission. + + # check for devel instances after accepted requests + if cmd in ['accept']: +- import cgi ++ import html + sr_actions = rq.get_actions('submit') + for action in sr_actions: + u = makeurl(apiurl, ['/search/package'], { +@@ -2641,7 +2641,7 @@ Please submit there instead, or use --nodevelproject to force direct submission. + project, package) + msg = "%s (forwarded request %s from %s)" % (rq.description, reqid, rq.creator) + rid = create_submit_request(apiurl, action.tgt_project, action.tgt_package, +- project, package, cgi.escape(msg)) ++ project, package, html.escape(msg, False)) + print(msg) + print("New request #", rid) + for req in reqs: +@@ -8270,9 +8270,9 @@ Please submit there instead, or use --nodevelproject to force direct submission. + else: + message = edit_message() + +- import cgi ++ import html + xml = """ %s %s """ % \ +- (requestactionsxml, cgi.escape(message or "")) ++ (requestactionsxml, html.escape(message or "", False)) + u = makeurl(apiurl, ['request'], query='cmd=create') + f = http_POST(u, data=xml) + +diff --git a/osc/core.py b/osc/core.py +index b1289e48..4dba361d 100644 +--- a/osc/core.py ++++ b/osc/core.py +@@ -4172,18 +4172,18 @@ def clone_request(apiurl, reqid, msg=None): + + # create a maintenance release request + def create_release_request(apiurl, src_project, message=''): +- import cgi ++ import html + r = Request() + # api will complete the request + r.add_action('maintenance_release', src_project=src_project) + # XXX: clarify why we need the unicode(...) stuff +- r.description = cgi.escape(unicode(message, 'utf8')) ++ r.description = html.escape(unicode(message, 'utf8'), False) + r.create(apiurl) + return r + + # create a maintenance incident per request + def create_maintenance_request(apiurl, src_project, src_packages, tgt_project, tgt_releaseproject, opt_sourceupdate, message='', enforce_branching=False): +- import cgi ++ import html + r = Request() + if src_packages: + for p in src_packages: +@@ -4191,7 +4191,7 @@ def create_maintenance_request(apiurl, src_project, src_packages, tgt_project, t + else: + r.add_action('maintenance_incident', src_project=src_project, tgt_project=tgt_project, tgt_releaseproject=tgt_releaseproject, opt_sourceupdate = opt_sourceupdate) + # XXX: clarify why we need the unicode(...) stuff +- r.description = cgi.escape(unicode(message, 'utf8')) ++ r.description = html.escape(unicode(message, 'utf8'), False) + r.create(apiurl, addrevision=True, enforce_branching=enforce_branching) + return r + +@@ -4200,7 +4200,7 @@ def create_submit_request(apiurl, + dst_project=None, dst_package=None, + message="", orev=None, src_update=None, dst_updatelink=None): + +- import cgi ++ import html + options_block = "" + package = "" + if src_package: +@@ -4236,9 +4236,9 @@ def create_submit_request(apiurl, + orev or show_upstream_rev(apiurl, src_project, src_package), + targetxml, + options_block, +- cgi.escape(message)) ++ html.escape(message, False)) + +- # Don't do cgi.escape(unicode(message, "utf8"))) above. ++ # Don't do html.escape(unicode(message, "utf8")), False) above. + # Promoting the string to utf8, causes the post to explode with: + # uncaught exception: Fatal error: Start tag expected, '<' not found at :1. + # I guess, my original workaround was not that bad. +-- +2.21.0 + diff --git a/0103-core-Switch-from-platform.linux_distribution-to-dist.patch b/0103-core-Switch-from-platform.linux_distribution-to-dist.patch new file mode 100644 index 0000000..9b92c39 --- /dev/null +++ b/0103-core-Switch-from-platform.linux_distribution-to-dist.patch @@ -0,0 +1,49 @@ +From 2563319e0e84405121010b733dc849c8b283d0d9 Mon Sep 17 00:00:00 2001 +From: Neal Gompa +Date: Mon, 18 Nov 2019 01:12:58 -0500 +Subject: [PATCH] core: Switch from platform.linux_distribution() to + distro.id() + +The platform.linux_distribution() and platform.dist() methods have +been removed in Python 3.8. + +The suggested replacement is using the third party distro module. +--- + osc/core.py | 14 ++++---------- + 1 file changed, 4 insertions(+), 10 deletions(-) + +diff --git a/osc/core.py b/osc/core.py +index b1289e48..d1fb89e9 100644 +--- a/osc/core.py ++++ b/osc/core.py +@@ -4022,11 +4022,8 @@ def get_default_editor(): + if system == 'Windows': + return 'notepad' + if system == 'Linux': +- try: +- # Python 2.6 +- dist = platform.linux_distribution()[0] +- except AttributeError: +- dist = platform.dist()[0] ++ import distro ++ dist = distro.id() + if dist == 'debian': + return 'editor' + elif dist == 'fedora': +@@ -4040,11 +4037,8 @@ def get_default_pager(): + if system == 'Windows': + return 'less' + if system == 'Linux': +- try: +- # Python 2.6 +- dist = platform.linux_distribution()[0] +- except AttributeError: +- dist = platform.dist()[0] ++ import distro ++ dist = distro.id() + if dist == 'debian': + return 'pager' + return 'less' +-- +2.21.0 + diff --git a/osc.spec b/osc.spec index ffc0034..6d61d6f 100644 --- a/osc.spec +++ b/osc.spec @@ -2,7 +2,7 @@ # when rebasing check what they are using on # http://download.opensuse.org/repositories/openSUSE:/Tools/Fedora_30/src/ # update the obsrel to match the upstream release number -%global obsrel 255.1 +%global obsrel 272.1 # osc plugin support %global osc_plugin_dir %{_prefix}/lib/osc-plugins @@ -11,11 +11,11 @@ %global obsroot %{_prefix}/lib/obs %global obs_srcsvc_dir %{obsroot}/service -# Control building as Python 3 for F30+ -%if 0%{?fedora} >= 30 -%bcond_without python3 -%else +# Control building as Python 2 for - 0.166.2-272.1.1 +- Update to 0.166.2 +- Add fixes for Python 3.8 compatibility + * Thu Oct 03 2019 Miro HronĨok - 0.165.1-255.1.2.3 - Rebuilt for Python 3.8.0rc1 (#1748018) diff --git a/sources b/sources index 2a3fff2..2035f5b 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (osc-0.165.1.tar.gz) = 1108f25d4f85ce27e977d3a32d6b2b0511b6a1b58437094558ad42e9cde99b4ff0cd2bb1f0f6516c8d0fd51dfa46fa1ea52297cb266721e18174e6937d0c28af +SHA512 (osc-0.166.2.tar.gz) = cc4d53925d1f57348a6115981b5bec5b63a60e660ef388c1a9967863d9130a9cb3a8253c10ec6f82011733bd97ed6fb31312b621ec9d9580fcb062474b3a4fb8