AOSC-Archive / autobuild3

AOSC OS package maintenance toolkit (version 3)
https://aosc.io
GNU General Public License v2.0
24 stars 17 forks source link

Need better abstraction for abscripts, including triggers. #35

Open Artoria2e5 opened 9 years ago

Artoria2e5 commented 9 years ago

It's really sad (and quite normal) that all package managers we currently support has an implmentation for triggers. Being not strange at all, it's far better than what we have now, even better than the revised one in #34。

Additionally, different package managers pass fairly different args to the scripts. A common shell header should be added (personally I suggest /var/ab/headers/abscript.$ABPM in $ABPM's package).

Trigger Documentation

RPM has an internal Lua interpreter (-p <lua>) , but I can't find it to be anyhow useful.

Maybe we should implement the header in plain POSIX shell (at most busybox ash with bash extensions), so we can make more effective bootstraps. Therefore, arrays may not be used, and [[ foo == pattern ]] must be rewritten with case foo in (pattern).

For unsupported ones, we can have the current one (with faked never-really-working await/noawait and a warning) as a fallback.

PM support reference

DPKG RPM Autobuild3 Pacman
interest path %transfiletrigger* no magic-comments needed
interest-noawait %filetrigger* #ab:...:trigger_noawait:...
interest-await %transfiletrigger* #ab:...:trigger_await:...
interest name stub: ab /var/ab/triggers/$name/$PKGNAME
activate stub: ab stub: noawait
activate-noawait stub: ab /var/ab/triggers/$name/* (symlink)

Major changes:

Notes:

TODO: States, arg scheme

Icenowy commented 9 years ago

The triggers support in ab3 is designed for RPM usage, but with a DPKG-like grammar. DPKG triggers in os2 is directly ported to os3, without any changes.

The RPM-style triggers support is serious, but it's not extensible at all.The DPKG-style triggers is open and extensible, but not suitable for RPM.So... I made such a bad wheel.

MingcongBai commented 9 years ago

@Icenowy Well now let's fix this then...

Artoria2e5 commented 9 years ago

@Icenowy Updated. Working on the correspondence.

Artoria2e5 commented 8 years ago

Can we nullify the current stubs for dpkg and only use them in rpm? (I am quite lazy now so)

MingcongBai commented 8 years ago

Can we nullify the current stubs for dpkg and only use them in rpm? (I am quite lazy now so)

Explain this?

Artoria2e5 commented 8 years ago

Basically redirect the results of all the /var/ab/triggered/... to somewhere other than postinst itself. In rpm do an extra cat to include the results.

MingcongBai commented 8 years ago

Got it.