Re: [Rpm-maint] [rpm-software-management/rpm] Indentation support for tags (Issue #2927)

2024-03-14 Thread Florian Festi
Added some docs so you can find out things like that.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/2927#issuecomment-1997521895
You are receiving this because you are subscribed to this thread.

Message ID: ___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] Indentation support for tags (Issue #2927)

2024-03-14 Thread Panu Matilainen
Closed #2927 as completed via #2957.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/2927#event-12118649260
You are receiving this because you are subscribed to this thread.

Message ID: 
___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] Indentation support for tags (Issue #2927)

2024-03-11 Thread Vít Ondruch
Just FTR, I keep asking because example like this:

https://src.fedoraproject.org/rpms/nodejs20/blob/3391b85e233fb582fff9471c23788df5ad582d21/f/nodejs20.spec#_156-162

What could be nested here if the PR was accepted?

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/2927#issuecomment-1988728668
You are receiving this because you are subscribed to this thread.

Message ID: ___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] Indentation support for tags (Issue #2927)

2024-03-11 Thread Vít Ondruch
> The situation wrt other sections is a bit more complicated. RPM itself does 
> not really support indentation in most. Instead for most sections (scripts 
> and scriptlets) it just does macro expansion and `#if` magic and then hands 
> the result to some interpreter - or sticks it into a tag to be handed to an 
> interpreter later. So basically each section has it's own syntax. E.g. 
> `%sources` and `%patches` will happily add any indentation to the front of 
> the file name. So we are talking about the Preamble here only.

Yes, section content is section content. But I think that this is not possible: 
` %description` (note the space before `%`):

~~~
error: line 101: Unknown tag:  %description
~~~

and I might be wrong, but I don't see this supported by the PR. Or at least I 
can't see this covered by test case.

Also I am not sure how the ` %package foo` would work. RPM does not report any 
error ATM and I suspect that such line is assumed to be part of earlier 
`%description` in my case, because adding `%description foo` afterwards, I 
receive error:

~~~
error: line 106: %description foo: package newpackage-foo does not exist
~~~

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/2927#issuecomment-1988711676
You are receiving this because you are subscribed to this thread.

Message ID: ___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] Indentation support for tags (Issue #2927)

2024-03-11 Thread Florian Festi
The situation wrt other sections is a bit more complicated. RPM itself does not 
really support indentation in most. Instead for most sections (scripts and 
scriptlets) it just does macro expansion and `#if` magic and then hands the 
result to some interpreter - or sticks it into a tag to be handed to an 
interpreter later. So basically each section has it's own syntax. E.g. 
`%sources` and `%patches` will happily add any indentation to the front of the 
file name. So we are talking about the Preamble here only.

And yes, some syntax highlighting plugins would need to be adjusted.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/2927#issuecomment-1988655545
You are receiving this because you are subscribed to this thread.

Message ID: ___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] Indentation support for tags (Issue #2927)

2024-03-11 Thread Vít Ondruch
If the nesting for preamble was allowed, would be nestable also other sections, 
such as `%describtion`, `%pre`, etc?

BTW this change would break at minimum Vim syntax highlighter.


-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/2927#issuecomment-1988628252
You are receiving this because you are subscribed to this thread.

Message ID: ___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] Indentation support for tags (Issue #2927)

2024-03-11 Thread Vít Ondruch
> Not sure why your personal taste would have any weight in this discussion

Maybe because you value community feedback?

> Neither does this change require proper nesting from anyone

Actually RPM requires proper nesting now (no nesting) and it is mostly fine. 
Allowing nesting will open the discussion about proper nesting, if it should be 
e.g. 2 spaces or single tab etc. It will motivate people to adjust nesting by 
conditions, making diffs bigger.

No choice is sometimes better.

> nor is white space disallowed in these macro expressions (as one can easily 
> check with `rpm -E`).

Not everything can be tested by `rpm -E` probably:

~~~
$ rpmbuild -D "_sourceddir ." -D "_srpmdir ." -bs newpackage.spec
setting SOURCE_DATE_EPOCH=1705363200
Wrote: /home/vondruch/rpmbuild/SRPMS/newpackage-1-1.fc41.src.rpm
~~~

vs:

~~~
$ rpmbuild -D "_sourceddir ." -D "_srpmdir ." -bs newpackage.spec.space
error: line 150: Unknown tag:  BuildRequires: foo
~~~

and this is the difference:

~~~
$ diff -u newpackage.spec{,.space}
--- newpackage.spec 2024-03-11 14:59:41.476458832 +0100
+++ newpackage.spec.space   2024-03-11 14:59:37.510442485 +0100
@@ -147,7 +147,7 @@
 Version: 1
 Release: 1%{?dist}
 License: MIT
-%{!?foo:BuildRequires: foo}
+%{!?foo: BuildRequires: foo}
 
 %description
 
~~~



-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/2927#issuecomment-1988523363
You are receiving this because you are subscribed to this thread.

Message ID: ___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] Indentation support for tags (Issue #2927)

2024-03-11 Thread Root-Core
It would just be more consistent in my opinion, as everything (?) else works 
indented in an if block.
For me it would be a relief if the parsing (of any human-readable file) was 
consistent in this matter. There should always be a reason for an exception, 
and to my knowledge this is not the case.

On the other hand, I'm not a maintainer and have no experience in building 
RPMs, as this was my first attempt.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/2927#issuecomment-1988307718
You are receiving this because you are subscribed to this thread.

Message ID: ___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] Indentation support for tags (Issue #2927)

2024-03-11 Thread Florian Festi
Not sure why your personal taste would have any weight in this discussion. 
Neither does this change require proper nesting from anyone nor is white space 
disallowed in these macro expressions (as one can easily check with `rpm -E`).

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/2927#issuecomment-1988263184
You are receiving this because you are subscribed to this thread.

Message ID: ___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] Indentation support for tags (Issue #2927)

2024-03-11 Thread Vít Ondruch
I am against this request. The .spec file is not exactly easy to parse and this 
won't improve the situation. Also, it is kind of relieving that I don't have to 
bother with "proper" nesting inside conditionals.

BTW what is the impact on the shorthand such as:

~~~
{?suse_version:Requires: xdotool}
{!?suse_version:Requires: libxdo}
~~~

I think the space is currently not allowed in this construct

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/2927#issuecomment-1988213113
You are receiving this because you are subscribed to this thread.

Message ID: ___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


[Rpm-maint] [rpm-software-management/rpm] Indentation support for tags (Issue #2927)

2024-02-22 Thread Root-Core
**Describe the bug**

I try to implement a cross distribution spec file and the dependency names 
differ.
So I added an if and it works fine, until I indent the line in the if.

**To Reproduce**

1. Store the spec file in `/tmp/test.spec`
2. run `rpm --specfile /tmp/test.spec`

```
Name:   demo
Version:1.0.0
Release:0
Summary:RPM package
License:GPL
BuildArch:  noarch

%if 0%{?suse_version}
  Requires: xdotool
%else
  Requires: libxdo
%endif

%description
This is a test.

%install
%__install -m 755 mybinary -Dt %{buildroot}%{_bindir}/

%files
%{_bindir}/mybinary
```

**Expected behavior**

It should be fine and output `demo-1.0.0-0.noarch`.

**Output**

```
error: line 11: Unknown tag:   Requires: libxdo
error: query of specfile /tmp/test.spec failed, can't parse
```

**Environment**

 - OS / Distribution: tested on Alma and openSUSE
 - Version 4.16.1.3 / 4.14.3

**Additional context**

I am a total rpm newbie and this might be the desired behavior.
I know that the spec file "expands" / is evaluated to something with an 
randomly indented line, but it looks way better in the spec file.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/2927
You are receiving this because you are subscribed to this thread.

Message ID: ___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint