From: "Zoltan Boszormenyi" <zboszor@pr.hu>
To: Alexander Kanavin <alex.kanavin@gmail.com>
Cc: OE-core <openembedded-core@lists.openembedded.org>, zboszor@gmail.com
Subject: Re: [OE-core] [PATCH 1/6] package_rpm.bbclass: Handle posttrans scriptlets
Date: Mon, 23 Aug 2021 15:14:57 +0200 [thread overview]
Message-ID: <fb092fdd-103a-9eb9-c070-b72313d45fdd@pr.hu> (raw)
In-Reply-To: <CANNYZj_VL-bxXG_mb-Z5QaWhHZvr4p+LVnvgODm84tRkSrFjEA@mail.gmail.com>
It's documented at www.rpm.org, Red Hat and SuSE.
https://docs.fedoraproject.org/en-US/packaging-guidelines/Scriptlets/
https://en.opensuse.org/openSUSE:Packaging_scriptlet_snippets
https://rpm-packaging-guide.github.io/
It's available since RPM 4.4. RPM 4.16.1.3 is in Hardknott.
A short Google search showed that *maybe* dpkg also supports it,
or at least there are(were?) plans to implement it:
https://wiki.debian.org/i18n/TranslationDebsProposals
With postinst, the time when the scriptlet runs may depend
on the order of the packages in the upgrade transaction and
may run with the older binaries in place.
The posttrans scriptlet runs at the very end of the
install/upgrade transaction, just like the OPKG "intercept"
scripts.
I successfully tested it long ago with a kernel upgrade
that was running dracut on the new version, plus a dracut
upgrade in the same session. Dissecting the initramfs proved
that with postinst, the old dracut version generated it,
while with posttrans, the new one did.
Who would want to use it? Anyone who needs some finalizer
script to be run at the end of an RPM/DNF transaction.
I started on Angstrom and I know opkg doesn't implement this
and Yocto inherited it. This patch is basically a heads up
that there's another way to do the same thing. Maybe opkg
implements this some day, maybe not. Anyway, Yocto in general
will need more changes before the main package.bbclass can
start to use it for all package formats.
Zoltán
2021. 08. 23. 14:34 keltezéssel, Alexander Kanavin írta:
> 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
> <http://lists.openembedded.org> <zboszor=pr.hu@lists.openembedded.org
> <mailto:pr.hu@lists.openembedded.org>> wrote:
>
> From: Zoltán Böszörményi <zboszor@gmail.com <mailto:zboszor@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 <zboszor@gmail.com <mailto:zboszor@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
>
>
>
>
>
>
>
>
next prev parent reply other threads:[~2021-08-23 13:15 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-23 12:23 Kernel and RPM related bbclass changes Zoltan Boszormenyi
2021-08-23 12:23 ` [PATCH 1/6] package_rpm.bbclass: Handle posttrans scriptlets Zoltan Boszormenyi
2021-08-23 12:34 ` [OE-core] " Alexander Kanavin
2021-08-23 13:14 ` Zoltan Boszormenyi [this message]
2021-08-23 13:23 ` Richard Purdie
2021-08-23 13:42 ` Zoltan Boszormenyi
2021-08-23 12:23 ` [PATCH 2/6] kernel-module-split.bbclass: Support zstd-compressed modules Zoltan Boszormenyi
2021-08-23 12:23 ` [PATCH 3/6] kernel-module-split.bbclass: Allow opt-out of split kernel modules Zoltan Boszormenyi
2021-08-23 12:55 ` [OE-core] " Bruce Ashfield
2021-08-23 13:18 ` Zoltan Boszormenyi
2021-08-23 13:27 ` Bruce Ashfield
2021-08-23 13:31 ` Zoltan Boszormenyi
2021-08-23 13:35 ` Bruce Ashfield
[not found] ` <169DF0BA24F74A88.27647@lists.openembedded.org>
2021-08-23 12:56 ` Bruce Ashfield
2021-08-23 12:23 ` [PATCH 4/6] kernel.bbclass: Adapt to KERNEL_SPLIT_MODULES != "1" case Zoltan Boszormenyi
2021-08-23 12:23 ` [PATCH 5/6] kernel.bbclass: Use full versions for inter-package dependencies Zoltan Boszormenyi
2021-08-23 13:03 ` [OE-core] " Bruce Ashfield
2021-08-23 13:29 ` Zoltan Boszormenyi
2021-08-23 13:38 ` Bruce Ashfield
2021-08-23 13:48 ` Zoltan Boszormenyi
2021-08-23 12:23 ` [PATCH 6/6] Support zstd-compressed squashfs and cpio initramfs Zoltan Boszormenyi
2021-08-23 14:47 ` Kernel related bbclass changes Zoltan Boszormenyi
2021-08-23 14:47 ` [PATCH v2 1/4] kernel-module-split.bbclass: Support zstd-compressed modules Zoltan Boszormenyi
2021-08-23 14:47 ` [PATCH v2 2/4] Allow opt-out of split kernel modules Zoltan Boszormenyi
2021-08-23 14:47 ` [PATCH v2 3/4] kernel.bbclass: Use full versions for inter-package dependencies Zoltan Boszormenyi
2021-08-23 14:47 ` [PATCH v2 4/4] Support zstd-compressed squashfs and cpio initramfs Zoltan Boszormenyi
2021-08-23 14:54 ` Kernel related bbclass changes Zoltan Boszormenyi
2021-08-27 7:37 ` Kernel and image " Zoltan Boszormenyi
2021-08-27 7:37 ` [PATCH v4 1/4] kernel-module-split.bbclass: Support zstd-compressed modules Zoltan Boszormenyi
2021-08-27 7:37 ` [PATCH v4 2/4] Allow opt-out of split kernel modules Zoltan Boszormenyi
2021-08-27 7:37 ` [PATCH v4 3/4] kernel.bbclass: Use full versions for inter-package dependencies Zoltan Boszormenyi
2021-08-30 9:30 ` [OE-core] " Andrey Zhizhikin
2021-08-30 10:06 ` Zoltan Boszormenyi
[not found] ` <b75df7be-03d8-e454-60b8-1651fc935ca5@gmail.com>
2021-08-30 10:25 ` Andrey Zhizhikin
2021-08-30 19:51 ` Jon Mason
2021-08-31 4:28 ` Zoltan Boszormenyi
2021-08-31 13:32 ` Richard Purdie
2021-08-31 13:54 ` Andrey Zhizhikin
2021-08-27 7:37 ` [PATCH v4 4/4] Support zstd-compressed squashfs and cpio initramfs Zoltan Boszormenyi
2021-08-23 14:54 ` [PATCH v3 1/4] kernel-module-split.bbclass: Support zstd-compressed modules Zoltan Boszormenyi
2021-08-23 14:54 ` [PATCH v3 2/4] Allow opt-out of split kernel modules Zoltan Boszormenyi
2021-08-23 14:54 ` [PATCH v3 3/4] kernel.bbclass: Use full versions for inter-package dependencies Zoltan Boszormenyi
2021-08-23 14:54 ` [PATCH v3 4/4] Support zstd-compressed squashfs and cpio initramfs Zoltan Boszormenyi
2021-08-26 12:04 ` [OE-core] " Richard Purdie
2021-08-27 7:24 ` Zoltan Boszormenyi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fb092fdd-103a-9eb9-c070-b72313d45fdd@pr.hu \
--to=zboszor@pr.hu \
--cc=alex.kanavin@gmail.com \
--cc=openembedded-core@lists.openembedded.org \
--cc=zboszor@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox