It works! Push it!

 

 

On Monday 10 of December 2012 10:19:39 Jiri Moskovcak wrote:

> ---

> libreport.spec.in | 4 ++--

> po/POTFILES.in | 4 ++--

> src/gui-wizard-gtk/wizard.c | 9 ++++++--

> src/include/run_event.h | 8 +++++++

> src/include/workflow.h | 1 +

> src/lib/run_event.c | 23 ++++++++++++++++++++

> src/lib/workflow.c | 41 ++++++++++++++++++++++++++++++++++++

> src/workflows/Makefile.am | 8 +++----

> src/workflows/report_Fedora.xml.in | 13 ------------

> src/workflows/report_Upload.xml.in | 11 ----------

> src/workflows/report_fedora.conf | 2 +-

> src/workflows/workflow_Fedora.xml.in | 13 ++++++++++++

> src/workflows/workflow_Upload.xml.in | 11 ++++++++++

> 13 files changed, 113 insertions(+), 35 deletions(-)

> delete mode 100644 src/workflows/report_Fedora.xml.in

> delete mode 100644 src/workflows/report_Upload.xml.in

> create mode 100644 src/workflows/workflow_Fedora.xml.in

> create mode 100644 src/workflows/workflow_Upload.xml.in

>

> diff --git a/libreport.spec.in b/libreport.spec.in

> index 78f690e..3c915f6 100644

> --- a/libreport.spec.in

> +++ b/libreport.spec.in

> @@ -403,11 +403,11 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :

> %{_bindir}/reporter-upload

> %{_sysconfdir}/libreport/events/report_Uploader.xml

> %config(noreplace) %{_sysconfdir}/libreport/events.d/uploader_event.conf

> -%{_sysconfdir}/libreport/workflows/report_Upload.xml

> +%{_sysconfdir}/libreport/workflows/workflow_Upload.xml

>

> %files fedora

> %defattr(-,root,root,-)

> -%{_sysconfdir}/libreport/workflows/report_Fedora.xml

> +%{_sysconfdir}/libreport/workflows/workflow_Fedora.xml

> %config(noreplace) %{_sysconfdir}/libreport/workflows.d/report_fedora.conf

>

> %changelog

> diff --git a/po/POTFILES.in b/po/POTFILES.in

> index 2dfe09e..b310941 100644

> --- a/po/POTFILES.in

> +++ b/po/POTFILES.in

> @@ -40,5 +40,5 @@ src/plugins/report_uReport.xml.in

> src/plugins/rhbz.c

> src/plugins/ureport.c

> src/report-newt/report-newt.c

> -src/workflows/report_Fedora.xml.in

> -src/workflows/report_Upload.xml.in

> +src/workflows/workflow_Fedora.xml.in

> +src/workflows/workflow_Upload.xml.in

> diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c

> index 0891756..2907611 100644

> --- a/src/gui-wizard-gtk/wizard.c

> +++ b/src/gui-wizard-gtk/wizard.c

> @@ -2464,10 +2464,15 @@ static void set_auto_event_chain(GtkButton *button, gpointer user_data)

> static void add_workflow_buttons(GtkBox *box, GHashTable *workflows, GCallback func)

> {

> gtk_container_foreach(GTK_CONTAINER(box), &remove_child_widget, NULL);

> - GList *keys = g_hash_table_get_keys(g_workflow_list);

> +

> + GHashTable *workflow_table = load_workflow_config_data_from_list(

> + list_possible_events_glist(g_dump_dir_name, "workflow"),

> + WORKFLOWS_DIR);

> +

> + GList *keys = g_hash_table_get_keys(workflow_table);

> while(keys)

> {

> - workflow_t *w = g_hash_table_lookup(g_workflow_list, keys->data);

> + workflow_t *w = g_hash_table_lookup(workflow_table, keys->data);

> char *btn_label = xasprintf("<b>%s</b>\n%s", wf_get_screen_name(w), wf_get_description(w));

> GtkWidget *button = gtk_button_new_with_label(btn_label);

> GList *children = gtk_container_get_children(GTK_CONTAINER(button));

> diff --git a/src/include/run_event.h b/src/include/run_event.h

> index bf94b5c..0afebc6 100644

> --- a/src/include/run_event.h

> +++ b/src/include/run_event.h

> @@ -223,6 +223,14 @@ int run_event_stdio_ask_yes_no_yesforever(const char *msg, const char *key, void

> */

> char *run_event_stdio_ask_password(const char *msg, void *param);

>

> +/*

> + * Returns a list of possible events for given problem directory

> + *

> + * @param problem_dir_name the name of the problem directory

> + * @param pfx the prefix of the events "report", "workflow"

> + */

> +GList *list_possible_events_glist(const char *problem_dir_name,

> + const char *pfx);

> #ifdef __cplusplus

> }

> #endif

> diff --git a/src/include/workflow.h b/src/include/workflow.h

> index e60d6b5..db8c65d 100644

> --- a/src/include/workflow.h

> +++ b/src/include/workflow.h

> @@ -43,5 +43,6 @@ void wf_set_screen_name(workflow_t *w, const char* screen_name);

> void wf_set_description(workflow_t *w, const char* description);

> void wf_set_long_desc(workflow_t *w, const char* long_desc);

> void wf_add_event(workflow_t *w, event_config_t *ec);

> +GHashTable *load_workflow_config_data_from_list(GList *wf_names, const char *path);

>

> #endif

> diff --git a/src/lib/run_event.c b/src/lib/run_event.c

> index c8ccfa5..a60913e 100644

> --- a/src/lib/run_event.c

> +++ b/src/lib/run_event.c

> @@ -684,6 +684,29 @@ char *list_possible_events(struct dump_dir *dd, const char *dump_dir_name, const

> return strbuf_free_nobuf(result);

> }

>

> +GList *list_possible_events_glist(const char *problem_dir_name,

> + const char *pfx)

> +{

> + struct dump_dir *dd = dd_opendir(problem_dir_name, DD_OPEN_READONLY);

> + GList *l = NULL;

> + char *events = list_possible_events(dd, problem_dir_name, pfx);

> + char *start = events;

> + char *end = strchr(events, '\n');

> +

> + while(end)

> + {

> + *end = '\0';

> + l = g_list_append(l, xstrdup(start));

> + start = end + 1;

> + end = strchr(start, '\n');

> + }

> +

> + dd_close(dd);

> + free(events);

> +

> + return l;

> +}

> +

> void run_event_stdio_alert(const char *msg, void *param)

> {

> alert(msg);

> diff --git a/src/lib/workflow.c b/src/lib/workflow.c

> index 1fba64c..35fa904 100644

> --- a/src/lib/workflow.c

> +++ b/src/lib/workflow.c

> @@ -72,6 +72,47 @@ workflow_t *get_workflow(const char *name)

> return g_hash_table_lookup(g_workflow_list, name);

> }

>

> +static gint file_obj_cmp(file_obj_t *file, const char *filename)

> +{

> + gint cmp = strcmp(file->filename, filename);

> + return cmp;

> +}

> +

> +static void load_workflow_config(const char *name,

> + GList *available_wfs,

> + GHashTable *wf_list)

> +{

> + GList *wf_file = g_list_find_custom(available_wfs, name, (GCompareFunc)file_obj_cmp);

> + if (wf_file)

> + {

> + file_obj_t *file = (file_obj_t *)wf_file->data;

> + workflow_t *workflow = new_workflow(file->filename);

> + load_workflow_description_from_file(workflow, file->fullpath);

> + VERB1 log("Adding '%s' to workflows\n", file->filename);

> + g_hash_table_insert(wf_list, file->filename, workflow);

> + }

> +}

> +

> +GHashTable *load_workflow_config_data_from_list(GList *wf_names,

> + const char *path)

> +{

> + GList *wfs = wf_names;

> + GHashTable *wf_list = g_hash_table_new_full(

> + g_str_hash,

> + g_str_equal,

> + g_free,

> + (GDestroyNotify) free_workflow

> + );

> + GList *workflow_files = get_file_list(path, "xml");

> + while(wfs)

> + {

> + load_workflow_config((const char *)wfs->data, workflow_files, wf_list);

> + wfs = g_list_next(wfs);

> + }

> +

> + return wf_list;

> +}

> +

> GHashTable *load_workflow_config_data(const char *path)

> {

> if (g_workflow_list)

> diff --git a/src/workflows/Makefile.am b/src/workflows/Makefile.am

> index 3cd0797..98fa1a4 100644

> --- a/src/workflows/Makefile.am

> +++ b/src/workflows/Makefile.am

> @@ -1,8 +1,8 @@

> workflowsdir = $(WORKFLOWS_DIR)

>

> dist_workflows_DATA = \

> - report_Fedora.xml \

> - report_Upload.xml

> + workflow_Fedora.xml \

> + workflow_Upload.xml

>

> workflowsconfdir = $(WORKFLOWS_CONF_DIR)

>

> @@ -12,5 +12,5 @@ dist_workflowsconf_DATA =\

> @INTLTOOL_XML_RULE@

>

> EXTRA_DIST = \

> - report_Fedora.xml.in \

> - report_Upload.xml.in

> + workflow_Fedora.xml.in \

> + workflow_Upload.xml.in

> diff --git a/src/workflows/report_Fedora.xml.in b/src/workflows/report_Fedora.xml.in

> deleted file mode 100644

> index f9df177..0000000

> --- a/src/workflows/report_Fedora.xml.in

> +++ /dev/null

> @@ -1,13 +0,0 @@

> -<?xml version="1.0" encoding="UTF-8" ?>

> -<workflow>

> - <_name>Report to Fedora</_name>

> - <_description>Process the report using the Fedora infrastructure</_description>

> -

> - <events>

> - <event>report_uReport</event>

> - <event>collect_*</event>

> - <event>analyze_CCpp</event>

> - <event>report_Bugzilla</event>

> - <event>post_report</event>

> - </events>

> -</workflow>

> diff --git a/src/workflows/report_Upload.xml.in b/src/workflows/report_Upload.xml.in

> deleted file mode 100644

> index 3965f99..0000000

> --- a/src/workflows/report_Upload.xml.in

> +++ /dev/null

> @@ -1,11 +0,0 @@

> -<?xml version="1.0" encoding="UTF-8"?>

> -<workflow>

> - <_name>Upload the problem data to a server</_name>

> - <_description>Analyze the problem locally and upload the data via scp or ftp</_description>

> -

> - <events>

> - <event>collect_*</event>

> - <event>analyze_CCpp</event>

> - <event>report_Uploader</event>

> - </events>

> -</workflow>

> \ No newline at end of file

> diff --git a/src/workflows/report_fedora.conf b/src/workflows/report_fedora.conf

> index 9dd86ce..8c58f12 100644

> --- a/src/workflows/report_fedora.conf

> +++ b/src/workflows/report_fedora.conf

> @@ -1,3 +1,3 @@

> -EVENT=report_Fedora analyzer=CCpp

> +EVENT=workflow_Fedora analyzer=CCpp

> # this is just a meta event which consists of other events

> # the list is defined in the xml file

> diff --git a/src/workflows/workflow_Fedora.xml.in b/src/workflows/workflow_Fedora.xml.in

> new file mode 100644

> index 0000000..f9df177

> --- /dev/null

> +++ b/src/workflows/workflow_Fedora.xml.in

> @@ -0,0 +1,13 @@

> +<?xml version="1.0" encoding="UTF-8" ?>

> +<workflow>

> + <_name>Report to Fedora</_name>

> + <_description>Process the report using the Fedora infrastructure</_description>

> +

> + <events>

> + <event>report_uReport</event>

> + <event>collect_*</event>

> + <event>analyze_CCpp</event>

> + <event>report_Bugzilla</event>

> + <event>post_report</event>

> + </events>

> +</workflow>

> diff --git a/src/workflows/workflow_Upload.xml.in b/src/workflows/workflow_Upload.xml.in

> new file mode 100644

> index 0000000..3965f99

> --- /dev/null

> +++ b/src/workflows/workflow_Upload.xml.in

> @@ -0,0 +1,11 @@

> +<?xml version="1.0" encoding="UTF-8"?>

> +<workflow>

> + <_name>Upload the problem data to a server</_name>

> + <_description>Analyze the problem locally and upload the data via scp or ftp</_description>

> +

> + <events>

> + <event>collect_*</event>

> + <event>analyze_CCpp</event>

> + <event>report_Uploader</event>

> + </events>

> +</workflow>

> \ No newline at end of file

>