Re: Trying to set up a clean upgrade path for celestia

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11. 02. 23 17:58, Mattia Verga wrote:
Mattia Verga wrote on 2023/02/11 22:26:

Directory -> symlink change conflict:
https://docs.fedoraproject.org/en-US/packaging-guidelines/Directory_Repla...

Regards,
Mamoru

Thanks, that worked! (with some ugly warnings about file not found during cleanup, but...)

Just a note about the example lua script in FPL: I think it could be a better example to define
`path = rpm.expand("/path/to/dir")`
rather than
`path = "/path/to/dir"`
so to not hardcode system dirs. I had to dig a bit into lua to find how to do that.

Sctriptlets are expanded on build time, so rpm.expand() is unnecessary and dangerous.

Don't use it in sctriptlets. Use the macros directly.

See:

https://src.fedoraproject.org/rpms/python-notebook/blob/f35/f/python-notebook.spec#_160

%pretrans -n python3-%{pypi_name} -p <lua>
path = "%{python3_sitelib}/%{pypi_name}/static/components/moment"
st = posix.stat(path)
if st and st.type == "link" then
  os.remove(path)
end

$ rpm -qp --scripts python3-notebook-6.4.0-4.fc35.noarch.rpm
pretrans scriptlet (using <lua>):
path = "/usr/lib/python3.10/site-packages/notebook/static/components/moment"
st = posix.stat(path)
if st and st.type == "link" then
  os.remove(path)
end


If the rpm.expand() call actually was there, you would end up with:

path = rpm.expand("/usr/lib/python3.10/site-packages/notebook/static/components/moment")

Which is not necessary. And even if you escaped the %-signs like this:

path = rpm.expand("%%{python3_sitelib}/%{pypi_name}/static/components/moment")

You would (probably) end up with:

path = rpm.expand("%{python3_sitelib}/%{pypi_name}/static/components/moment")

Which would fail on runtime if python3-rpm-macros is not instilled.

--
Miro Hrončok
--
Phone: +420777974800
IRC: mhroncok
_______________________________________________
packaging mailing list -- packaging@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to packaging-leave@xxxxxxxxxxxxxxxxxxxxxxx
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/packaging@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue




[Index of Archives]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite Forum]     [KDE Users]

  Powered by Linux