ALT Linux Team development discussions
 help / color / mirror / Atom feed
* [devel] [PATCH for rpm] Add triggers circumvension for packagekit offline update
@ 2019-10-31 11:58 Aleksei Nikiforov
  2019-10-31 12:59 ` Dmitry V. Levin
  0 siblings, 1 reply; 6+ messages in thread
From: Aleksei Nikiforov @ 2019-10-31 11:58 UTC (permalink / raw)
  To: devel; +Cc: Aleksei Nikiforov

Joint change with Oleg Solovyov (mcpain@)
---
 alt/rpm.spec | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/alt/rpm.spec b/alt/rpm.spec
index 6217493b7..d93e701b1 100644
--- a/alt/rpm.spec
+++ b/alt/rpm.spec
@@ -385,6 +385,7 @@ ls -A tests/rpmtests.dir 2>/dev/null ||:
 #[ ! -L %%_rpmlibdir/noarch-alt-%%_target_os ] || rm -f %%_rpmlibdir/noarch-alt-%%_target_os ||:
 
 %post
+if [ ! -f %_localstatedir/PackageKit/disable-rpm-triggers ]; then
 #chgrp %%name %%_localstatedir/%%name/[A-Z]*
 [ -n "$DURING_INSTALL" -o -n "$BTE_INSTALL" ] ||
         %_rpmlibdir/pdeath_execute $PPID %_rpmlibdir/postupdate
@@ -393,6 +394,7 @@ ls -A tests/rpmtests.dir 2>/dev/null ||:
 if set /var/cache/apt/*.bin && [ -f "$1" ]; then
         %_rpmlibdir/pdeath_execute $PPID rm -f "$@"
 fi
+fi
 :
 
 %triggerpostun -- rpm <= 4.0.4
-- 
2.21.0



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [devel] [PATCH for rpm] Add triggers circumvension for packagekit offline update
  2019-10-31 11:58 [devel] [PATCH for rpm] Add triggers circumvension for packagekit offline update Aleksei Nikiforov
@ 2019-10-31 12:59 ` Dmitry V. Levin
  2019-10-31 13:19   ` Aleksei Nikiforov
  2019-10-31 13:24   ` [devel] [PATCH for rpm v2] " Aleksei Nikiforov
  0 siblings, 2 replies; 6+ messages in thread
From: Dmitry V. Levin @ 2019-10-31 12:59 UTC (permalink / raw)
  To: ALT Devel discussion list

[-- Attachment #1: Type: text/plain, Size: 1231 bytes --]

On Thu, Oct 31, 2019 at 02:58:08PM +0300, Aleksei Nikiforov wrote:
> Joint change with Oleg Solovyov (mcpain@)

Thanks.

It's not clear from the commit message why one might need to disable
rpmdb --rebuilddb after rpm update.

Could you elaborate, please?

> ---
>  alt/rpm.spec | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/alt/rpm.spec b/alt/rpm.spec
> index 6217493b7..d93e701b1 100644
> --- a/alt/rpm.spec
> +++ b/alt/rpm.spec
> @@ -385,6 +385,7 @@ ls -A tests/rpmtests.dir 2>/dev/null ||:
>  #[ ! -L %%_rpmlibdir/noarch-alt-%%_target_os ] || rm -f %%_rpmlibdir/noarch-alt-%%_target_os ||:
>  
>  %post
> +if [ ! -f %_localstatedir/PackageKit/disable-rpm-triggers ]; then
>  #chgrp %%name %%_localstatedir/%%name/[A-Z]*
>  [ -n "$DURING_INSTALL" -o -n "$BTE_INSTALL" ] ||
>          %_rpmlibdir/pdeath_execute $PPID %_rpmlibdir/postupdate
> @@ -393,6 +394,7 @@ ls -A tests/rpmtests.dir 2>/dev/null ||:
>  if set /var/cache/apt/*.bin && [ -f "$1" ]; then
>          %_rpmlibdir/pdeath_execute $PPID rm -f "$@"
>  fi
> +fi
>  :

If this change is needed, it should rather look this way:

if [ -f %_localstatedir/PackageKit/disable-rpm-triggers ]; then
	exit 0
fi


-- 
ldv

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [devel] [PATCH for rpm] Add triggers circumvension for packagekit offline update
  2019-10-31 12:59 ` Dmitry V. Levin
@ 2019-10-31 13:19   ` Aleksei Nikiforov
  2019-11-01 18:58     ` Dmitry V. Levin
  2019-10-31 13:24   ` [devel] [PATCH for rpm v2] " Aleksei Nikiforov
  1 sibling, 1 reply; 6+ messages in thread
From: Aleksei Nikiforov @ 2019-10-31 13:19 UTC (permalink / raw)
  To: devel

31.10.2019 15:59, Dmitry V. Levin пишет:
> On Thu, Oct 31, 2019 at 02:58:08PM +0300, Aleksei Nikiforov wrote:
>> Joint change with Oleg Solovyov (mcpain@)
> 
> Thanks.
> 
> It's not clear from the commit message why one might need to disable
> rpmdb --rebuilddb after rpm update.
> 
> Could you elaborate, please?
> 

packagekit offline update is implemented in following way:
1) system is preparing for offline update: all new installed packages 
are downloaded, etc.
2) system is rebooting into special systemd offline update mode upon 
user request.
3) in this offline update mode packagekit offline update service is 
performing system update using packagekit service activated via dbus.
4) Last step of systemd offline update is a reboot request. It must be 
made by offline update service. And packagekit offline update service 
does request it.

Thus, rpmdb --rebuilddb from rpm scripts would be in race against reboot 
request. Testing showed that it doesn't work properly in such 
conditions. In best case, rpmdb --rebuilddb doesn't do anything at all 
before reboot happens. Instead of hoping to get it work properly in such 
conditions, disabling it in rpm scripts and calling it right after 
update but before reboot request from packagekit offline update works fine:

http://git.altlinux.org/people/darktemplar/packages/?p=PackageKit.git;a=commitdiff;h=9b34f9657927dc748ec0a7b42cf2f58389a7f60a

A bit info about offline updates:
https://www.freedesktop.org/software/systemd/man/systemd.offline-updates.html

>> ---
>>   alt/rpm.spec | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/alt/rpm.spec b/alt/rpm.spec
>> index 6217493b7..d93e701b1 100644
>> --- a/alt/rpm.spec
>> +++ b/alt/rpm.spec
>> @@ -385,6 +385,7 @@ ls -A tests/rpmtests.dir 2>/dev/null ||:
>>   #[ ! -L %%_rpmlibdir/noarch-alt-%%_target_os ] || rm -f %%_rpmlibdir/noarch-alt-%%_target_os ||:
>>   
>>   %post
>> +if [ ! -f %_localstatedir/PackageKit/disable-rpm-triggers ]; then
>>   #chgrp %%name %%_localstatedir/%%name/[A-Z]*
>>   [ -n "$DURING_INSTALL" -o -n "$BTE_INSTALL" ] ||
>>           %_rpmlibdir/pdeath_execute $PPID %_rpmlibdir/postupdate
>> @@ -393,6 +394,7 @@ ls -A tests/rpmtests.dir 2>/dev/null ||:
>>   if set /var/cache/apt/*.bin && [ -f "$1" ]; then
>>           %_rpmlibdir/pdeath_execute $PPID rm -f "$@"
>>   fi
>> +fi
>>   :
> 
> If this change is needed, it should rather look this way:
> 
> if [ -f %_localstatedir/PackageKit/disable-rpm-triggers ]; then
> 	exit 0
> fi
> 
> 
> 
> _______________________________________________
> Devel mailing list
> Devel@lists.altlinux.org
> https://lists.altlinux.org/mailman/listinfo/devel
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [devel] [PATCH for rpm v2] Add triggers circumvension for packagekit offline update
  2019-10-31 12:59 ` Dmitry V. Levin
  2019-10-31 13:19   ` Aleksei Nikiforov
@ 2019-10-31 13:24   ` Aleksei Nikiforov
  1 sibling, 0 replies; 6+ messages in thread
From: Aleksei Nikiforov @ 2019-10-31 13:24 UTC (permalink / raw)
  To: devel; +Cc: Aleksei Nikiforov

Joint change with Oleg Solovyov (mcpain@)
---
 alt/rpm.spec | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/alt/rpm.spec b/alt/rpm.spec
index 6217493b7..a38367ffd 100644
--- a/alt/rpm.spec
+++ b/alt/rpm.spec
@@ -385,6 +385,10 @@ ls -A tests/rpmtests.dir 2>/dev/null ||:
 #[ ! -L %%_rpmlibdir/noarch-alt-%%_target_os ] || rm -f %%_rpmlibdir/noarch-alt-%%_target_os ||:
 
 %post
+if [ -f %_localstatedir/PackageKit/disable-rpm-triggers ]; then
+        exit 0
+fi
+
 #chgrp %%name %%_localstatedir/%%name/[A-Z]*
 [ -n "$DURING_INSTALL" -o -n "$BTE_INSTALL" ] ||
         %_rpmlibdir/pdeath_execute $PPID %_rpmlibdir/postupdate
-- 
2.21.0



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [devel] [PATCH for rpm] Add triggers circumvension for packagekit offline update
  2019-10-31 13:19   ` Aleksei Nikiforov
@ 2019-11-01 18:58     ` Dmitry V. Levin
  2019-11-05 12:40       ` [devel] [PATCH for rpm v3] " Aleksei Nikiforov
  0 siblings, 1 reply; 6+ messages in thread
From: Dmitry V. Levin @ 2019-11-01 18:58 UTC (permalink / raw)
  To: ALT Devel discussion list

[-- Attachment #1: Type: text/plain, Size: 1731 bytes --]

On Thu, Oct 31, 2019 at 04:19:16PM +0300, Aleksei Nikiforov wrote:
> 31.10.2019 15:59, Dmitry V. Levin пишет:
> > On Thu, Oct 31, 2019 at 02:58:08PM +0300, Aleksei Nikiforov wrote:
> >> Joint change with Oleg Solovyov (mcpain@)
> > 
> > Thanks.
> > 
> > It's not clear from the commit message why one might need to disable
> > rpmdb --rebuilddb after rpm update.
> > 
> > Could you elaborate, please?
> 
> packagekit offline update is implemented in following way:
> 1) system is preparing for offline update: all new installed packages 
> are downloaded, etc.
> 2) system is rebooting into special systemd offline update mode upon 
> user request.
> 3) in this offline update mode packagekit offline update service is 
> performing system update using packagekit service activated via dbus.
> 4) Last step of systemd offline update is a reboot request. It must be 
> made by offline update service. And packagekit offline update service 
> does request it.
> 
> Thus, rpmdb --rebuilddb from rpm scripts would be in race against reboot 
> request. Testing showed that it doesn't work properly in such 
> conditions. In best case, rpmdb --rebuilddb doesn't do anything at all 
> before reboot happens. Instead of hoping to get it work properly in such 
> conditions, disabling it in rpm scripts and calling it right after 
> update but before reboot request from packagekit offline update works fine:

OK, I cannot say that I like this approach, but at least it makes sense.
The alternative is invoking pk-offline-update in a separate pid namespace
which is probably not as simple as disabling rpm %post.

Could you add the rationale from your post into the commit message,
please?


-- 
ldv

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [devel] [PATCH for rpm v3] Add triggers circumvension for packagekit offline update
  2019-11-01 18:58     ` Dmitry V. Levin
@ 2019-11-05 12:40       ` Aleksei Nikiforov
  0 siblings, 0 replies; 6+ messages in thread
From: Aleksei Nikiforov @ 2019-11-05 12:40 UTC (permalink / raw)
  To: devel; +Cc: Aleksei Nikiforov

packagekit offline update is implemented in following way:
1) system is preparing for offline update:
   all new installed packages are downloaded, etc.
2) system is rebooting into special systemd offline update mode
   upon user request.
3) in this offline update mode packagekit offline update service is performing
   system update using packagekit service activated via dbus.
4) Last step of systemd offline update is a reboot request.
   It must be made by offline update service.
   And packagekit offline update service does request it.

Thus, rpmdb --rebuilddb from rpm scripts would be in race against reboot request.
Testing showed that it doesn't work properly in such conditions.
In best case, rpmdb --rebuilddb doesn't do anything at all before reboot happens.
Instead of hoping to get it work properly in such conditions,
disabling it in rpm scripts and calling it right after update
but before reboot request from packagekit offline update works fine.

Joint change with Oleg Solovyov (mcpain@)
---
 alt/rpm.spec | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/alt/rpm.spec b/alt/rpm.spec
index 6217493b7..a38367ffd 100644
--- a/alt/rpm.spec
+++ b/alt/rpm.spec
@@ -385,6 +385,10 @@ ls -A tests/rpmtests.dir 2>/dev/null ||:
 #[ ! -L %%_rpmlibdir/noarch-alt-%%_target_os ] || rm -f %%_rpmlibdir/noarch-alt-%%_target_os ||:
 
 %post
+if [ -f %_localstatedir/PackageKit/disable-rpm-triggers ]; then
+        exit 0
+fi
+
 #chgrp %%name %%_localstatedir/%%name/[A-Z]*
 [ -n "$DURING_INSTALL" -o -n "$BTE_INSTALL" ] ||
         %_rpmlibdir/pdeath_execute $PPID %_rpmlibdir/postupdate
-- 
2.21.0



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-11-05 12:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-31 11:58 [devel] [PATCH for rpm] Add triggers circumvension for packagekit offline update Aleksei Nikiforov
2019-10-31 12:59 ` Dmitry V. Levin
2019-10-31 13:19   ` Aleksei Nikiforov
2019-11-01 18:58     ` Dmitry V. Levin
2019-11-05 12:40       ` [devel] [PATCH for rpm v3] " Aleksei Nikiforov
2019-10-31 13:24   ` [devel] [PATCH for rpm v2] " Aleksei Nikiforov

ALT Linux Team development discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/devel/0 devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 devel devel/ http://lore.altlinux.org/devel \
		devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru
	public-inbox-index devel

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git