public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
To: git-commits@fedoraproject.org
Subject: [rpms/rpkg] 1.70-1: Patch: Add `--custom-user-metadata` to build command
Date: Mon, 10 Aug 2026 21:44:25 GMT [thread overview]
Message-ID: <178639826578.1.12479769567621041588.rpms-rpkg-c4386cfdd5c0@fedoraproject.org> (raw)
A new commit has been pushed.
Repo : rpms/rpkg
Branch : 1.70-1
Commit : c4386cfdd5c0a6ddace7d97f30bf853447b46d20
Author : Ondřej Nosek <onosek@redhat.com>
Date : 2022-03-19T15:33:53+00:00
Stats : +138/-7 in 2 file(s)
URL : https://src.fedoraproject.org/rpms/rpkg/c/c4386cfdd5c0a6ddace7d97f30bf853447b46d20?branch=1.70-1
Log:
Patch: Add `--custom-user-metadata` to build command
Signed-off-by: Ondřej Nosek <onosek@redhat.com>
---
diff --git a/0004-Add-custom-user-metadata-to-build-command.patch b/0004-Add-custom-user-metadata-to-build-command.patch
new file mode 100644
index 0000000..1550b16
--- /dev/null
+++ b/0004-Add-custom-user-metadata-to-build-command.patch
@@ -0,0 +1,127 @@
+From f008396c503f02e4a9af6e81c5d95a3c86fb2198 Mon Sep 17 00:00:00 2001
+From: Ondrej Nosek <onosek@redhat.com>
+Date: Wed, 9 Mar 2022 03:24:12 +0100
+Subject: [PATCH] Add `--custom-user-metadata` to build command
+
+Add support for `--custom-user-metadata` argument for `build` and
+`scratch-build` commands. This will pass a JSON string of custom
+metadata to Koji/Brew to be deserialized and stored under the build's
+extra.custom_user_metadata field.
+Example: fedpkg scratch-build --srpm --custom-user-metadata
+'{"name1":"value1","name2":"value2"}'
+
+JIRA: RHELCMP-8318
+Signed-off-by: Ondrej Nosek <onosek@redhat.com>
+---
+ pyrpkg/__init__.py | 5 ++++-
+ pyrpkg/cli.py | 19 ++++++++++++++++++-
+ tests/test_cli.py | 12 ++++++++++++
+ 3 files changed, 34 insertions(+), 2 deletions(-)
+
+diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py
+index 85970df..ab8a4a6 100644
+--- a/pyrpkg/__init__.py
++++ b/pyrpkg/__init__.py
+@@ -2312,7 +2312,7 @@ class Commands(object):
+
+ def build(self, skip_tag=False, scratch=False, background=False,
+ url=None, chain=None, arches=None, sets=False, nvr_check=True,
+- fail_fast=False):
++ fail_fast=False, custom_user_metadata=None):
+ """Initiate a build in build system
+
+ :param bool skip_tag: Skip the tag action after the build.
+@@ -2328,6 +2328,7 @@ class Commands(object):
+ :param bool fail_fast: Perform the build in fast failure mode, which
+ will cause the entire build to fail if any subtask/architecture
+ build fails.
++ :param str custom_user_metadata JSON string of custom metadata
+ :return: task ID returned from Koji API ``build`` and ``chainBuild``.
+ :rtype: int
+ """
+@@ -2394,6 +2395,8 @@ class Commands(object):
+ raise rpkgError('Invalid architecture name: %s' % arch)
+ cmd.append('--arch-override=%s' % ','.join(arches))
+ opts['arch_override'] = ' '.join(arches)
++ if custom_user_metadata:
++ opts['custom_user_metadata'] = custom_user_metadata
+
+ cmd.append(self.target)
+
+diff --git a/pyrpkg/cli.py b/pyrpkg/cli.py
+index 8efb841..6423664 100644
+--- a/pyrpkg/cli.py
++++ b/pyrpkg/cli.py
+@@ -16,6 +16,7 @@ from __future__ import print_function
+
+ import argparse
+ import getpass
++import json
+ import logging
+ import os
+ import re
+@@ -505,6 +506,10 @@ class cliClient(object):
+ help='Submit build to buildsystem without check if NVR was '
+ 'already built. NVR is constructed locally and may be '
+ 'different from NVR constructed during build on builder.')
++ self.build_parser_common.add_argument(
++ "--custom-user-metadata", type=str,
++ help=('Provide a JSON string of custom metadata to be deserialized and '
++ 'stored under the build\'s extra.custom_user_metadata field'))
+
+ def register_rpm_common(self):
+ """Create a common parser for rpm commands"""
+@@ -1994,6 +1999,17 @@ class cliClient(object):
+ if self.args.target:
+ self.cmd.target = self.args.target
+
++ custom_user_metadata = {}
++ if hasattr(self.args, 'custom_user_metadata') and self.args.custom_user_metadata:
++ try:
++ custom_user_metadata = json.loads(self.args.custom_user_metadata)
++ # Use ValueError instead of json.JSONDecodeError for Python 2 and 3 compatibility
++ except ValueError as e:
++ self.parser.error("--custom-user-metadata is not valid JSON: %s" % e)
++
++ if not isinstance(custom_user_metadata, dict):
++ self.parser.error("--custom-user-metadata must be a JSON object")
++
+ # handle uploading the srpm if we got one
+ url = self._handle_srpm_option()
+
+@@ -2006,7 +2022,8 @@ class cliClient(object):
+ arches=arches,
+ sets=sets,
+ nvr_check=nvr_check,
+- fail_fast=self.args.fail_fast)
++ fail_fast=self.args.fail_fast,
++ custom_user_metadata=custom_user_metadata)
+
+ def chainbuild(self):
+ """Implement chain-build command"""
+diff --git a/tests/test_cli.py b/tests/test_cli.py
+index dd21a54..35b9b53 100644
+--- a/tests/test_cli.py
++++ b/tests/test_cli.py
+@@ -3590,6 +3590,18 @@ class TestBuildPackage(FakeKojiCreds, CliTestCase):
+ cli_opts=['--fail-fast'],
+ expected_opts={'fail_fast': True})
+
++ def test_option_custom_user_metadata(self):
++ self.assert_build('build',
++ cli_opts=['--custom-user-metadata', '{"a":"b"}'],
++ expected_opts={'custom_user_metadata': {'a': 'b'}})
++
++ def test_option_custom_user_metadata_scratch(self):
++ self.assert_build('scratch-build',
++ cli_opts=['--custom-user-metadata', '{"a": "b", "c": "d"}'],
++ expected_opts={
++ 'scratch': True,
++ 'custom_user_metadata': {'a': 'b', 'c': 'd'}})
++
+ @patch('pyrpkg.Commands.nvr', new_callable=PropertyMock)
+ def test_fail_to_get_nvr_but_has_to_check_nvr_existence(self, nvr):
+ nvr.side_effect = rpkgError
+--
+2.35.1
+
diff --git a/rpkg.spec b/rpkg.spec
index 5c027b9..30366ed 100644
--- a/rpkg.spec
+++ b/rpkg.spec
@@ -1,6 +1,6 @@
Name: rpkg
Version: 1.64
-Release: 2%{?dist}
+Release: 3%{?dist}
Summary: Python library for interacting with rpm+git
License: GPLv2+ and LGPLv2
@@ -9,17 +9,17 @@ BuildArch: noarch
Source0: https://pagure.io/releases/rpkg/%{name}-%{version}.tar.gz
# RHEL7 is currently the only release that is built for Python 2.
-%if 0%{?fedora} || 0%{?rhel} > 7
-# Disable python2 build by default
-%global with_python2 0
-# Enable python3 build by default
-%global with_python3 1
-%else
+%if 0%{?rhel} == 7
%global with_python2 1
%global with_python3 0
# sitelib for noarch packages, sitearch for others (remove the unneeded one)
%{!?__python2: %global __python2 %{__python}}
%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
+%else
+# Disable python2 build by default
+%global with_python2 0
+# Enable python3 build by default
+%global with_python3 1
%endif
@@ -37,6 +37,7 @@ Patch2: 0002-Remove-pytest-coverage-execution.patch
%if 0%{?with_python2}
Patch3: 0003-Remove-Environment-Markers-syntax.patch
%endif
+Patch4: 0004-Add-custom-user-metadata-to-build-command.patch
%description
Python library for interacting with rpm+git
@@ -249,6 +250,9 @@ example_cli_dir=$RPM_BUILD_ROOT%{_datadir}/%{name}/examples/cli
%changelog
+* Fri Mar 18 2022 Ondřej Nosek <onosek@redhat.com> - 1.64-3
+- Patch: Add `--custom-user-metadata` to build command
+
* Tue Feb 08 2022 Ondřej Nosek <onosek@redhat.com> - 1.64-2
- Upload correct tarball
reply other threads:[~2026-08-10 21:44 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=178639826578.1.12479769567621041588.rpms-rpkg-c4386cfdd5c0@fedoraproject.org \
--to=git-commits@fedoraproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox