Re: [Rpm-maint] [rpm-software-management/rpm] Don't let macro '%-x' add extra space between flag and argument (PR #2455)

2023-10-11 Thread Ralf Habacker
@rhabacker pushed 4 commits.

4e3b5b997d6f076da8fbd5663c0b7851a4e03d25  Add macro '%-x**' containing all 
occurrences of the flag '-x' or '-x '.
fdd6d430f35ebd5b668b6fbd63f60e246797a0b3  Add test case for macro '%-x**'
c4d439b31f22e1f201d7fa7935c38b0b6056ee46  Add test case for macro '%-x'
d05de19bda75ab62cdb0669d8455060395ffccad  Don't let macro '%-x' add extra space 
between flag and argument

-- 
View it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2455/files/a23d8bedea7eb59d50e4d8384a46ba22ab5cf422..d05de19bda75ab62cdb0669d8455060395ffccad
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] Add doc notes related to option processing (PR #2542)

2023-06-13 Thread Ralf Habacker
@rhabacker commented on this pull request.



> @@ -43,6 +43,15 @@ macros are available:
 | %{-f*} | if present at invocation, the argument to the last occurence of 
flag f
 | %1, %2, ...| the arguments themselves (after getopt(3) processing)
 
+With rpm >= 4.17 and disabled option processing the mentioned macros are 
defined as:
+
+| Macro  | Description | Notes
+| -- | --- | --
+| %0 | the name of the macro being invoked
+| %*, %** | all arguments
+| %# | the number of arguments
+| %1, %2, ...| the arguments themselves

I separated that because these macros do have a different meaning 

- enabled option processing

| Macro  | Description
| -- | ---
| %* | all arguments (unlike shell, not including any processed flags)
| %**| all arguments (including any processed flags)
| %1, %2, ...|  the arguments themselves (after getopt(3) processing)

- disabled option processing

| Macro  | Description
| -- | ---
| %*, %** | all flags and arguments
| %1, %2, ...| the flags and arguments themselves

How to handle them ?

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2542#discussion_r1227891619
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] Add doc notes related to option processing (PR #2542)

2023-06-12 Thread Ralf Habacker
See #2541
You can view, comment on, or merge this pull request online at:

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

-- Commit Summary --

  * Add doc note about 'disabled option processing'
  * Add doc note that getopt processing only supports short options

-- File Changes --

M docs/manual/macros.md (17)

-- Patch Links --

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

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2542
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] rpm macros cannot process long options (Issue #2541)

2023-06-12 Thread Ralf Habacker
> ... at least implicitly documented via the parametric macro declaration 
> syntax, that only short option names are supported by rpm itself. 

This could be formulated even more clearly. 

> Passing `-` as the option string delegates _all_ option processing to the 
> macro (as per 
> https://rpm-software-management.github.io/rpm/manual/macros.html), 

This seems to have been added with #1392, and since it's a workaround for not 
supporting long options, I think it's worth adding a note that it only works 
with rpm >= 4.17 and how the shell-like macros are set up.

Looking at the code, it looks like %# is set to the number of arguments, each 
single argument is put into %1..%n and all arguments are merged into %* and 
%**; the macros %{-x..} macros are not defined.

> %1, %2, … the arguments themselves (after getopt(3) processing)

This statement is not true for this case.



-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/2541#issuecomment-1587222088
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] rpm macros cannot process long options (Issue #2541)

2023-06-12 Thread Ralf Habacker
> Passing `-` as the option string delegates _all_ option processing to the 
> macro (as per 
> https://rpm-software-management.github.io/rpm/manual/macros.html),

This is not true for rpm version 4.14 (which is the default on Leap) as 
mentioned in the first report, it simply outputs 

> $ rpm --define '%foo(-) "%**"' --eval '%foo --test'
> foo: invalid option -- '-'
> error: Unknown option - in foo(_:)


-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/2541#issuecomment-1587124468
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] rpm macros cannot process long options (Issue #2541)

2023-06-12 Thread Ralf Habacker
With actual rpm releases (Leap: 4.14, Tumbleweed 4:18) it is not possible to 
parse options in the form `--` or `-- arg` as shown below:

```
$ rpm --version
RPM version 4.14.3
$ LC_ALL=C rpm --define '%foo(-) "%**"' --eval '%foo --test file1'
foo: invalid option -- '-'
error: Unknown option - in foo(_:)
```
Trying to parse `-- arg` returns:
```
LC_ALL=C rpm --define '%foo(-:) "%**"' --eval '%foo --test arg  file1'
foo: invalid option -- '-'
error: Unknown option - in foo(_:)
```

With rpm 4.18 the result is:
```
$ LC_ALL=C ../rpm-build/rpm 
RPM version 4.18.90
$ LC_ALL=C ../rpm-build/rpm --define '%foo(-) "%**"' --eval '%foo --test  file1'
"--test file1"
```
and 
```
LC_ALL=C ../rpm-build/rpm --define '%foo(-:) "%**"' --eval '%foo --test arg  
file1'
error: Unknown option - in foo(-:)
```

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/2541
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] Add macro '%-x**' containing all occurrences of the flag '-x' (PR #2449)

2023-06-08 Thread Ralf Habacker
@rhabacker pushed 2 commits.

707ea38dcd1fcdb75377c046dac42ae7047a9e32  Add macro '%-x**' containing all 
occurrences of the flag '-x' or '-x '.
a1476b8610e42db5c079bd268bf975fd4a1eb6ab  Add test case for macro '%-x**'

-- 
View it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2449/files/9e24ee6a7feb187425410d7cfc85875bdc5528d0..a1476b8610e42db5c079bd268bf975fd4a1eb6ab
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] Add macro '%-x**' containing all occurrences of the flag '-x' (PR #2449)

2023-06-06 Thread Ralf Habacker
> ...  The conclusion is that something similar must be done before calling 
> getopt in rpm to process macro parameters with quotes.

There is already a function named 
[`splitQuoted()`](https://github.com/rpm-software-management/rpm/blob/51c596a6c893824d459ddc6ac28ea28e9f391bd4/rpmio/macro.c#L963),
 which splits the arguments, currently only separated by space and tabs.

It looks like a candidate for processing quotes.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2449#issuecomment-1578336162
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] Accessing macro parameter from lua fails with "attempt to index a nil value (global 'opt')" (Issue #2446)

2023-06-06 Thread Ralf Habacker
> So no, it wont work in rpm 4.14.

Since this version is still the default version on openSUSE Leap 15.4/15.5, I 
tried to implement the above example for 4.14 and came up with the following 
script based on [rpm 
macros](https://rpm-software-management.github.io/rpm/manual/macros.html):

```
cat << EOF > test-4.14.macros
%foo(a:b) %{lua:
if rpm.expand("%{-b}")  then
   print('do b ')
else
   print('or not')
end
if rpm.expand("%{-a*}") == 's' then
   print('do s ')
end
if tonumber(rpm.expand("%#")) == 0 then
   print('no arguments :(')
else
   for arg in rpm.expand("%*"):gmatch("[^%s]+") do
 print(arg..' ')
   end
end
}
```

```
$ rpm --eval='%{load:test-4.14.macros} %foo -as -b  arg1 arg2
do b do s  arg1 arg2
```
Are there any plans to update the mentioned distros to rpm 4.17 soon?  
Otherwise, I suggest adding this example to the documentation for older 
versions.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/2446#issuecomment-1578046281
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] Add macro '%-x**' containing all occurrences of the flag '-x' (PR #2449)

2023-06-05 Thread Ralf Habacker
Since `rpm` uses a call to `getopt` to process the command line, I checked the 
parameter list with the command line tool `getopt`.

$ getopt -o "D:" -- -D11 -D 22 -D "33" -D "44 55" -D "66 77"
 -D '11' -D '22' -D '33' -D '44 55' -D '66 77' --

which gave the expected results (apart from adding an extra space between the 
flag and the value).

Running `getopt` with gdb and inspecting the argv array
```
Breakpoint 1, main (argc=11, argv=0x7fd7d8) at misc-utils/getopt.c:369
369 struct getopt_control ctl = {
(gdb) p argv[8]
$10 = 0x7fdd66 "-D44 55"
(gdb) p argv[9]
$11 = 0x7fdd6e "-D"
(gdb) p argv[10]
$12 = 0x7fdd71 "66 77"
(gdb)
```
shows that the quoting is done by the shell and not by getopt itself. The 
conclusion is that something similar must be done before calling getopt in rpm 
to process macro parameters with quotes.


-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2449#issuecomment-1576670293
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] Add macro '%-x**' containing all occurrences of the flag '-x' (PR #2449)

2023-06-05 Thread Ralf Habacker
> @pmatilai what about quoting each argument separately, 

I checked how quotes in strings are handled correctly with the changes from 
this pull request:

$ ../rpm-build/rpm --define '%foo(D:) %{-D**}' --eval '%foo -D11  -D 22 
-D"33" -D"44 55" -D "66 77"argument'
 -D11 -D 22 -D"33" -D"44 -D "66

The result is that the parameter `-D"44 55"` and `-D "66 77"` are not 
recognized correctly.

But the same issue also happens with the present macros related to returning 
flags and/or values 

$ ../rpm-build/rpm --define '%foo(D:) %{-D}' --eval '%foo -D"44 55"   
argument'
-D"44

../rpm-build/rpm --define '%foo(D:) %{-D*}' --eval '%foo -D "44 55"   
argument'
"44

so there is no difference here.


-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2449#issuecomment-1576603621
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] Add macro '%-x**' containing all occurrences of the flag '-x' (PR #2449)

2023-05-26 Thread Ralf Habacker
@rhabacker pushed 2 commits.

8a2ce401037701f7ba8b4521e5275bc2e69cbe60  Add macro '%-x**' containing all 
occurrences of the flag '-x' or '-x '.
9e24ee6a7feb187425410d7cfc85875bdc5528d0  Add test case for macro '%-x**'

-- 
View it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2449/files/352165ced88ea834bb3918af29607263b7b71e69..9e24ee6a7feb187425410d7cfc85875bdc5528d0
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] Add macro '%-x**' containing all occurrences of the flag '-x' (PR #2449)

2023-05-24 Thread Ralf Habacker
> Is there anything else that would block the merge? I need this feature to fix 
> a problem I am having on 
> https://build.opensuse.org/project/show/windows:mingw:win32.

The dbus project has reported a problem in this regard on 
https://gitlab.freedesktop.org/dbus/dbus/-/issues/455 for which this support is 
required, since the associated macro mingwxx-cmake must be adapted to filter 
out all occurrences of -Dxxx and --xxx together with -B and -S.  

Alternatively, this functionality would have to be (re)implemented as a lua 
macro, which in my opinion is a waste of time, since there is already a 
solution with this merge request.  

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2449#issuecomment-1562038850
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] Add macro '%-x**' containing all occurrences of the flag '-x' (PR #2449)

2023-05-11 Thread Ralf Habacker
Is there anything else that would block the merge? I need this feature to fix a 
problem I am having on 
https://build.opensuse.org/project/show/windows:mingw:win32.  

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2449#issuecomment-1544651361
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] Don't let macro '%-x' add extra space between flag and argument (PR #2455)

2023-04-17 Thread Ralf Habacker
@rhabacker pushed 4 commits.

357226d505af0a27264b5bd44d9487fa7ce41516  Add macro '%-x**' containing all 
occurrences of the flag '-x' or '-x '.
352165ced88ea834bb3918af29607263b7b71e69  Add test case for macro '%-x**'
a425f2210b503ae5ddb796953daa76cdb8571007  Add test case for macro '%-x'
a23d8bedea7eb59d50e4d8384a46ba22ab5cf422  Don't let macro '%-x' add extra space 
between flag and argument

-- 
View it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2455/files/4d0c21d253abb19e7b3e2774ffd193a989ff9279..a23d8bedea7eb59d50e4d8384a46ba22ab5cf422
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] Add macro '%-x**' containing all occurrences of the flag '-x' (PR #2449)

2023-04-17 Thread Ralf Habacker
@rhabacker pushed 2 commits.

357226d505af0a27264b5bd44d9487fa7ce41516  Add macro '%-x**' containing all 
occurrences of the flag '-x' or '-x '.
352165ced88ea834bb3918af29607263b7b71e69  Add test case for macro '%-x**'

-- 
View it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2449/files/e9e72286becc2437bd5e23e3891911eac342c797..352165ced88ea834bb3918af29607263b7b71e69
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] Don't let macro '%-x' add extra space between flag and argument (PR #2455)

2023-04-17 Thread Ralf Habacker
> This may fix a use-case for you but is likely to break it for several others.

A number of conditions are required for this to cause a problem:
1. in the parameter list of a macro `x:`must be specified.
2. `%-x` is used in the macro in question
3. the calling program supports only `-x` and `-x ` is passed and 
vice versa. 

In the following examples from the list given: 

> /usr/lib/rpm/macros:1407:%__scm_apply_hg(qp:m:)\
> /usr/lib/rpm/macros:1408:%{__hg} import - %{-p:-p%{-p*}} %{-q} -m %{-m*} 
> --user "%{__scm_author}"

This post already contains a workaround for the mentioned problem, as [`git 
am`](https://linux.die.net/man/1/hg) requires the same syntax as the `patch` 
command with `-p`. Only the value of `%-p` is used and is thus independent 
of the passing form.

> /usr/lib/rpm/macros:1427:%__scm_apply_git_am(qp:m:)\
> /usr/lib/rpm/macros:1428:%{__git} am %{-q} %{-p:-p%{-p*}}

This occurrence is also a workaround for the problem mentioned, since [`git 
am`](https://git-scm.com/docs/git-am#Documentation/git-am.txt--pltngt) requires 
`-p`. Only the value of `%-p` is used and is thus independent of the passing 
form.

> /usr/lib/rpm/macros:1433:%{__quilt} import %{-p:-p%{-p*}} %{1} && %{__quilt} 
> push %{-q}

According to https://linux.die.net/man/1/quilt the format is `-p `, but the 
listed location uses `-p`, so it must work, otherwise it would already be 
reported as a problem.  Only the value of `%-p` is used and is thus independent 
of the passing format.

> /usr/lib/rpm/macros:1453: local options = rpm.expand("%{-q} %{-p:-p%{-p*}} 
> %{-m:-m%{-m*}}")\

Only the value of `%-p` is used and is thus independent of the passing form.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2455#issuecomment-1510850063
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] Don't let macro '%-x' add extra space between flag and argument (PR #2455)

2023-03-30 Thread Ralf Habacker
> We have no idea how many macros and packages out there are _relying_ on the 
> current, very long standing behavior. This may fix a use-case for you but is 
> likely to break it for several others.

On openSUSE Leap 15.4 I found the following locations where such a flag is used:
```
 grep -rn "%{-[a-zA-Z]}" /usr/lib/rpm
/usr/lib/rpm/macros:1403:%{__hg} init %{-q} .\
/usr/lib/rpm/macros:1404:%{__hg} add %{-q} .\
/usr/lib/rpm/macros:1405:%{__hg} commit %{-q} --user "%{__scm_author}" -m 
"%{NAME}-%{VERSION} base"
/usr/lib/rpm/macros:1408:%{__hg} import - %{-p:-p%{-p*}} %{-q} -m %{-m*} --user 
"%{__scm_author}"
/usr/lib/rpm/macros:1412:%{__git} init %{-q}\
/usr/lib/rpm/macros:1416:%{__git} commit %{-q} --allow-empty -a\\\
/usr/lib/rpm/macros:1421:%{__git} commit %{-q} -m %{-m*} --author 
"%{__scm_author}"
/usr/lib/rpm/macros:1425:%{expand:%__scm_setup_git %{-q}}
/usr/lib/rpm/macros:1428:%{__git} am %{-q} %{-p:-p%{-p*}}
/usr/lib/rpm/macros:1433:%{__quilt} import %{-p:-p%{-p*}} %{1} && %{__quilt} 
push %{-q}
/usr/lib/rpm/macros:1437:%{__bzr} init %{-q}\
/usr/lib/rpm/macros:1440:%{__bzr} commit %{-q} -m "%{NAME}-%{VERSION} base"
/usr/lib/rpm/macros:1445:%{__bzr} commit %{-q} -m %{-m*}
/usr/lib/rpm/macros:1453:local options = rpm.expand("%{-q} %{-p:-p%{-p*}} 
%{-m:-m%{-m*}}")\
/usr/lib/rpm/macros:1474:%setup %{-a} %{-b} %{-c} %{-D} %{-n} %{-T} %{!-v:-q}\
/usr/lib/rpm/macros:1477:%{!-N:%autopatch %{-v} %{-p:-p%{-p*}}}
/usr/lib/rpm/macros.d/macros.kernel-source:61:  [ -n "%{-X}" ] && 
continue ;; \
/usr/lib/rpm/macros.d/macros.kernel-source:63:  [ -z "%{-X}" -a -n 
"$flavors" ] && continue ;; \
/usr/lib/rpm/macros.d/macros.kernel-source:68:  echo 
"%%_suse_kernel_module_subpackage -n %{-n*}%{!-n:%name} -v 
%{-v*}%{!-v:%version} -r %{-r*}%{!-r:%release} %{-f} %{-p} %{-b} %{-c:-c} 
$flavor $kver" \
/usr/lib/rpm/macros.d/macros.kernel-source:93:  
%{expand:%%_kernel_module_package %{-x:-X} %{-n} %{-v} %{-r} %{-t} %{-f} %{-p} 
%{-b} %{-c} %*}
/usr/lib/rpm/macros.d/macros.kernel-source:98:  
%{expand:%%_kernel_module_package %{-x: }%{!-x:-X} %{-n} %{-v} %{-r} %{-s:-t 
%{-s*}} %{-f} %{-p} %{-b} %{-c} %*}
```

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2455#issuecomment-1490104143
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] Don't let macro '%-x' add extra space between flag and argument (PR #2455)

2023-03-30 Thread Ralf Habacker
@rhabacker pushed 4 commits.

698f348b36a5cacc27b9124d1480689464cbb396  Add macro '%-x**' containing all 
occurrences of the flag '-x' or '-x '.
7ea7048c9ba1d800dcace3ea2d4bbec4ab459abe  Add test case for macro '%-x**'
f262752ebe6fe748c2cc66a7b270ca67b0e68d05  Add test case for macro '%-x'
4d0c21d253abb19e7b3e2774ffd193a989ff9279  Don't let macro '%-x' add extra space 
between flag and argument

-- 
View it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2455/files/13ee56a4a4c3260f6c4742729d6b178361d83338..4d0c21d253abb19e7b3e2774ffd193a989ff9279
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] Added more details to the doc about what is returned by the macros '%-x' and '%-x*' (PR #2458)

2023-03-30 Thread Ralf Habacker
Fixes: #2457
You can view, comment on, or merge this pull request online at:

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

-- Commit Summary --

  * Added more details to the doc about what is returned by the macros 
'%-x' and '%-x*'

-- File Changes --

M docs/manual/macros.md (4)

-- Patch Links --

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

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2458
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] No indication in the doc that the macros '%-x' and '%-x*' return the last occurrence of the specified flag (Issue #2457)

2023-03-30 Thread Ralf Habacker
Working on https://github.com/rpm-software-management/rpm/pull/2449, it turned 
out that the macros '%-x' and '%-x*' return the last occurrence of the 
specified flag if more than one flag is specified. This is not mentioned in the 
documentation.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/2457
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] Add macro '%-x**' containing all occurrences of the flag '-x' (PR #2449)

2023-03-30 Thread Ralf Habacker
@rhabacker pushed 2 commits.

fdddf0e4d5b565fb70fd484f3fe659cebbdf920b  Add macro '%-x**' containing all 
occurrences of the flag '-x' or '-x '.
e9e72286becc2437bd5e23e3891911eac342c797  Add test case for macro '%-x**'

-- 
View it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2449/files/7ea7048c9ba1d800dcace3ea2d4bbec4ab459abe..e9e72286becc2437bd5e23e3891911eac342c797
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] Add macro '%-x**' containing all occurrences of the flag '-x' (PR #2449)

2023-03-30 Thread Ralf Habacker
> depends on #2455

Dropped that dependency.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2449#issuecomment-1490025786
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] Add macro '%-x**' containing all occurrences of the flag '-x' (PR #2449)

2023-03-30 Thread Ralf Habacker
@rhabacker pushed 2 commits.

698f348b36a5cacc27b9124d1480689464cbb396  Add macro '%-x**' containing all 
occurrences of the flag '-x' or '-x '.
7ea7048c9ba1d800dcace3ea2d4bbec4ab459abe  Add test case for macro '%-x**'

-- 
View it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2449/files/9e3db2c11940cba44d8a6a35bb9f33bbeb06cdcb..7ea7048c9ba1d800dcace3ea2d4bbec4ab459abe
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] Don't let macro '%-x' add extra space between flag and argument (PR #2455)

2023-03-30 Thread Ralf Habacker
> FWIW, you can build without rpm-sequoia by supplying 
> `-DWITH_INTERNAL_OPENPGP=ON` to cmake.

Thanks for this pointer, which I can confirm that it works 

To run the generated `rpmbuild` it looks to be required to install the build 
and use environment variable `RPM_CONFIGDIR` and  `LD_LIBRARY_PATH` e.g. 
```
cd ~
git clone https://github.com/rpm-software-management/rpm.git
cmake -S rpm -B rpm-build
cmake --build rpm-build
cmake --build rpm-build --target install DESTDIR=$PWD/rpm-install
RPM_CONFIGDIR=$PWD/rpm-install/usr/local/lib/rpm 
LD_LIBRARY_PATH=$PWD/rpm-install/usr/local/lib64 
$PWD/rpm-install/usr/localbin/rpmbuild --define='%foo(b:B:) %{-b}' --eval '%foo 
-b2 -b a=2 -B4 dsfdfdf'
-b a=2
```


-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2455#issuecomment-1490009021
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] Add macro '%-x**' containing all occurrences of the flag '-x' (PR #2449)

2023-03-24 Thread Ralf Habacker
This pull request required several push forces because the master branch of rpm 
on openSUSE 15.4 could not be built due to the missing package rpm-sequoia. The 
patch was therefore developed on rpm-4.14.x and ported to the master branch.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2449#issuecomment-1483002915
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] Don't let macro '%-x' add extra space between flag and argument (PR #2455)

2023-03-24 Thread Ralf Habacker
This pull request required several push forces because the master branch of rpm 
on openSUSE 15.4 could not be built due to the missing package `rpm-sequoia`. 
The patch was therefore developed on rpm-4.14.x and ported to the master 
branch.  

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2455#issuecomment-1483001454
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] Add macro '%-x**' containing all occurrences of the flag '-x' (PR #2449)

2023-03-24 Thread Ralf Habacker
@rhabacker pushed 5 commits.

c58523210de4b634b88234f62356afacc5f545d9  Add test case for macro '%-x'
9e68081107b48927844cdf41d842b07451296893  Don't let macro '%-x' add extra space 
between flag and argument
13ee56a4a4c3260f6c4742729d6b178361d83338  Fix documentation of macro '%-x'
1f88268f898a2e1cebe137c75ca031d5b44e30e2  Add macro '%-x**' containing all 
occurrences of the flag '-x' or '-x '.
9e3db2c11940cba44d8a6a35bb9f33bbeb06cdcb  Add test case for macro '%-x**'

-- 
View it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2449/files/da62a753391e590b2a1a45ecc0ae22d023ddab5e..9e3db2c11940cba44d8a6a35bb9f33bbeb06cdcb
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] Don't let macro '%-x' add extra space between flag and argument (PR #2455)

2023-03-24 Thread Ralf Habacker
@rhabacker pushed 2 commits.

9e68081107b48927844cdf41d842b07451296893  Don't let macro '%-x' add extra space 
between flag and argument
13ee56a4a4c3260f6c4742729d6b178361d83338  Fix documentation of macro '%-x'

-- 
View it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2455/files/86a6bac1a673baa386990487584a2f5c7e0aae72..13ee56a4a4c3260f6c4742729d6b178361d83338
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] Don't let macro '%-x' add extra space between flag and argument (PR #2455)

2023-03-24 Thread Ralf Habacker
@rhabacker pushed 1 commit.

86a6bac1a673baa386990487584a2f5c7e0aae72  Fix documentation of macro '%-x'

-- 
View it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2455/files/3555d4ba148abda108704d4e494841fba4f8f24f..86a6bac1a673baa386990487584a2f5c7e0aae72
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] Don't let macro '%-x' add extra space between flag and argument (PR #2455)

2023-03-24 Thread Ralf Habacker
@rhabacker pushed 2 commits.

c58523210de4b634b88234f62356afacc5f545d9  Add test case for macro '%-x'
3555d4ba148abda108704d4e494841fba4f8f24f  Don't let macro '%-x' add extra space 
between flag and argument

-- 
View it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2455/files/490824b1890e35873a651de714db85ef7947222c..3555d4ba148abda108704d4e494841fba4f8f24f
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] Don't let macro '%-x' add extra space between flag and argument (PR #2455)

2023-03-24 Thread Ralf Habacker
@rhabacker pushed 1 commit.

490824b1890e35873a651de714db85ef7947222c  Don't let macro '%-x' add extra space 
between flag and argument

-- 
View it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2455/files/b969a46bade5559574f98dfd0ce6acd9d9549928..490824b1890e35873a651de714db85ef7947222c
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] Don't let macro '%-x' add extra space between flag and argument (PR #2455)

2023-03-24 Thread Ralf Habacker
Fixes #2454
You can view, comment on, or merge this pull request online at:

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

-- Commit Summary --

  * Add test case for macro '%-x'
  * Don't let macro '%-x' add extra space between flag and argument

-- File Changes --

M rpmio/macro.c (18)
M tests/rpmmacro.at (17)

-- Patch Links --

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

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2455
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] Macro %-x modifies original flag if argument follows without intervening space (Issue #2454)

2023-03-24 Thread Ralf Habacker
See the following example:
```
$rpm --version
RPM version 4.14.3

$ rpm --define '%foo(b:) %{-b}' --eval '%foo -b2'
-b 2
```
The macro adds a space between flag and argument, which may affect passing to 
applications as shown by the following example:

```
$ python3 -bb
Python 3.6.15 (default, Sep 23 2021, 15:41:43) [GCC] on linux
Type "help", "copyright", "credits" or "license" for more information.

``` 
Passing the option through a rpm macro returns: 
```
$ rpm --define '%foo(b:) python3 %{-b}' --eval '%foo -bb` 
python3 -b b
```
Running the generated command fails: 
```
$`rpm --define '%foo(b:) python3 %{-b}' --eval '%foo -bb'` 
python3: can't open file 'b': [Errno 2] No such file or directory
```


-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/2454
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] Add macro '%-x**' containing all occurrences of the flag '-x' (PR #2449)

2023-03-24 Thread Ralf Habacker
@rhabacker pushed 4 commits.

588fe4e589e93df6c55f2561a4239469a894bb1e  Add macro '%-x**' containing all 
occurrences of the flag '-x' or '-x '.
9ce95f236aa9b93a2a7f57e0748d7fcaa793dc46  Add test case for macro '%-x**'
c720f1c535f3e9fd3839dbd96a5c2a8a6c0e33ca  Fix documentation of macro '%-x'
da62a753391e590b2a1a45ecc0ae22d023ddab5e  Let macro '%-x' use the original 
notation too

-- 
View it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2449/files/13361c96424980dd34be3e34c93d889049232721..da62a753391e590b2a1a45ecc0ae22d023ddab5e
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] Could not build rpm from master branch with cmake - No package 'libmagic' found (Issue #2452)

2023-03-24 Thread Ralf Habacker
I'm trying to build rpm from master branch on openSUSE 15.4 and got a build 
failure:

 
cd ~
git clone https://github.com/rpm-software-management/rpm.git
$ cmake -S rpm -B rpm-build
-- The C compiler identification is GNU 7.5.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.2") 
-- Found ZLIB: /usr/lib64/libz.so (found version "1.2.11")  
-- Found BZip2: /usr/lib64/libbz2.so (found version "1.0.8") 
-- Looking for BZ2_bzCompressInit
-- Looking for BZ2_bzCompressInit - found
-- Performing Test Iconv_IS_BUILT_IN
-- Performing Test Iconv_IS_BUILT_IN - Success
-- Found Iconv: built in to C library  
-- Checking for module 'lua>=5.2'
--   Found lua, version 5.3.6
-- Checking for module 'popt'
--   Found popt, version 1.16
-- Checking for module 'libmagic'
--   No package 'libmagic' found
CMake Error at /usr/share/cmake/Modules/FindPkgConfig.cmake:607 (message):
  A required package was not found
Call Stack (most recent call first):
  /usr/share/cmake/Modules/FindPkgConfig.cmake:829 (_pkg_check_modules_internal)
  CMakeLists.txt:138 (pkg_check_modules)
``` 

The problem is that there is no pkgconfig support for `libmagic` provided by 
the associated `file-devel` package:
```
$ rpm -q -l file-devel
/usr/include/magic.h
/usr/lib64/libmagic.so
/usr/share/doc/packages/file-devel
/usr/share/doc/packages/file-devel/AUTHORS
/usr/share/doc/packages/file-devel/ChangeLog
/usr/share/doc/packages/file-devel/NEWS
/usr/share/doc/packages/file-devel/README
/usr/share/licenses/file-devel
/usr/share/licenses/file-devel/COPYING
/usr/share/man/man3/libmagic.3.gz
```


-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/2452
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] Documentation does not mention %** to get all macro parameter (Issue #2444)

2023-03-24 Thread Ralf Habacker
Closed #2444 as completed.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/2444#event-8837071118
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] Add macro '-x**' containing all occurrences of the flag '-x' (PR #2449)

2023-03-24 Thread Ralf Habacker
@rhabacker pushed 4 commits.

55e823552a77d32e091029a3de3b1de7b11583ca  Add macro '%-x**' containing all 
occurrences of the flag '-x' or '-x '.
e367ec02c4b9225c256539016f46dc3f3fdfb856  Add test case for macro '%-x**'
9c675a153c73e7fd9d168c63a6b0cdd2a1a04856  Fix documentation of macro '%-x'
0bf2ff8984df12e9ab10c2a44f44f90c6ac17604  Let macro '%-x' use the original 
notation too

-- 
View it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2449/files/7bdc64e64f41df099ee2d3920e68e7c90f92a59b..0bf2ff8984df12e9ab10c2a44f44f90c6ac17604
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] Add macro '-x**' containing all occurrences of the flag '-x' (PR #2449)

2023-03-24 Thread Ralf Habacker
@rhabacker pushed 2 commits.

b5d78ba8a14541f3a6c5d92139f26dbf6ffc1eb5  Add macro '-x**' containing all 
occurrences of the flag '-x' or '-x '.
7bdc64e64f41df099ee2d3920e68e7c90f92a59b  Add test case for macro '%-x**'

-- 
View it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2449/files/ab8341d28b4b6a896bfddc7a38a45f1af60171d6..7bdc64e64f41df099ee2d3920e68e7c90f92a59b
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] Add documentation for shell like macro '%**' (PR #2445)

2023-03-24 Thread Ralf Habacker
@rhabacker pushed 1 commit.

014b6435cf80c6b28bdc95601cf5f14ae681353a  Add test case for macro '%**'

-- 
View it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2445/files/4147a8490465398db6c3361be7e4d4a9616ceba6..014b6435cf80c6b28bdc95601cf5f14ae681353a
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] Add macro '-x**' containing all occurrences of the flag '-x' (PR #2449)

2023-03-24 Thread Ralf Habacker
@rhabacker pushed 2 commits.

e5bddc4664cb7aab65089caa6d9da6499326bb78  Add macro '-x**' containing all 
occurrences of the flag '-x' or '-x '.
ab8341d28b4b6a896bfddc7a38a45f1af60171d6  Add test case for macro '%-x**'

-- 
View it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2449/files/b38f87edc9aa7d76afa83cb6b1b0f0aa2ae51e5d..ab8341d28b4b6a896bfddc7a38a45f1af60171d6
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] Add macro '-x**' containing all occurrences of the flag '-x' (PR #2449)

2023-03-24 Thread Ralf Habacker
@rhabacker pushed 2 commits.

51c001aea91e99ee860e46fdcd4a96b9ac50304f  Add macro '-x**' containing all 
occurrences of the flag '-x' or '-x '.
b38f87edc9aa7d76afa83cb6b1b0f0aa2ae51e5d  Add test case for macro '%-x**'

-- 
View it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2449/files/0273daa43cba6cdd373269df92d8bab2d70693ad..b38f87edc9aa7d76afa83cb6b1b0f0aa2ae51e5d
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] Add macro '-x**' containing all occurrences of the flag '-x' (PR #2449)

2023-03-23 Thread Ralf Habacker
@rhabacker pushed 2 commits.

b5117ae76f47c3629d56668c272808e066eeabe8  Keep original flag format when 
creating the %-x** macro
0273daa43cba6cdd373269df92d8bab2d70693ad  Adjust test case for macro '%-x**'

-- 
View it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2449/files/fb9c9ffe57563ce3f5ddca570500108a795be262..0273daa43cba6cdd373269df92d8bab2d70693ad
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] Add macro '-x**' containing all occurrences of the flag '-x' (PR #2449)

2023-03-23 Thread Ralf Habacker
@rhabacker pushed 1 commit.

fb9c9ffe57563ce3f5ddca570500108a795be262  Add test case for macro '%-x**'

-- 
View it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2449/files/22f16526824374413d50c008e6d4a2285949ac3b..fb9c9ffe57563ce3f5ddca570500108a795be262
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] Add macro '-x**' containing all occurrences of the flag '-x' (PR #2449)

2023-03-23 Thread Ralf Habacker
@rhabacker pushed 2 commits.

8b9dbeee09014bf2a6b01f22cb6ed3896bebbd5e  Add macro '-x**' containing all 
occurrences of the flag '-x'.
22f16526824374413d50c008e6d4a2285949ac3b  Add test case for macro '%-x**'

-- 
View it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2449/files/fc3f06225125ce99d03712d79ef60eae143ed647..22f16526824374413d50c008e6d4a2285949ac3b
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] Add macro '-x**' containing all occurrences of the flag '-x' (PR #2449)

2023-03-23 Thread Ralf Habacker
Fix #546
You can view, comment on, or merge this pull request online at:

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

-- Commit Summary --

  * Add macro '-x**' containing all occurrences of the flag 
'-x'.

-- File Changes --

M docs/manual/macros.md (3)
M rpmio/macro.c (15)

-- Patch Links --

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

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2449
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] Accessing macro parameter from lua fails with "attempt to index a nil value (global 'opt')" (Issue #2446)

2023-03-23 Thread Ralf Habacker
Thanks for clarification. 

I saw this paragraph, but I understood it to mean that the minimal version only 
refers to the last sentence and that it may only need adjustments.


-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/2446#issuecomment-1480953486
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] No build-in processing for multiple occurrences of an option with the same name (Issue #2448)

2023-03-23 Thread Ralf Habacker
Attempting to process multiple occurrences of an option with the same name with 
the available rpm macros always returns the last occurrence of the specified 
option, as the following example shows:

```sh
$ rpm --version
RPM version 4.14.3

$ rpm --define='%_macro(D:) %(echo " option -D: %{-D:%{-D*}}")'  --eval 
"%_macro -Dxxx=aaa -Dyyy sdsdsd"
 option -D: -Dyyy
```
An evaluation of the 
[available](https://github.com/rpm-software-management/rpm/blob/master/docs/manual/macros.md)
 rpm macros for accessing macro parameters with: 
```sh
$ rpm --define='%_macro(D:) %(echo -e " name: %0 \\n non-option-count: %# \\n 
non-option-params: %* \\n all-params: %** \\n option -D: %{-D:%{-D*}}")'  
--eval "%_macro -Dxxx=aaa -Dyy sdsdsd"
 name: _macro 
 non-option-count: 1 
 non-option-parameter: sdsdsd 
 all parameters: -Dxxx=aaa -Dyyy -- sdsdsd 
 Option -D: -Dyyy
```
shows that the requested option is basically available only through `%**` but 
requires additional processing to extract the multiple occurrences of the 
relevant option. It would therefore be helpful if rpm had support for this case.

This case has come up when revising an rpm macro for cmake support at the mingw 
project on build.opensuse.org, where single options would have to be processed 
in the macro in question but other options that may occur multiple times would 
have to be passed to cmake.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/2448
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] Accessing macro parameter from lua fails with "attempt to index a nil value (global 'opt')" (Issue #2446)

2023-03-22 Thread Ralf Habacker
The documentation at 
https://github.com/rpm-software-management/rpm/blob/master/docs/manual/lua.md 
mentions how to get macro options as

``` 
%foo(a:b) %{lua:
if opt.b then
...
```

but this does not work on openSUSE Leap 15.4 with rpm with version:
```
rpm --version
RPM version 4.14.3
```
Running such a macro returns this error:
```
error: lua script failed: [string ""]:2: attempt to index a nil value 
(global 'opt')
```

# How to reproduce
1. Paste the following macro, mentioned in the documentation, into a file:
```
cat << EOF > test.macros
%foo(a:b) %{lua:
if opt.b then
   print('do b')
else
   print('or not')
end
if opt.a == 's' then
   print('do s')
end
if #arg == 0 then
   print('no arguments :(')
else
   for i = 1, #arg do
  print(arg[i])
   end
end
}
EOF
```
2. then run 
```
$ rpm --eval='%{load:test.macros} %foo -axxx=yyy -b  dsdsd'
error: lua script failed: [string ""]:2: attempt to index a nil value 
(global 'opt')
```

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/2446
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] Add documentation for shell like macro '%**' (PR #2445)

2023-03-22 Thread Ralf Habacker
See https://github.com/rpm-software-management/rpm/issues/2444
You can view, comment on, or merge this pull request online at:

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

-- Commit Summary --

  * Add documentation for shell like macro '%**'

-- File Changes --

M docs/manual/macros.md (1)

-- Patch Links --

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

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2445
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] Documentation does not mention %** to get all macro parameter (Issue #2444)

2023-03-22 Thread Ralf Habacker
At 
https://github.com/rpm-software-management/rpm/blob/7b0b5e7d2cf53817ec5e2545c5f591a26db72cec/docs/manual/macros.md
 there is mentioned 

```
%*  all arguments (unlike shell, not including any processed flags)
```
but not 
```
%** all arguments (including any processed flags)
```
which is implemented In the source code at 
https://github.com/rpm-software-management/rpm/commit/c22d5b12999de6633d89828165ea3ab2112993e8
 and 
**https://github.com/rpm-software-management/rpm/commit/bebd15081a1ad61752d37d51e6377f65dd622ea3

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/2444
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