* Re: [PATCH V2] opkg: Call prerm and postrm scripts on package upgrade.
[not found] <543ea179.e25bb40a.2c8a.1e34SMTPIN_ADDED_BROKEN@mx.google.com>
@ 2014-10-15 17:26 ` Paul Barker
2014-10-15 22:34 ` Peter Urbanec
0 siblings, 1 reply; 3+ messages in thread
From: Paul Barker @ 2014-10-15 17:26 UTC (permalink / raw)
To: Peter Urbanec; +Cc: OE Core
On 15 October 2014 17:31, Peter Urbanec <openembedded-devel@urbanec.net> wrote:
> opkg upgrade will now call prerm and postrm scripts from the old package
> with the "upgrade new-version" arguments, similar to what dpkg does.
>
> Signed-off-by: Peter Urbanec <openembedded-devel@urbanec.net>
> ---
> .../opkg/opkg/prerm-and-postrm-scripts.patch | 82
> ++++++++++++++++++++++
> meta/recipes-devtools/opkg/opkg_0.2.2.bb | 1 +
> 2 files changed, 83 insertions(+)
> create mode 100644
> meta/recipes-devtools/opkg/opkg/prerm-and-postrm-scripts.patch
>
> diff --git a/meta/recipes-devtools/opkg/opkg/prerm-and-postrm-scripts.patch
> b/meta/recipes-devtools/opkg/opkg/prerm-and-postrm-scripts.patch
> new file mode 100644
> index 0000000..0d7f726
> --- /dev/null
> +++ b/meta/recipes-devtools/opkg/opkg/prerm-and-postrm-scripts.patch
> @@ -0,0 +1,82 @@
> +Upstream-Status: Submitted [opkg-devel@googlegroups.com]
> +Signed-off-by: Peter Urbanec <openembedded-devel@urbanec.net>
> +
> +From 476965fdb2d6eec559242e6205cbb07d539b80e1 Mon Sep 17 00:00:00 2001
> +From: Peter Urbanec <openembedded-devel@urbanec.net>
> +Date: Wed, 15 Oct 2014 14:32:22 +1100
> +Subject: [PATCH] opkg_install: Call prerm and postrm scripts on package
> upgrade.
> +To: opkg-devel@googlegroups.com
> +Cc: paul@paulbarker.me.uk
> +
> +When upgrading a package from v1 to v2, run "v1-prerm upgrade v2" and
> +"v1-postrm upgrade v2", similarly to what dpkg does.
> +
> +This patch fixes issue 104.
For the sake of future readers within OpenEmbedded, we need to make
clearer here that this is opkg issue 104, not an OE issue number. This
change isn't needed in the patch to opkg upstream though.
> +
> +Signed-off-by: Peter Urbanec <openembedded-devel@urbanec.net>
Sorry to be pedantic but there's now 2 copies of the Signed-off-by
line. If you resend this, I'd also bring the Upstream-status line down
so that it immediately follows the Signed-off-by line. That's just a
minor cosmetic point though, it may be possible for someone to make
these edits as the patch is merged.
> +
> +---
> + libopkg/opkg_install.c | 40 ++++++++++++++++++++++++++++++++++++++--
> + 1 file changed, 38 insertions(+), 2 deletions(-)
> +
> +diff --git a/libopkg/opkg_install.c b/libopkg/opkg_install.c
> +index 4f6fe65..ec0f34a 100644
> +--- a/libopkg/opkg_install.c
> ++++ b/libopkg/opkg_install.c
> +@@ -601,7 +601,25 @@ prerm_upgrade_old_pkg(pkg_t *pkg, pkg_t *old_pkg)
> + Error unwind, for both the above cases:
> + old-postinst abort-upgrade new-version
> + */
> +- return 0;
> ++ int err;
> ++ char *script_args;
> ++ char *new_version;
> ++
> ++ if (!old_pkg || !pkg)
> ++ return 0;
> ++
> ++ new_version = pkg_version_str_alloc(pkg);
> ++
> ++ sprintf_alloc(&script_args, "upgrade %s", new_version);
> ++ free(new_version);
> ++ err = pkg_run_script(old_pkg, "prerm", script_args);
> ++ free(script_args);
> ++ if (err != 0) {
> ++ opkg_msg(ERROR, "prerm script for package \"%s\" failed\n",
> ++ old_pkg->name);
> ++ return -1;
> ++ }
> ++ return 0;
> + }
> +
> + static int
> +@@ -1001,7 +1019,25 @@ postrm_upgrade_old_pkg(pkg_t *pkg, pkg_t *old_pkg)
> + new-postrm failed-upgrade old-version
> + Error unwind, for both cases:
> + old-preinst abort-upgrade new-version */
> +- return 0;
> ++ int err;
> ++ char *script_args;
> ++ char *new_version;
> ++
> ++ if (!old_pkg || !pkg)
> ++ return 0;
> ++
> ++ new_version = pkg_version_str_alloc(pkg);
> ++
> ++ sprintf_alloc(&script_args, "upgrade %s", new_version);
> ++ free(new_version);
> ++ err = pkg_run_script(old_pkg, "postrm", script_args);
> ++ free(script_args);
> ++ if (err != 0) {
> ++ opkg_msg(ERROR, "postrm script for package \"%s\" failed\n",
> ++ old_pkg->name);
> ++ return -1;
> ++ }
> ++ return 0;
> + }
> +
> + static int
> +--
> +2.1.2
> +
This looks fine. As I've said in reply to the patch on the opkg-devel
mailing list, I'm busy this week but should have time to test this
properly next week. It looks correct to me though, the logic is almost
identical to the patch I prepared which covers prerm only.
It probably doesn't need to wait for my test before going into OE though.
--
Paul Barker
Email: paul@paulbarker.me.uk
http://www.paulbarker.me.uk
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH V2] opkg: Call prerm and postrm scripts on package upgrade.
2014-10-15 17:26 ` [PATCH V2] opkg: Call prerm and postrm scripts on package upgrade Paul Barker
@ 2014-10-15 22:34 ` Peter Urbanec
0 siblings, 0 replies; 3+ messages in thread
From: Peter Urbanec @ 2014-10-15 22:34 UTC (permalink / raw)
To: Paul Barker; +Cc: OE Core
On 16/10/14 04:26, Paul Barker wrote:
> For the sake of future readers within OpenEmbedded, we need to make
> clearer here that this is opkg issue 104, not an OE issue number. This
> change isn't needed in the patch to opkg upstream though.
>
>> +
>> +Signed-off-by: Peter Urbanec <openembedded-devel@urbanec.net>
>
> Sorry to be pedantic but there's now 2 copies of the Signed-off-by
> line. If you resend this, I'd also bring the Upstream-status line down
> so that it immediately follows the Signed-off-by line. That's just a
> minor cosmetic point though, it may be possible for someone to make
> these edits as the patch is merged.
I resent the patch with your suggestions incorporated. Specifically, I
mentioned that the patch is for an opkg issue and provided the URL to
the relevant opkg issue tracker entry. I also rearranged the
Upstream-Status and Signed-off-by lines as suggested.
> This looks fine. As I've said in reply to the patch on the opkg-devel
> mailing list, I'm busy this week but should have time to test this
> properly next week. It looks correct to me though, the logic is almost
> identical to the patch I prepared which covers prerm only.
>
> It probably doesn't need to wait for my test before going into OE though.
Thanks. Version 3 of the patch I sent out has no code changes, just the
patch meta information and comments.
Cheers,
Peter
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH V2] opkg: Call prerm and postrm scripts on package upgrade.
@ 2014-10-15 16:31 Peter Urbanec
0 siblings, 0 replies; 3+ messages in thread
From: Peter Urbanec @ 2014-10-15 16:31 UTC (permalink / raw)
To: openembedded-core
opkg upgrade will now call prerm and postrm scripts from the old package
with the "upgrade new-version" arguments, similar to what dpkg does.
Signed-off-by: Peter Urbanec <openembedded-devel@urbanec.net>
---
.../opkg/opkg/prerm-and-postrm-scripts.patch | 82
++++++++++++++++++++++
meta/recipes-devtools/opkg/opkg_0.2.2.bb | 1 +
2 files changed, 83 insertions(+)
create mode 100644
meta/recipes-devtools/opkg/opkg/prerm-and-postrm-scripts.patch
diff --git
a/meta/recipes-devtools/opkg/opkg/prerm-and-postrm-scripts.patch
b/meta/recipes-devtools/opkg/opkg/prerm-and-postrm-scripts.patch
new file mode 100644
index 0000000..0d7f726
--- /dev/null
+++ b/meta/recipes-devtools/opkg/opkg/prerm-and-postrm-scripts.patch
@@ -0,0 +1,82 @@
+Upstream-Status: Submitted [opkg-devel@googlegroups.com]
+Signed-off-by: Peter Urbanec <openembedded-devel@urbanec.net>
+
+From 476965fdb2d6eec559242e6205cbb07d539b80e1 Mon Sep 17 00:00:00 2001
+From: Peter Urbanec <openembedded-devel@urbanec.net>
+Date: Wed, 15 Oct 2014 14:32:22 +1100
+Subject: [PATCH] opkg_install: Call prerm and postrm scripts on package
upgrade.
+To: opkg-devel@googlegroups.com
+Cc: paul@paulbarker.me.uk
+
+When upgrading a package from v1 to v2, run "v1-prerm upgrade v2" and
+"v1-postrm upgrade v2", similarly to what dpkg does.
+
+This patch fixes issue 104.
+
+Signed-off-by: Peter Urbanec <openembedded-devel@urbanec.net>
+
+---
+ libopkg/opkg_install.c | 40 ++++++++++++++++++++++++++++++++++++++--
+ 1 file changed, 38 insertions(+), 2 deletions(-)
+
+diff --git a/libopkg/opkg_install.c b/libopkg/opkg_install.c
+index 4f6fe65..ec0f34a 100644
+--- a/libopkg/opkg_install.c
++++ b/libopkg/opkg_install.c
+@@ -601,7 +601,25 @@ prerm_upgrade_old_pkg(pkg_t *pkg, pkg_t *old_pkg)
+ Error unwind, for both the above cases:
+ old-postinst abort-upgrade new-version
+ */
+- return 0;
++ int err;
++ char *script_args;
++ char *new_version;
++
++ if (!old_pkg || !pkg)
++ return 0;
++
++ new_version = pkg_version_str_alloc(pkg);
++
++ sprintf_alloc(&script_args, "upgrade %s", new_version);
++ free(new_version);
++ err = pkg_run_script(old_pkg, "prerm", script_args);
++ free(script_args);
++ if (err != 0) {
++ opkg_msg(ERROR, "prerm script for package \"%s\" failed\n",
++ old_pkg->name);
++ return -1;
++ }
++ return 0;
+ }
+
+ static int
+@@ -1001,7 +1019,25 @@ postrm_upgrade_old_pkg(pkg_t *pkg, pkg_t
*old_pkg)
+ new-postrm failed-upgrade old-version
+ Error unwind, for both cases:
+ old-preinst abort-upgrade new-version */
+- return 0;
++ int err;
++ char *script_args;
++ char *new_version;
++
++ if (!old_pkg || !pkg)
++ return 0;
++
++ new_version = pkg_version_str_alloc(pkg);
++
++ sprintf_alloc(&script_args, "upgrade %s", new_version);
++ free(new_version);
++ err = pkg_run_script(old_pkg, "postrm", script_args);
++ free(script_args);
++ if (err != 0) {
++ opkg_msg(ERROR, "postrm script for package \"%s\" failed\n",
++ old_pkg->name);
++ return -1;
++ }
++ return 0;
+ }
+
+ static int
+--
+2.1.2
+
diff --git a/meta/recipes-devtools/opkg/opkg_0.2.2.bb
b/meta/recipes-devtools/opkg/opkg_0.2.2.bb
index 3dd7489..c5b6561 100644
--- a/meta/recipes-devtools/opkg/opkg_0.2.2.bb
+++ b/meta/recipes-devtools/opkg/opkg_0.2.2.bb
@@ -4,6 +4,7 @@ SRC_URI =
"http://downloads.yoctoproject.org/releases/${BPN}/${BPN}-${PV}.tar.gz
file://no-install-recommends.patch \
file://add-exclude.patch \
file://opkg-configure.service \
+ file://prerm-and-postrm-scripts.patch \
"
S = "${WORKDIR}/${BPN}-${PV}"
--
2.1.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-10-15 22:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <543ea179.e25bb40a.2c8a.1e34SMTPIN_ADDED_BROKEN@mx.google.com>
2014-10-15 17:26 ` [PATCH V2] opkg: Call prerm and postrm scripts on package upgrade Paul Barker
2014-10-15 22:34 ` Peter Urbanec
2014-10-15 16:31 Peter Urbanec
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox