Re: [Rpm-maint] [rpm-software-management/rpm] Add support for sysusers group membership lines (PR #2990)

2024-04-04 Thread Panu Matilainen
Merged #2990 into master.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2990#event-12352560333
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 support for sysusers group membership lines (PR #2990)

2024-04-04 Thread Florian Festi
@ffesti pushed 1 commit.

c3ea56e308e81e83a55ffb1a5b4fe5bb4b6b7cad  Add support for sysusers group 
membership lines

-- 
View it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2990/files/8558a2c2bf06c4b89a4ea59b50cedb80b00c6d87..c3ea56e308e81e83a55ffb1a5b4fe5bb4b6b7cad
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 support for sysusers group membership lines (PR #2990)

2024-04-04 Thread Panu Matilainen
@pmatilai approved this pull request.

Other than the dependencies doc nit, looks fine to me now.



-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2990#pullrequestreview-1978812025
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 support for sysusers group membership lines (PR #2990)

2024-04-03 Thread Panu Matilainen
@pmatilai commented on this pull request.



> @@ -25,6 +25,9 @@ user/group allocation altogether by using
 
 ## Dependencies
 
+Explict group membership (m) will create a dependency on both the user
+and the group name.

It's a bit weird to have this as the first thing in this section. I'd put it 
after the more common main file ownership stuff.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2990#pullrequestreview-1978795106
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 support for sysusers group membership lines (PR #2990)

2024-04-03 Thread Florian Festi
@ffesti pushed 1 commit.

8558a2c2bf06c4b89a4ea59b50cedb80b00c6d87  Add support for sysusers group 
membership lines

-- 
View it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2990/files/81acc230b3b7c84b519e4bca4aee13bdbf9952b2..8558a2c2bf06c4b89a4ea59b50cedb80b00c6d87
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 support for sysusers group membership lines (PR #2990)

2024-04-03 Thread Florian Festi
OK, fixed the issue in the code and made sure the test cases actually checks 
for group membership. Added a bit to the docs and the commit message.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2990#issuecomment-2034875120
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 support for sysusers group membership lines (PR #2990)

2024-04-03 Thread Florian Festi
@ffesti pushed 2 commits.

1e4e9648b114131b8a872878ef8c5cc5739efaf9  Re-Word User / Group handling a bit
81acc230b3b7c84b519e4bca4aee13bdbf9952b2  Add support for sysusers group 
membership lines

-- 
View it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2990/files/e96d496349e191e4b97d07f74ce477edd125bdfc..81acc230b3b7c84b519e4bca4aee13bdbf9952b2
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 support for sysusers group membership lines (PR #2990)

2024-04-02 Thread Florian Festi
Yeah, I already noticed and fixed psm.c and tagexts.c. There is still something 
wrong with the test case or the code or both. I update the patch ass soon as 
this works.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2990#issuecomment-2031444302
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 support for sysusers group membership lines (PR #2990)

2024-03-27 Thread Panu Matilainen
A bigger problem is that this doesn't actually work. As in, add the users into 
the groups on install.  The "receiving" code does not know to look for these 
new provides so they end up being just decoration.

What you don't test does not work, is a good rule of thumb :smile: 

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2990#issuecomment-2022526452
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 support for sysusers group membership lines (PR #2990)

2024-03-27 Thread Panu Matilainen
Oh and, a proper commit message for the main change. The how and why are quite 
a bit more complicated than "Create Requires/Recommends for both the user and 
the group."

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2990#issuecomment-2022419561
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 support for sysusers group membership lines (PR #2990)

2024-03-27 Thread Panu Matilainen
@pmatilai commented on this pull request.



> @@ -38,9 +41,10 @@ to weaken these into recommends-dependencies by setting
 
 ## Limitations
 
-At this time, rpm only supports the `u` and `g` directives of sysusers.d
-format and ignores others. If other directives are needed, the package
-will need to call systemd-sysusers with the correct arguments manually.
+At this time, rpm only supports the `u`, `g` and (since RPM 4.20) `m`
+directives of sysusers.d format and ignores others. If other
+directives are needed, the package will need to call systemd-sysusers
+with the correct arguments manually.
 
 ## Technical details

The 'm' dependencies are different enough from user/group that they deserve an 
explanation and an example in the technical details section.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2990#pullrequestreview-1962890434
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 support for sysusers group membership lines (PR #2990)

2024-03-27 Thread Panu Matilainen
@pmatilai commented on this pull request.



>  if arg[1] == 'g' then
 type = 'group'
 elseif arg[1] == 'u' then
 type = 'user'
-elseif arg[1] == 'r' or arg[1] == 'm' then
+elseif arg[1] == 'm' and #arg >=3 then
+type = 'usergroup'

'groupmember' might be a more obvious name for what it does. Wouldn't matter a 
bit in a script internals, but since these are visible in the package 
dependencies...

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2990#pullrequestreview-1962874462
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 support for sysusers group membership lines (PR #2990)

2024-03-27 Thread Panu Matilainen
@pmatilai commented on this pull request.



> +goto continue
+end
+fields = {}
+for w in line:gmatch("%S+") do
+table.insert(fields, w)
+end
+if #fields >= 3 and fields[1] == 'm' then
+   print(string.format('user(%s)\\ngroup(%s)', fields[2], fields[3]))
+end
+::continue::
+end
+}
+
+%__sysusers_recommends() %{?_use_weak_usergroup_deps:%{__sysusers_dependencies 
%1}}
+
+%__sysusers_requires() %{!?_use_weak_usergroup_deps:%{__sysusers_dependencies 
%1}}

You'll need the %[] expression thing in these, like you had in the earlier 
version. %{?...} only tests whether the macro is defined, so this will use weak 
dependencies even if set to 0.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2990#pullrequestreview-1962855501
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 support for sysusers group membership lines (PR #2990)

2024-03-26 Thread Florian Festi
Ok, I'll just use `%{?` for now. Removed the code duplication.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2990#issuecomment-2020412022
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 support for sysusers group membership lines (PR #2990)

2024-03-26 Thread Panu Matilainen
@pmatilai commented on this pull request.



> @@ -20,3 +20,41 @@
 ::continue::
 end
 }
+
+%__sysusers_recommends() %{lua:
+if rpm.expand('%[0%{?_use_weak_usergroup_deps}]') == '0' then

Argh, indeed. Maybe we should just add a native macro for rpmExpandNumeric(), 
it's not like the need to check for config setting is a rare case...

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2990#discussion_r1538779389
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 support for sysusers group membership lines (PR #2990)

2024-03-26 Thread Florian Festi
@ffesti commented on this pull request.



> @@ -20,3 +20,41 @@
 ::continue::
 end
 }
+
+%__sysusers_recommends() %{lua:
+if rpm.expand('%[0%{?_use_weak_usergroup_deps}]') == '0' then

Funny enough `tonumber` returns `nil` on `nil` so that won't work unless 
augmented with some handling for that case.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2990#discussion_r1538768080
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 support for sysusers group membership lines (PR #2990)

2024-03-25 Thread Panu Matilainen
@pmatilai commented on this pull request.



> @@ -20,3 +20,41 @@
 ::continue::
 end
 }
+
+%__sysusers_recommends() %{lua:
+if rpm.expand('%[0%{?_use_weak_usergroup_deps}]') == '0' then

Oh and there's indeed a nicer way to do this (I remember you asking about this 
but didn't have an answer off-hand):

```
if tonumber(macros._use_weak_usergroup_deps) == 0 then
```

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2990#pullrequestreview-1957611121
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 support for sysusers group membership lines (PR #2990)

2024-03-25 Thread Panu Matilainen
@pmatilai commented on this pull request.



> +fields = {}
+for w in line:gmatch("%S+") do
+table.insert(fields, w)
+end
+if #fields >= 3 and fields[1] == 'm' then
+   print(string.format('user(%s)\\ngroup(%s)', fields[2], fields[3]))
+end
+::continue::
+end
+}
+
+%__sysusers_requires() %{lua:
+if rpm.expand('%[0%{?_use_weak_usergroup_deps}]') ~= '0' then
+   return
+end
+for line in io.lines(macros["1"]) do

Parametric macro arguments are available as `arg[1]` etc, no need to go through 
`macros`.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2990#pullrequestreview-1957576966
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 support for sysusers group membership lines (PR #2990)

2024-03-25 Thread Panu Matilainen
@pmatilai commented on this pull request.



> +if rpm.expand('%[0%{?_use_weak_usergroup_deps}]') ~= '0' then
+   return
+end
+for line in io.lines(macros["1"]) do
+if line:sub(1, 1) == '#' then
+goto continue
+end
+fields = {}
+for w in line:gmatch("%S+") do
+table.insert(fields, w)
+end
+if #fields >= 3 and fields[1] == 'm' then
+   print(string.format('user(%s)\\ngroup(%s)', fields[2], fields[3]))
+end
+::continue::
+end

Basically it becomes something like

```
%__sysusers_helper() %{lua:
   ...the actual work...
}

%__sysusers_requires() %{lua:
macros.__sysusers_helper({arg[1], arg[2]})
}
%__sysusers_recommends() %{lua:
macros.__sysusers_helper({arg[1], arg[2]})
}
```

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2990#discussion_r1537488180
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 support for sysusers group membership lines (PR #2990)

2024-03-25 Thread Panu Matilainen
@pmatilai commented on this pull request.



> +if rpm.expand('%[0%{?_use_weak_usergroup_deps}]') ~= '0' then
+   return
+end
+for line in io.lines(macros["1"]) do
+if line:sub(1, 1) == '#' then
+goto continue
+end
+fields = {}
+for w in line:gmatch("%S+") do
+table.insert(fields, w)
+end
+if #fields >= 3 and fields[1] == 'm' then
+   print(string.format('user(%s)\\ngroup(%s)', fields[2], fields[3]))
+end
+::continue::
+end

Put these into some %__sysusers_helper() macro (in the same file) that both 
requires and recommends call, no reason to duplicate identical code.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2990#pullrequestreview-1957460293
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 support for sysusers group membership lines (PR #2990)

2024-03-25 Thread Florian Festi
Add support for sysusers group membership lines

m user group

Create Requires/Recommends for both the user and the group.
You can view, comment on, or merge this pull request online at:

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

-- Commit Summary --

  * Re-Word User / Group handling a bit
  * Add support for sysusers group membership lines

-- File Changes --

M docs/manual/users_and_groups.md (23)
M fileattrs/sysusers.attr (38)
M macros.in (21)
M tests/data/SPECS/klang.spec (2)
M tests/rpmi.at (58)

-- Patch Links --

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

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

Message ID: rpm-software-management/rpm/pull/2...@github.com
___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint