[Rpm-maint] [rpm-software-management/rpm] 4.19.1.1: `rpmbuild --undefine foo` is not qorking (Issue #2923)
Tomasz Kłoczko
notifications at github.com
Wed Feb 21 15:49:13 UTC 2024
I know that this option is not mentioned anywhere in documentation however IMO it should be present to be able not only define from command line macro using `--define foo` but as well undefine it if it is present in global or spec macros.
So this is I've decided to raise this not as RFE but issue ticket.
More interesting is that on use `rpmbuild --undefine foo` rpmbuild do not fails with message informing that it is is unsupported option.
I'm not 100% how `--undefine` option is recognised but looks like some parts or rpm command line parsing are involved.
I made two test specs to expose that
<details>
<summary>test-define.spec</summary>
```spec
Summary: test --define
Name: test-define
Version: 1
License: foo
Release: 2%{?dist}
%description
Test --define.
%prep
%if 0%{?test}
echo "test defined"
%endif
%check
echo "%{name} package has no test suite"
%files
```
</details>
<details>
<summary>test-undefine.spec</summary>
```spec
%define test 1
Summary: test --undefine
Name: test-undefine
Version: 1
License: foo
Release: 2%{?dist}
%description
Test --undefine.
%prep
%if 0%{?test}
echo "test defined"
%endif
%check
echo "%{name} package has no test suite"
%files
```
</details>
And here are results:
```console
[tkloczko at pers-jacek SPECS]$ rpmbuild -bp test-define.spec
warning: source_date_epoch_from_changelog set but %changelog is missing
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.ySytzr
+ umask 022
+ cd /home/tkloczko/rpmbuild/BUILD
+ RPM_EC=0
++ jobs -p
+ exit 0
RPM build warnings:
source_date_epoch_from_changelog set but %changelog is missing
[tkloczko at pers-jacek SPECS]$ rpmbuild -bp test-define.spec --define "test 1"
warning: source_date_epoch_from_changelog set but %changelog is missing
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.PANGwI
+ umask 022
+ cd /home/tkloczko/rpmbuild/BUILD
+ echo 'test defined'
test defined
+ RPM_EC=0
++ jobs -p
+ exit 0
RPM build warnings:
source_date_epoch_from_changelog set but %changelog is missing
```
So it works as expected.
And here is `--undefine` test
```console
[tkloczko at pers-jacek SPECS]$ rpmbuild -bp test-undefine.spec
warning: source_date_epoch_from_changelog set but %changelog is missing
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.GM3NF2
+ umask 022
+ cd /home/tkloczko/rpmbuild/BUILD
+ echo 'test defined'
test defined
+ RPM_EC=0
++ jobs -p
+ exit 0
RPM build warnings:
source_date_epoch_from_changelog set but %changelog is missing
[tkloczko at pers-jacek SPECS]$ rpmbuild -bp test-undefine.spec --undefine test
warning: source_date_epoch_from_changelog set but %changelog is missing
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.2kdiZT
+ umask 022
+ cd /home/tkloczko/rpmbuild/BUILD
+ echo 'test defined'
test defined
+ RPM_EC=0
++ jobs -p
+ exit 0
RPM build warnings:
source_date_epoch_from_changelog set but %changelog is missing
```
So `--undefine` as cmd param is recognised however second case is not handled as expected.
I'm almost sure that fixing that could be one one or two code change .. however cannot locate that.
May I ask for help? 🤔
--
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/2923
You are receiving this because you are subscribed to this thread.
Message ID: <rpm-software-management/rpm/issues/2923 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20240221/8dbd25c7/attachment-0001.html>
More information about the Rpm-maint
mailing list