onosek pushed to rpms/rpkg (rawhide). "A few patches mostly for
`pre-push-check` (..more)"
by notificationsï¼ fedoraproject.org
Notification time stamped 2023-03-31 23:57:28 UTC
From bd87270301b52a4b0c99555aa070378a8c6cc736 Mon Sep 17 00:00:00 2001
From: Ondřej Nosek <onosek(a)redhat.com>
Date: Mar 31 2023 23:54:46 +0000
Subject: A few patches mostly for `pre-push-check`
- Patch: Fix unittests for `clone` and pre-push hook script
- Patch: pre-push hook script contains a user's config
- Patch: A HEAD query into a lookaside cache
- Patch: `pre-push-check` have to use spectool with --define
- Patch: Add more information about pre-push hook
- Patch: Update to spec file presence checking
- Patch: More robust spec file presence checking
Signed-off-by: Ondřej Nosek <onosek(a)redhat.com>
---
diff --git a/0007-More-robust-spec-file-presence-checking.patch b/0007-More-robust-spec-file-presence-checking.patch
new file mode 100644
index 0000000..a1dde64
--- /dev/null
+++ b/0007-More-robust-spec-file-presence-checking.patch
@@ -0,0 +1,292 @@
+From 1108810bdefd0d880517b274acd6a3bd0d4156e0 Mon Sep 17 00:00:00 2001
+From: Ondrej Nosek <onosek(a)redhat.com>
+Date: Tue, 21 Mar 2023 02:44:04 +0100
+Subject: [PATCH 07/12] More robust spec file presence checking
+
+Some commands (verrel, sources, prep, import, ...) need to check
+whether the dist-git repository is in the correct state. It means
+at least the presence of the specfile.
+In the beginning, rpkg detects layouts. Layouts determine the file
+structure of the repository. For example, most commands can't
+be executed for the RetiredLayout (there is no specfile).
+When the repository directory exists, some layout can be always
+detected. Therefore '--path' argument is now checked for
+a valid directory.
+The timeout change in the request fixes the new bandit's finding.
+
+Fixes: #663
+JIRA: RHELCMP-11387
+
+Signed-off-by: Ondrej Nosek <onosek(a)redhat.com>
+---
+ pyrpkg/__init__.py | 9 ++++---
+ pyrpkg/cli.py | 8 +++---
+ pyrpkg/layout/__init__.py | 4 +--
+ pyrpkg/utils.py | 14 ++++++++++
+ tests/commands/test_push.py | 54 +++++++++++++++++++------------------
+ tests/test_cli.py | 12 ++++++---
+ 6 files changed, 63 insertions(+), 38 deletions(-)
+
+diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py
+index 776cb21..028d195 100644
+--- a/pyrpkg/__init__.py
++++ b/pyrpkg/__init__.py
+@@ -923,9 +923,8 @@ class Commands(object):
+ def load_spec(self):
+ """This sets the spec attribute"""
+
+- if self.layout is None:
++ if self.layout is None or isinstance(self.layout, layout.IncompleteLayout):
+ raise rpkgError('Spec file is not available')
+-
+ if self.is_retired():
+ raise rpkgError('This package or module is retired. The action has stopped.')
+
+@@ -1166,8 +1165,10 @@ class Commands(object):
+
+ @property
+ def sources_filename(self):
+- if self.layout is None:
+- return os.path.join(self.path, 'sources')
++ if self.layout is None or isinstance(self.layout, layout.IncompleteLayout):
++ raise rpkgError('Spec file is not available')
++ if self.is_retired():
++ raise rpkgError('This package or module is retired. The action has stopped.')
+ return os.path.join(
+ self.path, self.layout.sources_file_template.replace("{0.repo_name}", self.repo_name))
+
+diff --git a/pyrpkg/cli.py b/pyrpkg/cli.py
+index c3672b3..1bcf6e4 100644
+--- a/pyrpkg/cli.py
++++ b/pyrpkg/cli.py
+@@ -386,7 +386,7 @@ class cliClient(object):
+ help='Run Koji commands as a different user')
+ # Let the user define a path to work in rather than cwd
+ self.parser.add_argument('--path', default=None,
+- type=utils.u,
++ type=utils.validate_path,
+ help='Define the directory to work in '
+ '(defaults to cwd)')
+ # Verbosity
+@@ -911,8 +911,9 @@ class cliClient(object):
+ if 'path' in args:
+ # Without "path", we can't really test...
+ url = '%(protocol)s://%(host)s/%(path)s/info/refs?service=git-receive-pack' % args
+- resp = requests.head(url, auth=HTTPBasicAuth(args['username'],
+- args['password']))
++ resp = requests.head(url,
++ auth=HTTPBasicAuth(args['username'], args['password']),
++ timeout=15)
+ if resp.status_code == 401:
+ return self.oidc_client.report_token_issue()
+
+@@ -2363,6 +2364,7 @@ class cliClient(object):
+
+ def import_srpm(self):
+ uploadfiles = self.cmd.import_srpm(self.args.srpm)
++ self.load_cmd() # to reload layouts - because a specfile could appear during import
+ if uploadfiles:
+ try:
+ self.cmd.upload(uploadfiles, replace=True, offline=self.args.offline)
+diff --git a/pyrpkg/layout/__init__.py b/pyrpkg/layout/__init__.py
+index 762af0d..850ddc2 100644
+--- a/pyrpkg/layout/__init__.py
++++ b/pyrpkg/layout/__init__.py
+@@ -12,8 +12,8 @@
+ from pyrpkg.errors import LayoutError
+
+ from .base import MetaLayout
+-from .layouts import (DistGitLayout, IncompleteLayout, # noqa: F401
+- RetiredLayout, SRPMLayout)
++from .layouts import (DistGitLayout, DistGitResultsDirLayout, # noqa: F401
++ IncompleteLayout, RetiredLayout, SRPMLayout)
+
+
+ def build(path, hint=None):
+diff --git a/pyrpkg/utils.py b/pyrpkg/utils.py
+index ceb4906..3337bdb 100644
+--- a/pyrpkg/utils.py
++++ b/pyrpkg/utils.py
+@@ -26,11 +26,25 @@ if six.PY3:
+ def u(s):
+ return s
+
++ def validate_path(s):
++ abspath = os.path.abspath(s)
++ if os.path.exists(abspath):
++ return s
++ else:
++ raise argparse.ArgumentTypeError('given path \'{0}\' doesn\'t exist'.format(abspath))
++
+ getcwd = os.getcwd
+ else:
+ def u(s):
+ return s.decode('utf-8')
+
++ def validate_path(s):
++ abspath = os.path.abspath(s.decode('utf-8'))
++ if os.path.exists(abspath):
++ return s.decode('utf-8')
++ else:
++ raise argparse.ArgumentTypeError('given path \'{0}\' doesn\'t exist'.format(abspath))
++
+ getcwd = os.getcwdu
+
+
+diff --git a/tests/commands/test_push.py b/tests/commands/test_push.py
+index ef8057a..79c3a8b 100644
+--- a/tests/commands/test_push.py
++++ b/tests/commands/test_push.py
+@@ -1,9 +1,13 @@
+ # -*- coding: utf-8 -*-
+
+ import os
++import subprocess
+
+ import git
+
++import pyrpkg
++from pyrpkg.sources import SourcesFile
++
+ from . import CommandTestCase
+
+ SPECFILE_TEMPLATE = """Name: test
+@@ -22,11 +26,6 @@ Test
+ %%install
+ rm -f $RPM_BUILD_ROOT%%{_sysconfdir}/"""
+
+-CLONE_CONFIG = '''
+- bz.default-component %(module)s
+- sendemail.to %(module)s-owner(a)fedoraproject.org
+-'''
+-
+
+ class CommandPushTestCase(CommandTestCase):
+
+@@ -45,28 +44,30 @@ class CommandPushTestCase(CommandTestCase):
+
+ self.make_new_git(self.module)
+
+- import pyrpkg
+- cmd = pyrpkg.Commands(self.path, self.lookaside,
+- self.lookasidehash,
+- self.lookaside_cgi, self.gitbaseurl,
+- self.anongiturl, self.branchre, self.kojiprofile,
+- self.build_client, self.user, self.dist,
+- self.target, self.quiet)
+- cmd.clone_config_rpms = CLONE_CONFIG
+- cmd.clone(self.module, anon=True)
+- cmd.path = os.path.join(self.path, self.module)
+- os.chdir(os.path.join(self.path, self.module))
++ moduledir = os.path.join(self.gitroot, self.module)
++ subprocess.check_call(['git', 'clone', 'file://%s' % moduledir],
++ cwd=self.path, stdout=subprocess.PIPE,
++ stderr=subprocess.PIPE)
++
++ self.cloned_dir = os.path.join(self.path, self.module)
++ self.cmd = pyrpkg.Commands(self.cloned_dir, self.lookaside,
++ self.lookasidehash,
++ self.lookaside_cgi, self.gitbaseurl,
++ self.anongiturl, self.branchre, self.kojiprofile,
++ self.build_client, self.user, self.dist,
++ self.target, self.quiet)
++ os.chdir(self.cloned_dir)
+
+ spec_file = 'module.spec'
+ with open(spec_file, 'w') as f:
+ f.write(SPECFILE_TEMPLATE % '')
+
+- cmd.repo.index.add([spec_file])
+- cmd.repo.index.commit("add SPEC")
++ self.cmd.repo.index.add([spec_file])
++ self.cmd.repo.index.commit("add SPEC")
+
+ # Now, change directory to parent and test the push
+ os.chdir(self.path)
+- cmd.push(no_verify=True)
++ self.cmd.push(no_verify=True)
+
+
+ class TestPushWithPatches(CommandTestCase):
+@@ -76,18 +77,20 @@ class TestPushWithPatches(CommandTestCase):
+
+ self.make_new_git(self.module)
+
+- import pyrpkg
+- self.cmd = pyrpkg.Commands(self.path, self.lookaside,
++ moduledir = os.path.join(self.gitroot, self.module)
++ subprocess.check_call(['git', 'clone', 'file://%s' % moduledir],
++ cwd=self.path, stdout=subprocess.PIPE,
++ stderr=subprocess.PIPE)
++
++ self.cloned_dir = os.path.join(self.path, self.module)
++ self.cmd = pyrpkg.Commands(self.cloned_dir, self.lookaside,
+ self.lookasidehash,
+ self.lookaside_cgi, self.gitbaseurl,
+ self.anongiturl, self.branchre,
+ self.kojiprofile,
+ self.build_client, self.user, self.dist,
+ self.target, self.quiet)
+- self.cmd.clone_config_rpms = CLONE_CONFIG
+- self.cmd.clone(self.module, anon=True)
+- self.cmd.path = os.path.join(self.path, self.module)
+- os.chdir(os.path.join(self.path, self.module))
++ os.chdir(self.cloned_dir)
+
+ # Track SPEC and a.patch in git
+ spec_file = 'module.spec'
+@@ -103,7 +106,6 @@ Patch3: d.path
+ f.write(patch_file)
+
+ # Track c.patch in sources
+- from pyrpkg.sources import SourcesFile
+ sources_file = SourcesFile(self.cmd.sources_filename,
+ self.cmd.source_entry_type)
+ file_hash = self.cmd.lookasidecache.hash_file('c.patch')
+diff --git a/tests/test_cli.py b/tests/test_cli.py
+index df053aa..868ad1f 100644
+--- a/tests/test_cli.py
++++ b/tests/test_cli.py
+@@ -1841,9 +1841,11 @@ class TestMockbuild(CliTestCase):
+ @patch('pyrpkg.Commands._config_dir_basic')
+ @patch('pyrpkg.Commands._config_dir_other')
+ @patch('os.path.exists', return_value=False)
++ @patch('pyrpkg.utils.validate_path')
+ def test_use_mock_config_got_from_koji(
+- self, exists, config_dir_other, config_dir_basic):
++ self, validate_path, exists, config_dir_other, config_dir_basic):
+ mock_layout = layout.DistGitLayout(root_dir=self.cloned_repo_path)
++ validate_path.return_value = self.cloned_repo_path
+ with patch('pyrpkg.layout.build', return_value=mock_layout):
+ config_dir_basic.return_value = '/path/to/config-dir'
+
+@@ -1859,9 +1861,11 @@ class TestMockbuild(CliTestCase):
+
+ @patch('pyrpkg.Commands._config_dir_basic')
+ @patch('os.path.exists', return_value=False)
++ @patch('pyrpkg.utils.validate_path')
+ def test_fail_to_store_mock_config_in_created_config_dir(
+- self, exists, config_dir_basic):
++ self, validate_path, exists, config_dir_basic):
+ config_dir_basic.side_effect = rpkgError
++ validate_path.return_value = self.cloned_repo_path
+
+ cli_cmd = ['rpkg', '--path', self.cloned_repo_path,
+ '--release', 'rhel-7', 'mockbuild']
+@@ -1870,10 +1874,12 @@ class TestMockbuild(CliTestCase):
+ @patch('pyrpkg.Commands._config_dir_basic')
+ @patch('pyrpkg.Commands._config_dir_other')
+ @patch('os.path.exists', return_value=False)
++ @patch('pyrpkg.utils.validate_path')
+ def test_fail_to_populate_mock_config(
+- self, exists, config_dir_other, config_dir_basic):
++ self, validate_path, exists, config_dir_other, config_dir_basic):
+ config_dir_basic.return_value = '/path/to/config-dir'
+ config_dir_other.side_effect = rpkgError
++ validate_path.return_value = self.cloned_repo_path
+
+ cli_cmd = ['rpkg', '--path', self.cloned_repo_path,
+ '--release', 'rhel-7', 'mockbuild']
+--
+2.39.2
+
diff --git a/0008-Update-to-spec-file-presence-checking.patch b/0008-Update-to-spec-file-presence-checking.patch
new file mode 100644
index 0000000..723415f
--- /dev/null
+++ b/0008-Update-to-spec-file-presence-checking.patch
@@ -0,0 +1,43 @@
+From 791fd03b4de1324508583ab53c89cc67459db355 Mon Sep 17 00:00:00 2001
+From: Ondrej Nosek <onosek(a)redhat.com>
+Date: Tue, 21 Mar 2023 13:44:38 +0100
+Subject: [PATCH 08/12] Update to spec file presence checking
+
+Using a different approach to checking the layout. Older way prevented
+`retire` function working correctly. Layouts are detected at the
+beginning of the run and the result stays the same, unlike the direct
+checking files like dead.package in function `is_retired`.
+
+Fixes: #663
+JIRA: RHELCMP-11387
+
+Signed-off-by: Ondrej Nosek <onosek(a)redhat.com>
+---
+ pyrpkg/__init__.py | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py
+index 028d195..e8f4886 100644
+--- a/pyrpkg/__init__.py
++++ b/pyrpkg/__init__.py
+@@ -925,7 +925,7 @@ class Commands(object):
+
+ if self.layout is None or isinstance(self.layout, layout.IncompleteLayout):
+ raise rpkgError('Spec file is not available')
+- if self.is_retired():
++ if isinstance(self.layout, layout.RetiredLayout):
+ raise rpkgError('This package or module is retired. The action has stopped.')
+
+ # Get a list of ".spec" files in the path we're looking at
+@@ -1167,7 +1167,7 @@ class Commands(object):
+ def sources_filename(self):
+ if self.layout is None or isinstance(self.layout, layout.IncompleteLayout):
+ raise rpkgError('Spec file is not available')
+- if self.is_retired():
++ if isinstance(self.layout, layout.RetiredLayout):
+ raise rpkgError('This package or module is retired. The action has stopped.')
+ return os.path.join(
+ self.path, self.layout.sources_file_template.replace("{0.repo_name}", self.repo_name))
+--
+2.39.2
+
diff --git a/0009-Add-more-information-about-pre-push-hook.patch b/0009-Add-more-information-about-pre-push-hook.patch
new file mode 100644
index 0000000..60bad27
--- /dev/null
+++ b/0009-Add-more-information-about-pre-push-hook.patch
@@ -0,0 +1,44 @@
+From 0393dc39bf450cf20df9db63bac135c078f64a14 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= <lsedlar(a)redhat.com>
+Date: Tue, 28 Mar 2023 08:53:30 +0200
+Subject: [PATCH 09/12] Add more information about pre-push hook
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+It's not obvious to many users where the check is coming from, and they
+have the power to edit the script or delete it completely. Let's try to
+improve that a bit.
+
+Signed-off-by: LubomÃr Sedlář <lsedlar(a)redhat.com>
+---
+ pyrpkg/__init__.py | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py
+index e8f4886..7a3c9c6 100644
+--- a/pyrpkg/__init__.py
++++ b/pyrpkg/__init__.py
+@@ -1806,6 +1806,10 @@ class Commands(object):
+ hook_content = textwrap.dedent("""
+ #!/bin/bash
+
++ # This file was generated by {0} when cloning the repository.
++ # You can edit it to your liking or delete completely. It will not
++ # be recreated.
++
+ _remote="$1"
+ _url="$2"
+
+@@ -4429,7 +4433,7 @@ class Commands(object):
+ return self._repo_name, version, release
+
+ def pre_push_check(self, ref):
+- show_hint = ('Hint: this check (pre-push hook script) can be bypassed by adding '
++ show_hint = ('Hint: this check (.git/hooks/pre-push script) can be bypassed by adding '
+ 'the argument \'--no-verify\' argument to the push command.')
+ try:
+ commit = self.repo.commit(ref)
+--
+2.39.2
+
diff --git a/0010-pre-push-check-have-to-use-spectool-with-define.patch b/0010-pre-push-check-have-to-use-spectool-with-define.patch
new file mode 100644
index 0000000..bfe7094
--- /dev/null
+++ b/0010-pre-push-check-have-to-use-spectool-with-define.patch
@@ -0,0 +1,146 @@
+From d5be51eec99108c3809551b615064d0c5cbe628a Mon Sep 17 00:00:00 2001
+From: Ondrej Nosek <onosek(a)redhat.com>
+Date: Tue, 28 Mar 2023 19:58:06 +0200
+Subject: [PATCH 10/12] `pre-push-check` have to use spectool with --define
+
+To get all defined source files and patches from the specfile,
+the 'spectool' utility needs '--define' argument(s) to set specific
+paths for the repository.
+
+JIRA: RHELCMP-11466
+Fixes: #672
+
+Signed-off-by: Ondrej Nosek <onosek(a)redhat.com>
+---
+ pyrpkg/__init__.py | 57 +++++++++++++++------------
+ tests/commands/test_pre_push_check.py | 3 +-
+ 2 files changed, 33 insertions(+), 27 deletions(-)
+
+diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py
+index 7a3c9c6..584c141 100644
+--- a/pyrpkg/__init__.py
++++ b/pyrpkg/__init__.py
+@@ -4442,30 +4442,41 @@ class Commands(object):
+ sys.exit(1)
+
+ try:
++ clone_dir = tempfile.mkdtemp(prefix="pre_push_hook_")
++ for cmd in [
++ ('git', 'clone', self.path, clone_dir),
++ ('git', 'checkout', ref),
++ ]:
++ ret, _, _ = self._run_command(cmd, cwd=clone_dir,
++ # suppress unwanted printing of command line messages
++ return_stdout=True, return_stderr=True)
++ if ret != 0:
++ self.log.error('Command \'{0}\' failed. Push operation '
++ 'was cancelled.'.format(' '.join(cmd)))
++ self.log.warning(show_hint)
++ sys.exit(2)
++
++ # get all source files from the specfile (including patches)
+ # Assume, that specfile names are same in the active branch
+ # and in the pushed branch (git checkout f37 && git push origin rawhide)
+ # in this case 'f37' is active branch and 'rawhide' is pushed branch.
+ specfile_path_absolute = os.path.join(self.layout.specdir, self.spec)
+ # convert to relative path
+ specfile_path = os.path.relpath(specfile_path_absolute, start=self.path)
+- spec_content = self.repo.git.cat_file("-p", "{0}:{1}".format(ref, specfile_path))
+- except Exception:
+- # It might be the case of an empty commit
+- self.log.warning('Specfile doesn\'t exist. Push operation continues.')
+- return
+-
+- # load specfile content from pushed branch and save it into a temporary file
+- with tempfile.NamedTemporaryFile(mode="w+") as temporary_spec:
+- temporary_spec.write(spec_content)
+- temporary_spec.flush()
+- # get all source files from the specfile (including patches)
+- cmd = ('spectool', '-l', temporary_spec.name)
+- ret, stdout, _ = self._run_command(cmd, return_text=True, return_stdout=True)
++ cmd = ['spectool', '-l', os.path.join(clone_dir, specfile_path)]
++ # extract just '--define' arguments from rpmdefines
++ for opt, val in zip(self.rpmdefines[0::2], self.rpmdefines[1::2]):
++ if opt == '--define':
++ cmd.extend((opt, val))
++ ret, stdout, _ = self._run_command(cmd, cwd=clone_dir,
++ return_text=True, return_stdout=True)
+ if ret != 0:
+ self.log.error('Command \'{0}\' failed. Push operation '
+ 'was cancelled.'.format(' '.join(cmd)))
+ self.log.warning(show_hint)
+- sys.exit(2)
++ sys.exit(3)
++ finally:
++ self._cleanup_tmp_dir(clone_dir)
+
+ source_files = []
+ # extract source files from the spectool's output
+@@ -4490,22 +4501,16 @@ class Commands(object):
+ sources_file_path_absolute = self.sources_filename
+ # convert to relative path
+ sources_file_path = os.path.relpath(sources_file_path_absolute, start=self.path)
+- sources_file_content = self.repo.git.cat_file(
+- '-p', '{0}:{1}'.format(ref, sources_file_path))
++
++ # parse 'sources' files content
++ sourcesf = SourcesFile(sources_file_path, self.source_entry_type)
++ sourcesf_entries = set(item.file for item in sourcesf.entries)
+ except Exception:
+ self.log.warning('\'sources\' file doesn\'t exist. Push operation continues.')
+ # NOTE: check doesn't fail when 'sources' file doesn't exist. Just skips the rest.
+ # it might be the case of the push without 'sources' = retiring the repository
+ return
+
+- # load 'sources' file content from pushed branch and save it into a temporary file
+- with tempfile.NamedTemporaryFile(mode="w+") as temporary_sources_file:
+- temporary_sources_file.write(sources_file_content)
+- temporary_sources_file.flush()
+- # parse 'sources' files content
+- sourcesf = SourcesFile(temporary_sources_file.name, self.source_entry_type)
+- sourcesf_entries = set(item.file for item in sourcesf.entries)
+-
+ # list of all files (their relative paths) in the commit
+ repo_entries = set(item.path for item in commit.tree.traverse() if item.type != "tree")
+
+@@ -4518,7 +4523,7 @@ class Commands(object):
+ 'nor tracked in git. '
+ 'Push operation was cancelled'.format(source_file))
+ self.log.warning(show_hint)
+- sys.exit(3)
++ sys.exit(4)
+
+ # verify all file entries in 'sources' were uploaded to the lookaside cache
+ for entry in sourcesf.entries:
+@@ -4532,6 +4537,6 @@ class Commands(object):
+ self.log.error('Source file (or tarball) \'{}\' wasn\'t uploaded to the lookaside '
+ 'cache. Push operation was cancelled.'.format(filename))
+ self.log.warning(show_hint)
+- sys.exit(4)
++ sys.exit(5)
+
+ return 0 # The push operation continues
+diff --git a/tests/commands/test_pre_push_check.py b/tests/commands/test_pre_push_check.py
+index 5e314b9..ee151c1 100644
+--- a/tests/commands/test_pre_push_check.py
++++ b/tests/commands/test_pre_push_check.py
+@@ -37,6 +37,7 @@ class TestPrePushCheck(CommandTestCase):
+ def setUp(self):
+ super(TestPrePushCheck, self).setUp()
+
++ self.dist = "rhel-8"
+ self.make_new_git(self.module)
+
+ moduledir = os.path.join(self.gitroot, self.module)
+@@ -87,7 +88,7 @@ Patch3: d.patch
+ with self.assertRaises(SystemExit) as exc:
+ self.cmd.pre_push_check("HEAD")
+
+- self.assertEqual(exc.exception.code, 3)
++ self.assertEqual(exc.exception.code, 4)
+ log_error.assert_called_once_with("Source file 'b.patch' was neither listed in the "
+ "'sources' file nor tracked in git. Push operation "
+ "was cancelled")
+--
+2.39.2
+
diff --git a/0011-A-HEAD-query-into-a-lookaside-cache.patch b/0011-A-HEAD-query-into-a-lookaside-cache.patch
new file mode 100644
index 0000000..a3281b2
--- /dev/null
+++ b/0011-A-HEAD-query-into-a-lookaside-cache.patch
@@ -0,0 +1,97 @@
+From 77cd608e596af94811c22a16ff58a265d9c7381e Mon Sep 17 00:00:00 2001
+From: Ondrej Nosek <onosek(a)redhat.com>
+Date: Fri, 31 Mar 2023 14:09:09 +0200
+Subject: [PATCH 11/12] A HEAD query into a lookaside cache
+
+A query about whether some file is present in the lookaside cache was
+under authentication and it prevented using command `pre-push-check`
+for those without the 'packager' permission.
+Added another method (based on HTTP HEAD), that allows the same check
+without authentication.
+
+JIRA: RHELCMP-11485
+Fixes: https://pagure.io/fedpkg/issue/513
+
+Signed-off-by: Ondrej Nosek <onosek(a)redhat.com>
+---
+ pyrpkg/__init__.py | 2 +-
+ pyrpkg/lookaside.py | 36 ++++++++++++++++++++++++++++++++++--
+ 2 files changed, 35 insertions(+), 3 deletions(-)
+
+diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py
+index 584c141..15203b7 100644
+--- a/pyrpkg/__init__.py
++++ b/pyrpkg/__init__.py
+@@ -4529,7 +4529,7 @@ class Commands(object):
+ for entry in sourcesf.entries:
+ filename = entry.file
+ hash = entry.hash
+- file_exists_in_lookaside = self.lookasidecache.remote_file_exists(
++ file_exists_in_lookaside = self.lookasidecache.remote_file_exists_head(
+ self.ns_repo_name if self.lookaside_namespaced else self.repo_name,
+ filename,
+ hash)
+diff --git a/pyrpkg/lookaside.py b/pyrpkg/lookaside.py
+index 90f0f1e..ecbf12b 100644
+--- a/pyrpkg/lookaside.py
++++ b/pyrpkg/lookaside.py
+@@ -22,7 +22,7 @@ import sys
+
+ import pycurl
+ import six
+-from six.moves import http_client
++from six.moves import http_client, urllib
+
+ from .errors import (AlreadyUploadedError, DownloadError, InvalidHashType,
+ UploadError)
+@@ -157,7 +157,7 @@ class CGILookasideCache(object):
+ return
+
+ self.log.info("Downloading %s", filename)
+- urled_file = filename.replace(' ', '%20')
++ urled_file = urllib.parse.quote(filename)
+ url = self.get_download_url(name, urled_file, hash, hashtype, **kwargs)
+ if isinstance(url, six.text_type):
+ url = url.encode('utf-8')
+@@ -200,6 +200,38 @@ class CGILookasideCache(object):
+ if not self.file_is_valid(outfile, hash, hashtype=hashtype):
+ raise DownloadError('%s failed checksum' % filename)
+
++ def remote_file_exists_head(self, name, filename, hash):
++ """Verify whether a file exists on the lookaside cache.
++ Uses a HTTP HEAD request and doesn't require authentication.
++
++ :param str name: The name of the module. (usually the name of the
++ SRPM). This can include the namespace as well (depending on what
++ the server side expects).
++ :param str filename: The name of the file to check for.
++ :param str hash: The known good hash of the file.
++ """
++
++ urled_file = urllib.parse.quote(filename)
++ url = self.get_download_url(name, urled_file, hash, self.hashtype)
++
++ c = pycurl.Curl()
++ c.setopt(pycurl.URL, url)
++ c.setopt(pycurl.NOBODY, True)
++ c.setopt(pycurl.FOLLOWLOCATION, 1)
++
++ try:
++ c.perform()
++ status = c.getinfo(pycurl.RESPONSE_CODE)
++ except Exception as e:
++ raise DownloadError(e)
++ finally:
++ c.close()
++
++ if status != 200:
++ self.log.debug('Unavailable file \'%s\' at %s' % (filename, url))
++ return False
++ return True
++
+ def remote_file_exists(self, name, filename, hash):
+ """Verify whether a file exists on the lookaside cache
+
+--
+2.39.2
+
diff --git a/0012-pre-push-hook-script-contains-a-user-s-config.patch b/0012-pre-push-hook-script-contains-a-user-s-config.patch
new file mode 100644
index 0000000..ff2676d
--- /dev/null
+++ b/0012-pre-push-hook-script-contains-a-user-s-config.patch
@@ -0,0 +1,197 @@
+From 1f03eb9102f765c36cc201a499d815732e67dd39 Mon Sep 17 00:00:00 2001
+From: Ondrej Nosek <onosek(a)redhat.com>
+Date: Mon, 27 Mar 2023 23:34:12 +0200
+Subject: [PATCH 12/12] pre-push hook script contains a user's config
+
+When the `clone` command is called with an argument
+-C|--config <config_file>
+this argument is placed to the generated pre-push script.
+
+Fixes: #667
+JIRA: RHELCMP-11394
+
+Signed-off-by: Ondrej Nosek <onosek(a)redhat.com>
+---
+ pyrpkg/__init__.py | 23 ++++++++++++-------
+ pyrpkg/cli.py | 6 +++--
+ tests/commands/test_clone.py | 44 ++++++++++++++++++++++++++++++++++++
+ 3 files changed, 63 insertions(+), 10 deletions(-)
+
+diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py
+index 15203b7..9996402 100644
+--- a/pyrpkg/__init__.py
++++ b/pyrpkg/__init__.py
+@@ -1566,7 +1566,8 @@ class Commands(object):
+ return
+
+ def clone(self, repo, path=None, branch=None, bare_dir=None,
+- anon=False, target=None, depth=None, extra_args=None):
++ anon=False, target=None, depth=None, extra_args=None,
++ config_path=None):
+ """Clone a repo, optionally check out a specific branch.
+
+ :param str repo: the name of the repository to clone.
+@@ -1583,6 +1584,7 @@ class Commands(object):
+ to the specified number of commits.
+ :param list extra_args: additional arguments that are passed to
+ the clone command.
++ :param str config_path: path to the global config file
+ """
+
+ if not path:
+@@ -1638,7 +1640,7 @@ class Commands(object):
+
+ if not bare_dir:
+ self._add_git_excludes(os.path.join(path, git_dir))
+- self._add_git_pre_push_hook(os.path.join(path, git_dir))
++ self._add_git_pre_push_hook(os.path.join(path, git_dir), config_path)
+
+ return
+
+@@ -1654,7 +1656,7 @@ class Commands(object):
+ return repo
+
+ def clone_with_dirs(self, repo, anon=False, target=None, depth=None,
+- extra_args=None):
++ extra_args=None, config_path=None):
+ """Clone a repo old style with subdirs for each branch.
+
+ :param str repo: name of the repository to clone.
+@@ -1666,6 +1668,7 @@ class Commands(object):
+ to the specified number of commits.
+ :param list extra_args: additional arguments that are passed to
+ the clone command.
++ :param str config_path: path to the global config file
+ """
+
+ self._push_url = None
+@@ -1724,7 +1727,7 @@ class Commands(object):
+
+ # Add excludes
+ self._add_git_excludes(branch_path)
+- self._add_git_pre_push_hook(branch_path)
++ self._add_git_pre_push_hook(branch_path, config_path)
+ except (git.GitCommandError, OSError) as e:
+ raise rpkgError('Could not locally clone %s from %s: %s'
+ % (branch, repo_path, e))
+@@ -1787,7 +1790,7 @@ class Commands(object):
+ git_excludes.write()
+ self.log.debug('Git-excludes patterns were added into %s' % git_excludes_path)
+
+- def _add_git_pre_push_hook(self, conf_dir):
++ def _add_git_pre_push_hook(self, repo_dir, config_path=None):
+ """
+ Create pre-push hook script and write it in the location:
+ <repository_directory>/.git/hooks/pre-push
+@@ -1803,6 +1806,10 @@ class Commands(object):
+ self.log.debug('Pre-push hook script was NOT added - missing '
+ 'the packaging tool like fedpkg, rhpkg, ...')
+ return
++
++ # in case the clone command run with 'x-pkg -C <config_path> clone <repo_name>'
++ config_arg = ' -C "{0}"'.format(os.path.realpath(config_path)) if config_path else ""
++
+ hook_content = textwrap.dedent("""
+ #!/bin/bash
+
+@@ -1818,7 +1825,7 @@ class Commands(object):
+ do
+ command -v {0} >/dev/null 2>&1 || {{ echo >&2 "Warning: '{0}' is missing, \\
+ pre-push check is omitted. See .git/hooks/pre-push"; exit 0; }}
+- {0} pre-push-check "$local_sha"
++ {0}{1} pre-push-check "$local_sha"
+ ret_code=$?
+ if [ $ret_code -ne 0 ] && [ $exit_code -eq 0 ]; then
+ exit_code=$ret_code
+@@ -1826,8 +1833,8 @@ class Commands(object):
+ done
+
+ exit $exit_code
+- """).strip().format(tool_name)
+- git_pre_push_hook_path = os.path.join(conf_dir, '.git/hooks/pre-push')
++ """).strip().format(tool_name, config_arg)
++ git_pre_push_hook_path = os.path.join(repo_dir, '.git/hooks/pre-push')
+ if not os.path.exists(os.path.dirname(git_pre_push_hook_path)):
+ # prepare ".git/hooks" directory if it is missing
+ os.makedirs(os.path.dirname(git_pre_push_hook_path))
+diff --git a/pyrpkg/cli.py b/pyrpkg/cli.py
+index 1bcf6e4..3d8ce33 100644
+--- a/pyrpkg/cli.py
++++ b/pyrpkg/cli.py
+@@ -2182,14 +2182,16 @@ class cliClient(object):
+ anon=self.args.anonymous,
+ target=self.args.clone_target,
+ depth=self.args.depth,
+- extra_args=self.extra_args)
++ extra_args=self.extra_args,
++ config_path=self.args.config)
+ else:
+ self.cmd.clone(self.args.repo[0],
+ branch=self.args.branch,
+ anon=self.args.anonymous,
+ target=self.args.clone_target,
+ depth=self.args.depth,
+- extra_args=self.extra_args)
++ extra_args=self.extra_args,
++ config_path=self.args.config)
+
+ def commit(self):
+ if self.args.with_changelog and not self.args.message:
+diff --git a/tests/commands/test_clone.py b/tests/commands/test_clone.py
+index f741864..6ef1300 100644
+--- a/tests/commands/test_clone.py
++++ b/tests/commands/test_clone.py
+@@ -95,6 +95,50 @@ class CommandCloneTestCase(CommandTestCase):
+
+ shutil.rmtree(altpath)
+
++ def test_clone_anonymous_pre_push_hook(self):
++ self.make_new_git(self.module)
++
++ altpath = tempfile.mkdtemp(prefix='rpkg-tests.')
++
++ cmd = pyrpkg.Commands(self.path, self.lookaside, self.lookasidehash,
++ self.lookaside_cgi, self.gitbaseurl,
++ self.anongiturl, self.branchre, self.kojiprofile,
++ self.build_client, self.user, self.dist,
++ self.target, self.quiet)
++ cmd.clone(self.module, anon=True, config_path=None)
++
++ moduledir = os.path.join(self.path, self.module)
++ self.assertTrue(os.path.isfile(os.path.join(moduledir, '.git/hooks/pre-push')))
++
++ with open(os.path.join(moduledir, '.git/hooks/pre-push')) as git_hook_script:
++ content = git_hook_script.read()
++ pattern = '__main__.py pre-push-check "$local_sha"'
++ self.assertIn(pattern, content)
++
++ shutil.rmtree(altpath)
++
++ def test_clone_anonymous_pre_push_hook_config(self):
++ self.make_new_git(self.module)
++
++ altpath = tempfile.mkdtemp(prefix='rpkg-tests.')
++
++ cmd = pyrpkg.Commands(self.path, self.lookaside, self.lookasidehash,
++ self.lookaside_cgi, self.gitbaseurl,
++ self.anongiturl, self.branchre, self.kojiprofile,
++ self.build_client, self.user, self.dist,
++ self.target, self.quiet)
++ cmd.clone(self.module, anon=True, config_path="/home/conf/rhpkg.conf")
++
++ moduledir = os.path.join(self.path, self.module)
++ self.assertTrue(os.path.isfile(os.path.join(moduledir, '.git/hooks/pre-push')))
++
++ with open(os.path.join(moduledir, '.git/hooks/pre-push')) as git_hook_script:
++ content = git_hook_script.read()
++ pattern = '__main__.py -C "/home/conf/rhpkg.conf" pre-push-check "$local_sha"'
++ self.assertIn(pattern, content)
++
++ shutil.rmtree(altpath)
++
+ def test_clone_anonymous_with_branch(self):
+ self.make_new_git(self.module,
+ branches=['rpkg-tests-1', 'rpkg-tests-2'])
+--
+2.39.2
+
diff --git a/0013-Fix-unittests-for-clone-and-pre-push-hook-script.patch b/0013-Fix-unittests-for-clone-and-pre-push-hook-script.patch
new file mode 100644
index 0000000..991fb22
--- /dev/null
+++ b/0013-Fix-unittests-for-clone-and-pre-push-hook-script.patch
@@ -0,0 +1,49 @@
+From 1d82b7eaf98e695689a7dc10bd308030e3c13eea Mon Sep 17 00:00:00 2001
+From: Ondrej Nosek <onosek(a)redhat.com>
+Date: Sat, 1 Apr 2023 01:34:34 +0200
+Subject: [PATCH] Fix unittests for `clone` and pre-push hook script
+
+Signed-off-by: Ondrej Nosek <onosek(a)redhat.com>
+---
+ tests/commands/test_clone.py | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/tests/commands/test_clone.py b/tests/commands/test_clone.py
+index 6ef1300..85fdfd1 100644
+--- a/tests/commands/test_clone.py
++++ b/tests/commands/test_clone.py
+@@ -1,5 +1,6 @@
+ import os
+ import shutil
++import sys
+ import tempfile
+
+ import git
+@@ -110,9 +111,10 @@ class CommandCloneTestCase(CommandTestCase):
+ moduledir = os.path.join(self.path, self.module)
+ self.assertTrue(os.path.isfile(os.path.join(moduledir, '.git/hooks/pre-push')))
+
++ clonned_by = os.path.basename(sys.argv[0])
+ with open(os.path.join(moduledir, '.git/hooks/pre-push')) as git_hook_script:
+ content = git_hook_script.read()
+- pattern = '__main__.py pre-push-check "$local_sha"'
++ pattern = '{0} pre-push-check "$local_sha"'.format(clonned_by)
+ self.assertIn(pattern, content)
+
+ shutil.rmtree(altpath)
+@@ -132,9 +134,11 @@ class CommandCloneTestCase(CommandTestCase):
+ moduledir = os.path.join(self.path, self.module)
+ self.assertTrue(os.path.isfile(os.path.join(moduledir, '.git/hooks/pre-push')))
+
++ clonned_by = os.path.basename(sys.argv[0])
+ with open(os.path.join(moduledir, '.git/hooks/pre-push')) as git_hook_script:
+ content = git_hook_script.read()
+- pattern = '__main__.py -C "/home/conf/rhpkg.conf" pre-push-check "$local_sha"'
++ pattern = '{0} -C "/home/conf/rhpkg.conf" pre-push-check ' \
++ '"$local_sha"'.format(clonned_by)
+ self.assertIn(pattern, content)
+
+ shutil.rmtree(altpath)
+--
+2.39.2
+
diff --git a/rpkg.spec b/rpkg.spec
index 50604bf..290e345 100644
--- a/rpkg.spec
+++ b/rpkg.spec
@@ -1,6 +1,6 @@
Name: rpkg
Version: 1.66
-Release: 4%{?dist}
+Release: 5%{?dist}
Summary: Python library for interacting with rpm+git
License: GPLv2+ and LGPLv2
@@ -40,6 +40,13 @@ Patch3: 0003-Remove-Environment-Markers-syntax.patch
Patch4: 0004-Process-source-URLs-with-fragment-in-pre-push-hook.patch
Patch5: 0005-container-build-update-signing-intent-help-for-OSBS-.patch
Patch6: 0006-Do-not-generate-pre-push-hook-script-in-some-cases.patch
+Patch7: 0007-More-robust-spec-file-presence-checking.patch
+Patch8: 0008-Update-to-spec-file-presence-checking.patch
+Patch9: 0009-Add-more-information-about-pre-push-hook.patch
+Patch10: 0010-pre-push-check-have-to-use-spectool-with-define.patch
+Patch11: 0011-A-HEAD-query-into-a-lookaside-cache.patch
+Patch12: 0012-pre-push-hook-script-contains-a-user-s-config.patch
+Patch13: 0013-Fix-unittests-for-clone-and-pre-push-hook-script.patch
%description
Python library for interacting with rpm+git
@@ -256,6 +263,15 @@ example_cli_dir=$RPM_BUILD_ROOT%{_datadir}/%{name}/examples/cli
%changelog
+* Sat Apr 1 2023 Ondřej Nosek <onosek(a)redhat.com> - 1.66-5
+- Patch: Fix unittests for `clone` and pre-push hook script
+- Patch: pre-push hook script contains a user's config
+- Patch: A HEAD query into a lookaside cache
+- Patch: `pre-push-check` have to use spectool with --define
+- Patch: Add more information about pre-push hook
+- Patch: Update to spec file presence checking
+- Patch: More robust spec file presence checking
+
* Fri Mar 10 2023 Ondřej Nosek <onosek(a)redhat.com> - 1.66-4
- Patch: Do not generate pre-push hook script in some cases
https://src.fedoraproject.org/rpms/rpkg/c/bd87270301b52a4b0c99555aa070378...
2Â months
dcavalca pushed to rpms/esmi_ib_library (epel8). "Initial import;
Fixes: RHBZ#2174487"
by notificationsï¼ fedoraproject.org
Notification time stamped 2023-03-31 23:30:43 UTC
From 83a57eb9ea02ef9a9ca6ba42d54b0ce00abbe22d Mon Sep 17 00:00:00 2001
From: Davide Cavalca <dcavalca(a)fedoraproject.org>
Date: Mar 08 2023 01:48:38 +0000
Subject: Initial import; Fixes: RHBZ#2174487
---
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..e41e9d1
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+/esmi_ib_library-f4ce8713f3ed5cc4d20a9238d2be7405e7bbd583.tar.gz
diff --git a/esmi_ib_library.spec b/esmi_ib_library.spec
new file mode 100644
index 0000000..bf6f4ce
--- /dev/null
+++ b/esmi_ib_library.spec
@@ -0,0 +1,118 @@
+%global date 20220622
+%global commit f4ce8713f3ed5cc4d20a9238d2be7405e7bbd583
+%global shortcommit %(c=%{commit}; echo ${c:0:7})
+%global major_version 1
+%global minor_version 5
+%global full_version %{major_version}.%{minor_version}.0
+%global soversion %{full_version}.0
+
+# The documentation doesn't build at the moment, use the prebuilt one instead
+%bcond_with doc
+
+Name: esmi_ib_library
+Version: %{full_version}^%{date}git%{shortcommit}
+Release: %autorelease
+Summary: E-SMI: EPYC System management Interface In-band Library
+
+License: NCSA
+URL: https://github.com/amd/esmi_ib_library
+Source: %{url}/archive/%{commit}/%{name}-%{commit}.tar.gz
+
+# This is a hardware enablement package for AMD x86_64 platforms
+ExclusiveArch: x86_64
+
+BuildRequires: chrpath
+BuildRequires: cmake
+BuildRequires: gcc-c++
+BuildRequires: sed
+%if %{with doc}
+BuildRequires: doxygen
+BuildRequires: make
+BuildRequires: texlive-latex
+%endif
+
+Suggests: %{name}-doc = %{version}-%{release}
+
+%description
+The EPYC System Management Interface In-band Library, or E-SMI library, is
+part of the EPYC System Management Inband software stack. It is a C library
+for Linux that provides a user space interface to monitor and control the CPU's
+power, energy, performance and other system management features.
+
+%package devel
+Summary: Development headers and libraries for %{name}
+Requires: %{name}%{?_isa} = %{version}-%{release}
+
+%description devel
+This package contains development headers and libraries for %{name}.
+
+%package doc
+Summary: Additional documentation for %{name}
+BuildArch: noarch
+
+%description doc
+This package contains additional documentation for %{name}.
+
+%package -n e_smi_tool
+Summary: E-SMI: EPYCâ„¢ System management Interface tool
+
+%description -n e_smi_tool
+This package contains E-SMI tool, a program based on the E-SMI In-band library
+that provides options to Monitor and Control System Management functionality.
+
+%prep
+%autosetup -n %{name}-%{commit}
+
+# Use FHS install paths and patch version detection
+sed -i CMakeLists.txt \
+ -e 's:${E_SMI}/bin:%{_bindir}:g' \
+ -e 's:e_smi/include:%{_includedir}:g' \
+ -e 's:${E_SMI}/lib/static:%{_libdir}:g' \
+ -e 's:${E_SMI}/lib:%{_libdir}:g' \
+ -e 's:${E_SMI}/doc:%{_pkgdocdir}:g' \
+ -e 's:get_version_from_tag("1.0.0.0":get_version_from_tag("%{soversion}":'
+
+%if %{with doc}
+# Remove prebuilt docs
+rm ESMI_IB_Release_Notes.pdf ESMI_Manual.pdf
+%endif
+
+%build
+%cmake
+%cmake_build
+%if %{with doc}
+make -C %{_vpath_builddir} doc
+%endif
+
+%install
+%cmake_install
+
+# Strip rpath
+chrpath -d %{buildroot}/%{_bindir}/e_smi_tool
+
+%check
+%ctest
+
+%files
+%license License.txt
+%dir %{_pkgdocdir}
+%doc %{_pkgdocdir}/README.md
+%doc %{_pkgdocdir}/RELEASENOTES.md
+%{_libdir}/libe_smi64.so.%{major_version}
+%{_libdir}/libe_smi64.so.%{major_version}.%{minor_version}
+
+%files devel
+%{_includedir}/e_smi/
+%{_libdir}/libe_smi64.so
+
+%files doc
+%license License.txt
+%dir %{_pkgdocdir}
+%doc %{_pkgdocdir}/ESMI_IB_Release_Notes.pdf
+%doc %{_pkgdocdir}/ESMI_Manual.pdf
+
+%files -n e_smi_tool
+%{_bindir}/e_smi_tool
+
+%changelog
+%autochangelog
diff --git a/sources b/sources
new file mode 100644
index 0000000..0566553
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+SHA512 (esmi_ib_library-f4ce8713f3ed5cc4d20a9238d2be7405e7bbd583.tar.gz) = 3677e94034b1e6cbb15565bfffb6fd4efd951b5654faee9195402ee3556caa28dccc26fc3cb195f64da3870d9ca8c7a0daf087edd01f7585444617ad85dcb3ea
https://src.fedoraproject.org/rpms/esmi_ib_library/c/83a57eb9ea02ef9a9ca6...
2Â months
dcavalca pushed to rpms/esmi_ib_library (epel8). "Fix build on EPEL
8 and EPEL 9"
by notificationsï¼ fedoraproject.org
Notification time stamped 2023-03-31 23:30:43 UTC
From 8b562e69d7856e80b34a6478eb338aec8a219701 Mon Sep 17 00:00:00 2001
From: Davide Cavalca <dcavalca(a)fedoraproject.org>
Date: Mar 29 2023 18:26:03 +0000
Subject: Fix build on EPEL 8 and EPEL 9
---
diff --git a/esmi-amd_hsmp-include.patch b/esmi-amd_hsmp-include.patch
new file mode 100644
index 0000000..379113b
--- /dev/null
+++ b/esmi-amd_hsmp-include.patch
@@ -0,0 +1,332 @@
+diff -Naur a/include/e_smi/amd_hsmp.h b/include/e_smi/amd_hsmp.h
+--- a/include/e_smi/amd_hsmp.h 1969-12-31 16:00:00.000000000 -0800
++++ b/include/e_smi/amd_hsmp.h 2023-03-29 10:16:14.350755709 -0700
+@@ -0,0 +1,316 @@
++/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
++
++#ifndef _ASM_X86_AMD_HSMP_H_
++#define _ASM_X86_AMD_HSMP_H_
++
++/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
++
++#ifndef _UAPI_ASM_X86_AMD_HSMP_H_
++#define _UAPI_ASM_X86_AMD_HSMP_H_
++
++#include <linux/types.h>
++
++#pragma pack(4)
++
++#define HSMP_MAX_MSG_LEN 8
++
++/*
++ * HSMP Messages supported
++ */
++enum hsmp_message_ids {
++ HSMP_TEST = 1, /* 01h Increments input value by 1 */
++ HSMP_GET_SMU_VER, /* 02h SMU FW version */
++ HSMP_GET_PROTO_VER, /* 03h HSMP interface version */
++ HSMP_GET_SOCKET_POWER, /* 04h average package power consumption */
++ HSMP_SET_SOCKET_POWER_LIMIT, /* 05h Set the socket power limit */
++ HSMP_GET_SOCKET_POWER_LIMIT, /* 06h Get current socket power limit */
++ HSMP_GET_SOCKET_POWER_LIMIT_MAX,/* 07h Get maximum socket power value */
++ HSMP_SET_BOOST_LIMIT, /* 08h Set a core maximum frequency limit */
++ HSMP_SET_BOOST_LIMIT_SOCKET, /* 09h Set socket maximum frequency level */
++ HSMP_GET_BOOST_LIMIT, /* 0Ah Get current frequency limit */
++ HSMP_GET_PROC_HOT, /* 0Bh Get PROCHOT status */
++ HSMP_SET_XGMI_LINK_WIDTH, /* 0Ch Set max and min width of xGMI Link */
++ HSMP_SET_DF_PSTATE, /* 0Dh Alter APEnable/Disable messages behavior */
++ HSMP_SET_AUTO_DF_PSTATE, /* 0Eh Enable DF P-State Performance Boost algorithm */
++ HSMP_GET_FCLK_MCLK, /* 0Fh Get FCLK and MEMCLK for current socket */
++ HSMP_GET_CCLK_THROTTLE_LIMIT, /* 10h Get CCLK frequency limit in socket */
++ HSMP_GET_C0_PERCENT, /* 11h Get average C0 residency in socket */
++ HSMP_SET_NBIO_DPM_LEVEL, /* 12h Set max/min LCLK DPM Level for a given NBIO */
++ HSMP_GET_NBIO_DPM_LEVEL, /* 13h Get LCLK DPM level min and max for a given NBIO */
++ HSMP_GET_DDR_BANDWIDTH, /* 14h Get theoretical maximum and current DDR Bandwidth */
++ HSMP_GET_TEMP_MONITOR, /* 15h Get socket temperature */
++ HSMP_GET_DIMM_TEMP_RANGE, /* 16h Get per-DIMM temperature range and refresh rate */
++ HSMP_GET_DIMM_POWER, /* 17h Get per-DIMM power consumption */
++ HSMP_GET_DIMM_THERMAL, /* 18h Get per-DIMM thermal sensors */
++ HSMP_GET_SOCKET_FREQ_LIMIT, /* 19h Get current active frequency per socket */
++ HSMP_GET_CCLK_CORE_LIMIT, /* 1Ah Get CCLK frequency limit per core */
++ HSMP_GET_RAILS_SVI, /* 1Bh Get SVI-based Telemetry for all rails */
++ HSMP_GET_SOCKET_FMAX_FMIN, /* 1Ch Get Fmax and Fmin per socket */
++ HSMP_GET_IOLINK_BANDWITH, /* 1Dh Get current bandwidth on IO Link */
++ HSMP_GET_XGMI_BANDWITH, /* 1Eh Get current bandwidth on xGMI Link */
++ HSMP_SET_GMI3_WIDTH, /* 1Fh Set max and min GMI3 Link width */
++ HSMP_SET_PCI_RATE, /* 20h Control link rate on PCIe devices */
++ HSMP_SET_POWER_MODE, /* 21h Select power efficiency profile policy */
++ HSMP_SET_PSTATE_MAX_MIN, /* 22h Set the max and min DF P-State */
++ HSMP_MSG_ID_MAX,
++};
++
++struct hsmp_message {
++ __u32 msg_id; /* Message ID */
++ __u16 num_args; /* Number of input argument words in message */
++ __u16 response_sz; /* Number of expected output/response words */
++ __u32 args[HSMP_MAX_MSG_LEN]; /* argument/response buffer */
++ __u16 sock_ind; /* socket number */
++};
++
++enum hsmp_msg_type {
++ HSMP_RSVD = -1,
++ HSMP_SET = 0,
++ HSMP_GET = 1,
++};
++
++struct hsmp_msg_desc {
++ int num_args;
++ int response_sz;
++ enum hsmp_msg_type type;
++};
++
++/*
++ * User may use these comments as reference, please find the
++ * supported list of messages and message definition in the
++ * HSMP chapter of respective family/model PPR.
++ *
++ * Not supported messages would return -ENOMSG.
++ */
++static const struct hsmp_msg_desc hsmp_msg_desc_table[] = {
++ /* RESERVED */
++ {0, 0, HSMP_RSVD},
++
++ /*
++ * HSMP_TEST, num_args = 1, response_sz = 1
++ * input: args[0] = xx
++ * output: args[0] = xx + 1
++ */
++ {1, 1, HSMP_GET},
++
++ /*
++ * HSMP_GET_SMU_VER, num_args = 0, response_sz = 1
++ * output: args[0] = smu fw ver
++ */
++ {0, 1, HSMP_GET},
++
++ /*
++ * HSMP_GET_PROTO_VER, num_args = 0, response_sz = 1
++ * output: args[0] = proto version
++ */
++ {0, 1, HSMP_GET},
++
++ /*
++ * HSMP_GET_SOCKET_POWER, num_args = 0, response_sz = 1
++ * output: args[0] = socket power in mWatts
++ */
++ {0, 1, HSMP_GET},
++
++ /*
++ * HSMP_SET_SOCKET_POWER_LIMIT, num_args = 1, response_sz = 0
++ * input: args[0] = power limit value in mWatts
++ */
++ {1, 0, HSMP_SET},
++
++ /*
++ * HSMP_GET_SOCKET_POWER_LIMIT, num_args = 0, response_sz = 1
++ * output: args[0] = socket power limit value in mWatts
++ */
++ {0, 1, HSMP_GET},
++
++ /*
++ * HSMP_GET_SOCKET_POWER_LIMIT_MAX, num_args = 0, response_sz = 1
++ * output: args[0] = maximuam socket power limit in mWatts
++ */
++ {0, 1, HSMP_GET},
++
++ /*
++ * HSMP_SET_BOOST_LIMIT, num_args = 1, response_sz = 0
++ * input: args[0] = apic id[31:16] + boost limit value in MHz[15:0]
++ */
++ {1, 0, HSMP_SET},
++
++ /*
++ * HSMP_SET_BOOST_LIMIT_SOCKET, num_args = 1, response_sz = 0
++ * input: args[0] = boost limit value in MHz
++ */
++ {1, 0, HSMP_SET},
++
++ /*
++ * HSMP_GET_BOOST_LIMIT, num_args = 1, response_sz = 1
++ * input: args[0] = apic id
++ * output: args[0] = boost limit value in MHz
++ */
++ {1, 1, HSMP_GET},
++
++ /*
++ * HSMP_GET_PROC_HOT, num_args = 0, response_sz = 1
++ * output: args[0] = proc hot status
++ */
++ {0, 1, HSMP_GET},
++
++ /*
++ * HSMP_SET_XGMI_LINK_WIDTH, num_args = 1, response_sz = 0
++ * input: args[0] = min link width[15:8] + max link width[7:0]
++ */
++ {1, 0, HSMP_SET},
++
++ /*
++ * HSMP_SET_DF_PSTATE, num_args = 1, response_sz = 0
++ * input: args[0] = df pstate[7:0]
++ */
++ {1, 0, HSMP_SET},
++
++ /* HSMP_SET_AUTO_DF_PSTATE, num_args = 0, response_sz = 0 */
++ {0, 0, HSMP_SET},
++
++ /*
++ * HSMP_GET_FCLK_MCLK, num_args = 0, response_sz = 2
++ * output: args[0] = fclk in MHz, args[1] = mclk in MHz
++ */
++ {0, 2, HSMP_GET},
++
++ /*
++ * HSMP_GET_CCLK_THROTTLE_LIMIT, num_args = 0, response_sz = 1
++ * output: args[0] = core clock in MHz
++ */
++ {0, 1, HSMP_GET},
++
++ /*
++ * HSMP_GET_C0_PERCENT, num_args = 0, response_sz = 1
++ * output: args[0] = average c0 residency
++ */
++ {0, 1, HSMP_GET},
++
++ /*
++ * HSMP_SET_NBIO_DPM_LEVEL, num_args = 1, response_sz = 0
++ * input: args[0] = nbioid[23:16] + max dpm level[15:8] + min dpm level[7:0]
++ */
++ {1, 0, HSMP_SET},
++
++ /*
++ * HSMP_GET_NBIO_DPM_LEVEL, num_args = 1, response_sz = 1
++ * input: args[0] = nbioid[23:16]
++ * output: args[0] = max dpm level[15:8] + min dpm level[7:0]
++ */
++ {1, 1, HSMP_GET},
++
++ /*
++ * HSMP_GET_DDR_BANDWIDTH, num_args = 0, response_sz = 1
++ * output: args[0] = max bw in Gbps[31:20] + utilised bw in Gbps[19:8] +
++ * bw in percentage[7:0]
++ */
++ {0, 1, HSMP_GET},
++
++ /*
++ * HSMP_GET_TEMP_MONITOR, num_args = 0, response_sz = 1
++ * output: args[0] = temperature in degree celsius. [15:8] integer part +
++ * [7:5] fractional part
++ */
++ {0, 1, HSMP_GET},
++
++ /*
++ * HSMP_GET_DIMM_TEMP_RANGE, num_args = 1, response_sz = 1
++ * input: args[0] = DIMM address[7:0]
++ * output: args[0] = refresh rate[3] + temperature range[2:0]
++ */
++ {1, 1, HSMP_GET},
++
++ /*
++ * HSMP_GET_DIMM_POWER, num_args = 1, response_sz = 1
++ * input: args[0] = DIMM address[7:0]
++ * output: args[0] = DIMM power in mW[31:17] + update rate in ms[16:8] +
++ * DIMM address[7:0]
++ */
++ {1, 1, HSMP_GET},
++
++ /*
++ * HSMP_GET_DIMM_THERMAL, num_args = 1, response_sz = 1
++ * input: args[0] = DIMM address[7:0]
++ * output: args[0] = temperature in degree celcius[31:21] + update rate in ms[16:8] +
++ * DIMM address[7:0]
++ */
++ {1, 1, HSMP_GET},
++
++ /*
++ * HSMP_GET_SOCKET_FREQ_LIMIT, num_args = 0, response_sz = 1
++ * output: args[0] = frequency in MHz[31:16] + frequency source[15:0]
++ */
++ {0, 1, HSMP_GET},
++
++ /*
++ * HSMP_GET_CCLK_CORE_LIMIT, num_args = 1, response_sz = 1
++ * input: args[0] = apic id [31:0]
++ * output: args[0] = frequency in MHz[31:0]
++ */
++ {1, 1, HSMP_GET},
++
++ /*
++ * HSMP_GET_RAILS_SVI, num_args = 0, response_sz = 1
++ * output: args[0] = power in mW[31:0]
++ */
++ {0, 1, HSMP_GET},
++
++ /*
++ * HSMP_GET_SOCKET_FMAX_FMIN, num_args = 0, response_sz = 1
++ * output: args[0] = fmax in MHz[31:16] + fmin in MHz[15:0]
++ */
++ {0, 1, HSMP_GET},
++
++ /*
++ * HSMP_GET_IOLINK_BANDWITH, num_args = 1, response_sz = 1
++ * input: args[0] = link id[15:8] + bw type[2:0]
++ * output: args[0] = io bandwidth in Mbps[31:0]
++ */
++ {1, 1, HSMP_GET},
++
++ /*
++ * HSMP_GET_XGMI_BANDWITH, num_args = 1, response_sz = 1
++ * input: args[0] = link id[15:8] + bw type[2:0]
++ * output: args[0] = xgmi bandwidth in Mbps[31:0]
++ */
++ {1, 1, HSMP_GET},
++
++ /*
++ * HSMP_SET_GMI3_WIDTH, num_args = 1, response_sz = 0
++ * input: args[0] = min link width[15:8] + max link width[7:0]
++ */
++ {1, 0, HSMP_SET},
++
++ /*
++ * HSMP_SET_PCI_RATE, num_args = 1, response_sz = 1
++ * input: args[0] = link rate control value
++ * output: args[0] = previous link rate control value
++ */
++ {1, 1, HSMP_SET},
++
++ /*
++ * HSMP_SET_POWER_MODE, num_args = 1, response_sz = 0
++ * input: args[0] = power efficiency mode[2:0]
++ */
++ {1, 0, HSMP_SET},
++
++ /*
++ * HSMP_SET_PSTATE_MAX_MIN, num_args = 1, response_sz = 0
++ * input: args[0] = min df pstate[15:8] + max df pstate[7:0]
++ */
++ {1, 0, HSMP_SET},
++};
++
++/* Reset to default packing */
++#pragma pack()
++
++/* Define unique ioctl command for hsmp msgs using generic _IOWR */
++#define HSMP_BASE_IOCTL_NR 0xF8
++#define HSMP_IOCTL_CMD _IOWR(HSMP_BASE_IOCTL_NR, 0, struct hsmp_message)
++
++#endif /*_ASM_X86_AMD_HSMP_H_*/
++
++int hsmp_send_message(struct hsmp_message *msg);
++
++#endif /*_ASM_X86_AMD_HSMP_H_*/
+diff -Naur a/include/e_smi/e_smi_monitor.h b/include/e_smi/e_smi_monitor.h
+--- a/include/e_smi/e_smi_monitor.h 2022-06-22 08:19:31.000000000 -0700
++++ b/include/e_smi/e_smi_monitor.h 2023-03-29 10:02:10.570876113 -0700
+@@ -50,7 +50,7 @@
+ */
+
+ #include <stdint.h>
+-#include <asm/amd_hsmp.h>
++#include <e_smi/amd_hsmp.h>
+ #include <e_smi/e_smi.h>
+
+ #define FILEPATHSIZ 512 //!< Buffer to hold size of sysfs filepath
diff --git a/esmi_ib_library.spec b/esmi_ib_library.spec
index bf6f4ce..341e6c4 100644
--- a/esmi_ib_library.spec
+++ b/esmi_ib_library.spec
@@ -17,6 +17,7 @@ Summary: E-SMI: EPYC System management Interface In-band Library
License: NCSA
URL: https://github.com/amd/esmi_ib_library
Source: %{url}/archive/%{commit}/%{name}-%{commit}.tar.gz
+Patch: esmi-amd_hsmp-include.patch
# This is a hardware enablement package for AMD x86_64 platforms
ExclusiveArch: x86_64
@@ -61,7 +62,12 @@ This package contains E-SMI tool, a program based on the E-SMI In-band library
that provides options to Monitor and Control System Management functionality.
%prep
-%autosetup -n %{name}-%{commit}
+%setup -q -n %{name}-%{commit}
+
+# The kernel on el8 and el9 is missing some includes we need so patch them in
+%if 0%{?el8} || 0%{?el9}
+%patch0 -p1
+%endif
# Use FHS install paths and patch version detection
sed -i CMakeLists.txt \
https://src.fedoraproject.org/rpms/esmi_ib_library/c/8b562e69d7856e80b34a...
2Â months
dcavalca pushed to rpms/esmi_ib_library (epel9). "Fix build on EPEL
8 and EPEL 9"
by notificationsï¼ fedoraproject.org
Notification time stamped 2023-03-31 23:11:53 UTC
From 8b562e69d7856e80b34a6478eb338aec8a219701 Mon Sep 17 00:00:00 2001
From: Davide Cavalca <dcavalca(a)fedoraproject.org>
Date: Mar 29 2023 18:26:03 +0000
Subject: Fix build on EPEL 8 and EPEL 9
---
diff --git a/esmi-amd_hsmp-include.patch b/esmi-amd_hsmp-include.patch
new file mode 100644
index 0000000..379113b
--- /dev/null
+++ b/esmi-amd_hsmp-include.patch
@@ -0,0 +1,332 @@
+diff -Naur a/include/e_smi/amd_hsmp.h b/include/e_smi/amd_hsmp.h
+--- a/include/e_smi/amd_hsmp.h 1969-12-31 16:00:00.000000000 -0800
++++ b/include/e_smi/amd_hsmp.h 2023-03-29 10:16:14.350755709 -0700
+@@ -0,0 +1,316 @@
++/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
++
++#ifndef _ASM_X86_AMD_HSMP_H_
++#define _ASM_X86_AMD_HSMP_H_
++
++/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
++
++#ifndef _UAPI_ASM_X86_AMD_HSMP_H_
++#define _UAPI_ASM_X86_AMD_HSMP_H_
++
++#include <linux/types.h>
++
++#pragma pack(4)
++
++#define HSMP_MAX_MSG_LEN 8
++
++/*
++ * HSMP Messages supported
++ */
++enum hsmp_message_ids {
++ HSMP_TEST = 1, /* 01h Increments input value by 1 */
++ HSMP_GET_SMU_VER, /* 02h SMU FW version */
++ HSMP_GET_PROTO_VER, /* 03h HSMP interface version */
++ HSMP_GET_SOCKET_POWER, /* 04h average package power consumption */
++ HSMP_SET_SOCKET_POWER_LIMIT, /* 05h Set the socket power limit */
++ HSMP_GET_SOCKET_POWER_LIMIT, /* 06h Get current socket power limit */
++ HSMP_GET_SOCKET_POWER_LIMIT_MAX,/* 07h Get maximum socket power value */
++ HSMP_SET_BOOST_LIMIT, /* 08h Set a core maximum frequency limit */
++ HSMP_SET_BOOST_LIMIT_SOCKET, /* 09h Set socket maximum frequency level */
++ HSMP_GET_BOOST_LIMIT, /* 0Ah Get current frequency limit */
++ HSMP_GET_PROC_HOT, /* 0Bh Get PROCHOT status */
++ HSMP_SET_XGMI_LINK_WIDTH, /* 0Ch Set max and min width of xGMI Link */
++ HSMP_SET_DF_PSTATE, /* 0Dh Alter APEnable/Disable messages behavior */
++ HSMP_SET_AUTO_DF_PSTATE, /* 0Eh Enable DF P-State Performance Boost algorithm */
++ HSMP_GET_FCLK_MCLK, /* 0Fh Get FCLK and MEMCLK for current socket */
++ HSMP_GET_CCLK_THROTTLE_LIMIT, /* 10h Get CCLK frequency limit in socket */
++ HSMP_GET_C0_PERCENT, /* 11h Get average C0 residency in socket */
++ HSMP_SET_NBIO_DPM_LEVEL, /* 12h Set max/min LCLK DPM Level for a given NBIO */
++ HSMP_GET_NBIO_DPM_LEVEL, /* 13h Get LCLK DPM level min and max for a given NBIO */
++ HSMP_GET_DDR_BANDWIDTH, /* 14h Get theoretical maximum and current DDR Bandwidth */
++ HSMP_GET_TEMP_MONITOR, /* 15h Get socket temperature */
++ HSMP_GET_DIMM_TEMP_RANGE, /* 16h Get per-DIMM temperature range and refresh rate */
++ HSMP_GET_DIMM_POWER, /* 17h Get per-DIMM power consumption */
++ HSMP_GET_DIMM_THERMAL, /* 18h Get per-DIMM thermal sensors */
++ HSMP_GET_SOCKET_FREQ_LIMIT, /* 19h Get current active frequency per socket */
++ HSMP_GET_CCLK_CORE_LIMIT, /* 1Ah Get CCLK frequency limit per core */
++ HSMP_GET_RAILS_SVI, /* 1Bh Get SVI-based Telemetry for all rails */
++ HSMP_GET_SOCKET_FMAX_FMIN, /* 1Ch Get Fmax and Fmin per socket */
++ HSMP_GET_IOLINK_BANDWITH, /* 1Dh Get current bandwidth on IO Link */
++ HSMP_GET_XGMI_BANDWITH, /* 1Eh Get current bandwidth on xGMI Link */
++ HSMP_SET_GMI3_WIDTH, /* 1Fh Set max and min GMI3 Link width */
++ HSMP_SET_PCI_RATE, /* 20h Control link rate on PCIe devices */
++ HSMP_SET_POWER_MODE, /* 21h Select power efficiency profile policy */
++ HSMP_SET_PSTATE_MAX_MIN, /* 22h Set the max and min DF P-State */
++ HSMP_MSG_ID_MAX,
++};
++
++struct hsmp_message {
++ __u32 msg_id; /* Message ID */
++ __u16 num_args; /* Number of input argument words in message */
++ __u16 response_sz; /* Number of expected output/response words */
++ __u32 args[HSMP_MAX_MSG_LEN]; /* argument/response buffer */
++ __u16 sock_ind; /* socket number */
++};
++
++enum hsmp_msg_type {
++ HSMP_RSVD = -1,
++ HSMP_SET = 0,
++ HSMP_GET = 1,
++};
++
++struct hsmp_msg_desc {
++ int num_args;
++ int response_sz;
++ enum hsmp_msg_type type;
++};
++
++/*
++ * User may use these comments as reference, please find the
++ * supported list of messages and message definition in the
++ * HSMP chapter of respective family/model PPR.
++ *
++ * Not supported messages would return -ENOMSG.
++ */
++static const struct hsmp_msg_desc hsmp_msg_desc_table[] = {
++ /* RESERVED */
++ {0, 0, HSMP_RSVD},
++
++ /*
++ * HSMP_TEST, num_args = 1, response_sz = 1
++ * input: args[0] = xx
++ * output: args[0] = xx + 1
++ */
++ {1, 1, HSMP_GET},
++
++ /*
++ * HSMP_GET_SMU_VER, num_args = 0, response_sz = 1
++ * output: args[0] = smu fw ver
++ */
++ {0, 1, HSMP_GET},
++
++ /*
++ * HSMP_GET_PROTO_VER, num_args = 0, response_sz = 1
++ * output: args[0] = proto version
++ */
++ {0, 1, HSMP_GET},
++
++ /*
++ * HSMP_GET_SOCKET_POWER, num_args = 0, response_sz = 1
++ * output: args[0] = socket power in mWatts
++ */
++ {0, 1, HSMP_GET},
++
++ /*
++ * HSMP_SET_SOCKET_POWER_LIMIT, num_args = 1, response_sz = 0
++ * input: args[0] = power limit value in mWatts
++ */
++ {1, 0, HSMP_SET},
++
++ /*
++ * HSMP_GET_SOCKET_POWER_LIMIT, num_args = 0, response_sz = 1
++ * output: args[0] = socket power limit value in mWatts
++ */
++ {0, 1, HSMP_GET},
++
++ /*
++ * HSMP_GET_SOCKET_POWER_LIMIT_MAX, num_args = 0, response_sz = 1
++ * output: args[0] = maximuam socket power limit in mWatts
++ */
++ {0, 1, HSMP_GET},
++
++ /*
++ * HSMP_SET_BOOST_LIMIT, num_args = 1, response_sz = 0
++ * input: args[0] = apic id[31:16] + boost limit value in MHz[15:0]
++ */
++ {1, 0, HSMP_SET},
++
++ /*
++ * HSMP_SET_BOOST_LIMIT_SOCKET, num_args = 1, response_sz = 0
++ * input: args[0] = boost limit value in MHz
++ */
++ {1, 0, HSMP_SET},
++
++ /*
++ * HSMP_GET_BOOST_LIMIT, num_args = 1, response_sz = 1
++ * input: args[0] = apic id
++ * output: args[0] = boost limit value in MHz
++ */
++ {1, 1, HSMP_GET},
++
++ /*
++ * HSMP_GET_PROC_HOT, num_args = 0, response_sz = 1
++ * output: args[0] = proc hot status
++ */
++ {0, 1, HSMP_GET},
++
++ /*
++ * HSMP_SET_XGMI_LINK_WIDTH, num_args = 1, response_sz = 0
++ * input: args[0] = min link width[15:8] + max link width[7:0]
++ */
++ {1, 0, HSMP_SET},
++
++ /*
++ * HSMP_SET_DF_PSTATE, num_args = 1, response_sz = 0
++ * input: args[0] = df pstate[7:0]
++ */
++ {1, 0, HSMP_SET},
++
++ /* HSMP_SET_AUTO_DF_PSTATE, num_args = 0, response_sz = 0 */
++ {0, 0, HSMP_SET},
++
++ /*
++ * HSMP_GET_FCLK_MCLK, num_args = 0, response_sz = 2
++ * output: args[0] = fclk in MHz, args[1] = mclk in MHz
++ */
++ {0, 2, HSMP_GET},
++
++ /*
++ * HSMP_GET_CCLK_THROTTLE_LIMIT, num_args = 0, response_sz = 1
++ * output: args[0] = core clock in MHz
++ */
++ {0, 1, HSMP_GET},
++
++ /*
++ * HSMP_GET_C0_PERCENT, num_args = 0, response_sz = 1
++ * output: args[0] = average c0 residency
++ */
++ {0, 1, HSMP_GET},
++
++ /*
++ * HSMP_SET_NBIO_DPM_LEVEL, num_args = 1, response_sz = 0
++ * input: args[0] = nbioid[23:16] + max dpm level[15:8] + min dpm level[7:0]
++ */
++ {1, 0, HSMP_SET},
++
++ /*
++ * HSMP_GET_NBIO_DPM_LEVEL, num_args = 1, response_sz = 1
++ * input: args[0] = nbioid[23:16]
++ * output: args[0] = max dpm level[15:8] + min dpm level[7:0]
++ */
++ {1, 1, HSMP_GET},
++
++ /*
++ * HSMP_GET_DDR_BANDWIDTH, num_args = 0, response_sz = 1
++ * output: args[0] = max bw in Gbps[31:20] + utilised bw in Gbps[19:8] +
++ * bw in percentage[7:0]
++ */
++ {0, 1, HSMP_GET},
++
++ /*
++ * HSMP_GET_TEMP_MONITOR, num_args = 0, response_sz = 1
++ * output: args[0] = temperature in degree celsius. [15:8] integer part +
++ * [7:5] fractional part
++ */
++ {0, 1, HSMP_GET},
++
++ /*
++ * HSMP_GET_DIMM_TEMP_RANGE, num_args = 1, response_sz = 1
++ * input: args[0] = DIMM address[7:0]
++ * output: args[0] = refresh rate[3] + temperature range[2:0]
++ */
++ {1, 1, HSMP_GET},
++
++ /*
++ * HSMP_GET_DIMM_POWER, num_args = 1, response_sz = 1
++ * input: args[0] = DIMM address[7:0]
++ * output: args[0] = DIMM power in mW[31:17] + update rate in ms[16:8] +
++ * DIMM address[7:0]
++ */
++ {1, 1, HSMP_GET},
++
++ /*
++ * HSMP_GET_DIMM_THERMAL, num_args = 1, response_sz = 1
++ * input: args[0] = DIMM address[7:0]
++ * output: args[0] = temperature in degree celcius[31:21] + update rate in ms[16:8] +
++ * DIMM address[7:0]
++ */
++ {1, 1, HSMP_GET},
++
++ /*
++ * HSMP_GET_SOCKET_FREQ_LIMIT, num_args = 0, response_sz = 1
++ * output: args[0] = frequency in MHz[31:16] + frequency source[15:0]
++ */
++ {0, 1, HSMP_GET},
++
++ /*
++ * HSMP_GET_CCLK_CORE_LIMIT, num_args = 1, response_sz = 1
++ * input: args[0] = apic id [31:0]
++ * output: args[0] = frequency in MHz[31:0]
++ */
++ {1, 1, HSMP_GET},
++
++ /*
++ * HSMP_GET_RAILS_SVI, num_args = 0, response_sz = 1
++ * output: args[0] = power in mW[31:0]
++ */
++ {0, 1, HSMP_GET},
++
++ /*
++ * HSMP_GET_SOCKET_FMAX_FMIN, num_args = 0, response_sz = 1
++ * output: args[0] = fmax in MHz[31:16] + fmin in MHz[15:0]
++ */
++ {0, 1, HSMP_GET},
++
++ /*
++ * HSMP_GET_IOLINK_BANDWITH, num_args = 1, response_sz = 1
++ * input: args[0] = link id[15:8] + bw type[2:0]
++ * output: args[0] = io bandwidth in Mbps[31:0]
++ */
++ {1, 1, HSMP_GET},
++
++ /*
++ * HSMP_GET_XGMI_BANDWITH, num_args = 1, response_sz = 1
++ * input: args[0] = link id[15:8] + bw type[2:0]
++ * output: args[0] = xgmi bandwidth in Mbps[31:0]
++ */
++ {1, 1, HSMP_GET},
++
++ /*
++ * HSMP_SET_GMI3_WIDTH, num_args = 1, response_sz = 0
++ * input: args[0] = min link width[15:8] + max link width[7:0]
++ */
++ {1, 0, HSMP_SET},
++
++ /*
++ * HSMP_SET_PCI_RATE, num_args = 1, response_sz = 1
++ * input: args[0] = link rate control value
++ * output: args[0] = previous link rate control value
++ */
++ {1, 1, HSMP_SET},
++
++ /*
++ * HSMP_SET_POWER_MODE, num_args = 1, response_sz = 0
++ * input: args[0] = power efficiency mode[2:0]
++ */
++ {1, 0, HSMP_SET},
++
++ /*
++ * HSMP_SET_PSTATE_MAX_MIN, num_args = 1, response_sz = 0
++ * input: args[0] = min df pstate[15:8] + max df pstate[7:0]
++ */
++ {1, 0, HSMP_SET},
++};
++
++/* Reset to default packing */
++#pragma pack()
++
++/* Define unique ioctl command for hsmp msgs using generic _IOWR */
++#define HSMP_BASE_IOCTL_NR 0xF8
++#define HSMP_IOCTL_CMD _IOWR(HSMP_BASE_IOCTL_NR, 0, struct hsmp_message)
++
++#endif /*_ASM_X86_AMD_HSMP_H_*/
++
++int hsmp_send_message(struct hsmp_message *msg);
++
++#endif /*_ASM_X86_AMD_HSMP_H_*/
+diff -Naur a/include/e_smi/e_smi_monitor.h b/include/e_smi/e_smi_monitor.h
+--- a/include/e_smi/e_smi_monitor.h 2022-06-22 08:19:31.000000000 -0700
++++ b/include/e_smi/e_smi_monitor.h 2023-03-29 10:02:10.570876113 -0700
+@@ -50,7 +50,7 @@
+ */
+
+ #include <stdint.h>
+-#include <asm/amd_hsmp.h>
++#include <e_smi/amd_hsmp.h>
+ #include <e_smi/e_smi.h>
+
+ #define FILEPATHSIZ 512 //!< Buffer to hold size of sysfs filepath
diff --git a/esmi_ib_library.spec b/esmi_ib_library.spec
index bf6f4ce..341e6c4 100644
--- a/esmi_ib_library.spec
+++ b/esmi_ib_library.spec
@@ -17,6 +17,7 @@ Summary: E-SMI: EPYC System management Interface In-band Library
License: NCSA
URL: https://github.com/amd/esmi_ib_library
Source: %{url}/archive/%{commit}/%{name}-%{commit}.tar.gz
+Patch: esmi-amd_hsmp-include.patch
# This is a hardware enablement package for AMD x86_64 platforms
ExclusiveArch: x86_64
@@ -61,7 +62,12 @@ This package contains E-SMI tool, a program based on the E-SMI In-band library
that provides options to Monitor and Control System Management functionality.
%prep
-%autosetup -n %{name}-%{commit}
+%setup -q -n %{name}-%{commit}
+
+# The kernel on el8 and el9 is missing some includes we need so patch them in
+%if 0%{?el8} || 0%{?el9}
+%patch0 -p1
+%endif
# Use FHS install paths and patch version detection
sed -i CMakeLists.txt \
https://src.fedoraproject.org/rpms/esmi_ib_library/c/8b562e69d7856e80b34a...
2Â months
kpvdr pushed to rpms/qpid-proton (f36). "Attempt fix for whl file
_arch issue"
by notificationsï¼ fedoraproject.org
Notification time stamped 2023-03-31 22:51:25 UTC
From e664348c62a504c5cb69e914660b4332176d7ccb Mon Sep 17 00:00:00 2001
From: Kim van der Riet <kvanderr(a)redhat.com>
Date: Mar 31 2023 22:51:06 +0000
Subject: Attempt fix for whl file _arch issue
---
diff --git a/qpid-proton.spec b/qpid-proton.spec
index f649fc3..6c2111d 100644
--- a/qpid-proton.spec
+++ b/qpid-proton.spec
@@ -239,8 +239,15 @@ rm -rf build
# library to be installed so we don't duplicate it inside the extension
# That is also why we have to point pkg-config at the installed library
PKG_CONFIG_PATH=%{buildroot}%{_libdir}/pkgconfig %py3_build_wheel
-ls -la dist/
-%py3_install_wheel python_qpid_proton-%{version}-cp310-cp310-linux_%{_arch}.whl
+# Fix wheel arch name mismatch for some arches
+%ifarch i386
+%define whl_arch i686
+%elifarch arm
+%define whl_arch armv7l
+%else
+%define whl_arch %{_arch}
+%endif
+%py3_install_wheel python_qpid_proton-%{version}-cp310-cp310-linux_%{whl_arch}.whl
# We seem to need to strip the build extension otherwise it seems to embed a reference to
# the buildroot in the debug info which fails the rpmbuild - probably because we massaged
# the pkgconfig path above
https://src.fedoraproject.org/rpms/qpid-proton/c/e664348c62a504c5cb69e914...
2Â months
pagure pushed to rpms/gdb (f38). "Backport "Fix crash in
inside_main_func" (..more)"
by notificationsï¼ fedoraproject.org
Notification time stamped 2023-03-31 22:49:32 UTC
From 9b284f749c9ddfdc6f59a440e1d842acd66f16d7 Mon Sep 17 00:00:00 2001
From: Keith Seitz <keiths(a)redhat.com>
Date: Mar 31 2023 21:09:01 +0000
Subject: Backport "Fix crash in inside_main_func"
Resolves: rhbz#2183595
---
diff --git a/_gdb.spec.Patch.include b/_gdb.spec.Patch.include
index 259715b..fa4a22c 100644
--- a/_gdb.spec.Patch.include
+++ b/_gdb.spec.Patch.include
@@ -253,3 +253,7 @@ Patch059: gdb-rhbz1553104-s390x-arch12-test.patch
# [aarch64] Backport fix from Luis Machado for RH BZ 2177655.
Patch060: gdb-rhbz2177655-aarch64-pauth-valid-regcache.patch
+# Backport "Fix crash in inside_main_func"
+# (Tom Tromey, RHBZ 2183595)
+Patch061: gdb-rhbz2183595-rustc-inside_main.patch
+
diff --git a/_gdb.spec.patch.include b/_gdb.spec.patch.include
index 3a533c1..12bf93a 100644
--- a/_gdb.spec.patch.include
+++ b/_gdb.spec.patch.include
@@ -58,3 +58,4 @@
%patch058 -p1
%patch059 -p1
%patch060 -p1
+%patch061 -p1
diff --git a/_patch_order b/_patch_order
index c7e631a..d28e8f9 100644
--- a/_patch_order
+++ b/_patch_order
@@ -58,3 +58,4 @@ gdb-linux_perf-bundle.patch
gdb-libexec-add-index.patch
gdb-rhbz1553104-s390x-arch12-test.patch
gdb-rhbz2177655-aarch64-pauth-valid-regcache.patch
+gdb-rhbz2183595-rustc-inside_main.patch
diff --git a/gdb-rhbz2183595-rustc-inside_main.patch b/gdb-rhbz2183595-rustc-inside_main.patch
new file mode 100644
index 0000000..16a77b6
--- /dev/null
+++ b/gdb-rhbz2183595-rustc-inside_main.patch
@@ -0,0 +1,136 @@
+From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
+From: Tom Tromey <tromey(a)adacore.com>
+Date: Fri, 24 Feb 2023 10:40:16 -0700
+Subject: gdb-rhbz2183595-rustc-inside_main.patch
+
+;; Backport "Fix crash in inside_main_func"
+;; (Tom Tromey, RHBZ 2183595)
+
+gdb 13.1 crashes while running the rust compiler's debugger tests.
+The crash has a number of causes.
+
+First, the rust compiler still uses the C++-like _Z mangling, but with
+its own twist -- some hex digits added to the end of a symbol. So,
+while gdb finds the correct name of "main":
+
+(top-gdb) p name
+$13 = 0x292e0c0 "rustc_gdb_1031745::main"
+
+It isn't found in the minsyms, because C++ demangling yields:
+
+[99] t 0x90c0 _ZN17rustc_gdb_10317454main17h5b5be7fe16a97225E section .text rustc_gdb_1031745::main::h5b5be7fe16a97225 zko06yobckx336v
+
+This could perhaps be fixed. I also filed a new PR to suggest
+preferring the linkage name of the main program.
+
+Next, the rust compiler emits both a DW_TAG_subprogram and a
+DW_TAG_namespace for "main". This happens because the file is named
+"main.rs" -- i.e., the bug is specific to the source file name. The
+crash also seems to require the nested function inside of 'main', at
+least for me. The namespace always is generated, but perhaps this
+changes the ordering in the DWARF.
+
+When inside_main_func looks up the main symbol, it finds the namespace
+symbol rather than the function. (I filed a bug about fixing gdb's
+symbol tables -- long overdue.)
+
+Meanwhile, as I think it's important to fix this crash sooner rather
+than later, this patch changes inside_main_func to check that the
+symbol that is found is LOC_BLOCK. This perhaps should have been done
+in the first place, anyway.
+
+Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30158
+
+diff --git a/gdb/frame.c b/gdb/frame.c
+--- a/gdb/frame.c
++++ b/gdb/frame.c
+@@ -2453,6 +2453,14 @@ inside_main_func (frame_info_ptr this_frame)
+ if (bs.symbol == nullptr)
+ return false;
+
++ /* We might have found some unrelated symbol. For example, the
++ Rust compiler can emit both a subprogram and a namespace with
++ the same name in the same scope; and due to how gdb's symbol
++ tables currently work, we can't request the one we'd
++ prefer. */
++ if (bs.symbol->aclass () != LOC_BLOCK)
++ return false;
++
+ const struct block *block = bs.symbol->value_block ();
+ gdb_assert (block != nullptr);
+ sym_addr = block->start ();
+diff --git a/gdb/testsuite/gdb.rust/main-crash.exp b/gdb/testsuite/gdb.rust/main-crash.exp
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.rust/main-crash.exp
+@@ -0,0 +1,35 @@
++# Copyright (C) 2023 Free Software Foundation, Inc.
++
++# 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 3 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program. If not, see <http://www.gnu.org/licenses/>.
++
++# Regression test for a crash in inside_main_func.
++
++load_lib rust-support.exp
++require allow_rust_tests
++
++standard_testfile main.rs
++if {[prepare_for_testing "failed to prepare" $testfile $srcfile \
++ {debug rust}]} {
++ return -1
++}
++
++set line [gdb_get_line_number "BREAK"]
++# The bug was that this would crash.
++if {![runto ${srcfile}:$line]} {
++ untested "could not run to breakpoint"
++ return -1
++}
++
++# Test that gdb is alive.
++gdb_test "print 23" " = 23"
+diff --git a/gdb/testsuite/gdb.rust/main.rs b/gdb/testsuite/gdb.rust/main.rs
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.rust/main.rs
+@@ -0,0 +1,30 @@
++// Copyright (C) 2016-2023 Free Software Foundation, Inc.
++
++// 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 3 of the License, or
++// (at your option) any later version.
++//
++// This program is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU General Public License
++// along with this program. If not, see <http://www.gnu.org/licenses/>.
++
++#![allow(dead_code)]
++#![allow(unused_variables)]
++#![allow(unused_assignments)]
++
++fn global_fn(x: u8) {
++ // BREAK
++}
++
++fn main() {
++ fn nested(y: u8) {
++ global_fn(y)
++ }
++
++ nested(23);
++}
diff --git a/gdb.spec b/gdb.spec
index 259d8e6..7f2db45 100644
--- a/gdb.spec
+++ b/gdb.spec
@@ -57,7 +57,7 @@ Version: 13.1
# The release always contains a leading reserved number, start it at 1.
# `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing.
-Release: 2%{?dist}
+Release: 3%{?dist}
License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and LGPLv3+ and BSD and Public Domain and GFDL
# Do not provide URL for snapshots as the file lasts there only for 2 days.
@@ -1192,6 +1192,10 @@ fi
%endif
%changelog
+* Fri Mar 31 2023 Keith Seitz <keiths(a)redhat.com> - 13.1-3
+- Backport "Fix crash in inside_main_func".
+ (Tom Tromey, RHBZ 2183595)
+
* Fri Mar 24 2023 Kevin Buettner <kevinb(a)redhat.com> - 13.1-2
- Backport fix for RHBZ 2177655. (Luis Machado)
https://src.fedoraproject.org/rpms/gdb/c/9b284f749c9ddfdc6f59a440e1d842ac...
2Â months
pagure pushed to rpms/esmi_ib_library (rawhide). "Fix build on EPEL
8 and EPEL 9"
by notificationsï¼ fedoraproject.org
Notification time stamped 2023-03-31 22:36:50 UTC
From 8b562e69d7856e80b34a6478eb338aec8a219701 Mon Sep 17 00:00:00 2001
From: Davide Cavalca <dcavalca(a)fedoraproject.org>
Date: Mar 29 2023 18:26:03 +0000
Subject: Fix build on EPEL 8 and EPEL 9
---
diff --git a/esmi-amd_hsmp-include.patch b/esmi-amd_hsmp-include.patch
new file mode 100644
index 0000000..379113b
--- /dev/null
+++ b/esmi-amd_hsmp-include.patch
@@ -0,0 +1,332 @@
+diff -Naur a/include/e_smi/amd_hsmp.h b/include/e_smi/amd_hsmp.h
+--- a/include/e_smi/amd_hsmp.h 1969-12-31 16:00:00.000000000 -0800
++++ b/include/e_smi/amd_hsmp.h 2023-03-29 10:16:14.350755709 -0700
+@@ -0,0 +1,316 @@
++/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
++
++#ifndef _ASM_X86_AMD_HSMP_H_
++#define _ASM_X86_AMD_HSMP_H_
++
++/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
++
++#ifndef _UAPI_ASM_X86_AMD_HSMP_H_
++#define _UAPI_ASM_X86_AMD_HSMP_H_
++
++#include <linux/types.h>
++
++#pragma pack(4)
++
++#define HSMP_MAX_MSG_LEN 8
++
++/*
++ * HSMP Messages supported
++ */
++enum hsmp_message_ids {
++ HSMP_TEST = 1, /* 01h Increments input value by 1 */
++ HSMP_GET_SMU_VER, /* 02h SMU FW version */
++ HSMP_GET_PROTO_VER, /* 03h HSMP interface version */
++ HSMP_GET_SOCKET_POWER, /* 04h average package power consumption */
++ HSMP_SET_SOCKET_POWER_LIMIT, /* 05h Set the socket power limit */
++ HSMP_GET_SOCKET_POWER_LIMIT, /* 06h Get current socket power limit */
++ HSMP_GET_SOCKET_POWER_LIMIT_MAX,/* 07h Get maximum socket power value */
++ HSMP_SET_BOOST_LIMIT, /* 08h Set a core maximum frequency limit */
++ HSMP_SET_BOOST_LIMIT_SOCKET, /* 09h Set socket maximum frequency level */
++ HSMP_GET_BOOST_LIMIT, /* 0Ah Get current frequency limit */
++ HSMP_GET_PROC_HOT, /* 0Bh Get PROCHOT status */
++ HSMP_SET_XGMI_LINK_WIDTH, /* 0Ch Set max and min width of xGMI Link */
++ HSMP_SET_DF_PSTATE, /* 0Dh Alter APEnable/Disable messages behavior */
++ HSMP_SET_AUTO_DF_PSTATE, /* 0Eh Enable DF P-State Performance Boost algorithm */
++ HSMP_GET_FCLK_MCLK, /* 0Fh Get FCLK and MEMCLK for current socket */
++ HSMP_GET_CCLK_THROTTLE_LIMIT, /* 10h Get CCLK frequency limit in socket */
++ HSMP_GET_C0_PERCENT, /* 11h Get average C0 residency in socket */
++ HSMP_SET_NBIO_DPM_LEVEL, /* 12h Set max/min LCLK DPM Level for a given NBIO */
++ HSMP_GET_NBIO_DPM_LEVEL, /* 13h Get LCLK DPM level min and max for a given NBIO */
++ HSMP_GET_DDR_BANDWIDTH, /* 14h Get theoretical maximum and current DDR Bandwidth */
++ HSMP_GET_TEMP_MONITOR, /* 15h Get socket temperature */
++ HSMP_GET_DIMM_TEMP_RANGE, /* 16h Get per-DIMM temperature range and refresh rate */
++ HSMP_GET_DIMM_POWER, /* 17h Get per-DIMM power consumption */
++ HSMP_GET_DIMM_THERMAL, /* 18h Get per-DIMM thermal sensors */
++ HSMP_GET_SOCKET_FREQ_LIMIT, /* 19h Get current active frequency per socket */
++ HSMP_GET_CCLK_CORE_LIMIT, /* 1Ah Get CCLK frequency limit per core */
++ HSMP_GET_RAILS_SVI, /* 1Bh Get SVI-based Telemetry for all rails */
++ HSMP_GET_SOCKET_FMAX_FMIN, /* 1Ch Get Fmax and Fmin per socket */
++ HSMP_GET_IOLINK_BANDWITH, /* 1Dh Get current bandwidth on IO Link */
++ HSMP_GET_XGMI_BANDWITH, /* 1Eh Get current bandwidth on xGMI Link */
++ HSMP_SET_GMI3_WIDTH, /* 1Fh Set max and min GMI3 Link width */
++ HSMP_SET_PCI_RATE, /* 20h Control link rate on PCIe devices */
++ HSMP_SET_POWER_MODE, /* 21h Select power efficiency profile policy */
++ HSMP_SET_PSTATE_MAX_MIN, /* 22h Set the max and min DF P-State */
++ HSMP_MSG_ID_MAX,
++};
++
++struct hsmp_message {
++ __u32 msg_id; /* Message ID */
++ __u16 num_args; /* Number of input argument words in message */
++ __u16 response_sz; /* Number of expected output/response words */
++ __u32 args[HSMP_MAX_MSG_LEN]; /* argument/response buffer */
++ __u16 sock_ind; /* socket number */
++};
++
++enum hsmp_msg_type {
++ HSMP_RSVD = -1,
++ HSMP_SET = 0,
++ HSMP_GET = 1,
++};
++
++struct hsmp_msg_desc {
++ int num_args;
++ int response_sz;
++ enum hsmp_msg_type type;
++};
++
++/*
++ * User may use these comments as reference, please find the
++ * supported list of messages and message definition in the
++ * HSMP chapter of respective family/model PPR.
++ *
++ * Not supported messages would return -ENOMSG.
++ */
++static const struct hsmp_msg_desc hsmp_msg_desc_table[] = {
++ /* RESERVED */
++ {0, 0, HSMP_RSVD},
++
++ /*
++ * HSMP_TEST, num_args = 1, response_sz = 1
++ * input: args[0] = xx
++ * output: args[0] = xx + 1
++ */
++ {1, 1, HSMP_GET},
++
++ /*
++ * HSMP_GET_SMU_VER, num_args = 0, response_sz = 1
++ * output: args[0] = smu fw ver
++ */
++ {0, 1, HSMP_GET},
++
++ /*
++ * HSMP_GET_PROTO_VER, num_args = 0, response_sz = 1
++ * output: args[0] = proto version
++ */
++ {0, 1, HSMP_GET},
++
++ /*
++ * HSMP_GET_SOCKET_POWER, num_args = 0, response_sz = 1
++ * output: args[0] = socket power in mWatts
++ */
++ {0, 1, HSMP_GET},
++
++ /*
++ * HSMP_SET_SOCKET_POWER_LIMIT, num_args = 1, response_sz = 0
++ * input: args[0] = power limit value in mWatts
++ */
++ {1, 0, HSMP_SET},
++
++ /*
++ * HSMP_GET_SOCKET_POWER_LIMIT, num_args = 0, response_sz = 1
++ * output: args[0] = socket power limit value in mWatts
++ */
++ {0, 1, HSMP_GET},
++
++ /*
++ * HSMP_GET_SOCKET_POWER_LIMIT_MAX, num_args = 0, response_sz = 1
++ * output: args[0] = maximuam socket power limit in mWatts
++ */
++ {0, 1, HSMP_GET},
++
++ /*
++ * HSMP_SET_BOOST_LIMIT, num_args = 1, response_sz = 0
++ * input: args[0] = apic id[31:16] + boost limit value in MHz[15:0]
++ */
++ {1, 0, HSMP_SET},
++
++ /*
++ * HSMP_SET_BOOST_LIMIT_SOCKET, num_args = 1, response_sz = 0
++ * input: args[0] = boost limit value in MHz
++ */
++ {1, 0, HSMP_SET},
++
++ /*
++ * HSMP_GET_BOOST_LIMIT, num_args = 1, response_sz = 1
++ * input: args[0] = apic id
++ * output: args[0] = boost limit value in MHz
++ */
++ {1, 1, HSMP_GET},
++
++ /*
++ * HSMP_GET_PROC_HOT, num_args = 0, response_sz = 1
++ * output: args[0] = proc hot status
++ */
++ {0, 1, HSMP_GET},
++
++ /*
++ * HSMP_SET_XGMI_LINK_WIDTH, num_args = 1, response_sz = 0
++ * input: args[0] = min link width[15:8] + max link width[7:0]
++ */
++ {1, 0, HSMP_SET},
++
++ /*
++ * HSMP_SET_DF_PSTATE, num_args = 1, response_sz = 0
++ * input: args[0] = df pstate[7:0]
++ */
++ {1, 0, HSMP_SET},
++
++ /* HSMP_SET_AUTO_DF_PSTATE, num_args = 0, response_sz = 0 */
++ {0, 0, HSMP_SET},
++
++ /*
++ * HSMP_GET_FCLK_MCLK, num_args = 0, response_sz = 2
++ * output: args[0] = fclk in MHz, args[1] = mclk in MHz
++ */
++ {0, 2, HSMP_GET},
++
++ /*
++ * HSMP_GET_CCLK_THROTTLE_LIMIT, num_args = 0, response_sz = 1
++ * output: args[0] = core clock in MHz
++ */
++ {0, 1, HSMP_GET},
++
++ /*
++ * HSMP_GET_C0_PERCENT, num_args = 0, response_sz = 1
++ * output: args[0] = average c0 residency
++ */
++ {0, 1, HSMP_GET},
++
++ /*
++ * HSMP_SET_NBIO_DPM_LEVEL, num_args = 1, response_sz = 0
++ * input: args[0] = nbioid[23:16] + max dpm level[15:8] + min dpm level[7:0]
++ */
++ {1, 0, HSMP_SET},
++
++ /*
++ * HSMP_GET_NBIO_DPM_LEVEL, num_args = 1, response_sz = 1
++ * input: args[0] = nbioid[23:16]
++ * output: args[0] = max dpm level[15:8] + min dpm level[7:0]
++ */
++ {1, 1, HSMP_GET},
++
++ /*
++ * HSMP_GET_DDR_BANDWIDTH, num_args = 0, response_sz = 1
++ * output: args[0] = max bw in Gbps[31:20] + utilised bw in Gbps[19:8] +
++ * bw in percentage[7:0]
++ */
++ {0, 1, HSMP_GET},
++
++ /*
++ * HSMP_GET_TEMP_MONITOR, num_args = 0, response_sz = 1
++ * output: args[0] = temperature in degree celsius. [15:8] integer part +
++ * [7:5] fractional part
++ */
++ {0, 1, HSMP_GET},
++
++ /*
++ * HSMP_GET_DIMM_TEMP_RANGE, num_args = 1, response_sz = 1
++ * input: args[0] = DIMM address[7:0]
++ * output: args[0] = refresh rate[3] + temperature range[2:0]
++ */
++ {1, 1, HSMP_GET},
++
++ /*
++ * HSMP_GET_DIMM_POWER, num_args = 1, response_sz = 1
++ * input: args[0] = DIMM address[7:0]
++ * output: args[0] = DIMM power in mW[31:17] + update rate in ms[16:8] +
++ * DIMM address[7:0]
++ */
++ {1, 1, HSMP_GET},
++
++ /*
++ * HSMP_GET_DIMM_THERMAL, num_args = 1, response_sz = 1
++ * input: args[0] = DIMM address[7:0]
++ * output: args[0] = temperature in degree celcius[31:21] + update rate in ms[16:8] +
++ * DIMM address[7:0]
++ */
++ {1, 1, HSMP_GET},
++
++ /*
++ * HSMP_GET_SOCKET_FREQ_LIMIT, num_args = 0, response_sz = 1
++ * output: args[0] = frequency in MHz[31:16] + frequency source[15:0]
++ */
++ {0, 1, HSMP_GET},
++
++ /*
++ * HSMP_GET_CCLK_CORE_LIMIT, num_args = 1, response_sz = 1
++ * input: args[0] = apic id [31:0]
++ * output: args[0] = frequency in MHz[31:0]
++ */
++ {1, 1, HSMP_GET},
++
++ /*
++ * HSMP_GET_RAILS_SVI, num_args = 0, response_sz = 1
++ * output: args[0] = power in mW[31:0]
++ */
++ {0, 1, HSMP_GET},
++
++ /*
++ * HSMP_GET_SOCKET_FMAX_FMIN, num_args = 0, response_sz = 1
++ * output: args[0] = fmax in MHz[31:16] + fmin in MHz[15:0]
++ */
++ {0, 1, HSMP_GET},
++
++ /*
++ * HSMP_GET_IOLINK_BANDWITH, num_args = 1, response_sz = 1
++ * input: args[0] = link id[15:8] + bw type[2:0]
++ * output: args[0] = io bandwidth in Mbps[31:0]
++ */
++ {1, 1, HSMP_GET},
++
++ /*
++ * HSMP_GET_XGMI_BANDWITH, num_args = 1, response_sz = 1
++ * input: args[0] = link id[15:8] + bw type[2:0]
++ * output: args[0] = xgmi bandwidth in Mbps[31:0]
++ */
++ {1, 1, HSMP_GET},
++
++ /*
++ * HSMP_SET_GMI3_WIDTH, num_args = 1, response_sz = 0
++ * input: args[0] = min link width[15:8] + max link width[7:0]
++ */
++ {1, 0, HSMP_SET},
++
++ /*
++ * HSMP_SET_PCI_RATE, num_args = 1, response_sz = 1
++ * input: args[0] = link rate control value
++ * output: args[0] = previous link rate control value
++ */
++ {1, 1, HSMP_SET},
++
++ /*
++ * HSMP_SET_POWER_MODE, num_args = 1, response_sz = 0
++ * input: args[0] = power efficiency mode[2:0]
++ */
++ {1, 0, HSMP_SET},
++
++ /*
++ * HSMP_SET_PSTATE_MAX_MIN, num_args = 1, response_sz = 0
++ * input: args[0] = min df pstate[15:8] + max df pstate[7:0]
++ */
++ {1, 0, HSMP_SET},
++};
++
++/* Reset to default packing */
++#pragma pack()
++
++/* Define unique ioctl command for hsmp msgs using generic _IOWR */
++#define HSMP_BASE_IOCTL_NR 0xF8
++#define HSMP_IOCTL_CMD _IOWR(HSMP_BASE_IOCTL_NR, 0, struct hsmp_message)
++
++#endif /*_ASM_X86_AMD_HSMP_H_*/
++
++int hsmp_send_message(struct hsmp_message *msg);
++
++#endif /*_ASM_X86_AMD_HSMP_H_*/
+diff -Naur a/include/e_smi/e_smi_monitor.h b/include/e_smi/e_smi_monitor.h
+--- a/include/e_smi/e_smi_monitor.h 2022-06-22 08:19:31.000000000 -0700
++++ b/include/e_smi/e_smi_monitor.h 2023-03-29 10:02:10.570876113 -0700
+@@ -50,7 +50,7 @@
+ */
+
+ #include <stdint.h>
+-#include <asm/amd_hsmp.h>
++#include <e_smi/amd_hsmp.h>
+ #include <e_smi/e_smi.h>
+
+ #define FILEPATHSIZ 512 //!< Buffer to hold size of sysfs filepath
diff --git a/esmi_ib_library.spec b/esmi_ib_library.spec
index bf6f4ce..341e6c4 100644
--- a/esmi_ib_library.spec
+++ b/esmi_ib_library.spec
@@ -17,6 +17,7 @@ Summary: E-SMI: EPYC System management Interface In-band Library
License: NCSA
URL: https://github.com/amd/esmi_ib_library
Source: %{url}/archive/%{commit}/%{name}-%{commit}.tar.gz
+Patch: esmi-amd_hsmp-include.patch
# This is a hardware enablement package for AMD x86_64 platforms
ExclusiveArch: x86_64
@@ -61,7 +62,12 @@ This package contains E-SMI tool, a program based on the E-SMI In-band library
that provides options to Monitor and Control System Management functionality.
%prep
-%autosetup -n %{name}-%{commit}
+%setup -q -n %{name}-%{commit}
+
+# The kernel on el8 and el9 is missing some includes we need so patch them in
+%if 0%{?el8} || 0%{?el9}
+%patch0 -p1
+%endif
# Use FHS install paths and patch version detection
sed -i CMakeLists.txt \
https://src.fedoraproject.org/rpms/esmi_ib_library/c/8b562e69d7856e80b34a...
2Â months
orion pushed to rpms/fail2ban (epel8). "Merge branch 'rawhide' into epel8"
by notificationsï¼ fedoraproject.org
Notification time stamped 2023-03-31 22:34:04 UTC
From 47267b8b953122c7fdec19fe5be38e3b7b46bad0 Mon Sep 17 00:00:00 2001
From: Orion Poplawski <orion(a)nwra.com>
Date: Mar 30 2023 16:35:40 +0000
Subject: Merge branch 'rawhide' into epel8
---
diff --git a/28473.patch b/28473.patch
deleted file mode 100644
index 3b315cf..0000000
--- a/28473.patch
+++ /dev/null
@@ -1,214 +0,0 @@
-From 659cd9223bb9a04cc50986a3b371e22e2bac9a91 Mon Sep 17 00:00:00 2001
-From: hsk17 <hsk17(a)mail.de>
-Date: Tue, 29 Nov 2022 12:11:59 +0100
-Subject: [PATCH 1/3] upstream configreader patch
-
-Signed-off-by: hsk17 <hsk17(a)mail.de>
----
- .../fail2ban-1.0.2-configreader-warning.patch | 23 +++++++++++++++++++
- 1 file changed, 23 insertions(+)
- create mode 100644 net-analyzer/fail2ban/files/fail2ban-1.0.2-configreader-warning.patch
-
-diff --git a/net-analyzer/fail2ban/files/fail2ban-1.0.2-configreader-warning.patch b/net-analyzer/fail2ban/files/fail2ban-1.0.2-configreader-warning.patch
-new file mode 100644
-index 0000000000000..74f2739708ae7
---- /dev/null
-+++ b/net-analyzer/fail2ban/files/fail2ban-1.0.2-configreader-warning.patch
-@@ -0,0 +1,23 @@
-+From 432e7e1e93936f09e349e80d94254e5f43d0cc8a Mon Sep 17 00:00:00 2001
-+From: "Sergey G. Brester" <serg.brester(a)sebres.de>
-+Date: Mon, 28 Nov 2022 13:21:15 +0100
-+Subject: [PATCH] no warning if no config value but default (debug message now)
-+
-+closes #3420
-+---
-+ fail2ban/client/configreader.py | 2 +-
-+ 1 file changed, 1 insertion(+), 1 deletion(-)
-+
-+diff --git a/fail2ban/client/configreader.py b/fail2ban/client/configreader.py
-+index 1b5a56a27c..c7f965ce52 100644
-+--- a/fail2ban/client/configreader.py
-++++ b/fail2ban/client/configreader.py
-+@@ -277,7 +277,7 @@ def getOptions(self, sec, options, pOptions=None, shouldExist=False, convert=Tru
-+ # TODO: validate error handling here.
-+ except NoOptionError:
-+ if not optvalue is None:
-+- logSys.warning("'%s' not defined in '%s'. Using default one: %r"
-++ logSys.debug("'%s' not defined in '%s'. Using default one: %r"
-+ % (optname, sec, optvalue))
-+ values[optname] = optvalue
-+ # elif logSys.getEffectiveLevel() <= logLevel:
-
-From 79a59ae91ece23711370af79dc820a801b05e56b Mon Sep 17 00:00:00 2001
-From: hsk17 <hsk17(a)mail.de>
-Date: Tue, 29 Nov 2022 12:13:05 +0100
-Subject: [PATCH 2/3] rev bump to add upstream configreader patch
-
-Signed-off-by: hsk17 <hsk17(a)mail.de>
----
- .../fail2ban/fail2ban-1.0.2-r1.ebuild | 134 ++++++++++++++++++
- 1 file changed, 134 insertions(+)
- create mode 100644 net-analyzer/fail2ban/fail2ban-1.0.2-r1.ebuild
-
-diff --git a/net-analyzer/fail2ban/fail2ban-1.0.2-r1.ebuild b/net-analyzer/fail2ban/fail2ban-1.0.2-r1.ebuild
-new file mode 100644
-index 0000000000000..64532f55baf31
---- /dev/null
-+++ b/net-analyzer/fail2ban/fail2ban-1.0.2-r1.ebuild
-@@ -0,0 +1,134 @@
-+# Copyright 1999-2022 Gentoo Authors
-+# Distributed under the terms of the GNU General Public License v2
-+
-+EAPI=8
-+
-+DISTUTILS_SINGLE_IMPL=1
-+PYTHON_COMPAT=( python3_{8..11} )
-+
-+inherit bash-completion-r1 distutils-r1 systemd tmpfiles
-+
-+DESCRIPTION="Scans log files and bans IPs that show malicious signs"
-+HOMEPAGE="https://www.fail2ban.org/"
-+
-+if [[ ${PV} == *9999 ]] ; then
-+ EGIT_REPO_URI="https://github.com/fail2ban/fail2ban"
-+ inherit git-r3
-+else
-+ SRC_URI="https://github.com/fail2ban/fail2ban/archive/${PV}.tar.gz -> ${P}.tar.gz"
-+ KEYWORDS="~alpha amd64 arm arm64 hppa ppc ppc64 sparc x86"
-+fi
-+
-+LICENSE="GPL-2"
-+SLOT="0"
-+IUSE="selinux systemd"
-+
-+RDEPEND="
-+ virtual/logger
-+ virtual/mta
-+ selinux? ( sec-policy/selinux-fail2ban )
-+ systemd? (
-+ $(python_gen_cond_dep '
-+ || (
-+ dev-python/python-systemd[${PYTHON_USEDEP}]
-+ sys-apps/systemd[python(-),${PYTHON_USEDEP}]
-+ )' 'python*' )
-+ )
-+"
-+
-+DOCS=( ChangeLog DEVELOP README.md THANKS TODO doc/run-rootless.txt )
-+
-+PATCHES=(
-+ "${FILESDIR}"/${PN}-0.11.2-adjust-apache-logs-paths.patch
-+ "${FILESDIR}"/${P}-configreader-warning.patch
-+)
-+
-+python_prepare_all() {
-+ distutils-r1_python_prepare_all
-+
-+ # Replace /var/run with /run, but not in the top source directory
-+ find . -mindepth 2 -type f -exec \
-+ sed -i -e 's|/var\(/run/fail2ban\)|\1|g' {} + || die
-+}
-+
-+python_compile() {
-+ ./fail2ban-2to3 || die
-+ distutils-r1_python_compile
-+}
-+
-+python_test() {
-+ bin/fail2ban-testcases \
-+ --no-network \
-+ --no-gamin \
-+ --verbosity=4 || die "Tests failed with ${EPYTHON}"
-+
-+ # Workaround for bug #790251
-+ rm -r fail2ban.egg-info || die
-+}
-+
-+python_install_all() {
-+ distutils-r1_python_install_all
-+
-+ rm -rf "${ED}"/usr/share/doc/${PN} "${ED}"/run || die
-+
-+ newconfd files/fail2ban-openrc.conf ${PN}
-+
-+ # These two are placed in the ${BUILD_DIR} after being "built"
-+ # in install_scripts().
-+ newinitd "${BUILD_DIR}/fail2ban-openrc.init" "${PN}"
-+ systemd_dounit "${BUILD_DIR}/${PN}.service"
-+
-+ dotmpfiles files/${PN}-tmpfiles.conf
-+
-+ doman man/*.{1,5}
-+
-+ # Use INSTALL_MASK if you do not want to touch /etc/logrotate.d.
-+ # See http://thread.gmane.org/gmane.linux.gentoo.devel/35675
-+ insinto /etc/logrotate.d
-+ newins files/${PN}-logrotate ${PN}
-+
-+ keepdir /var/lib/${PN}
-+
-+ newbashcomp files/bash-completion ${PN}-client
-+ bashcomp_alias ${PN}-client ${PN}-server ${PN}-regex
-+}
-+
-+pkg_preinst() {
-+ has_version "<${CATEGORY}/${PN}-0.7"
-+ previous_less_than_0_7=$?
-+}
-+
-+pkg_postinst() {
-+ tmpfiles_process ${PN}-tmpfiles.conf
-+
-+ if [[ ${previous_less_than_0_7} = 0 ]] ; then
-+ elog
-+ elog "Configuration files are now in /etc/fail2ban/"
-+ elog "You probably have to manually update your configuration"
-+ elog "files before restarting Fail2Ban!"
-+ elog
-+ elog "Fail2Ban is not installed under /usr/lib anymore. The"
-+ elog "new location is under /usr/share."
-+ elog
-+ elog "You are upgrading from version 0.6.x, please see:"
-+ elog "http://www.fail2ban.org/wiki/index.php/HOWTO_Upgrade_from_0.6_to_0.8"
-+ fi
-+
-+ if ! has_version dev-python/pyinotify && ! has_version app-admin/gamin ; then
-+ elog "For most jail.conf configurations, it is recommended you install either"
-+ elog "dev-python/pyinotify or app-admin/gamin (in order of preference)"
-+ elog "to control how log file modifications are detected"
-+ fi
-+
-+ if ! has_version dev-lang/python[sqlite] ; then
-+ elog "If you want to use ${PN}'s persistent database, then reinstall"
-+ elog "dev-lang/python with USE=sqlite. If you do not use the"
-+ elog "persistent database feature, then you should set"
-+ elog "dbfile = :memory: in fail2ban.conf accordingly."
-+ fi
-+
-+ if has_version sys-apps/systemd[-python] ; then
-+ elog "If you want to track logins through sys-apps/systemd's"
-+ elog "journal backend, then reinstall sys-apps/systemd with USE=python"
-+ fi
-+}
-
-From ab30bb72cf1cdb0ccd717c417c10eae82381d6d7 Mon Sep 17 00:00:00 2001
-From: hsk17 <hsk17(a)mail.de>
-Date: Tue, 27 Dec 2022 16:08:43 +0100
-Subject: [PATCH 3/3] Update fail2ban-1.0.2-configreader-warning.patch
-
-Signed-off-by: hsk17 <hsk17(a)mail.de>
----
- .../fail2ban/files/fail2ban-1.0.2-configreader-warning.patch | 3 +++
- 1 file changed, 3 insertions(+)
-
-diff --git a/net-analyzer/fail2ban/files/fail2ban-1.0.2-configreader-warning.patch b/net-analyzer/fail2ban/files/fail2ban-1.0.2-configreader-warning.patch
-index 74f2739708ae7..b53e604572cfd 100644
---- a/net-analyzer/fail2ban/files/fail2ban-1.0.2-configreader-warning.patch
-+++ b/net-analyzer/fail2ban/files/fail2ban-1.0.2-configreader-warning.patch
-@@ -1,3 +1,6 @@
-+
-+https://github.com/fail2ban/fail2ban/commit/432e7e1
-+
- From 432e7e1e93936f09e349e80d94254e5f43d0cc8a Mon Sep 17 00:00:00 2001
- From: "Sergey G. Brester" <serg.brester(a)sebres.de>
- Date: Mon, 28 Nov 2022 13:21:15 +0100
diff --git a/432e7e1e93936f09e349e80d94254e5f43d0cc8a.patch b/432e7e1e93936f09e349e80d94254e5f43d0cc8a.patch
new file mode 100644
index 0000000..74f2739
--- /dev/null
+++ b/432e7e1e93936f09e349e80d94254e5f43d0cc8a.patch
@@ -0,0 +1,23 @@
+From 432e7e1e93936f09e349e80d94254e5f43d0cc8a Mon Sep 17 00:00:00 2001
+From: "Sergey G. Brester" <serg.brester(a)sebres.de>
+Date: Mon, 28 Nov 2022 13:21:15 +0100
+Subject: [PATCH] no warning if no config value but default (debug message now)
+
+closes #3420
+---
+ fail2ban/client/configreader.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/fail2ban/client/configreader.py b/fail2ban/client/configreader.py
+index 1b5a56a27c..c7f965ce52 100644
+--- a/fail2ban/client/configreader.py
++++ b/fail2ban/client/configreader.py
+@@ -277,7 +277,7 @@ def getOptions(self, sec, options, pOptions=None, shouldExist=False, convert=Tru
+ # TODO: validate error handling here.
+ except NoOptionError:
+ if not optvalue is None:
+- logSys.warning("'%s' not defined in '%s'. Using default one: %r"
++ logSys.debug("'%s' not defined in '%s'. Using default one: %r"
+ % (optname, sec, optvalue))
+ values[optname] = optvalue
+ # elif logSys.getEffectiveLevel() <= logLevel:
diff --git a/fail2ban.spec b/fail2ban.spec
index 759fb73..266ad11 100644
--- a/fail2ban.spec
+++ b/fail2ban.spec
@@ -21,7 +21,7 @@ Patch1: fail2ban-python311.patch
# Patch for dovecot jail eating 100% CPU
#Patch2: https://github.com/fail2ban/fail2ban/commit/ca2b94c5229bd474f612b57b67d79...
# Remove warning about allowipv6 from startup
-Patch2: https://patch-diff.githubusercontent.com/raw/gentoo/gentoo/pull/28473.patch
+Patch2: https://github.com/fail2ban/fail2ban/commit/432e7e1e93936f09e349e80d94254...
BuildArch: noarch
https://src.fedoraproject.org/rpms/fail2ban/c/47267b8b953122c7fdec19fe5be...
2Â months