Bug 2068607 - rpmdev-bumpspec wrong lookup path for includes
Summary: rpmdev-bumpspec wrong lookup path for includes
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: rpmdevtools
Version: 34
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Neal Gompa
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-03-25 19:12 UTC by Robbie Harwood
Modified: 2022-05-06 08:20 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-05-04 10:57:02 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Robbie Harwood 2022-03-25 19:12:27 UTC
rharwood@eesha:~/pesign.fedora/rawhide$ rpmdev-bumpspec pesign.spec 
error: Unable to open /home/rharwood/rpmbuild/SOURCES/pesign.patches: No such file or directory
error: query of specfile pesign.spec failed, can't parse
rharwood@eesha:~/pesign.fedora/rawhide$ ls -l pesign.patches 
-rw-r--r-- 1 rharwood rharwood 193 Mar 25 15:02 pesign.patches
rharwood@eesha:~/pesign.fedora/rawhide$ 

To me, it looks like rpmdev-bumpspec is looking in the wrong place - somewhere below rpmbuild, which isn't where we are.  (This is the `fedpkg clone pesign` directory.)

The result, beyond that error, seems to be that rpmdev-bumpspec successfully updates Release, but misses the NVR in the changelog entry:

+* Fri Mar 25 2022 Robbie Harwood <rharwood>
+- rebuilt

(which is the actual issue for me).

rharwood@eesha:~/pesign.fedora/rawhide$ rpm -qv rpmdevtools
rpmdevtools-9.6-1.fc34.noarch
rharwood@eesha:~/pesign.fedora/rawhide$

Comment 1 Michael Schwendt 2022-04-11 06:14:59 UTC
It's your spec file that breaks "rpm" queries already. Run anything based on "rpm -q --specfile pesign.spec" to see.

Comment 2 Fabio Valentini 2022-05-04 10:57:02 UTC
> The result, beyond that error, seems to be that rpmdev-bumpspec successfully updates Release, but misses the NVR in the changelog entry:

I think it would better to not write partial results when parsing the .spec file fails?
I reported this issue with rpmdevtools here: https://pagure.io/rpmdevtools/issue/93

> (This is the `fedpkg clone pesign` directory.)

Yes, but rpmdev-bumpspec cannot (or at least, *does not*) know that. Indeed, RPM is quite stupid here, and by default, it will look for files in /home/$USER/rpmbuild/SOURCES/ unless you specify otherwise. I think this is a terrible default nowadays, but changing it will break every user who uses the ~/rpmbuild directory structure.

If you want RPM tools to behave in "one flat directory per package" / "dist-git-style", you can put these macros into ~/.rpmmacros, which will render the ~/rpmbuild directory unused, and make all RPM tools look for files only in %(pwd) instead:

%_topdir        %(pwd)
%_rpmtopdir     %{_topdir}
%_builddir      %{_rpmtopdir}
%_buildrootdir  %{_rpmtopdir}
%_sourcedir     %{_rpmtopdir}
%_specdir       %{_rpmtopdir}
%_rpmdir        %{_rpmtopdir}
%_srcrpmdir     %{_rpmtopdir}

Comment 3 Robbie Harwood 2022-05-04 14:51:28 UTC
> If you want RPM tools to behave in "one flat directory per package" / "dist-git-style", you can put these macros into ~/.rpmmacros, which will render the ~/rpmbuild directory unused, and make all RPM tools look for files only in %(pwd) instead:

What I want is for there to be a tool I can run that bumps the version in the spec for fedora packages I work on.  I don't really care what tool that is so long as it's available.  Right now, collective wisdom says that it's rpmdev-bumpspec, but what you're saying suggests that rpmdevtools isn't interested in that use case.  Maybe we need a `fedpkg bumpspec` that does all this instead.

Comment 4 Fabio Valentini 2022-05-04 15:12:40 UTC
> What I want is for there to be a tool I can run that bumps the version in the spec for fedora packages I work on.

rpmdev-bumpspec *is* that tool, and it should work for ~99.95% of Fedora .spec files, in both dist-git folders and in ~/rpmbuild directory trees.

The only reason it does not work for pesign.spec within its dist-git folder is because it uses the %include RPM macro (only for including a five-line list of Patches?).

> but what you're saying suggests that rpmdevtools isn't interested in that use case

Only 17 packages (~0.05%) in Fedora use the %include macro, so it's not well supported by our tools in all circumstances (i.e., calling rpmdev-bumpspec in a dist-git repository without having the local macro overrides). So I wouldn't say that rpmdevtools isn't interested, it's just *very low priority* because it affects such a small number of packages, and because most packagers just use the workaround I mentioned above.

If you don't want to use the local macro overrides workaround for some reason, please file an RFE for an "fedpkg bumpspec" that automatically overrides "%_sourcedir" with "%(pwd)" when calling rpmdev-bumpspec. I don't think we should add a rather "heavy" and possibly error-prone "am I running within a dist-git repo" detection to rpmdev-bumpspec.

Comment 5 Michael Schwendt 2022-05-06 08:20:57 UTC
Automatically overriding %_sourcedir would break when using it within rpmbuild's default tree.


Note You need to log in before you can comment on or make changes to this bug.