Re: [Rpm-maint] [rpm-software-management/rpm] Improve description of conditionals + comments in spec documentation (#830)

2019-09-10 Thread Panu Matilainen
Works for me.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/830#issuecomment-529891374___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] Improve description of conditionals + comments in spec documentation (#830)

2019-09-10 Thread Panu Matilainen
Merged #830 into master.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/830#event-2621887065___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] Improve description of conditionals + comments in spec documentation (#830)

2019-09-10 Thread pavlinamv
The comments are incorporated in the new version.
Thank you for the review. 

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/830#issuecomment-529876894___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] Improve description of conditionals + comments in spec documentation (#830)

2019-09-10 Thread pavlinamv
@pavlinamv pushed 2 commits.

db00406d78149cfaa0e78fea9426d5642bc6a95e  Improve description of conditionals 
in spec documentation
c150103aae26475d92ee26d6427a13f9f21890ad  Add description of comments in spec 
documentation


-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/rpm-software-management/rpm/pull/830/files/cdec9833c0d43651ca49873f22d042716eaa8629..c150103aae26475d92ee26d6427a13f9f21890ad
___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] Improve description of conditionals + comments in spec documentation (#830)

2019-09-09 Thread Panu Matilainen
pmatilai commented on this pull request.



> +%elifarch, %elifos or %else can be optionally used. Conditionals %endif and
+%else should not be followed by any text. Conditionals may be nested within
+other conditionals.
+
+Conditionals are not macros. It has an interesting consequence (similar as
+the fact that macros get expanded in comments). If a conditional is a part
+of a definition like
+\verbatim
+   %define macro_with_if \
+   %if 0  \
+   %global output XXX\
+   %endif
+\endverbatim
+the expansion (including %global) occurs before evaluating of the
+conditionals. Thus after the expansion of %macro_with_if macro %output
+is defined to XXX.

I don't think this last block belongs here, at least in this detail. Dark 
corners are often best left undocumented to allow changing if a saner behavior 
becomes feasible later. I'd condense that into something like:

%if-conditionals are not macros, and are unlikely to yield expected results if 
used in them.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/830#pullrequestreview-285483065___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] Improve description of conditionals + comments in spec documentation (#830)

2019-09-09 Thread Panu Matilainen
pmatilai commented on this pull request.



> +
+%if can be used for various purposes. The test can be evaluated based on
+the existence of a macro, like:
+\verbatim
+   %if %{defined with_foo} && %{undefined with_bar}
+\endverbatim
+string comparison:
+\verbatim
+   %if %{optimize_flags} != "none"
+\endverbatim
+or a mathematical statement:
+\verbatim
+   %if 0%{?fedora} > 10 || 0%{?rhel} > 7
+\endverbatim
+Generally, a mathematical statement allows to use logical operators
+&&, ||, !, relational operators !=, ==, <, > , <=, >= and parentheses.

Might as well document the rest of the mathematical operators as well (+-/*)

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/830#pullrequestreview-285478700___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] Improve description of conditionals + comments in spec documentation (#830)

2019-09-09 Thread Panu Matilainen
pmatilai commented on this pull request.



>   %endif
 \endverbatim
 
-Conditionals are not macros, thus they can be used in spec files only.
+%ifos is used to control RPM's spec file processing according to the
+build system's operating system.
+
+%if can be used for various purposes. The test can be evaluated based on
+the existence of a macro, like:
+\verbatim
+   %if %{defined with_foo} && %{undefined with_bar}
+\endverbatim
+string comparison:
+\verbatim
+   %if %{optimize_flags} != "none"

To set a good example, for string comparisons it's best to quote both operands.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/830#pullrequestreview-285477252___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] Improve description of conditionals + comments in spec documentation (#830)

2019-09-09 Thread Panu Matilainen
pmatilai commented on this pull request.



>   %endif
 \endverbatim
 
-Conditionals are not macros, thus they can be used in spec files only.
+%ifos is used to control RPM's spec file processing according to the
+build system's operating system.

It's not build system's operating system, but the build *target* operating 
system. In > 99% of the cases that's the same thing, but in theory rpm supports 
cross-architecture and -os builds.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/830#pullrequestreview-285475964___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] Improve description of conditionals + comments in spec documentation (#830)

2019-09-09 Thread Panu Matilainen
pmatilai commented on this pull request.



>  \verbatim
-   %ifarch ppc64 ppc x86_64
-   ...
-   %if 0%{?ver} && 0%{?ver} >= 100
-   ...
-   %else
-   ...
-   %endif
+   %ifarch %{power64} s390x x86_64 ia64
+   %global architectures 1

The new example is just as meaningles as the old one. While we're at it, lets 
make the example actually meaningful. As in, something that actually explains 
why somebody would want to use it, such as this snippet from anaconda.spec:
```
%ifarch s390 s390x
BuildRequires: s390utils-devel
%endif
```


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/830#pullrequestreview-285474685___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] Improve description of conditionals + comments in spec documentation (#830)

2019-09-09 Thread Panu Matilainen
pmatilai commented on this pull request.



> @@ -214,24 +214,67 @@ can express this as
BuildConflicts: gcc <= 2.7.2.1
 \endverbatim
 
+\section comments Comments
+
+Comments in spec file have # at the start of the line.
+\verbatim
+   # this is a comment
+\endverbatim
+Macros are expanded in comments, thus if a macro is in comment use two percent
+characters before it:

I'd make that more like:
```
Macros are expanded even in comment lines. If this is undesireable, escape the 
macro with an extra percent sign (%):
<...example..>
```

Now that we have such a thing, it'd be good to mention %dnl as a less quirky 
way of adding comments to specs.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/830#pullrequestreview-285472092___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


[Rpm-maint] [rpm-software-management/rpm] Improve description of conditionals + comments in spec documentation (#830)

2019-09-05 Thread pavlinamv
- Improve description of conditionals in spec documentation
- Add description of comments in spec documentation
You can view, comment on, or merge this pull request online at:

  https://github.com/rpm-software-management/rpm/pull/830

-- Commit Summary --

  * Improve description of conditionals in spec documentation
  * Add description of comments in spec documentation

-- File Changes --

M doc/manual/spec (67)

-- Patch Links --

https://github.com/rpm-software-management/rpm/pull/830.patch
https://github.com/rpm-software-management/rpm/pull/830.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/830
___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint