aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2010-01-02 19:24:03 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2010-01-02 19:24:03 +0200
commitc44f0f83448b426935e9aeb07c5d761299144d14 (patch)
tree696d15a11587c94e3a5f8b356f3f91adc73c789a
parent1b0a4de9fa73dd2453cbd2902c2cd4d000f4abe7 (diff)
downloadwydawca-c44f0f83448b426935e9aeb07c5d761299144d14.tar.gz
wydawca-c44f0f83448b426935e9aeb07c5d761299144d14.tar.bz2
$- construct (similar to m4's dnl).
* src/meta.c: Special construct $- removes the character immediately following it. * doc/wydawca.texi: Document the use of $- construct. * src/triplet.c (expand_triplet_ls_full) (expand_triplet_ls_upload): Keep trailing newline in the expansion. * tests/etc/notify.rc: Update.
-rw-r--r--NEWS11
-rw-r--r--doc/wydawca.texi25
-rw-r--r--src/meta.c5
-rw-r--r--src/triplet.c2
-rw-r--r--tests/etc/notify.rc9
5 files changed, 40 insertions, 12 deletions
diff --git a/NEWS b/NEWS
index cad6ca1..bbceb00 100644
--- a/NEWS
+++ b/NEWS
@@ -16,16 +16,23 @@ The following meta-variables are renamed:
triplet:full triplet:ls:full
triplet:upload triplet:ls:upload
triplet:dist triplet:ls:dist
triplet:sig triplet:ls:sig
triplet:dir triplet:ls:dir
+The expansions of {triplet:ls:full} and {triplet:ls:upload} include
+trailing newline. This means that if your config contains one of these
+variables on a line by itself, you will need to add $- at the end of
+that line, to suppress an extra newline. See "listings" in subsection
+4.14.4 "Event Notification", for an example.
+
To update your configuration, use the following (extended) sed expression:
- s/\{(triplet):(full|upload|dist|sig|dir)\}/{\1:ls:\2}/g
-
+ s/\{(triplet):(full|upload)\}/{\1:ls:\2}$-/g
+ s/\{(triplet):(dist|sig|dir)\}/{\1:ls:\2}/g
+
* Distribution verification.
The new keyword `check-script' defines a shell script to
verify the submitted tarball. See the documentation, section
4.12 "Distribution Verification", for details.
diff --git a/doc/wydawca.texi b/doc/wydawca.texi
index 88c2e6c..e9e63be 100644
--- a/doc/wydawca.texi
+++ b/doc/wydawca.texi
@@ -681,12 +681,14 @@ example above:
"a long string may be"
" split over several lines"
@end group
@end smallexample
@anchor{meta-interpretation}
+@cindex meta-interpretation
+@cindex meta-variables
Depending on the context, the contents of a quoted string may be
subject to @dfn{meta-variable interpretation}. During this process,
any sequence
@smallexample
$@{@var{var}@}
@@ -712,12 +714,19 @@ becomes
If the name of the variable consists of a single character, the curly
braces around it may be omitted. Thus, @code{$@{u@}} and @code{$u} are
equivalent.
If @var{var} is not defined, the meta-reference is left unchanged.
+The special sequence @samp{$-} causes removal of it and any character
+following it. Most often it is used as a next-to-last character
+on a line, right before the newline. In this position it causes the
+removal of the trailing newline, similar to @samp{dnl} in @command{m4}.
+@xref{listings, Triplet Listings}, for a detailed description and
+examples of @samp{$-} use.
+
To insert a literal @samp{$} character in a string that is subject to
meta-variable interpretation, duplicate it: @samp{$$}.
The exact set of defined meta-variables and their values depend on the
context and are discussed in detail below.
@@ -2628,38 +2637,46 @@ spool.
processing this spool.
@kwindex timer:spool:user
@item timer:spool:user @tab User @acronym{CPU} time spent while
processing this spool.
@end multitable
+@anchor{listings}
+@cindex listing, triplet
+@cindex triplet listing
@dfn{Listings} referred to in the table above, are similar to those
-produced by @code{ls} command, and include information
+produced by the @code{ls} command, and include information
on file permissions, ownership, size and modification date. For
example, here is a possible @code{$@{triplet:ls:full@}} listing:
@smallexample
-rw-r--r-- gray users 2707278 2007-09-06 22:14:35 tar-1.18.tar.gz
-rw-r--r-- gray users 189 2007-09-06 22:14:35 tar-1.18.tar.gz.sig
-rw-r--r-- gray user 62 2007-09-06 22:14:35 tar-1.18.tar.gz.directive.asc
@end smallexample
-
The following example shows how to configure success notification
-for the user:
+for the user. Notice the use of the @samp{$-} after
+@samp{$@{triplet:ls:upload@}}: it removes the newline character after
+it and thus allows for more natural indentation of the next
+line. Without it, the expanded message would have contained two
+newlines after the full listing: one produced by
+@samp{$@{triplet:ls:upload@}} and the second one taken verbatim from
+the message template.
@smallexample
notify-event @{
event success;
recipient user;
message <<EOT
Subject: Upload of $@{project@} successful
Upload of $@{project@} to $@{url@}/$@{dir@} finished successfully.
Files uploaded:
-$@{triplet:ls:upload@}
+$@{triplet:ls:upload@}$-
Resource usage: $@{timer:triplet:real@}/$@{timer:wydawca:real@}r \
$@{timer:triplet:user@}/$@{timer:wydawca:user@}u \
$@{timer:triplet:system@}/$@{timer:wydawca:system@}s
Regards,
diff --git a/src/meta.c b/src/meta.c
index fc88c6b..545ac36 100644
--- a/src/meta.c
+++ b/src/meta.c
@@ -75,12 +75,17 @@ meta_expand_string (const char *string, struct metadef *def, void *data,
{
case '$':
obstack_grow (&stk, p, 1);
p++;
break;
+ case '-':
+ if (*++p)
+ p++;
+ break;
+
case '{':
e = strchr (p + 1, '}');
if (e && (s = find_expansion_word (p + 1, e - p - 1, def, data)))
{
if (dict)
{
diff --git a/src/triplet.c b/src/triplet.c
index f18f573..7f6ac68 100644
--- a/src/triplet.c
+++ b/src/triplet.c
@@ -396,13 +396,12 @@ expand_triplet_ls_full (struct metadef *def, void *data)
}
if (buf[file_directive])
{
strcat (def->value, buf[file_directive]);
strcat (def->value, "\n");
}
- def->value[size-1] = 0; /* Kill terminating newline */
free (buf[file_dist]);
free (buf[file_signature]);
free (buf[file_directive]);
return def->value;
}
@@ -427,13 +426,12 @@ expand_triplet_ls_upload (struct metadef *def, void *data)
}
if (buf[file_signature])
{
strcat (def->value, buf[file_signature]);
strcat (def->value, "\n");
}
- def->value[size-1] = 0; /* Kill terminating newline */
free (buf[file_dist]);
free (buf[file_signature]);
return def->value;
}
diff --git a/tests/etc/notify.rc b/tests/etc/notify.rc
index 4461ce3..138d6bb 100644
--- a/tests/etc/notify.rc
+++ b/tests/etc/notify.rc
@@ -21,13 +21,13 @@ notify-event {
message <<EOT
Subject: Upload of ${project} successful
Upload of ${project} to ${url}/${dir} finished successfully.
Files uploaded:
-${triplet:ls:upload}
+${triplet:ls:upload}$-
Regards,
Wydawca
The Project Submission Robot
EOT;
}
@@ -39,13 +39,13 @@ notify-event {
message <<EOT
Subject: Upload of ${project} successful
${user:real-name} (${user:email}) successfully uploaded files
for ${project} to ${url}/${dir}. Files uploaded:
-${triplet:ls:upload}
+${triplet:ls:upload}$-
Regards,
Wydawca
The Project Submission Robot
EOT;
}
@@ -58,13 +58,13 @@ notify-event {
message <<EOT
Subject: Suspicious upload of ${project}
Someone not authorized to make releases for ${project}
has attempted to upload the following files to ${url}/${dir}:
-${triplet:ls:full}
+${triplet:ls:full}$-
This upload has been ignored and the files removed. The person who attempted
the upload was ${user:real-name}, user name ${user:name}, email ${user:email}.
If you think this is an error and wish this user to be authorized to make
releases for ${project}, please contact <puszcza-hackers@gnu.org.ua>.
Otherwise, let us know so we could undertake appropriate measures.
@@ -181,13 +181,14 @@ notify-event {
message <<EOT
Subject: ${triplet:dist} rejected
Your upload of ${triplet:dist} has been rejected by the distribution
verification procedure with the following diagnostics:
-${check:diagn}
+${check:diagn}$-
+
Please fix the tarball and resubmit.
Regards,
Wydawca
The Project Submission Robot
EOT;

Return to:

Send suggestions and report system problems to the System administrator.