aboutsummaryrefslogtreecommitdiff
path: root/src/triplet.c
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2009-02-21 18:26:51 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2009-02-21 18:26:51 +0200
commit0b63c31eadfe5d4e94c7014bd0f3bd4370783d19 (patch)
tree9feb30a2c64d785d5e59fecd06429413e9f4d398 /src/triplet.c
parent1213cf065e9b3a5fb45d00276b3d168462838c17 (diff)
downloadwydawca-0b63c31eadfe5d4e94c7014bd0f3bd4370783d19.tar.gz
wydawca-0b63c31eadfe5d4e94c7014bd0f3bd4370783d19.tar.bz2
Implement timers and destination URLs.
* gconf/gconf-gram.y (stmt_end): Make sure end callback is called in the same environment as the begin one. * src/vtab.c, src/null.c, src/timer.c: New files. * src/Makefile.am (wydawca_SOURCES): Add new files. * src/config.c (cb_mailer): Remove useless check. (cb_destination_url): New function. (directory_kw): Change handling of the destination keyword. (cb_directory): Rewrite final checks. * src/directive.c, /src/process.c, src/triplet.c: Add timers. * src/diskio.c (move_file, archive_file, symlink_file, rmsymlink_file): Prefix with dir_. * src/mail.c (mail_stats): Add timer meta-variables. * src/wydawca.c (make_stat_expansion): Change definition. * src/wydawca.h (struct virt_tab): New data type. (struct directory_pair.dest_url): New member. * tests/upload-dry.at: Update expected output.
Diffstat (limited to 'src/triplet.c')
-rw-r--r--src/triplet.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/triplet.c b/src/triplet.c
index 03aa4cc..6ebc142 100644
--- a/src/triplet.c
+++ b/src/triplet.c
@@ -229,7 +229,8 @@ void
enumerate_triplets (struct directory_pair *dpair)
{
if (debug_level)
- logmsg (LOG_DEBUG, "Processing files for %s", dpair->dest_dir);
+ logmsg (LOG_DEBUG, "Processing files for %s (%s)",
+ dpair->url, mu_url_to_string (dpair->dest_url));
if (triplet_table)
{
hash_do_for_each (triplet_table, triplet_processor, dpair);
@@ -542,6 +543,26 @@ expand_user_email (struct metadef *def, void *data)
return def->value;
}
+#define DECL_EXPAND_TIMER(what) \
+static const char * \
+__cat2__(expand_timer_,what) (struct metadef *def, void *data) \
+{ \
+ wydawca_timer_t t = timer_stop ((char*)def->data); \
+ def->storage = timer_format_time (__cat2__(timer_get_,what) (t)); \
+ def->value = def->storage; \
+}
+
+DECL_EXPAND_TIMER(real)
+DECL_EXPAND_TIMER(user)
+DECL_EXPAND_TIMER(system)
+
+#define DECL_TIMER(name,t) \
+ { "timer:" #name ":" #t, NULL, __cat2__(expand_timer_,t), NULL, #name }
+#define DECL_FULL_TIMER(name) \
+ DECL_TIMER(name, real), \
+ DECL_TIMER(name, user), \
+ DECL_TIMER(name, system)
+
struct metadef triplet_meta[] = {
{ "project", NULL, expand_project_base, NULL },
{ "url", NULL, expand_url, NULL },
@@ -557,6 +578,9 @@ struct metadef triplet_meta[] = {
{ "user:name", NULL, expand_user_name, NULL },
{ "user:real-name", NULL, expand_user_real_name, NULL },
{ "user:email", NULL, expand_user_email, NULL },
+ DECL_FULL_TIMER(wydawca),
+ DECL_FULL_TIMER(triplet),
+ DECL_FULL_TIMER(directory),
{ NULL }
};

Return to:

Send suggestions and report system problems to the System administrator.