From 60c21111ec0c7cad80a130a341216202f1e1c5ff Mon Sep 17 00:00:00 2001 From: MSVSphere Packaging Team Date: Fri, 25 Oct 2024 15:59:45 +0300 Subject: [PATCH] import ksc-1.12-5.git869a25c.el10 --- .gitignore | 1 + .ksc.metadata | 1 + SOURCES/0001-manpage.patch | 93 +++++++++++++++++++++++++++ SOURCES/0002-c9s-notifications.patch | 57 +++++++++++++++++ SPECS/ksc.spec | 94 ++++++++++++++++++++++++++++ 5 files changed, 246 insertions(+) create mode 100644 .gitignore create mode 100644 .ksc.metadata create mode 100644 SOURCES/0001-manpage.patch create mode 100644 SOURCES/0002-c9s-notifications.patch create mode 100644 SPECS/ksc.spec diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..66accbf --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/ksc-869a25c.tar.gz diff --git a/.ksc.metadata b/.ksc.metadata new file mode 100644 index 0000000..78684fb --- /dev/null +++ b/.ksc.metadata @@ -0,0 +1 @@ +f2b282f3126447fa8fc3a65123641aa1535513f5 SOURCES/ksc-869a25c.tar.gz diff --git a/SOURCES/0001-manpage.patch b/SOURCES/0001-manpage.patch new file mode 100644 index 0000000..0b45966 --- /dev/null +++ b/SOURCES/0001-manpage.patch @@ -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.") diff --git a/SOURCES/0002-c9s-notifications.patch b/SOURCES/0002-c9s-notifications.patch new file mode 100644 index 0000000..8a56be0 --- /dev/null +++ b/SOURCES/0002-c9s-notifications.patch @@ -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" diff --git a/SPECS/ksc.spec b/SPECS/ksc.spec new file mode 100644 index 0000000..3d15424 --- /dev/null +++ b/SPECS/ksc.spec @@ -0,0 +1,94 @@ +%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 +Version: 1.12 +Release: 5%{?dist} +Summary: Kernel source code checker +Group: Development/Tools +AutoReqProv: no +License: GPL-2.0-or-later +URL: https://github.com/RedHatOfficial/ksc +BuildArch: noarch +Requires: kmod +Requires: binutils +Requires: kernel-devel +Requires: python3-requests +BuildRequires: python3-devel +BuildRequires: python3-setuptools +Source0: https://github.com/RedHatOfficial/ksc/archive/%{commit}/%{name}-%{shortcommit}.tar.gz +Patch0: 0001-manpage.patch +Patch1: 0002-c9s-notifications.patch + +%description +A kernel module source code checker to find usage of select symbols + +%prep +%forgesetup +# Fix build with setuptools 62.1 +# https://github.com/RedHatOfficial/ksc/issues/3 +sed -i "15i packages=[]," setup.py +%patch0 -p1 +%patch1 -p1 + +%build +%py3_build + +%install +%py3_install +install -D ksc.1 %{buildroot}%{_mandir}/man1/ksc.1 + +%files +%license COPYING +%doc README PKG-INFO +%{_bindir}/ksc +%{_datadir}/ksc +%{_mandir}/man1/ksc.* +%config(noreplace) %{_sysconfdir}/ksc.conf +%{python3_sitelib}/ksc-%{version}*.egg-info + +%changelog +* Fri Oct 25 2024 MSVSphere Packaging Team - Packaging variables read or set by %forgemeta +- Rebuilt for MSVSphere 10 + +* Mon Jun 24 2024 Troy Dawson - Packaging variables read or set by %forgemeta +- Bump release for June 2024 mass rebuild + +* Tue May 28 2024 Čestmír Kalina - 1.12-4 +- Resolves: JIRA: https://issues.redhat.com/browse/RHEL-35791 +- Update to the latest ksc + +* Thu Jan 25 2024 Fedora Release Engineering - Packaging variables read or set by %forgemeta +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Sun Jan 21 2024 Fedora Release Engineering - Packaging variables read or set by %forgemeta +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Mon Jun 19 2023 Čestmír Kalina - 1.7-8 +- Migrate license to SPDX + +* Thu Jan 19 2023 Fedora Release Engineering - Packaging variables read or set by %forgemeta +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + +* Thu Jul 21 2022 Fedora Release Engineering - Packaging variables read or set by %forgemeta +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + +* Tue Jun 21 2022 Lumír Balhar - 1.7-5 +- Fix compatibility with newer setuptools + +* Thu Jan 20 2022 Fedora Release Engineering - Packaging variables read or set by %forgemeta +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + +* Thu Jul 22 2021 Fedora Release Engineering - Packaging variables read or set by %forgemeta +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + +* Tue Jun 01 2021 Zamir SUN - 1.7-2 +- Add python3-requests into Requires + +* Tue Jan 05 2021 Čestmír Kalina - 1.7-1 +- Initial Fedora commit.