[brasero] Check version of applications for plugins now
- From: Philippe Rouquier <philippr src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [brasero] Check version of applications for plugins now
- Date: Tue, 3 Nov 2009 13:38:32 +0000 (UTC)
commit 62bda5dab82ddba07b0d1af3af333860a97d39c3
Author: Philippe Rouquier <bonfire-app wanadoo fr>
Date: Mon Nov 2 21:34:54 2009 +0100
Check version of applications for plugins now
libbrasero-burn/brasero-plugin-registration.h | 5 ++-
libbrasero-burn/burn-plugin.c | 64 +++++++++++++++++++++++--
plugins/cdrdao/burn-cdrdao.c | 7 ++-
plugins/cdrdao/burn-toc2cue.c | 7 ++-
plugins/cdrkit/burn-genisoimage.c | 7 ++-
plugins/cdrkit/burn-readom.c | 7 ++-
plugins/cdrkit/burn-wodim.c | 7 ++-
plugins/cdrtools/burn-cdda2wav.c | 7 ++-
plugins/cdrtools/burn-cdrecord.c | 7 ++-
plugins/cdrtools/burn-mkisofs.c | 7 ++-
plugins/cdrtools/burn-readcd.c | 7 ++-
plugins/dvdauthor/burn-dvdauthor.c | 7 ++-
plugins/growisofs/burn-dvd-rw-format.c | 7 ++-
plugins/growisofs/burn-growisofs.c | 8 ++-
plugins/vcdimager/burn-vcdimager.c | 7 ++-
15 files changed, 141 insertions(+), 20 deletions(-)
---
diff --git a/libbrasero-burn/brasero-plugin-registration.h b/libbrasero-burn/brasero-plugin-registration.h
index 95b629d..3f49e43 100644
--- a/libbrasero-burn/brasero-plugin-registration.h
+++ b/libbrasero-burn/brasero-plugin-registration.h
@@ -179,7 +179,10 @@ brasero_plugin_test_gstreamer_plugin (BraseroPlugin *plugin,
void
brasero_plugin_test_app (BraseroPlugin *plugin,
- const gchar *name);
+ const gchar *name,
+ const gchar *version_arg,
+ const gchar *version_format,
+ gint version [3]);
/**
* Boiler plate for plugin definition to save the hassle of definition.
diff --git a/libbrasero-burn/burn-plugin.c b/libbrasero-burn/burn-plugin.c
index 7193eca..9d73473 100644
--- a/libbrasero-burn/burn-plugin.c
+++ b/libbrasero-burn/burn-plugin.c
@@ -186,9 +186,18 @@ brasero_plugin_test_gstreamer_plugin (BraseroPlugin *plugin,
void
brasero_plugin_test_app (BraseroPlugin *plugin,
- const gchar *name)
-{
+ const gchar *name,
+ const gchar *version_arg,
+ const gchar *version_format,
+ gint version [3])
+{
+ gchar *standard_output = NULL;
+ gchar *standard_error = NULL;
+ guint major, minor, sub;
gchar *prog_path;
+ GPtrArray *argv;
+ gboolean res;
+ int i;
/* First see if this plugin can be used, i.e. if cdrecord is in
* the path */
@@ -230,7 +239,56 @@ brasero_plugin_test_app (BraseroPlugin *plugin,
return;
}
+ if (!version_arg) {
+ g_free (prog_path);
+ return;
+ }
+
+ /* Check version */
+ argv = g_ptr_array_new ();
+ g_ptr_array_add (argv, prog_path);
+ g_ptr_array_add (argv, (gchar *) version_arg);
+ g_ptr_array_add (argv, NULL);
+
+ res = g_spawn_sync (NULL,
+ (gchar **) argv->pdata,
+ NULL,
+ 0,
+ NULL,
+ NULL,
+ &standard_output,
+ &standard_error,
+ NULL,
+ NULL);
+
+ g_ptr_array_free (argv, TRUE);
g_free (prog_path);
+
+ if (!res) {
+ brasero_plugin_add_error (plugin,
+ BRASERO_PLUGIN_ERROR_WRONG_APP_VERSION,
+ name);
+ return;
+ }
+
+ for (i = 0; i < 3 && version [i] >= 0; i++);
+
+ if ((standard_output && sscanf (standard_output, version_format, &major, &minor, &sub) == i)
+ || (standard_error && sscanf (standard_error, version_format, &major, &minor, &sub) == i)) {
+ if (major < version [0]
+ || (version [1] >= 0 && minor < version [1])
+ || (version [2] >= 0 && sub < version [2]))
+ brasero_plugin_add_error (plugin,
+ BRASERO_PLUGIN_ERROR_WRONG_APP_VERSION,
+ name);
+ }
+ else
+ brasero_plugin_add_error (plugin,
+ BRASERO_PLUGIN_ERROR_WRONG_APP_VERSION,
+ name);
+
+ g_free (standard_output);
+ g_free (standard_error);
}
void
@@ -1212,8 +1270,6 @@ brasero_plugin_check_plugin_ready (BraseroPlugin *plugin)
}
function (BRASERO_PLUGIN (plugin));
-
- BRASERO_BURN_LOG ("Module %s successfully loaded", priv->name);
g_module_close (handle);
}
@@ -1252,8 +1308,6 @@ brasero_plugin_init_real (BraseroPlugin *object)
return;
}
- BRASERO_BURN_LOG ("Module %s successfully loaded", priv->name);
-
/* now see if we need to override the hardcoded priority of the plugin */
client = gconf_client_get_default ();
priority_path = brasero_plugin_get_gconf_priority_key (object);
diff --git a/plugins/cdrdao/burn-cdrdao.c b/plugins/cdrdao/burn-cdrdao.c
index 250c1e0..e883db7 100644
--- a/plugins/cdrdao/burn-cdrdao.c
+++ b/plugins/cdrdao/burn-cdrdao.c
@@ -698,5 +698,10 @@ brasero_cdrdao_export_caps (BraseroPlugin *plugin)
G_MODULE_EXPORT void
brasero_plugin_check_config (BraseroPlugin *plugin)
{
- brasero_plugin_test_app (plugin, "cdrdao");
+ gint version [3] = { 1, 2, 0};
+ brasero_plugin_test_app (plugin,
+ "cdrdao",
+ "version",
+ "Cdrdao version %d.%d.%d - (C) Andreas Mueller <andreas daneb de>",
+ version);
}
diff --git a/plugins/cdrdao/burn-toc2cue.c b/plugins/cdrdao/burn-toc2cue.c
index d4632fd..d6ba276 100644
--- a/plugins/cdrdao/burn-toc2cue.c
+++ b/plugins/cdrdao/burn-toc2cue.c
@@ -348,5 +348,10 @@ brasero_toc2cue_export_caps (BraseroPlugin *plugin)
G_MODULE_EXPORT void
brasero_plugin_check_config (BraseroPlugin *plugin)
{
- brasero_plugin_test_app (plugin, "toc2cue");
+ gint version [3] = { 1, 2, 0};
+ brasero_plugin_test_app (plugin,
+ "toc2cue",
+ "-V",
+ "%d.%d.%d",
+ version);
}
diff --git a/plugins/cdrkit/burn-genisoimage.c b/plugins/cdrkit/burn-genisoimage.c
index f42ae3e..02f3bc9 100644
--- a/plugins/cdrkit/burn-genisoimage.c
+++ b/plugins/cdrkit/burn-genisoimage.c
@@ -585,5 +585,10 @@ brasero_genisoimage_export_caps (BraseroPlugin *plugin)
G_MODULE_EXPORT void
brasero_plugin_check_config (BraseroPlugin *plugin)
{
- brasero_plugin_test_app (plugin, "genisoimage");
+ gint version [3] = { 1, 1, 0};
+ brasero_plugin_test_app (plugin,
+ "genisoimage",
+ "--version",
+ "genisoimage %d.%d.%d (Linux)",
+ version);
}
diff --git a/plugins/cdrkit/burn-readom.c b/plugins/cdrkit/burn-readom.c
index a1d6109..fdb7989 100644
--- a/plugins/cdrkit/burn-readom.c
+++ b/plugins/cdrkit/burn-readom.c
@@ -496,5 +496,10 @@ brasero_readom_export_caps (BraseroPlugin *plugin)
G_MODULE_EXPORT void
brasero_plugin_check_config (BraseroPlugin *plugin)
{
- brasero_plugin_test_app (plugin, "readom");
+ gint version [3] = { 1, 1, 0};
+ brasero_plugin_test_app (plugin,
+ "readom",
+ "--version",
+ "readcd %*s is not what you see here. This line is only a fake for too clever\nGUIs and other frontend applications. In fact, this program is:\nreadom %d.%d.%d",
+ version);
}
diff --git a/plugins/cdrkit/burn-wodim.c b/plugins/cdrkit/burn-wodim.c
index 2368844..cb914da 100644
--- a/plugins/cdrkit/burn-wodim.c
+++ b/plugins/cdrkit/burn-wodim.c
@@ -1405,5 +1405,10 @@ brasero_wodim_export_caps (BraseroPlugin *plugin)
G_MODULE_EXPORT void
brasero_plugin_check_config (BraseroPlugin *plugin)
{
- brasero_plugin_test_app (plugin, "wodim");
+ gint version [3] = { 1, 1, 0};
+ brasero_plugin_test_app (plugin,
+ "wodim",
+ "--version",
+ "Cdrecord-yelling-line-to-tell-frontends-to-use-it-like-version %*s \nWodim %d.%d.%d",
+ version);
}
diff --git a/plugins/cdrtools/burn-cdda2wav.c b/plugins/cdrtools/burn-cdda2wav.c
index dfc5cd6..c32ac97 100644
--- a/plugins/cdrtools/burn-cdda2wav.c
+++ b/plugins/cdrtools/burn-cdda2wav.c
@@ -432,5 +432,10 @@ brasero_cdda2wav_export_caps (BraseroPlugin *plugin)
G_MODULE_EXPORT void
brasero_plugin_check_config (BraseroPlugin *plugin)
{
- brasero_plugin_test_app (plugin, "cdda2wav");
+ gint version [3] = { 2, 0, 0};
+ brasero_plugin_test_app (plugin,
+ "cdda2wav",
+ "--version",
+ "cdda2wav %d.%d.%da64 (x86_64-unknown-linux-gnu) Copyright (C) 1993-2004 Heiko Ei�feldt (C) 2004-2009 J�rg Schilling",
+ version);
}
diff --git a/plugins/cdrtools/burn-cdrecord.c b/plugins/cdrtools/burn-cdrecord.c
index 2c1f7f6..62f4fb4 100644
--- a/plugins/cdrtools/burn-cdrecord.c
+++ b/plugins/cdrtools/burn-cdrecord.c
@@ -1406,5 +1406,10 @@ brasero_cdrecord_export_caps (BraseroPlugin *plugin)
G_MODULE_EXPORT void
brasero_plugin_check_config (BraseroPlugin *plugin)
{
- brasero_plugin_test_app (plugin, "cdrecord");
+ gint version [3] = { 2, 0, 0};
+ brasero_plugin_test_app (plugin,
+ "cdrecord",
+ "--version",
+ "Cdrecord-ProDVD-ProBD-Clone %d.%d.%da64 (x86_64-unknown-linux-gnu) Copyright (C) 1995-2009 J�rg Schilling",
+ version);
}
diff --git a/plugins/cdrtools/burn-mkisofs.c b/plugins/cdrtools/burn-mkisofs.c
index 0bc399b..95de80e 100644
--- a/plugins/cdrtools/burn-mkisofs.c
+++ b/plugins/cdrtools/burn-mkisofs.c
@@ -589,5 +589,10 @@ brasero_mkisofs_export_caps (BraseroPlugin *plugin)
G_MODULE_EXPORT void
brasero_plugin_check_config (BraseroPlugin *plugin)
{
- brasero_plugin_test_app (plugin, "mkisofs");
+ gint version [3] = { 2, 0, 0};
+ brasero_plugin_test_app (plugin,
+ "mkisofs",
+ "--version",
+ "mkisofs %d.%d.%da64 (x86_64-unknown-linux-gnu) Copyright (C) 1993-1997 Eric Youngdale (C) 1997-2009 J�rg Schilling",
+ version);
}
diff --git a/plugins/cdrtools/burn-readcd.c b/plugins/cdrtools/burn-readcd.c
index 68b746f..db89054 100644
--- a/plugins/cdrtools/burn-readcd.c
+++ b/plugins/cdrtools/burn-readcd.c
@@ -506,5 +506,10 @@ brasero_readcd_export_caps (BraseroPlugin *plugin)
G_MODULE_EXPORT void
brasero_plugin_check_config (BraseroPlugin *plugin)
{
- brasero_plugin_test_app (plugin, "readcd");
+ gint version [3] = { 2, 0, 0};
+ brasero_plugin_test_app (plugin,
+ "readcd",
+ "--version",
+ "readcd %d.%d.%da64 (x86_64-unknown-linux-gnu) Copyright (C) 1987, 1995-2009 J�rg Schilling",
+ version);
}
diff --git a/plugins/dvdauthor/burn-dvdauthor.c b/plugins/dvdauthor/burn-dvdauthor.c
index 7a109f5..982a280 100644
--- a/plugins/dvdauthor/burn-dvdauthor.c
+++ b/plugins/dvdauthor/burn-dvdauthor.c
@@ -426,5 +426,10 @@ brasero_dvd_author_export_caps (BraseroPlugin *plugin)
G_MODULE_EXPORT void
brasero_plugin_check_config (BraseroPlugin *plugin)
{
- brasero_plugin_test_app (plugin, "dvdauthor");
+ gint version [3] = { 0, 6, 0};
+ brasero_plugin_test_app (plugin,
+ "dvdauthor",
+ "-h",
+ "DVDAuthor::dvdauthor, version %d.%d.%d.",
+ version);
}
diff --git a/plugins/growisofs/burn-dvd-rw-format.c b/plugins/growisofs/burn-dvd-rw-format.c
index a7876d9..d80c344 100644
--- a/plugins/growisofs/burn-dvd-rw-format.c
+++ b/plugins/growisofs/burn-dvd-rw-format.c
@@ -218,5 +218,10 @@ brasero_dvd_rw_format_export_caps (BraseroPlugin *plugin)
G_MODULE_EXPORT void
brasero_plugin_check_config (BraseroPlugin *plugin)
{
- brasero_plugin_test_app (plugin, "dvd+rw-format");
+ gint version [3] = { 5, 0, -1};
+ brasero_plugin_test_app (plugin,
+ "dvd+rw-format",
+ "-v",
+ "* BD/DVD±RW/-RAM format utility by <appro fy chalmers se>, version %d.%d",
+ version);
}
diff --git a/plugins/growisofs/burn-growisofs.c b/plugins/growisofs/burn-growisofs.c
index 4590574..94a6b28 100644
--- a/plugins/growisofs/burn-growisofs.c
+++ b/plugins/growisofs/burn-growisofs.c
@@ -930,6 +930,10 @@ brasero_growisofs_export_caps (BraseroPlugin *plugin)
G_MODULE_EXPORT void
brasero_plugin_check_config (BraseroPlugin *plugin)
{
- brasero_plugin_test_app (plugin, "growisofs");
+ gint version [3] = { 5, 0, -1};
+ brasero_plugin_test_app (plugin,
+ "growisofs",
+ "--version",
+ "* %*s by <appro fy chalmers se>, version %d.%d,",
+ version);
}
-
diff --git a/plugins/vcdimager/burn-vcdimager.c b/plugins/vcdimager/burn-vcdimager.c
index 888b4f8..2bf508a 100644
--- a/plugins/vcdimager/burn-vcdimager.c
+++ b/plugins/vcdimager/burn-vcdimager.c
@@ -530,5 +530,10 @@ brasero_vcd_imager_export_caps (BraseroPlugin *plugin)
G_MODULE_EXPORT void
brasero_plugin_check_config (BraseroPlugin *plugin)
{
- brasero_plugin_test_app (plugin, "vcdimager");
+ gint version [3] = { 0, 7, 0};
+ brasero_plugin_test_app (plugin,
+ "vcdimager",
+ "--version",
+ "vcdimager (GNU VCDImager) %d.%d.%d",
+ version);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]