RPM Community Forums

Mailing List Message of <rpm-devel>

External configurable triggers in /etc/rpm/sysinfo/Triggername

From: Jeff Johnson <n3npq@mac.com>
Date: Fri 17 Oct 2008 - 19:54:24 CEST
Message-id: <5BD0A10B-1921-4EDA-860D-ED3A9397ED0D@mac.com>
With the completion of the ability to trigger
on file/directory paths, I'd like to add configurable
external triggers in /etc/rpm/sysinfo.

So its time to design a syntax that maps onto
the tag tuple that defines trigger scripts within
RPM packages.

The current syntax from spec files looks something like this (the  
script bodies
buried by overloading the section marker with a macro):

     %triggerprein  a -- triggers-N-b <= 1.0
     %triggerin     a -- triggers-N-b <= 1.0
     %triggerun     a -- triggers-N-b <= 1.0
     %triggerpostun a -- triggers-N-b <= 1.0

Attached below is the "no-brainer" YAML dump of the resultant tags  
(from tests/triggers-N/*.rpm).

YAML markup (instead of spec syntax) has these items to represent:
	0) the "package" name (for external triggers its just an identifier)
	1) context (the *prein, *in, *un, *postun suffixes)
	2) firing condition
	3) scriptlet interpreter
	4) scriptlet body

So a straightforward minimalistic YAML markup for the %triggerprein  
above might be done as

	a(triggerprein):
		- triggers-N-b <= 1.0
		- /bin/sh
		- |-
			echo "--- triggerprein(a) -- triggers-N-b <= 1.0        arg $1  
$2 ..."

That syntax gets the job done AFAICT.

But perhaps more aesthetic or tasteful or ... YAML markup should be  
done instead
of what I have sketched out. All I need for development is some  
markup to parse,
other syntax can be arranged later. There's certainly no legacy  
compatibility issues
with /etc/rpm/sysinfo/Triggername contents.

Other suggestions? Opinions?

73 de Jeff

=======================================================================

   Triggerscripts:
     - |-
         echo "--- triggerprein(a) -- triggers-N-b <= 1.0        arg  
$1 $2 ..."
     - |-
         echo "--- triggerin(a) -- triggers-N-b <= 1.0   arg $1 $2 ..."
     - |-
         echo "--- triggerun(a) -- triggers-N-b <= 1.0   arg $1 $2 ..."
     - |-
         echo "--- triggerpostun(a) -- triggers-N-b <= 1.0       arg  
$1 $2 ..."

   Triggername:
     - triggers-N-b
     - triggers-N-b
     - triggers-N-b
     - triggers-N-b

   Triggerversion:
     - 1.0
     - 1.0
     - 1.0
     - 1.0

   Triggerflags:
     - 33554442
     - 65546
     - 131082
     - 262154

   Triggerindex:
     - 0
     - 1
     - 2
     - 3

   Triggerscriptprog:
     - /bin/sh
     - /bin/sh
     - /bin/sh
     - /bin/sh
Received on Fri Oct 17 19:55:06 2008
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.