mudler / luet

:package: :whale: 0-dependency Container-based Package Manager using SAT solver and QLearning
https://luet.io
GNU General Public License v3.0
253 stars 24 forks source link

Add package finalize in addition to global finalize #312

Open msdobrescu opened 1 year ago

msdobrescu commented 1 year ago

Is your feature request related to a problem? Please describe.

Describe the solution you'd like

On the path /var/luet/db/repos/mocaccino-community/treefs/apps/xemacs/21.4.24-r5+6/finalize.yaml, for example, there is a copy of the mocaccino-community repo finalize.yaml.

Needing specific ops at finalization for a specific package, I have added code in the finalize.yaml of the collection (in C-R: /community-repository/packages/apps/finalize.yaml). Generally, it's like this:

install:

{{ range .Values.requires | uniq }}
  {{ if or (eq .name "X") (eq .name "gnome-common") (eq .name "gnome") }}
- glib-compile-schemas /usr/share/glib-2.0/schemas > /dev/null 2>&1
  {{ end }}
{{ end }}
- update-mime-database /usr/share/mime/
- ldconfig
{{ range .Values.requires | uniq }}
- env-update && source /etc/profile
{{ end }}

But for emacs or xemacs only, I add to the same file:

{{ if and (eq .Values.category "apps") (or (eq .Values.name "emacs") (eq .Values.name "xemacs")) }}
- eselect ctags update ifunset
{{ end }}
{{ if and (eq .Values.category "apps") (eq .Values.name "xemacs") }}
- eselect gnuclient update ifunset
{{ end }}

This entire thing goes to every package now, in /var/luet/db/repos/mocaccino-community/treefs/apps/<name>/<version>/finalize.yaml, regardless the package. What I would do? How I would prefer?

  1. Keep the first part as global (as before emacs)
  2. Add the second part to the package setup and end up this finalization to the package only:
- &apps-xemacs
  category: "apps"
  name: "xemacs"
  version: "21.4.24-r5+7"
...
finalize:
- glib-compile-schemas /usr/share/glib-2.0/schemas > /dev/null 2>&1
- env-update && source /etc/profile

That would be copied in /var/luet/db/repos/mocaccino-community/treefs/apps/xemacs/21.4.24-r5+6/finalize.yaml, at the end of the install section for that very package only, right after the global finalize.yaml install section content.

Describe alternatives you've considered

Additional context

msdobrescu commented 3 months ago

To summarize:

According to the above, the ideal implementation would be:

This solution means to reduce installation and especially upgrade times. Now, it may upgrade in minutes, literally, if the finalization would not be so long (hours in the case of some commands runs accumulation).