This needs to be better documented and tested.

What does this posttrans thing really do?
Who would want to use it?
Can there be examples?
Can the Postinst test in meta/lib/oeqa/selftest/cases/runtime_test.py be
extended to regression-check that it works?

Alex

On Mon, 23 Aug 2021 at 14:23, Zoltan Boszormenyi via lists.openembedded.org
<zboszor=pr...@lists.openembedded.org> wrote:

> From: Zoltán Böszörményi <zbos...@gmail.com>
>
> The "posttrans" scriptlet is the RPM equivalent of the
> OPKG "intercept script" concept and probably a cleaner one.
>
> "pretrans" also exists in RPM but there's no equivalent
> for it in OPKG.
>
> Signed-off-by: Zoltán Böszörményi <zbos...@gmail.com>
> ---
>  meta/classes/package_rpm.bbclass | 30 +++++++++++++++++++++---------
>  1 file changed, 21 insertions(+), 9 deletions(-)
>
> diff --git a/meta/classes/package_rpm.bbclass
> b/meta/classes/package_rpm.bbclass
> index 88d861c0e7..5992d3fd06 100644
> --- a/meta/classes/package_rpm.bbclass
> +++ b/meta/classes/package_rpm.bbclass
> @@ -308,10 +308,11 @@ python write_specfile () {
>      srcrconflicts  = ""
>      srcrobsoletes  = ""
>
> -    srcrpreinst  = []
> -    srcrpostinst = []
> -    srcrprerm    = []
> -    srcrpostrm   = []
> +    srcrpreinst   = []
> +    srcrpostinst  = []
> +    srcrprerm     = []
> +    srcrpostrm    = []
> +    srcrposttrans = []
>
>      spec_preamble_top = []
>      spec_preamble_bottom = []
> @@ -373,11 +374,11 @@ python write_specfile () {
>          splitrconflicts  = localdata.getVar('RCONFLICTS') or ""
>          splitrobsoletes  = ""
>
> -        splitrpreinst  = localdata.getVar('pkg_preinst')
> -        splitrpostinst = localdata.getVar('pkg_postinst')
> -        splitrprerm    = localdata.getVar('pkg_prerm')
> -        splitrpostrm   = localdata.getVar('pkg_postrm')
> -
> +        splitrpreinst   = localdata.getVar('pkg_preinst')
> +        splitrpostinst  = localdata.getVar('pkg_postinst')
> +        splitrprerm     = localdata.getVar('pkg_prerm')
> +        splitrpostrm    = localdata.getVar('pkg_postrm')
> +        splitrposttrans = localdata.getVar('pkg_posttrans')
>
>          if not perfiledeps:
>              # Add in summary of per file dependencies
> @@ -405,6 +406,7 @@ python write_specfile () {
>              srcrpostinst   = splitrpostinst
>              srcrprerm      = splitrprerm
>              srcrpostrm     = splitrpostrm
> +            srcrposttrans  = splitrposttrans
>
>              file_list = []
>              walk_files(root, file_list, conffiles, dirfiles)
> @@ -496,6 +498,11 @@ python write_specfile () {
>              scriptvar = wrap_uninstall(splitrpostrm)
>              spec_scriptlets_bottom.append(scriptvar)
>              spec_scriptlets_bottom.append('')
> +        if splitrposttrans:
> +            spec_scriptlets_bottom.append('%%posttrans -n %s' % splitname)
> +            spec_scriptlets_bottom.append('# %s - posttrans' % splitname)
> +            spec_scriptlets_bottom.append(splitrposttrans)
> +            spec_scriptlets_bottom.append('')
>
>          # Now process files
>          file_list = []
> @@ -590,6 +597,11 @@ python write_specfile () {
>          scriptvar = wrap_uninstall(srcrpostrm)
>          spec_scriptlets_top.append(scriptvar)
>          spec_scriptlets_top.append('')
> +    if srcrposttrans:
> +        spec_scriptlets_top.append('%posttrans')
> +        spec_scriptlets_top.append('# %s - posttrans' % srcname)
> +        spec_scriptlets_top.append(srcrposttrans)
> +        spec_scriptlets_top.append('')
>
>      # Write the SPEC file
>      specfile = open(outspecfile, 'w')
> --
> 2.31.1
>
>
> 
>
>
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#155151): 
https://lists.openembedded.org/g/openembedded-core/message/155151
Mute This Topic: https://lists.openembedded.org/mt/85083966/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to