Re: [Rpm-maint] [rpm-software-management/rpm] Add OrderWithRequires dependency generation (#1257)

2020-06-09 Thread mikhailnov
OrderWithRequires(pre) would probably be better for the use case which is 
described in this PR, but OrderWithRequires without pre also worked. This is 
probably some undocumented behaviour in dependency resolution, probably it 
tries to install required packages before the package which requires them, but 
I'm not sure.

```
# rpm -E %systemd_ordering
OrderWithRequires(post): systemd 
OrderWithRequires(preun): systemd 
OrderWithRequires(postun): systemd 
```

Implemention of Requires(pre) etc. generators will be ugly because it will 
requires to add each RPMTAG separately. It would be nice if the generator could 
print e.g. `post: xxx` to stdout, but it cannot be implemented with the current 
architecture of generators as far as I understand.
Scriptlets can be converted into files 
(https://github.com/rpm-software-management/rpm/issues/1033#issuecomment-583142300),
 it would easify making generators for them.

@Conan-Kudo pointed that most scriptlets are designed to fail silently, e.g. 
scriptlets that call `systemctl` fail silently if systemd is not installed, 
what allows to make a minmal system aithout systemd. Adding 'Requires(pre): 
systemd' will break this usecase. 'OrderWithRequires(pre): systemd' would solve 
that. In some other cases it is useful to make sure that the binary which is 
called is already installed and has all its dependencies satisfied when the 
scriptlet is executed. `bash --rpm-requires` can be used to generate 
(OrderWith)Requires for scriptlets.

Maybe generatore 'Provides: cmd(xxx)' for files inside /sbin /usr/sbin /bin 
/usr/bin and convert the output of `bash --rpm-requires` to 
'OrderWithRequires(scriptlet type): cmd(xxx)'

These are just some thoughts...

-- 
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/1257#issuecomment-641245796___
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 OrderWithRequires dependency generation (#1257)

2020-06-09 Thread Florian Festi
This is indeed not possible. The argument here is (except that it is simply not 
implemented) that those dependencies are generated from files in the package 
and not the scriptlets. So qualifiers should not be needed. But I am pretty 
sure people could come up with some valid use cases.

There is https://github.com/rpm-software-management/rpm/projects/11 There are 
quite a few things that I would like to see improved with dependency generators 
in the 4.17, 4.18 time frame.

-- 
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/1257#issuecomment-641227025___
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 OrderWithRequires dependency generation (#1257)

2020-06-09 Thread mikhailnov
Thanks. One question: do I understand correctly that currently there is no way 
to make a generator of Requires(pre), Requires(post), Requires(postun), 
OrderWithRequires(pre) etc.?

-- 
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/1257#issuecomment-641206157___
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 OrderWithRequires dependency generation (#1257)

2020-06-09 Thread Florian Festi
Yes, not having a dependency generator for OrderWithRequires is clearly an 
oversight. Details on what generators are a valid use case are not relevant 
here.

Thanks for the patch!

-- 
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/1257#issuecomment-641202025___
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 OrderWithRequires dependency generation (#1257)

2020-06-09 Thread Florian Festi
Merged #1257 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/1257#event-3424224260___
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 OrderWithRequires dependency generation (#1257)

2020-06-08 Thread Zbigniew Jędrzejewski-Szmek
> But why? If a package contains a config is /usr/lib/sysusers.d/, why not to 
> ensure that it is installed after systemd-sysusers binary is present and so 
> the scriptlet which creates users can be executed?

Yes, in that case the dependency is warranted.

> If there is just a scriptlet which calls `systemctl preset`

Each distribution can do this as they see fit, but at least in Fedora 
systemd.rpm calls `preset-all` upon installation, so the effect is the same no 
matter if packages with units are installed before or after.

> In most cases, I agree, it is not needed, but seems to be not harmful.

The reason to minimize dependencies is avoidance of circular dependencies. When 
there's a circular dependency, dnf will have to break the loop by ignoring some 
dependency, which can break some other script where the dependency is actually 
valid.

-- 
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/1257#issuecomment-640532705___
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 OrderWithRequires dependency generation (#1257)

2020-06-07 Thread mikhailnov
If there is just a scriptlet which calls `systemctl preset`, in _some_ cases it 
may silently fail to enable a service which must be enabled.
In most cases, I agree, it is not needed, but seems to be not harmful.

-- 
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/1257#issuecomment-640264300___
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 OrderWithRequires dependency generation (#1257)

2020-06-07 Thread mikhailnov
But why? If a package contains a config is /usr/lib/sysusers.d/, why not to 
ensure that it is installed after systemd-sysusers binary is present and so the 
scriptlet which creates users can be executed?

-- 
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/1257#issuecomment-640263148___
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 OrderWithRequires dependency generation (#1257)

2020-06-07 Thread Zbigniew Jędrzejewski-Szmek
> it is only some specific cases where this needs to be used.

Yeah, we used to pull in systemd much more often. Nowadays, most packages 
should not pull in systemd, and install time ordering also doesn't matter. But 
that's largely irrelevant here, since systemd was only used as an example here. 
Extending generation to OrderWithRequires seems to be generally useful.

-- 
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/1257#issuecomment-640238714___
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 OrderWithRequires dependency generation (#1257)

2020-06-07 Thread Igor Raits
> When a package contains a systemd unit, %systemd_* macros are usually used;
> it is usefull to add "OrderWithRequires: systemd" in this case to ensure
> that systemd is installed before that package.

I think I disagree here, it is only some specific cases where this needs to be 
used.

cc @keszybz 

---

Other than that, LGTM.

-- 
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/1257#issuecomment-640214135___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


[Rpm-maint] [rpm-software-management/rpm] Add OrderWithRequires dependency generation (#1257)

2020-06-06 Thread mikhailnov
It was possible to generate Requires, Recommends etc. using external dependency 
generators.
Adding ability to generate OrderWithRequires.

Example use case:

When a package contains a systemd unit, %systemd_* macros are usually used;
it is usefull to add OrderWithRequires: systemd in this case to 
ensure
that systemd is installed before that package.

It will help to avoid adding %systemd_ordering manually to all 
packages using systemd.
Having systemd preinstalled before packages with systemd scriptlets is really 
important,
otherwise those scriptlets fail silently, and the resulting ISO or chroot may 
be broken.

The same makes sense for e.g. systemd-sysusers, systemd-tmpfiles.

An RPM generator using this functionality was implemented: 
https://abf.io/import/order-rpm-generators
Rebuilding packages with systemd stuff in rosa2019.05 using this generator has 
already helped
to improve installation order, e.g. make e.g. openvpn be installed when systemd 
already exists
in a big transaction with ~3500 packages when building a big ISO image.
Before that openvpn was installed when systemd did not exist yet.

P.S. This patch adds %__find_orderwithrequires, maybe that is legacy code that 
should not be changed.
You can view, comment on, or merge this pull request online at:

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

-- Commit Summary --

  * Add OrderWithRequires dependency generation

-- File Changes --

M build/rpmfc.c (10)
M build/rpmfc.h (7)
M tools/rpmdeps.c (6)

-- Patch Links --

https://github.com/rpm-software-management/rpm/pull/1257.patch
https://github.com/rpm-software-management/rpm/pull/1257.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/1257
___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint