[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[RFC] Trigger directives that do not put packages in triggers-awaited



Hi,

please find attached a patch that implements 2 new directives
"interest-noawait" and "activate-noawait" for the triggers control file.

They work exactly like "interest" and "activate" but the package
that activate the triggers are not put in triggers-awaited status instead
they are directly configured. Up to now, this was only possible if you
manually activated triggers with dpkg-trigger. With this patch, the
package implementing the trigger can also specify that the trigger
is not important enough to consider that the triggering package is
not configured.

My goal is to simplify the configuration process because most
triggers are purely convenience triggers and are not required by
the triggering packages... (see man-db, bash-completion, etc.)
This will also make it more likely that the trigger is really only
executed once at the end instead of multiple times because some
package had to be configured earlier.

My main problem is how to introduce this new feature. For now, I
have added "-noawait" variants but given they are the most common case, I
wonder if I shall not change the current directive to not
put the packages in triggers-awaited and instead to add new directives
"interest-await" and "activate-await" (or "interest-crucial",
"activate-crucial") with the current behaviour. That would also reduce the
number of packages to modify to get the expected benefits... very few
packages really need to put the triggering package in triggers-awaited.

What do you think?

Also any code review is welcome of course.

Cheers,
-- 
Raphaël Hertzog ◈ Debian Developer

Follow my Debian News ▶ http://RaphaelHertzog.com (English)
                      ▶ http://RaphaelHertzog.fr (Français)
commit 8fd4917ab6eeff63f3035b8c76b90939ee9ae017
Author: Raphaël Hertzog <hertzog@debian.org>
Date:   Sun May 15 01:39:31 2011 +0200

    dpkg: implement "interest-noawait" and "activate-noawait" trigger commands
    
    Those variants do not put triggering packages in triggers-awaited status
    and thus do not record the package with the corresponding pending triggers
    in the Triggers-Awaited field.
    
    This should be used for triggers which do not provide essential
    functionality when we can safely consider that the triggering packages
    are able to satisfy dependencies even if the trigger processing
    has not yet happened.

diff --git a/doc/triggers.txt b/doc/triggers.txt
index d10aab0..77668ed 100644
--- a/doc/triggers.txt
+++ b/doc/triggers.txt
@@ -46,7 +46,8 @@ will not be processed immediately when it is activated; processing is
 deferred until it is convenient (as described below).
 
 At a trigger activation, the interested packages(s) are added to the
-triggering package's list of triggers-awaited packages; the triggering
+triggering package's list of triggers-awaited packages (unless the
+trigger has been configured to not require it); the triggering
 package is said to await the trigger processing.
 
 A package which has pending triggers, or which awaits triggers, is not
diff --git a/lib/dpkg/triglib.c b/lib/dpkg/triglib.c
index ae0f5b9..4bbb255 100644
--- a/lib/dpkg/triglib.c
+++ b/lib/dpkg/triglib.c
@@ -253,7 +253,8 @@ struct trigkindinfo {
 	/* Rest are for everyone: */
 	void (*activate_awaiter)(struct pkginfo *pkg /* may be NULL */);
 	void (*activate_done)(void);
-	void (*interest_change)(const char *name, struct pkginfo *pkg, int signum);
+	void (*interest_change)(const char *name, struct pkginfo *pkg, int signum,
+	                        bool noawait);
 };
 
 static const struct trigkindinfo tki_explicit, tki_file, tki_unknown;
@@ -318,7 +319,8 @@ trk_unknown_activate_done(void)
 }
 
 static void DPKG_ATTR_NORET
-trk_unknown_interest_change(const char *trig, struct pkginfo *pkg, int signum)
+trk_unknown_interest_change(const char *trig, struct pkginfo *pkg, int signum,
+                            bool noawait)
 {
 	ohshit(_("invalid or unknown syntax in trigger name `%.250s'"
 	         " (in trigger interests for package `%.250s')"),
@@ -381,9 +383,10 @@ trk_explicit_activate_start(void)
 static void
 trk_explicit_activate_awaiter(struct pkginfo *aw)
 {
-	char buf[1024];
+	char buf[1024], *slash;
 	const char *emsg;
 	struct pkginfo *pend;
+	bool noawait;
 
 	if (!trk_explicit_f)
 		return;
@@ -393,18 +396,28 @@ trk_explicit_activate_awaiter(struct pkginfo *aw)
 		        trk_explicit_fn.buf);
 
 	while (trk_explicit_fgets(buf, sizeof(buf)) >= 0) {
+		noawait = false;
+		slash = index(buf, '/');
+		if (slash && strcmp("/noawait", slash) == 0) {
+			noawait = true;
+			*slash = '\0';
+		}
 		emsg = pkg_name_is_illegal(buf, NULL);
 		if (emsg)
 			ohshit(_("trigger interest file `%.250s' syntax error; "
 			         "illegal package name `%.250s': %.250s"),
 			       trk_explicit_fn.buf, buf, emsg);
 		pend = pkg_db_find(buf);
-		trig_record_activation(pend, aw, trk_explicit_trig);
+		if (noawait)
+			trig_record_activation(pend, NULL, trk_explicit_trig);
+		else
+			trig_record_activation(pend, aw, trk_explicit_trig);
 	}
 }
 
 static void
-trk_explicit_interest_change(const char *trig,  struct pkginfo *pkg, int signum)
+trk_explicit_interest_change(const char *trig,  struct pkginfo *pkg, int signum,
+                             bool noawait)
 {
 	static struct varbuf newfn;
 	char buf[1024];
@@ -422,13 +435,15 @@ trk_explicit_interest_change(const char *trig,  struct pkginfo *pkg, int signum)
 	push_cleanup(cu_closestream, ~ehflag_normaltidy, NULL, 0, 1, nf);
 
 	while (trk_explicit_f && trk_explicit_fgets(buf, sizeof(buf)) >= 0) {
-		if (!strcmp(buf, pkg->name))
+		int len = strlen(pkg->name);
+		if (strncmp(buf, pkg->name, len) == 0 &&
+		    (buf[len] == '\0' || buf[len] == '/'))
 			continue;
 		fprintf(nf, "%s\n", buf);
 		empty = false;
 	}
 	if (signum > 0) {
-		fprintf(nf, "%s\n", pkg->name);
+		fprintf(nf, "%s%s\n", pkg->name, noawait ? "/noawait" : "");
 		empty = false;
 	}
 
@@ -491,7 +506,8 @@ static int filetriggers_edited = -1;
  * but die if already present.
  */
 static void
-trk_file_interest_change(const char *trig, struct pkginfo *pkg, int signum)
+trk_file_interest_change(const char *trig, struct pkginfo *pkg, int signum,
+                         bool noawait)
 {
 	struct filenamenode *fnn;
 	struct trigfileint **search, *tfi;
@@ -515,6 +531,7 @@ trk_file_interest_change(const char *trig, struct pkginfo *pkg, int signum)
 	tfi = nfmalloc(sizeof(*tfi));
 	tfi->pkg = pkg;
 	tfi->fnn = fnn;
+	tfi->noawait = noawait;
 	tfi->samefile_next = *trigh.namenode_interested(fnn);
 	*trigh.namenode_interested(fnn) = tfi;
 
@@ -522,6 +539,7 @@ trk_file_interest_change(const char *trig, struct pkginfo *pkg, int signum)
 	goto edited;
 
 found:
+	tfi->noawait = noawait;
 	if (signum > 1)
 		ohshit(_("duplicate file trigger interest for filename `%.250s' "
 		         "and package `%.250s'"), trig, pkg->name);
@@ -559,8 +577,8 @@ trig_file_interests_save(void)
 	push_cleanup(cu_closestream, ~ehflag_normaltidy, NULL, 0, 1, nf);
 
 	for (tfi = filetriggers.head; tfi; tfi = tfi->inoverall.next)
-		fprintf(nf, "%s %s\n", trigh.namenode_name(tfi->fnn),
-		        tfi->pkg->name);
+		fprintf(nf, "%s %s%s\n", trigh.namenode_name(tfi->fnn),
+		        tfi->pkg->name, tfi->noawait ? "/noawait" : "");
 
 	if (ferror(nf))
 		ohshite(_("unable to write new file triggers file `%.250s'"),
@@ -589,9 +607,10 @@ void
 trig_file_interests_ensure(void)
 {
 	FILE *f;
-	char linebuf[1024], *space;
+	char linebuf[1024], *space, *slash;
 	struct pkginfo *pkg;
 	const char *emsg;
+	bool noawait;
 
 	if (filetriggers_edited >= 0)
 		return;
@@ -612,13 +631,19 @@ trig_file_interests_ensure(void)
 			       triggersfilefile);
 		*space++ = '\0';
 
+		noawait = false;
+		slash = index(space, '/');
+		if (slash && strcmp("/noawait", slash) == 0) {
+			noawait = true;
+			*slash = '\0';
+		}
 		emsg = pkg_name_is_illegal(space, NULL);
 		if (emsg)
 			ohshit(_("file triggers record mentions illegal "
 			         "package name `%.250s' (for interest in file "
 				 "`%.250s'): %.250s"), space, linebuf, emsg);
 		pkg = pkg_db_find(space);
-		trk_file_interest_change(linebuf, pkg, +2);
+		trk_file_interest_change(linebuf, pkg, +2, noawait);
 	}
 	pop_cleanup(ehflag_normaltidy);
 ok:
@@ -643,7 +668,8 @@ trig_file_activate(struct filenamenode *trig, struct pkginfo *aw)
 
 	for (tfi = *trigh.namenode_interested(trig); tfi;
 	     tfi = tfi->samefile_next)
-		trig_record_activation(tfi->pkg, aw, trigh.namenode_name(trig));
+		trig_record_activation(tfi->pkg, tfi->noawait ? NULL : aw,
+		                       trigh.namenode_name(trig));
 }
 
 static void
@@ -675,39 +701,43 @@ static const struct trigkindinfo tki_file = {
 /*---------- Trigger control info file. ----------*/
 
 static void
-trig_cicb_interest_change(const char *trig, struct pkginfo *pkg, int signum)
+trig_cicb_interest_change(const char *trig, struct pkginfo *pkg, int signum,
+                          bool noawait)
 {
 	const struct trigkindinfo *tki = trig_classify_byname(trig);
 
 	assert(filetriggers_edited >= 0);
-	tki->interest_change(trig, pkg, signum);
+	tki->interest_change(trig, pkg, signum, noawait);
 }
 
 void
-trig_cicb_interest_delete(const char *trig, void *user)
+trig_cicb_interest_delete(const char *trig, void *user, bool noawait)
 {
-	trig_cicb_interest_change(trig, user, -1);
+	trig_cicb_interest_change(trig, user, -1, noawait);
 }
 
 void
-trig_cicb_interest_add(const char *trig, void *user)
+trig_cicb_interest_add(const char *trig, void *user, bool noawait)
 {
-	trig_cicb_interest_change(trig, user, +1);
+	trig_cicb_interest_change(trig, user, +1, noawait);
 }
 
 void
-trig_cicb_statuschange_activate(const char *trig, void *user)
+trig_cicb_statuschange_activate(const char *trig, void *user, bool noawait)
 {
 	struct pkginfo *aw = user;
 
 	trig_activate_start(trig);
-	dtki->activate_awaiter(aw);
+	if (noawait)
+		dtki->activate_awaiter(NULL);
+	else
+		dtki->activate_awaiter(aw);
 	dtki->activate_done();
 }
 
 static void
 parse_ci_call(const char *file, const char *cmd, trig_parse_cicb *cb,
-              const char *trig, void *user)
+              const char *trig, void *user, bool noawait)
 {
 	const char *emsg;
 
@@ -717,7 +747,7 @@ parse_ci_call(const char *file, const char *cmd, trig_parse_cicb *cb,
 		         "syntax in trigger name `%.250s': %.250s"),
 		       file, trig, emsg);
 	if (cb)
-		cb(trig, user);
+		cb(trig, user, noawait);
 }
 
 void
@@ -752,9 +782,13 @@ trig_parse_ci(const char *file, trig_parse_cicb *interest,
 		while (cisspace(*spc))
 			spc++;
 		if (!strcmp(cmd, "interest")) {
-			parse_ci_call(file, cmd, interest, spc, user);
+			parse_ci_call(file, cmd, interest, spc, user, false);
+		} else if (!strcmp(cmd, "interest-noawait")) {
+			parse_ci_call(file, cmd, interest, spc, user, true);
 		} else if (!strcmp(cmd, "activate")) {
-			parse_ci_call(file, cmd, activate, spc, user);
+			parse_ci_call(file, cmd, activate, spc, user, false);
+		} else if (!strcmp(cmd, "activate-noawait")) {
+			parse_ci_call(file, cmd, activate, spc, user, true);
 		} else {
 			ohshit(_("triggers ci file contains unknown directive `%.250s'"),
 			       cmd);
diff --git a/lib/dpkg/triglib.h b/lib/dpkg/triglib.h
index 9c06ac3..57b69a3 100644
--- a/lib/dpkg/triglib.h
+++ b/lib/dpkg/triglib.h
@@ -41,6 +41,7 @@ const char *trig_name_is_illegal(const char *p);
 struct trigfileint {
 	struct pkginfo *pkg;
 	struct filenamenode *fnn;
+	bool noawait;
 	struct trigfileint *samefile_next;
 	struct {
 		struct trigfileint *next, *prev;
@@ -83,10 +84,10 @@ void trig_fixup_awaiters(enum modstatdb_rw cstatus);
 void trig_file_interests_ensure(void);
 void trig_file_interests_save(void);
 
-typedef void trig_parse_cicb(const char *trig, void *user);
-void trig_cicb_interest_delete(const char *trig, void *user);
-void trig_cicb_interest_add(const char *trig, void *user);
-void trig_cicb_statuschange_activate(const char *trig, void *user);
+typedef void trig_parse_cicb(const char *trig, void *user, bool noawait);
+void trig_cicb_interest_delete(const char *trig, void *user, bool noawait);
+void trig_cicb_interest_add(const char *trig, void *user, bool noawait);
+void trig_cicb_statuschange_activate(const char *trig, void *user, bool noawait);
 void trig_parse_ci(const char *file, trig_parse_cicb *interest,
                    trig_parse_cicb *activate, void *user);
 
diff --git a/man/deb-triggers.5 b/man/deb-triggers.5
index f869cd2..63bf4fc 100644
--- a/man/deb-triggers.5
+++ b/man/deb-triggers.5
@@ -21,19 +21,32 @@ The trigger control directives currently supported are:
 .I trigger-name
 .PP
 .in +5
+.B interest-noawait
+.I trigger-name
+.PP
+.in +5
 Specifies that the package is interested in the named trigger. All
 triggers in which a package is interested must be listed using this
-directive in the triggers control file.
+directive in the triggers control file. The "noawait" variant does
+not put the triggering packages in triggers-awaited state. This should
+be used when the functionality provided by the trigger is not crucial.
 .PP
 .in +5
 .B activate
 .I trigger-name
 .PP
 .in +5
+.B activate-noawait
+.I trigger-name
+.PP
+.in +5
 Arranges that changes to this package's state will activate the
 specified trigger. The trigger will be activated at the start of
 the following operations: unpack, configure, remove (including for
 the benefit of a conflicting package), purge and deconfigure.
+The "noawait" variant does not put the triggering packages in
+triggers-awaited state. This should be used when the functionality
+provided by the trigger is not crucial.
 .PP
 .in +5
 If this package disappears during the unpacking of another package
@@ -45,6 +58,11 @@ versions of the package will be activated.
 .PP
 Unknown directives are an error which will prevent installation of the
 package.
+.PP
+The "-noawait" variants are only supported by dpkg 1.16.1 or newer, and
+will lead to errors if used with an older dpkg. It is thus recommended
+to add a "Pre-Depends: dpkg (>= 1.16.1)" to any package that wish to use
+those directives.
 .
 .SH SEE ALSO
 .BR dpkg\-trigger (1),
diff --git a/src/trigproc.c b/src/trigproc.c
index 07bf346..a91a900 100644
--- a/src/trigproc.c
+++ b/src/trigproc.c
@@ -345,7 +345,7 @@ trigproc(struct pkginfo *pkg)
 /*========== Transitional global activation. ==========*/
 
 static void
-transitional_interest_callback_ro(const char *trig, void *user)
+transitional_interest_callback_ro(const char *trig, void *user, bool noawait)
 {
 	struct pkginfo *pend = user;
 
@@ -357,12 +357,12 @@ transitional_interest_callback_ro(const char *trig, void *user)
 }
 
 static void
-transitional_interest_callback(const char *trig, void *user)
+transitional_interest_callback(const char *trig, void *user, bool noawait)
 {
 	struct pkginfo *pend = user;
 
-	trig_cicb_interest_add(trig, pend);
-	transitional_interest_callback_ro(trig, user);
+	trig_cicb_interest_add(trig, pend, noawait);
+	transitional_interest_callback_ro(trig, user, noawait);
 }
 
 /*
commit 1e51e1bda7b32bded97fa44aa3caf297b7ab7c19
Author: Raphaël Hertzog <hertzog@debian.org>
Date:   Wed May 18 15:44:08 2011 +0200

    Extend t-triggers to support new -noawait commands

diff --git a/t-triggers/Makefile b/t-triggers/Makefile
index c20eeae..6e0d68c 100644
--- a/t-triggers/Makefile
+++ b/t-triggers/Makefile
@@ -1,4 +1,4 @@
-TESTS_DEB := pkg-triggers pkg-trig-file \
+TESTS_DEB := pkg-triggers pkg-triggers-noawait pkg-trig-file \
              pkg-trig-explicit pkg-trig-cmd
 
 include ../Test.mk
@@ -6,6 +6,8 @@ include ../Test.mk
 TEST_CASES = test-trigger-file \
 	     test-trigger-explicit \
 	     test-trigger-cmd \
+	     test-trigger-noawait-file \
+	     test-trigger-noawait-explicit \
 	     test-trigger-noawait-cmd
 
 ifeq ($(DPKG_TESTSUITE_OPTIONS),local-db)
@@ -66,6 +68,54 @@ test-trigger-file:
 	$(DPKG_PURGE) pkg-triggers
 	$(DPKG_PURGE) pkg-trig-file
 
+test-trigger-noawait-file:
+	$(DPKG_UNPACK) pkg-triggers-noawait.deb
+	$(BEROOT) rm -f /a-trigger-ok /triggers/ok
+	# When unpacked, triggers are not active
+	$(DPKG_INSTALL) --no-triggers pkg-trig-file.deb
+	$(call pkg_is_installed,pkg-trig-file)
+	$(call pkg_status_is,pkg-triggers,install ok unpacked)
+	$(call pkg_field_is,pkg-triggers,Triggers-Pending,)
+	! test -f /triggers/ok
+	$(DPKG_CONFIGURE) --no-triggers pkg-triggers
+	$(call pkg_is_installed,pkg-triggers)
+	! test -f /triggers/ok
+	# When installed, triggers can be activated
+	$(DPKG_INSTALL) --no-triggers pkg-trig-file.deb
+	$(call pkg_status_is,pkg-triggers,install ok triggers-pending)
+	$(call pkg_field_is,pkg-triggers,Triggers-Pending, /triggers)
+	$(call pkg_is_installed,pkg-trig-file)
+	$(BEROOT) $(DPKG) --triggers-only pkg-triggers
+	$(call pkg_is_installed,pkg-triggers)
+	test -f /triggers/ok && $(BEROOT) rm -f /triggers/ok
+	# Try other ways to run the triggers
+	$(DPKG_INSTALL) --no-triggers pkg-trig-file.deb
+	$(call pkg_status_is,pkg-triggers,install ok triggers-pending)
+	$(call pkg_is_installed,pkg-trig-file)
+	$(BEROOT) $(DPKG) --triggers-only --pending
+	$(call pkg_is_installed,pkg-triggers)
+	test -f /triggers/ok && $(BEROOT) rm -f /triggers/ok
+	# Again
+	$(DPKG_INSTALL) --no-triggers pkg-trig-file.deb
+	$(call pkg_status_is,pkg-triggers,install ok triggers-pending)
+	$(call pkg_is_installed,pkg-trig-file)
+	$(DPKG_CONFIGURE) --pending
+	$(call pkg_is_installed,pkg-trig-file)
+	$(call pkg_is_installed,pkg-triggers)
+	test -f /triggers/ok && $(BEROOT) rm -f /triggers/ok
+	# Again, but we're unpacking instead of installing
+	$(DPKG_UNPACK) --no-triggers pkg-trig-file.deb
+	$(call pkg_status_is,pkg-triggers,install ok triggers-pending)
+	$(call pkg_status_is,pkg-trig-file,install ok unpacked)
+	$(DPKG_CONFIGURE) --no-triggers pkg-trig-file
+	$(call pkg_is_installed,pkg-trig-file)
+	$(BEROOT) $(DPKG) --triggers-only pkg-triggers
+	$(call pkg_is_installed,pkg-triggers)
+	test -f /triggers/ok && $(BEROOT) rm -f /triggers/ok
+	# Cleanup
+	$(DPKG_PURGE) pkg-triggers
+	$(DPKG_PURGE) pkg-trig-file
+
 test-trigger-explicit:
 	$(DPKG_UNPACK) pkg-triggers.deb
 	$(BEROOT) rm -f /a-trigger-ok /triggers/ok
@@ -130,6 +180,46 @@ test-trigger-explicit:
 	$(DPKG_PURGE) pkg-triggers
 	$(DPKG_PURGE) pkg-trig-explicit
 
+test-trigger-noawait-explicit:
+	$(DPKG_INSTALL) pkg-triggers-noawait.deb
+	$(BEROOT) rm -f /a-trigger-ok /triggers/ok
+	# When installed, triggers can be activated
+	$(DPKG_INSTALL) --no-triggers pkg-trig-explicit.deb
+	$(call pkg_status_is,pkg-triggers,install ok triggers-pending)
+	$(call pkg_field_is,pkg-triggers,Triggers-Pending, a-trigger)
+	$(call pkg_is_installed,pkg-trig-explicit)
+	$(BEROOT) $(DPKG) --triggers-only pkg-triggers
+	$(call pkg_is_installed,pkg-triggers)
+	test -f /a-trigger-ok && $(BEROOT) rm -f /a-trigger-ok
+	# Again, but we're unpacking instead of installing
+	$(DPKG_UNPACK) --no-triggers pkg-trig-explicit.deb
+	$(call pkg_status_is,pkg-triggers,install ok triggers-pending)
+	$(call pkg_status_is,pkg-trig-explicit,install ok unpacked)
+	$(call pkg_field_is,pkg-trig-explicit,Triggers-Awaited,)
+	$(DPKG_CONFIGURE) --no-triggers pkg-trig-explicit
+	$(call pkg_is_installed,pkg-trig-explicit)
+	$(call pkg_status_is,pkg-triggers,install ok triggers-pending)
+	$(DPKG_CONFIGURE) --pending
+	$(call pkg_is_installed,pkg-triggers)
+	test -f /a-trigger-ok && $(BEROOT) rm -f /a-trigger-ok
+	# Verify the trigger is activated on each status change
+	$(DPKG_UNPACK) --no-triggers pkg-trig-explicit.deb
+	$(call pkg_status_is,pkg-triggers,install ok triggers-pending)
+	$(call pkg_status_is,pkg-trig-explicit,install ok unpacked)
+	$(call pkg_field_is,pkg-trig-explicit,Triggers-Awaited,)
+	$(BEROOT) $(DPKG) --triggers-only pkg-triggers
+	$(call pkg_is_installed,pkg-triggers)
+	test -f /a-trigger-ok && $(BEROOT) rm -f /a-trigger-ok
+	$(DPKG_CONFIGURE) --no-triggers pkg-trig-explicit
+	$(call pkg_is_installed,pkg-trig-explicit)
+	$(call pkg_field_is,pkg-trig-explicit,Triggers-Awaited,)
+	$(call pkg_status_is,pkg-triggers,install ok triggers-pending)
+	$(BEROOT) $(DPKG) --triggers-only pkg-triggers
+	$(call pkg_is_installed,pkg-triggers)
+	# Cleanup
+	$(DPKG_PURGE) pkg-triggers
+	$(DPKG_PURGE) pkg-trig-explicit
+
 test-trigger-cmd:
 	$(DPKG_UNPACK) pkg-triggers.deb
 	$(BEROOT) rm -f /a-trigger-ok /triggers/ok
@@ -249,6 +339,9 @@ test-internal-db:
 	$(DPKG_INSTALL) pkg-triggers.deb
 	$(call stdout_is,cat $(DPKG_ADMINDIR)/triggers/a-trigger,pkg-triggers)
 	grep -q "^/triggers pkg-triggers$$" $(DPKG_ADMINDIR)/triggers/File
+	$(DPKG_INSTALL) pkg-triggers-noawait.deb
+	$(call stdout_is,cat $(DPKG_ADMINDIR)/triggers/a-trigger,pkg-triggers/noawait)
+	grep -q "^/triggers pkg-triggers/noawait$$" $(DPKG_ADMINDIR)/triggers/File
 	# Test that removal cleans up the triggers files
 	$(DPKG_PURGE) pkg-triggers
 	! test -e $(DPKG_ADMINDIR)/triggers/a-trigger
diff --git a/t-triggers/pkg-triggers-noawait/DEBIAN/control b/t-triggers/pkg-triggers-noawait/DEBIAN/control
new file mode 100644
index 0000000..01f173d
--- /dev/null
+++ b/t-triggers/pkg-triggers-noawait/DEBIAN/control
@@ -0,0 +1,8 @@
+Package: pkg-triggers
+Version: 0.0-1
+Section: test
+Priority: extra
+Maintainer: Raphaël Hertzog <hertzog@debian.org>
+Architecture: all
+Description: test package - providing triggers
+
diff --git a/t-triggers/pkg-triggers-noawait/DEBIAN/postinst b/t-triggers/pkg-triggers-noawait/DEBIAN/postinst
new file mode 100755
index 0000000..8c4c98d
--- /dev/null
+++ b/t-triggers/pkg-triggers-noawait/DEBIAN/postinst
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+if [ "$1" = "triggered" ]; then
+    case " $2 " in
+	*" a-trigger "*)
+	    touch /a-trigger-ok
+	;;
+	*" /triggers "*)
+	    touch /triggers/ok
+	;;
+    esac
+fi
+
diff --git a/t-triggers/pkg-triggers-noawait/DEBIAN/triggers b/t-triggers/pkg-triggers-noawait/DEBIAN/triggers
new file mode 100644
index 0000000..13d2512
--- /dev/null
+++ b/t-triggers/pkg-triggers-noawait/DEBIAN/triggers
@@ -0,0 +1,2 @@
+interest-noawait a-trigger
+interest-noawait /triggers

Reply to: