Blame SOURCES/0024-builddep-Warning-when-using-macros-with-source-rpms-.patch

7bd803
From 0afd47edc60fb7fe5c72fa64bca413bdce82d900 Mon Sep 17 00:00:00 2001
7bd803
From: Jan Kolarik <jkolarik@redhat.com>
7bd803
Date: Thu, 11 Aug 2022 14:12:06 +0200
7bd803
Subject: [PATCH] builddep: Warning when using macros with source rpms
7bd803
 (RhBug:2077820)
7bd803
7bd803
= changelog =
7bd803
type: bugfix
7bd803
resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2077820
7bd803
---
7bd803
 doc/builddep.rst    | 2 +-
7bd803
 plugins/builddep.py | 4 ++++
7bd803
 2 files changed, 5 insertions(+), 1 deletion(-)
7bd803
7bd803
diff --git a/doc/builddep.rst b/doc/builddep.rst
7bd803
index 6e9bde6..97eb823 100644
7bd803
--- a/doc/builddep.rst
7bd803
+++ b/doc/builddep.rst
7bd803
@@ -31,7 +31,7 @@ All general DNF options are accepted, see `Options` in :manpage:`dnf(8)` for det
7bd803
     Show this help.
7bd803
 
7bd803
 ``-D <macro expr>, --define <macro expr>``
7bd803
-    Define the RPM macro named `macro` to the value `expr` when parsing spec files.
7bd803
+    Define the RPM macro named `macro` to the value `expr` when parsing spec files. Does not apply for source rpm files.
7bd803
 
7bd803
 ``--spec``
7bd803
     Treat arguments as .spec files.
7bd803
diff --git a/plugins/builddep.py b/plugins/builddep.py
7bd803
index e3da012..e7dac43 100644
7bd803
--- a/plugins/builddep.py
7bd803
+++ b/plugins/builddep.py
7bd803
@@ -204,6 +204,10 @@ class BuildDepCommand(dnf.cli.Command):
7bd803
             err = _("Not all dependencies satisfied")
7bd803
             raise dnf.exceptions.Error(err)
7bd803
 
7bd803
+        if self.opts.define:
7bd803
+            logger.warning(_("Warning: -D or --define arguments have no meaning "
7bd803
+                             "for source rpm packages."))
7bd803
+
7bd803
     def _spec_deps(self, spec_fn):
7bd803
         try:
7bd803
             spec = rpm.spec(spec_fn)
7bd803
-- 
7bd803
2.37.1
7bd803