diff --git a/.gitignore b/.gitignore index 4c8118e..58104b6 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ /osc-0.164.2.tar.gz /osc-0.165.1.tar.gz /osc-0.166.2.tar.gz +/osc-0.167.1.tar.gz diff --git a/0001-fix-regression-in-osc-chroot.patch b/0001-fix-regression-in-osc-chroot.patch new file mode 100644 index 0000000..b8e9fab --- /dev/null +++ b/0001-fix-regression-in-osc-chroot.patch @@ -0,0 +1,129 @@ +From 76793cc0ac34523aa237cad407cb8dcb816dac7b Mon Sep 17 00:00:00 2001 +From: lethliel +Date: Wed, 11 Dec 2019 14:20:54 +0100 +Subject: [PATCH] fix regression in osc chroot + +This fixes some regressions with osc chroot: + +- osc chroot --wipe --root=/dir/ can now be called outside + a working copy +- osc chroot --noinit --root=/dir/ can now be called outside + a working copy and behaves like the old code (Just entering + the chroot without any modifications) +- The confirmation of the deletion is implemented again and thus + the --force option was implemented too. +--- + osc/build.py | 32 ++++++++++++++++++++++++++------ + osc/commandline.py | 32 +++++++++++++++++++++++++++++--- + 2 files changed, 55 insertions(+), 9 deletions(-) + +diff --git a/osc/build.py b/osc/build.py +index 8f599b85..46bd61f0 100644 +--- a/osc/build.py ++++ b/osc/build.py +@@ -524,6 +524,32 @@ def get_kiwipath_from_buildinfo(apiurl, bi_filename, prj, repo): + kiwipath.insert(0, myprp) + return kiwipath + ++def calculate_prj_pac(opts, descr): ++ project = opts.alternative_project or store_read_project('.') ++ if opts.local_package: ++ package = os.path.splitext(os.path.basename(descr))[0] ++ else: ++ package = store_read_package('.') ++ return project, package ++ ++def calculate_build_root(apihost, prj, pac, repo, arch): ++ buildroot = os.environ.get('OSC_BUILD_ROOT', config['build-root']) \ ++ % {'repo': repo, 'arch': arch, 'project': prj, 'package': pac, 'apihost': apihost} ++ return buildroot ++ ++def run_build(*args): ++ cmd = [config['build-cmd']] ++ cmd += args ++ ++ sucmd = os.environ.get('OSC_SU_WRAPPER', config['su-wrapper']).split() ++ if sucmd[0] == 'su': ++ if sucmd[-1] == '-c': ++ sucmd.pop() ++ cmd = sucmd + ['-s', cmd[0], 'root', '--'] + cmd[1:] ++ else: ++ cmd = sucmd + cmd ++ return run_external(cmd[0], *cmd[1:]) ++ + def main(apiurl, opts, argv): + + repo = argv[0] +@@ -696,12 +722,6 @@ def main(apiurl, opts, argv): + + if opts.shell: + buildargs.append("--shell") +- if os.path.exists(build_root) and os.path.exists(bi_filename) and not opts.clean and not opts.extra_pkgs: +- opts.noinit = True +- opts.offline = True +- # we should check if the service did run before and only skip it then, +- # but we have no save point for this atm +- opts.noservice = True + + if opts.noinit: + buildargs.append('--noinit') +diff --git a/osc/commandline.py b/osc/commandline.py +index 78e66e02..cbb8dfe0 100644 +--- a/osc/commandline.py ++++ b/osc/commandline.py +@@ -6341,6 +6341,8 @@ Please submit there instead, or use --nodevelproject to force direct submission. + help=SUPPRESS_HELP) + @cmdln.option('--shell-cmd', metavar='COMMAND', + help='run specified command instead of bash') ++ @cmdln.option('-f', '--force', action='store_true', ++ help='Do not ask for confirmation to wipe') + @cmdln.option('--host', metavar='HOST', + help='perform the build on a remote server - user@server:~/remote/directory') + @cmdln.option('--trust-all-projects', action='store_true', +@@ -6425,9 +6427,6 @@ Please submit there instead, or use --nodevelproject to force direct submission. + if opts.debuginfo and opts.disable_debuginfo: + raise oscerr.WrongOptions('osc: --debuginfo and --disable-debuginfo are mutual exclusive') + +- if subcmd == 'chroot' or subcmd == 'shell': +- opts.shell = True +- + if subcmd == 'wipe': + opts.wipe = True + +@@ -6450,6 +6449,33 @@ Please submit there instead, or use --nodevelproject to force direct submission. + if not opts.vm_type: + opts.vm_type = lastbuildroot[2] + ++ vm_chroot = opts.vm_type or conf.config['build-type'] ++ if (subcmd in ('shell', 'chroot') or opts.shell or opts.wipe) and not vm_chroot: ++ if opts.root: ++ build_root = opts.root ++ else: ++ args = self.parse_repoarchdescr(args, opts.noinit or opts.offline, opts.alternative_project, False, opts.vm_type, opts.multibuild_package) ++ repo, arch, build_descr = args ++ prj, pac = osc.build.calculate_prj_pac(opts, build_descr) ++ apihost = urlsplit(self.get_api_url())[1] ++ build_root = osc.build.calculate_build_root(apihost, prj, pac, repo, ++ arch) ++ if opts.wipe and not opts.force: ++ # Confirm delete ++ print("Really wipe '%s'? [y/N]: " % build_root) ++ choice = raw_input().lower() ++ if choice != 'y': ++ print('Aborting') ++ sys.exit(0) ++ build_args = ['--root=' + build_root, '--noinit', '--shell'] ++ if opts.wipe: ++ build_args.append('--wipe') ++ sys.exit(osc.build.run_build(*build_args)) ++ elif subcmd in ('shell', 'chroot') or opts.shell: ++ print('--shell in combination with build-type %s is experimental.' % vm_chroot) ++ print('The semantics may change at any time!') ++ opts.shell = True ++ + args = self.parse_repoarchdescr(args, opts.noinit or opts.offline, opts.alternative_project, False, opts.vm_type, opts.multibuild_package) + + if not opts.local_package: +-- +2.23.0 + diff --git a/0101-Do-not-attempt-to-run-source-services-when-local-pac.patch b/0101-Do-not-attempt-to-run-source-services-when-local-pac.patch index a3a0d9d..fbf16d6 100644 --- a/0101-Do-not-attempt-to-run-source-services-when-local-pac.patch +++ b/0101-Do-not-attempt-to-run-source-services-when-local-pac.patch @@ -1,6 +1,6 @@ -From f09b87050618cd39229491b2aa153cc488c1922a Mon Sep 17 00:00:00 2001 +From 7d4ec5b35be12b0dcc741cf050adf864b1b60735 Mon Sep 17 00:00:00 2001 From: Neal Gompa -Date: Thu, 30 May 2019 22:20:13 -0400 +Date: Fri, 27 Dec 2019 11:35:17 -0500 Subject: [PATCH] Do not attempt to run source services when --local-package is set @@ -14,31 +14,22 @@ Since any build passing --local-package probably can't run source services anyway, let's restore the capability to build with it by having it skip any attempt to run them automatically when the option is passed. --- - osc/commandline.py | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) + osc/build.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) -diff --git a/osc/commandline.py b/osc/commandline.py -index 0e3e695..da908da 100644 ---- a/osc/commandline.py -+++ b/osc/commandline.py -@@ -6318,7 +6318,7 @@ Please submit there instead, or use --nodevelproject to force direct submission. - args = self.parse_repoarchdescr(args, opts.noinit or opts.offline, opts.alternative_project, False, opts.vm_type, opts.multibuild_package) +diff --git a/osc/build.py b/osc/build.py +index 46bd61f0..8f66f82b 100644 +--- a/osc/build.py ++++ b/osc/build.py +@@ -727,7 +727,7 @@ def main(apiurl, opts, argv): + buildargs.append('--noinit') - # check for source services -- if not opts.offline and not opts.noservice: -+ if not opts.offline and not opts.noservice and not opts.local_package: - p = Package('.') - r = p.run_source_services(verbose=True) - if r: -@@ -6326,7 +6326,7 @@ Please submit there instead, or use --nodevelproject to force direct submission. - sys.exit(1) - else: - msg = ('WARNING: source services from package or project will not' -- 'be executed. This may not be the same build as on server!') -+ ' be executed. This may not be the same build as on server!') - print(msg) - - if not opts.local_package: + # check for source services +- if not opts.offline and not opts.noservice: ++ if not opts.offline and not opts.noservice and not opts.local_package: + p = osc.core.Package(os.curdir) + r = p.run_source_services(verbose=True) + if r: -- -2.21.0 +2.23.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 deleted file mode 100644 index 9b92c39..0000000 --- a/0103-core-Switch-from-platform.linux_distribution-to-dist.patch +++ /dev/null @@ -1,49 +0,0 @@ -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/0103-fix-broken-importsrcpkg-for-python3.patch b/0103-fix-broken-importsrcpkg-for-python3.patch new file mode 100644 index 0000000..55b0cde --- /dev/null +++ b/0103-fix-broken-importsrcpkg-for-python3.patch @@ -0,0 +1,38 @@ +From ae0b55de3bb2e8f2d6876140d6f4121af35e7b50 Mon Sep 17 00:00:00 2001 +From: Frank Schreiner +Date: Fri, 20 Dec 2019 08:36:08 +0100 +Subject: [PATCH] fix broken importsrcpkg for python3 + +without this patch, `importsrcpkg` breaks with the following output: + +``` + File "/usr/lib/python3.7/site-packages/osc/commandline.py", line 7868, in do_importsrcpkg + createPackageDir(os.path.join(project.dir, pac), project) + File "/usr/lib64/python3.7/posixpath.py", line 94, in join + genericpath._check_arg_types('join', a, *p) + File "/usr/lib64/python3.7/genericpath.py", line 151, in _check_arg_types + raise TypeError("Can't mix strings and bytes in path components") from None +TypeError: Can't mix strings and bytes in path components +``` + +Fixes #712 +--- + osc/commandline.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/osc/commandline.py b/osc/commandline.py +index 78e66e0..ba57985 100644 +--- a/osc/commandline.py ++++ b/osc/commandline.py +@@ -7860,7 +7860,7 @@ Please submit there instead, or use --nodevelproject to force direct submission. + print('please specify a package name with the \'--name\' option. ' \ + 'The automatic detection failed', file=sys.stderr) + sys.exit(1) +- ++ pac = pac.decode() + if conf.config['do_package_tracking']: + createPackageDir(os.path.join(project.dir, pac), project) + else: +-- +2.23.0 + diff --git a/osc.spec b/osc.spec index db80542..7523495 100644 --- a/osc.spec +++ b/osc.spec @@ -1,8 +1,8 @@ # SUSE guys use OBS to automatically handle release numbers, # when rebasing check what they are using on -# http://download.opensuse.org/repositories/openSUSE:/Tools/Fedora_30/src/ +# http://download.opensuse.org/repositories/openSUSE:/Tools/Fedora_31/src/ # update the obsrel to match the upstream release number -%global obsrel 272.1 +%global obsrel 281.1 # osc plugin support %global osc_plugin_dir %{_prefix}/lib/osc-plugins @@ -25,18 +25,20 @@ %endif # Real release number -%global rel 2 +%global baserelease 1 Name: osc Summary: Open Build Service Commander -Version: 0.166.2 +Version: 0.167.1 # Bump the release as necessary to ensure we're one level up from upstream -Release: %{obsrel}.%{rel}%{?dist} +Release: %{obsrel}.%{baserelease}%{?dist} License: GPLv2+ URL: https://github.com/openSUSE/osc Source: %{url}/archive/%{version}/%{name}-%{version}.tar.gz # Backports from upstream +## Fix various "osc chroot" regressions +Patch0001: 0001-fix-regression-in-osc-chroot.patch # Proposed fixes ## Fix osc build --local-package runs @@ -45,10 +47,9 @@ Patch0101: 0101-Do-not-attempt-to-run-source-services-when-local-pac.patch ## Use html.escape instead of cgi.escape ## From: https://github.com/openSUSE/osc/pull/681 Patch0102: 0102-Swap-all-usage-of-cgi.escape-with-html.escape.patch -## Use distro.id() instead of platform.linux_distribution() -## From: https://github.com/openSUSE/osc/pull/682 -Patch0103: 0103-core-Switch-from-platform.linux_distribution-to-dist.patch - +## Fix broken importsrcpkg for Python 3 +## From: https://github.com/openSUSE/osc/pull/713 +Patch0103: 0103-fix-broken-importsrcpkg-for-python3.patch BuildArch: noarch @@ -56,22 +57,22 @@ BuildArch: noarch BuildRequires: python3-devel BuildRequires: python3-distro BuildRequires: python3-rpm -BuildRequires: python3-urlgrabber +BuildRequires: python3-progressbar2 Requires: python3-distro Requires: python3-rpm Requires: python3-m2crypto Requires: python3-lxml -Requires: python3-urlgrabber +Requires: python3-progressbar2 %else BuildRequires: python2-devel BuildRequires: python2-distro BuildRequires: python2-rpm -BuildRequires: python2-urlgrabber +BuildRequires: python2-progressbar2 Requires: python2-distro Requires: python2-rpm Requires: m2crypto Requires: python2-lxml -Requires: python2-urlgrabber +Requires: python2-progressbar2 %endif %if 0%{?fedora} || 0%{?rhel} >= 8 @@ -82,7 +83,7 @@ Requires: obs-service-source_validator %endif # To ensure functional parity -Conflicts: obs-build < 20180816 +Conflicts: obs-build < 20191205 %description Commandline client for the Open Build Service. @@ -141,6 +142,13 @@ EOM %dir %{osc_plugin_dir} %changelog +* Fri Dec 27 2019 Neal Gompa - 0.167.1-281.1.1 +- Update to 0.167.1 +- Backport fix for regressions in osc chroot +- Refresh patch for fixing local builds +- Drop patch incorporated in this release +- Add patch to fix osc importsrcpkg on Python 3 + * Mon Nov 18 2019 Neal Gompa - 0.166.2-272.1.2 - Fix patch for replacing cgi.escape with html.escape diff --git a/sources b/sources index 2035f5b..20cda24 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (osc-0.166.2.tar.gz) = cc4d53925d1f57348a6115981b5bec5b63a60e660ef388c1a9967863d9130a9cb3a8253c10ec6f82011733bd97ed6fb31312b621ec9d9580fcb062474b3a4fb8 +SHA512 (osc-0.167.1.tar.gz) = 523593d212c6377a8d5c6b1189be0a5fd197643b554a4a54f9d51eea126fb3dc87c0ed2989ffabf94fd466a8d8c07db10396c8993f00ce8e3a11df823f096274