Blob Blame History Raw
From 0afd47edc60fb7fe5c72fa64bca413bdce82d900 Mon Sep 17 00:00:00 2001
From: Jan Kolarik <jkolarik@redhat.com>
Date: Thu, 11 Aug 2022 14:12:06 +0200
Subject: [PATCH] builddep: Warning when using macros with source rpms
 (RhBug:2077820)

= changelog =
type: bugfix
resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2077820
---
 doc/builddep.rst    | 2 +-
 plugins/builddep.py | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/doc/builddep.rst b/doc/builddep.rst
index 6e9bde6..97eb823 100644
--- a/doc/builddep.rst
+++ b/doc/builddep.rst
@@ -31,7 +31,7 @@ All general DNF options are accepted, see `Options` in :manpage:`dnf(8)` for det
     Show this help.
 
 ``-D <macro expr>, --define <macro expr>``
-    Define the RPM macro named `macro` to the value `expr` when parsing spec files.
+    Define the RPM macro named `macro` to the value `expr` when parsing spec files. Does not apply for source rpm files.
 
 ``--spec``
     Treat arguments as .spec files.
diff --git a/plugins/builddep.py b/plugins/builddep.py
index e3da012..e7dac43 100644
--- a/plugins/builddep.py
+++ b/plugins/builddep.py
@@ -204,6 +204,10 @@ class BuildDepCommand(dnf.cli.Command):
             err = _("Not all dependencies satisfied")
             raise dnf.exceptions.Error(err)
 
+        if self.opts.define:
+            logger.warning(_("Warning: -D or --define arguments have no meaning "
+                             "for source rpm packages."))
+
     def _spec_deps(self, spec_fn):
         try:
             spec = rpm.spec(spec_fn)
-- 
2.37.1