Compare commits

...

No commits in common. "c8" and "c9-beta" have entirely different histories.
c8 ... c9-beta

6 changed files with 210 additions and 183 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
SOURCES/ksc-1.9.tar.gz SOURCES/ksc-869a25c.tar.gz

View File

@ -1 +1 @@
27f4308a73e4cfe85dbd122fb7e81b47395371e1 SOURCES/ksc-1.9.tar.gz f2b282f3126447fa8fc3a65123641aa1535513f5 SOURCES/ksc-869a25c.tar.gz

View File

@ -0,0 +1,93 @@
diff --git a/data/ksc.conf b/data/ksc.conf
index 8ee4551..c4c53fc 100644
--- a/data/ksc.conf
+++ b/data/ksc.conf
@@ -1,6 +1,12 @@
+[global]
+user=user@example.com
+partner=none
+partnergroup=none
[bugzilla]
-user=user@redhat.com
-partner=partner-name
-partnergroup=partner-group
+enable=1
server=https://bugzilla.redhat.com/xmlrpc.cgi
-api_key=api_key
+api_key=API_KEY
+[mailing_list]
+enable=0
+smtp=smtp.example.com
+to=kabi-requests@redhat.com
diff --git a/ksc.1 b/ksc.1
index 078dd83..3c3ce86 100644
--- a/ksc.1
+++ b/ksc.1
@@ -139,12 +139,18 @@ partnergroup=none
.br
[bugzilla]
.br
+enable=1
+.br
server=https://bugzilla.redhat.com/xmlrpc.cgi
.br
api_key=API_KEY
.br
[mailing_list]
.br
+enable=1
+.br
+smtp=smtp.example.com
+.br
to=kabi-requests@redhat.com
Please replace the values above by your credentials.
@@ -153,7 +159,10 @@ Mandatory fields for any submission method: user, partner, partnergroup.
.br
Mandatory fields for Bugzilla submission method: server, api_key.
.br
-Mandatory fields for mailing list submission method: to.
+Mandatory fields for mailing list submission method: to, smtp.
+
+By default, Bugzilla (mailing list) submission method is auto-enabled
+(auto-disabled) and must be opted out (in).
Note that server must be a valid XML RPC Bugzilla link, user and to fields
must be valid e-mail addresses.
diff --git a/utils.py b/utils.py
index ce1a613..8038076 100644
--- a/utils.py
+++ b/utils.py
@@ -220,6 +220,7 @@ def getconfig(path='/etc/ksc.conf', mock=False, require_partner=False, verbose=T
# To be deprecated in the future:
result['bugzilla_enable'] = True
+ result['mailing_list_enable'] = False
cat = None
for line in lines:
@@ -305,10 +306,10 @@ def getconfig(path='/etc/ksc.conf', mock=False, require_partner=False, verbose=T
raise ConfigDeprecatedValueException(path, key, result[key])
if not (result['method'] & SubmissionMethod.BUGZILLA.value):
- conf["bugzilla_enable"] = False
+ result["bugzilla_enable"] = False
if not (result['method'] & SubmissionMethod.MAILING_LIST.value):
- conf["mailing_list_enable"] = False
+ result["mailing_list_enable"] = False
return result
@@ -365,6 +366,11 @@ def sendmail(filename, arch, mock, conf, releasename, module, subcomponent,
Email ksc report.
"""
+ for field in [ "smtp", "user", "to" ]:
+ if field not in conf:
+ print(f"Could not send an email, '{field}' config field is missing.")
+ return
+
major, centos = get_major_release(releasename)
if not major:
print("Invalid releasename: Mail not sent.")

View File

@ -0,0 +1,57 @@
diff --git a/ksc.py b/ksc.py
index 4652dde..a6dc9f3 100755
--- a/ksc.py
+++ b/ksc.py
@@ -631,12 +631,16 @@ class Ksc(object):
# Ignore undefined options in parser instead of throwing error
class IOptParse(OptionParser):
- def error(self, msg):
- pass
+ def _process_args(self, largs, rargs, values):
+ while rargs:
+ try:
+ OptionParser._process_args(self,largs,rargs,values)
+ except:
+ pass
parser = IOptParse()
- parser.add_option("-k", "--ko")
- opts, _ = parser.parse_args(commands[0:])
+ parser.add_option("-k", "--ko", action="append", dest="ko")
+ opts, _ = parser.parse_args(commands)
return opts.ko
except Exception:
return None
diff --git a/utils.py b/utils.py
index 8038076..b75e770 100644
--- a/utils.py
+++ b/utils.py
@@ -377,8 +377,12 @@ def sendmail(filename, arch, mock, conf, releasename, module, subcomponent,
return
body = f"Product: Red Hat Enterprise Linux {major}\n"
- body += f"Release: Centos Stream\n"
- body += f"Platform: {arch}\n"
+ if releasename and len(releasename):
+ body += f"Release: {releasename[0]}\n"
+ if centos:
+ body += "CentOS Stream: True\n"
+ if arch:
+ body += f"Platform: {arch}\n"
if 'group' in conf and conf['group'] != 'partner-group':
body += f"Partner Group: {conf['group']}\n"
@@ -387,7 +391,11 @@ def sendmail(filename, arch, mock, conf, releasename, module, subcomponent,
body += f"Partner: {conf['partner']}\n"
body += "\n"
- body += str(module) + "\n"
+ if module:
+ if type(module) is list:
+ body += ", ".join(module) + "\n"
+ else:
+ body += str(module) + "\n"
body += "\n"
body += "---\n"
body += "\n"

View File

@ -1,9 +0,0 @@
diff -ru a/ksc b/ksc
--- a/ksc 2022-02-11 07:47:47.000000000 +0100
+++ b/ksc 2022-02-21 13:22:53.038431651 +0100
@@ -1,4 +1,4 @@
#!/bin/sh
export PYTHONPATH=/usr/share/ksc
-exec /usr/bin/python3 -tt /usr/share/ksc/ksc.py "$@"
+exec /usr/libexec/platform-python -tt /usr/share/ksc/ksc.py "$@"

View File

@ -1,36 +1,43 @@
%global forgeurl https://github.com/RedHatOfficial/ksc
%global commitdate 20230109
%global commit 869a25c7de8ed880a72f66ae4f3e8407f1aa4114
%global shortcommit %(c=%{commit}; echo ${c:0:7})
%{?python_enable_dependency_generator}
%forgemeta -i
Name: ksc Name: ksc
Version: 1.9 Version: 1.12
Release: 2%{?dist} Release: 4%{?dist}
Summary: Kernel source code checker Summary: Kernel source code checker
Group: Development/Tools Group: Development/Tools
AutoReqProv: no AutoReqProv: no
License: GPLv2+ License: GPLv2+
URL: https://github.com/RedHatOfficial/ksc URL: https://github.com/RedHatOfficial/ksc
Source0: ksc-%{version}.tar.gz
BuildArch: noarch BuildArch: noarch
%{?__python3:Requires: %{__python3}}
Requires: (kernel-abi-whitelists or kernel-abi-stablelists)
Requires: kmod Requires: kmod
Requires: binutils Requires: binutils
Requires: kernel-devel Requires: kernel-devel
Requires: python3-magic
Requires: python3-requests Requires: python3-requests
BuildRequires: python3-devel BuildRequires: python3-devel
BuildRequires: python3-setuptools BuildRequires: python3-setuptools
Patch0: Replace-python3-with-platform-python.patch Source0: https://github.com/RedHatOfficial/ksc/archive/%{commit}/%{name}-%{shortcommit}.tar.gz
Patch0: 0001-manpage.patch
Patch1: 0002-c9s-notifications.patch
%description %description
A kernel module source code checker to find usage of non whitelist symbols A kernel module source code checker to find usage of select symbols
%prep %prep
%setup -q %forgesetup
%patch0 -p1 %patch0 -p1
%patch1 -p1
%build %build
%py3_build %py3_build
%install %install
%{__python3} setup.py install -O1 --root %{buildroot} %py3_install
install -D ksc.1 %{buildroot}%{_mandir}/man1/ksc.1 install -D ksc.1 %{buildroot}%{_mandir}/man1/ksc.1
%files %files
@ -43,166 +50,45 @@ install -D ksc.1 %{buildroot}%{_mandir}/man1/ksc.1
%{python3_sitelib}/ksc-%{version}*.egg-info %{python3_sitelib}/ksc-%{version}*.egg-info
%changelog %changelog
* Mon Feb 21 2022 Čestmír Kalina <ckalina@redhat.com> - 1.9-2 * Mon Mar 06 2023 Čestmír Kalina <ckalina@redhat.com> - 1.12-3
- Resolves: #2043450 ksc: Support Authorization header in bugzilla API - Resolves: #2165820 - The email method always mark CentOS Stream as release
- Use platform-python in place of python3
* Fri Feb 11 2022 Čestmír Kalina <ckalina@redhat.com> - 1.9-1 * Mon Jan 23 2023 Čestmír Kalina <ckalina@redhat.com> - 1.12-2
- Resolves: #2043450 ksc: Support Authorization header in bugzilla API - Resolves: #2066231 - add manpage docs
- Rebase to latest ksc release
* Mon May 17 2021 Čestmír Kalina <ckalina@redhat.com> - 1.8-3 * Mon Jan 09 2023 Čestmír Kalina <ckalina@redhat.com> - 1.12-1
- Resolves: #1954340 ksc: i18n issues, - Resolves: #2066231 - update to ksc 1.12
- Add release to Source0
* Mon Jun 13 2022 Čestmír Kalina <ckalina@redhat.com> - 1.11-2
- Resolves: #2066228 - Explicitly require target specification
* Wed May 18 2022 Čestmír Kalina <ckalina@redhat.com> - 1.11-1
- Resolves: #2066228 - Explicitly require target specification
* Wed Apr 13 2022 Čestmír Kalina <ckalina@redhat.com> - 1.10-1
- Resolves: #2066226 Drop mandatory kernel-abi-stablelist dependency
* Wed Feb 09 2022 Čestmír Kalina <ckalina@redhat.com> - 1.9-1
- Resolves: #2043447 ksc: Support Authorization header in bugzilla API
* Sun Dec 19 2021 Čestmír Kalina <ckalina@redhat.com> - 1.8-5
- Resolves: #2032138 add Red Hat Enterprise Linux 9 support
* Mon Nov 22 2021 Čestmír Kalina <ckalina@redhat.com> - 1.8-4
- Resolves: #1761398 Add symbol namespace support to ksc
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - Forge-specific packaging variables
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
* Tue Jun 01 2021 Ziqian SUN <zsun@redhat.com> - 1.8-2
- Adding python3-requests into Requires.
* Mon May 17 2021 Čestmír Kalina <ckalina@redhat.com> - 1.8-1
- Resolves: #1954495 ksc: i18n issues
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - Forge-specific packaging variables
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
* Tue Jan 05 2021 Čestmír Kalina <ckalina@redhat.com> - 1.7-1 * Tue Jan 05 2021 Čestmír Kalina <ckalina@redhat.com> - 1.7-1
- Resolves: #1886901 Avoid divisive language - Initial Fedora commit.
- Resolves: #1912506 File bugs with Tracking keyword by default
* Wed Nov 06 2019 Čestmír Kalina <ckalina@redhat.com> - 1.6-2
- Resolves: #1729039 Extend ksc output to include environment metadata
- (OSCI) Add kmod to Makefile-generated Requires
* Wed Nov 06 2019 Čestmír Kalina <ckalina@redhat.com> - 1.6-1
- Resolves: #1729039 Extend ksc output to include environment metadata
- Add modinfo vermagic field to the output.
- Add kmod (provides modinfo) to requires.
* Thu Nov 29 2018 Čestmír Kalina <ckalina@redhat.com> - 1.5-1
- Resolves: #1647528 ksc add feature to copy justifications between ksc...
- Resolves: #1648026 ksc add a non-processed .ko file
- Resolves: #1647974 piped input causes ksc to fail when asking for user input
- Add support for justification carry over.
- Add support for symbol filtering using -K.
- Fix input problems when piping through to ksc.
- Extend manpage with EXAMPLES section.
- Version bump fo 1.5.
* Tue Nov 06 2018 Cestmir Kalina <ckalina@redhat.com> - 1.4-1
- Resolves: #1643187 ksc manpage lies -k can only be specified once
- Resolves: #1645335 FILE is shown in ksc man page but no explain or effect
- Support for multiple -k arguments added
- Man page reworded to match ksc behaviour
* Tue Oct 30 2018 Cestmir Kalina <ckalina@redhat.com> - 1.3-1
- Resolves: #1642134 Error restrict bugs to groups without permission while
trying to submit RHEL8 symbols
- New ksc reports will no longer be submitted under redhat bugzilla group.
- At least one bugzilla group must be specified by a ksc user, otherwise ksc
will terminate with an error.
- Version bump to 1.3
* Tue Oct 23 2018 Cestmir Kalina <ckalina@redhat.com> - 1.2-1
- Version bump to resolve RPMDiff blockers.
- Related: #1641485
* Mon Oct 22 2018 Cestmir Kalina <ckalina@redhat.com> - 1.1-5
- Fix ksc report type error when executing against a no-exist file
- Resolves: #1641485
* Wed Oct 10 2018 Cestmir Kalina <ckalina@redhat.com> - 1.1-4
- Fix Requires so that rhpkg build does not fail when invoked.
- Related: #1619153
* Tue Oct 09 2018 Cestmir Kalina <ckalina@redhat.com> - 1.1-3
- Bump version to 1.1
- Related: #1633691
- Resolves: #1637594
* Tue Oct 09 2018 Cestmir Kalina <ckalina@redhat.com> - 1.1-1
- Replace the Python interpreter path to RHEL8 compliant path.
- Related: #1633691
- Resolves: #1637594
* Thu Sep 20 2018 Tomas Orsava <torsava@redhat.com> - 1.0-2
- Require the Python interpreter directly instead of using the package name
- Related: rhbz#1619153
* Fri Sep 7 2018 Cestmir Kalina <ckalina@redhat.com> - 1.0-1
- Resolves: #1623321
* Mon Jun 4 2018 Stanislav Kozina <skozina@redhat.com> - 0.9.24-1
- Remove options -d and --internal
* Wed May 2 2018 Petr Oros <poros@redhat.com> - 0.9.23-1
- Port for python 3
* Wed Dec 13 2017 Martin Lacko <mlacko@redhat.com> - 0.9.22-1
- Resolves: #1524779
* Tue Dec 5 2017 Martin Lacko <mlacko@redhat.com> - 0.9.21-1
- Resolves: #1520224
* Tue Nov 28 2017 Martin Lacko <mlacko@redhat.com> - 0.9.20-1
- Resolves: #1502930
* Tue Nov 7 2017 Stanislav Kozina <skozina@redhat.com> - 0.9.19-1
- Resolves: #1432864
- Resolves: #1500383
- Resolves: #1502930
- Resolves: #1503526
- Resolves: #1503603
- Resolves: #1503964
- Resolves: #1499249
- Resolves: #1441455
- Resolves: #1481310
- Resolves: #1456140
* Mon Sep 5 2016 Stanislav Kozina <skozina@redhat.com> - 0.9.18-1
- Resolves: #1373120
* Mon Aug 15 2016 Stanislav Kozina <skozina@redhat.com> - 0.9.17-1
- Add -y option to provide path to the Module.symvers file
- Resolves: #1366929
- Resolves: #1366952
* Fri Jul 15 2016 Stanislav Kozina <skozina@redhat.com> - 0.9.16-3
- Fix requires
- Resolves: #1356905
* Wed May 04 2016 Stanislav Kozina <skozina@redhat.com> - 0.9.16-1
- embed python-bugzilla interface to get rid of the package dependency
- Resolves: #1332810
* Tue Apr 26 2016 Stanislav Kozina <skozina@redhat.com> - 0.9.15-1
- always load whitelist file from kernel-abi-whitelists package, remove the attached files
- always load Module.symvers file from kernel-devel package, remove attached files
- use python-bugzilla instead of private bz_xmlrpc package
- Resolves: #1328384
- Resolves: #906664
- Resolves: #906659
- Resolves: #1272348
* Tue Feb 25 2014 Jiri Olsa <jolsa@redhat.com> - 0.9.11-1
- Resolves: #1066162
* Fri Jan 10 2014 Jiri Olsa <jolsa@redhat.com> - 0.9.10-1
- Resolves: #1051506
* Fri Jan 10 2014 Jiri Olsa <jolsa@redhat.com> - 0.9.9-2
- added binutils cpp file dependencies
- Resolves: #1051411
* Thu Jan 09 2014 Jiri Olsa <jolsa@redhat.com> - 0.9.9-1
- updating to version 0.9.9
- Resolves: #881654
- Resolves: #1028410
- Resolves: #1045025
- Resolves: #1045368
- Resolves: #1045388
* Fri Dec 27 2013 Daniel Mach <dmach@redhat.com> - 0.9.8-2
- Mass rebuild 2013-12-27
* Mon Nov 18 2013 Jiri Olsa <jolsa@redhat.com> - 0.9.8-1
- updating to version 0.9.8
- Resolves: #1028410
* Tue Aug 20 2013 Jiri Olsa <jolsa@redhat.com> - 0.9.5-1
- updating to version 0.9.5
* Fri Nov 30 2012 Jiri Olsa <jolsa@redhat.com> - 0.9.3-3
- removing kabi-whitelists dependency
* Fri Nov 30 2012 Jiri Olsa <jolsa@redhat.com> - 0.9.3-2
- spec file updates
* Fri Nov 30 2012 Jiri Olsa <jolsa@redhat.com> - 0.9.3-1
- new version with license info updated
* Tue Nov 20 2012 Jiri Olsa <jolsa@redhat.com> - 0.9.2-1
- initial