Bug 7609 - bare words are no longer supported in spec files
Summary: bare words are no longer supported in spec files
Alias: None
Product: ThinLinc
Classification: Unclassified
Component: Build system (show other bugs)
Version: trunk
Hardware: PC Unknown
: P2 Normal
Target Milestone: 4.13.0
Assignee: Samuel Mannehed
Keywords: ossman_tester, prosaic
Depends on:
Reported: 2020-12-11 17:04 CET by Samuel Mannehed
Modified: 2021-03-15 11:14 CET (History)
0 users

See Also:
Acceptance Criteria:


Description Samuel Mannehed cendio 2020-12-11 17:04:36 CET
On my Fedora 33 with RPM 4.16.0 our 'rpmscpec' fails when running repo/rebuild to refresh the repo/cache.

The repo/rebuild script doesn't show these errors from rpmspec, but if I run it manually I see this error:

> $ repo/rpmspec --arch armhf > /local/home/samuel/svn/cenbuild/repo/../build/prelink.spec
> error: bare words are no longer supported, please use "...":  armhf == i386 || armhf == x86_64
> error:                                                        ^
> error: /opt/cendio-build/lib/utils/macros:73: bad %if condition:  armhf == i386 || armhf == x86_64

As mentioned in the error, the fix is to add quotation marks around the arguments. This is likely a problem in many of our spec files all around.
Comment 1 Samuel Mannehed cendio 2020-12-14 13:52:05 CET
The effect of this bug is that cenbuild can't update the cache on systems with newer versions of RPM. This generally means that you can't build stuff.
Comment 2 Samuel Mannehed cendio 2020-12-17 14:25:14 CET
There's a tool called 'rpmlint' that can be used to verify the syntax in RPM spec files. However, due to some special macros we have in cenbuild I had to make this temporary modification to be able to run rpmlint:

+++ /opt/cendio-build/lib/utils/macros	2020-12-16 12:49:16.958148164 +0100
@@ -60,7 +60,7 @@
 # We need to make sure we have an arch defined
 %if "%{?_cendio_arch}" == ""
-%{error:You need to specify a target architecture (_cendio_arch)}
+%global _cendio_arch x86_64

I then verified that rpmlint does indeed complain about "bare words" not being supported any longer. It complains about a lot more stuff however aside from that error. In all 316 spec files in cenbuild it found 116 other errors and 695 warnings.

Most of them come from the fact that we have written spec file comments in the wrong way. Inline comments are not allowed in spec files.
Comment 3 Samuel Mannehed cendio 2020-12-17 14:25:53 CET
rpmlint can be run like this:

find . -name "*.spec" | xargs rpmlint
Comment 7 Samuel Mannehed cendio 2020-12-17 15:09:17 CET
The usage of bare words is now gone and both sides of the "==" and "!=" 
comparisons are now enclosed in quotes.

Furthermore, after fixing the spec file comments we are now down to 47 errors according to rpmlint.

I'll wait and see if the rebuild of the build system goes through before considering the bug resolved.
Comment 8 Samuel Mannehed cendio 2020-12-18 10:45:20 CET
The rebuild of the build system was successful. The changes were supposed to have no effect on older systems, and to me this indicates that things work as intended.
Comment 9 Pierre Ossman cendio 2020-12-18 10:59:28 CET
Changes look good. I cannot find anything overlooked when I grep for comparisons. Complete rebuild in Jenkins also passed fine.

I also forced a reparse of all .spec files and it seems to have read everything just fine.
Comment 10 Pierre Ossman cendio 2021-03-12 14:04:49 CET
This change has been committed but hasn't actually been rolled out as an update:

> error: bare words are no longer supported, please use "...":  i386 == i386 || i386 == x86_64
> error:                                                        ^
> error: /opt/cendio-build/lib/utils/macros:73: bad %if condition:  i386 == i386 || i386 == x86_64
Comment 12 Samuel Mannehed cendio 2021-03-12 16:28:55 CET
A new version of cendio-build-utils have now been built on chavez and then pushed out to our repos.
Comment 13 Pierre Ossman cendio 2021-03-15 11:14:40 CET
Confirmed working fine now on Fedora 33.

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