Hi,

I can confirm that the scriptlet still works, at least for
symlink-to-directory, I'm currently using it for a nodejs change.

I have initially struggled to make it works as it in my case I have
apparently needed to specify the package name with* -n option*, like so:
%pretrans -n %{pkgname} -p <lua>
>
> path = "/path/to/symlink"
> st = posix.stat(path)
> if st and st.type == "link" then
>   os.remove(path)
> end

Otherwise if used without the -n option like is in the docs, the scriptlet
wouldn't be initialized/started.

On Wed, Jul 30, 2025 at 11:36 AM Jarek Prokop <jpro...@redhat.com> wrote:

> On 7/29/25 11:03 PM, Fabio Valentini wrote:
> > On Tue, Jul 29, 2025 at 10:38 PM Elliott Sales de Andrade
> > <quantum.anal...@gmail.com> wrote:
> >> On Tue, Jul 29, 2025 at 4:16 PM Jos de Kloe <josdek...@gmail.com>
> wrote:
> >>> Hi,
> >>>
> >>> as suggested on this Directory_Replacement page I tried to solve this
> >>> problem by adding a little lua scriptlet.
> >>> Unfortunately it seems not to work for me so I must be missing some
> >>> details here.
> >> You aren't missing anything. The scriptlet doesn't work, as the
> >> transaction is checked by dnf before rpm scriptlets even happen. The
> >> best workaround is to just _not_ change directories to symlinks or
> >> vice versa. How to actually do that depends on the package, though.
> >> Given the recent Change Proposal to hard-link duplicate files, maybe
> >> the simplest option is to just make the symlinks into duplicate
> >> directory copies.
> >>
> >> I don't know why that documentation page still exists; I've never been
> >> able to get it to work as documented, and it's been that way for a
> >> long time:
> >> https://pagure.io/packaging-committee/issue/1139
> > As I understand it, some behaviour of dnf changed a few years ago,
> > which made the approach documented in the Packaging Guidelines
> > ("Directory_Replacement" page) no longer work.
>
> Hi,
>
> IIRC it still works OK (or to some degree), but can decide not to work
> in various situations,
> like "recently" (few months back) for nodejs with specific overlayfs
> configuration:
>
> https://lists.fedoraproject.org/archives/list/packag...@lists.fedoraproject.org/thread/OKEI2K7GSUHWEF5R5N767LUOJNP7YJQQ/
> >
> > So there's currently no really good / documented way to handle this case.
> > (And we should remove the docs for things that no longer work, I agree.)
> Sounds good, but then what would be in its place?
>
> I think this is yet another reminder that we should have another kind of
> workaround for these
> unfortunate situations. Just removing that without any replacement plan
> it is not an ideal way forward IMO.
> >
> > Fabio
> Thanks,
> Jarek
>
> --
> _______________________________________________
> devel mailing list -- devel@lists.fedoraproject.org
> To unsubscribe send an email to devel-le...@lists.fedoraproject.org
> Fedora Code of Conduct:
> https://docs.fedoraproject.org/en-US/project/code-of-conduct/
> List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
> List Archives:
> https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org
> Do not reply to spam, report it:
> https://pagure.io/fedora-infrastructure/new_issue
>
-- 
_______________________________________________
devel mailing list -- devel@lists.fedoraproject.org
To unsubscribe send an email to devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue

Reply via email to