summaryrefslogtreecommitdiff
path: root/builder
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2016-05-06 16:03:27 +0200
committerAlexander Larsson <alexl@redhat.com>2016-05-06 16:03:27 +0200
commit1ffdf27d927c7944e3bce9b1cd3c101d823fd826 (patch)
treeb91268da5ea5f1d224977ce4e5bbb75386d9a424 /builder
parentafa12a446fcc473eb740146805856e76ad82b4af (diff)
downloadxdg-app-1ffdf27d927c7944e3bce9b1cd3c101d823fd826.tar.gz
uncruftify: Initial run, all non-problematic changes
Diffstat (limited to 'builder')
-rw-r--r--builder/builder-cache.c116
-rw-r--r--builder/builder-cache.h74
-rw-r--r--builder/builder-context.c116
-rw-r--r--builder/builder-context.h76
-rw-r--r--builder/builder-manifest.c378
-rw-r--r--builder/builder-manifest.h82
-rw-r--r--builder/builder-module.c182
-rw-r--r--builder/builder-module.h64
-rw-r--r--builder/builder-options.c86
-rw-r--r--builder/builder-options.h40
-rw-r--r--builder/builder-source-archive.c82
-rw-r--r--builder/builder-source-archive.h4
-rw-r--r--builder/builder-source-bzr.c43
-rw-r--r--builder/builder-source-bzr.h4
-rw-r--r--builder/builder-source-file.c91
-rw-r--r--builder/builder-source-file.h4
-rw-r--r--builder/builder-source-git.c96
-rw-r--r--builder/builder-source-git.h4
-rw-r--r--builder/builder-source-patch.c37
-rw-r--r--builder/builder-source-patch.h4
-rw-r--r--builder/builder-source-script.c27
-rw-r--r--builder/builder-source-script.h4
-rw-r--r--builder/builder-source-shell.c49
-rw-r--r--builder/builder-source-shell.h4
-rw-r--r--builder/builder-source.c61
-rw-r--r--builder/builder-source.h58
-rw-r--r--builder/builder-utils.c316
-rw-r--r--builder/builder-utils.h18
-rw-r--r--builder/xdg-app-builder-main.c50
29 files changed, 1160 insertions, 1010 deletions
diff --git a/builder/builder-cache.c b/builder/builder-cache.c
index 6782d45..9c57af1 100644
--- a/builder/builder-cache.c
+++ b/builder/builder-cache.c
@@ -36,20 +36,22 @@
#include "builder-utils.h"
#include "builder-cache.h"
-struct BuilderCache {
- GObject parent;
- GChecksum *checksum;
- GFile *cache_dir;
- GFile *app_dir;
- char *branch;
- char *stage;
+struct BuilderCache
+{
+ GObject parent;
+ GChecksum *checksum;
+ GFile *cache_dir;
+ GFile *app_dir;
+ char *branch;
+ char *stage;
GHashTable *unused_stages;
- char *last_parent;
+ char *last_parent;
OstreeRepo *repo;
- gboolean disabled;
+ gboolean disabled;
};
-typedef struct {
+typedef struct
+{
GObjectClass parent_class;
} BuilderCacheClass;
@@ -69,7 +71,7 @@ enum {
static void
builder_cache_finalize (GObject *object)
{
- BuilderCache *self = (BuilderCache *)object;
+ BuilderCache *self = (BuilderCache *) object;
g_clear_object (&self->cache_dir);
g_clear_object (&self->app_dir);
@@ -152,14 +154,14 @@ builder_cache_class_init (BuilderCacheClass *klass)
"",
"",
G_TYPE_FILE,
- G_PARAM_READWRITE|G_PARAM_CONSTRUCT));
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
g_object_class_install_property (object_class,
PROP_APP_DIR,
g_param_spec_object ("app-dir",
"",
"",
G_TYPE_FILE,
- G_PARAM_READWRITE|G_PARAM_CONSTRUCT));
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
g_object_class_install_property (object_class,
PROP_BRANCH,
g_param_spec_string ("branch",
@@ -176,8 +178,8 @@ builder_cache_init (BuilderCache *self)
}
BuilderCache *
-builder_cache_new (GFile *cache_dir,
- GFile *app_dir,
+builder_cache_new (GFile *cache_dir,
+ GFile *app_dir,
const char *branch)
{
return g_object_new (BUILDER_TYPE_CACHE,
@@ -217,7 +219,7 @@ get_ref (BuilderCache *self, const char *stage)
gboolean
builder_cache_open (BuilderCache *self,
- GError **error)
+ GError **error)
{
self->repo = ostree_repo_new (self->cache_dir);
@@ -332,7 +334,7 @@ builder_cache_get_current_ref (BuilderCache *self)
gboolean
builder_cache_lookup (BuilderCache *self,
- const char *stage)
+ const char *stage)
{
g_autofree char *current = NULL;
g_autofree char *commit = NULL;
@@ -373,7 +375,7 @@ builder_cache_lookup (BuilderCache *self,
}
}
- checkout:
+checkout:
if (self->last_parent)
{
g_print ("Cache miss, checking out last cache hit\n");
@@ -388,12 +390,13 @@ builder_cache_lookup (BuilderCache *self,
}
gboolean
-builder_cache_commit (BuilderCache *self,
- const char *body,
- GError **error)
+builder_cache_commit (BuilderCache *self,
+ const char *body,
+ GError **error)
{
g_autofree char *current = NULL;
OstreeRepoCommitModifier *modifier = NULL;
+
g_autoptr(OstreeMutableTree) mtree = NULL;
g_autoptr(GFile) root = NULL;
g_autofree char *commit_checksum = NULL;
@@ -434,7 +437,7 @@ builder_cache_commit (BuilderCache *self,
res = TRUE;
- out:
+out:
if (!res)
{
if (!ostree_repo_abort_transaction (self->repo, NULL, NULL))
@@ -447,14 +450,14 @@ builder_cache_commit (BuilderCache *self,
}
gboolean
-builder_cache_get_outstanding_changes (BuilderCache *self,
- GPtrArray **added_out,
- GPtrArray **modified_out,
- GPtrArray **removed_out,
- GError **error)
+builder_cache_get_outstanding_changes (BuilderCache *self,
+ GPtrArray **added_out,
+ GPtrArray **modified_out,
+ GPtrArray **removed_out,
+ GError **error)
{
g_autoptr(GPtrArray) added = g_ptr_array_new_with_free_func (g_object_unref);
- g_autoptr(GPtrArray) modified = g_ptr_array_new_with_free_func ((GDestroyNotify)ostree_diff_item_unref);
+ g_autoptr(GPtrArray) modified = g_ptr_array_new_with_free_func ((GDestroyNotify) ostree_diff_item_unref);
g_autoptr(GPtrArray) removed = g_ptr_array_new_with_free_func (g_object_unref);
g_autoptr(GPtrArray) added_paths = g_ptr_array_new_with_free_func (g_free);
g_autoptr(GPtrArray) modified_paths = g_ptr_array_new_with_free_func (g_free);
@@ -513,11 +516,11 @@ builder_cache_get_outstanding_changes (BuilderCache *self,
}
GPtrArray *
-builder_cache_get_all_changes (BuilderCache *self,
- GError **error)
+builder_cache_get_all_changes (BuilderCache *self,
+ GError **error)
{
g_autoptr(GPtrArray) added = g_ptr_array_new_with_free_func (g_object_unref);
- g_autoptr(GPtrArray) modified = g_ptr_array_new_with_free_func ((GDestroyNotify)ostree_diff_item_unref);
+ g_autoptr(GPtrArray) modified = g_ptr_array_new_with_free_func ((GDestroyNotify) ostree_diff_item_unref);
g_autoptr(GPtrArray) removed = g_ptr_array_new_with_free_func (g_object_unref);
g_autoptr(GPtrArray) all_paths = g_ptr_array_new_with_free_func (g_free);
g_autoptr(GFile) init_root = NULL;
@@ -566,11 +569,11 @@ builder_cache_get_all_changes (BuilderCache *self,
}
GPtrArray *
-builder_cache_get_changes (BuilderCache *self,
- GError **error)
+builder_cache_get_changes (BuilderCache *self,
+ GError **error)
{
g_autoptr(GPtrArray) added = g_ptr_array_new_with_free_func (g_object_unref);
- g_autoptr(GPtrArray) modified = g_ptr_array_new_with_free_func ((GDestroyNotify)ostree_diff_item_unref);
+ g_autoptr(GPtrArray) modified = g_ptr_array_new_with_free_func ((GDestroyNotify) ostree_diff_item_unref);
g_autoptr(GPtrArray) removed = g_ptr_array_new_with_free_func (g_object_unref);
g_autoptr(GPtrArray) changed_paths = g_ptr_array_new_with_free_func (g_free);
g_autoptr(GFile) current_root = NULL;
@@ -619,14 +622,14 @@ builder_cache_get_changes (BuilderCache *self,
}
void
-builder_cache_disable_lookups (BuilderCache *self)
+builder_cache_disable_lookups (BuilderCache *self)
{
self->disabled = TRUE;
}
gboolean
-builder_gc (BuilderCache *self,
- GError **error)
+builder_gc (BuilderCache *self,
+ GError **error)
{
gint objects_total;
gint objects_pruned;
@@ -637,7 +640,7 @@ builder_gc (BuilderCache *self,
g_hash_table_iter_init (&iter, self->unused_stages);
while (g_hash_table_iter_next (&iter, &key, &value))
{
- const char *unused_stage = (const char *)key;
+ const char *unused_stage = (const char *) key;
g_autofree char *unused_ref = get_ref (self, unused_stage);
g_debug ("Removing unused ref %s", unused_ref);
@@ -660,51 +663,54 @@ builder_gc (BuilderCache *self,
}
void
-builder_cache_checksum_str (BuilderCache *self,
- const char *str)
+builder_cache_checksum_str (BuilderCache *self,
+ const char *str)
{
/* We include the terminating zero so that we make
* a difference between NULL and "". */
if (str)
- g_checksum_update (self->checksum, (const guchar *)str, strlen (str) + 1);
+ g_checksum_update (self->checksum, (const guchar *) str, strlen (str) + 1);
else
/* Always add something so we can't be fooled by a sequence like
NULL, "a" turning into "a", NULL. */
- g_checksum_update (self->checksum, (const guchar *)"\1", 1);
+ g_checksum_update (self->checksum, (const guchar *) "\1", 1);
}
void
-builder_cache_checksum_strv (BuilderCache *self,
- char **strv)
+builder_cache_checksum_strv (BuilderCache *self,
+ char **strv)
{
int i;
if (strv)
{
- g_checksum_update (self->checksum, (const guchar *)"\1", 1);
+ g_checksum_update (self->checksum, (const guchar *) "\1", 1);
for (i = 0; strv[i] != NULL; i++)
builder_cache_checksum_str (self, strv[i]);
}
else
- g_checksum_update (self->checksum, (const guchar *)"\2", 1);
+ {
+ g_checksum_update (self->checksum, (const guchar *) "\2", 1);
+ }
}
void
-builder_cache_checksum_boolean (BuilderCache *self,
- gboolean val)
+builder_cache_checksum_boolean (BuilderCache *self,
+ gboolean val)
{
if (val)
- g_checksum_update (self->checksum, (const guchar *)"\1", 1);
+ g_checksum_update (self->checksum, (const guchar *) "\1", 1);
else
- g_checksum_update (self->checksum, (const guchar *)"\0", 1);
+ g_checksum_update (self->checksum, (const guchar *) "\0", 1);
}
void
-builder_cache_checksum_uint32 (BuilderCache *self,
- guint32 val)
+builder_cache_checksum_uint32 (BuilderCache *self,
+ guint32 val)
{
guchar v[4];
+
v[0] = (val >> 0) & 0xff;
v[1] = (val >> 8) & 0xff;
v[2] = (val >> 16) & 0xff;
@@ -713,9 +719,9 @@ builder_cache_checksum_uint32 (BuilderCache *self,
}
void
-builder_cache_checksum_data (BuilderCache *self,
- guint8 *data,
- gsize len)
+builder_cache_checksum_data (BuilderCache *self,
+ guint8 *data,
+ gsize len)
{
g_checksum_update (self->checksum, data, len);
}
diff --git a/builder/builder-cache.h b/builder/builder-cache.h
index 171f27d..a421f26 100644
--- a/builder/builder-cache.h
+++ b/builder/builder-cache.h
@@ -28,51 +28,51 @@ G_BEGIN_DECLS
typedef struct BuilderCache BuilderCache;
-#define BUILDER_TYPE_CACHE (builder_cache_get_type())
+#define BUILDER_TYPE_CACHE (builder_cache_get_type ())
#define BUILDER_CACHE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BUILDER_TYPE_CACHE, BuilderCache))
#define BUILDER_IS_CACHE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BUILDER_TYPE_CACHE))
GType builder_cache_get_type (void);
-BuilderCache *builder_cache_new (GFile *cache_dir,
- GFile *app_dir,
- const char *branch);
-void builder_cache_disable_lookups (BuilderCache *self);
-gboolean builder_cache_open (BuilderCache *self,
- GError **error);
-GChecksum * builder_cache_get_checksum (BuilderCache *self);
-gboolean builder_cache_lookup (BuilderCache *self,
- const char *stage);
+BuilderCache *builder_cache_new (GFile *cache_dir,
+ GFile *app_dir,
+ const char *branch);
+void builder_cache_disable_lookups (BuilderCache *self);
+gboolean builder_cache_open (BuilderCache *self,
+ GError **error);
+GChecksum * builder_cache_get_checksum (BuilderCache *self);
+gboolean builder_cache_lookup (BuilderCache *self,
+ const char *stage);
void builder_cache_ensure_checkout (BuilderCache *self);
-gboolean builder_cache_has_checkout (BuilderCache *self);
-gboolean builder_cache_commit (BuilderCache *self,
- const char *body,
- GError **error);
-gboolean builder_cache_get_outstanding_changes (BuilderCache *self,
- GPtrArray **added_out,
- GPtrArray **modified_out,
- GPtrArray **removed_out,
- GError **error);
-GPtrArray *builder_cache_get_changes (BuilderCache *self,
- GError **error);
-GPtrArray *builder_cache_get_all_changes (BuilderCache *self,
- GError **error);
-gboolean builder_gc (BuilderCache *self,
- GError **error);
+gboolean builder_cache_has_checkout (BuilderCache *self);
+gboolean builder_cache_commit (BuilderCache *self,
+ const char *body,
+ GError **error);
+gboolean builder_cache_get_outstanding_changes (BuilderCache *self,
+ GPtrArray **added_out,
+ GPtrArray **modified_out,
+ GPtrArray **removed_out,
+ GError **error);
+GPtrArray *builder_cache_get_changes (BuilderCache *self,
+ GError **error);
+GPtrArray *builder_cache_get_all_changes (BuilderCache *self,
+ GError **error);
+gboolean builder_gc (BuilderCache *self,
+ GError **error);
-void builder_cache_checksum_str (BuilderCache *self,
- const char *str);
-void builder_cache_checksum_strv (BuilderCache *self,
- char **strv);
-void builder_cache_checksum_boolean (BuilderCache *self,
- gboolean val);
-void builder_cache_checksum_uint32 (BuilderCache *self,
- guint32 val);
-void builder_cache_checksum_data (BuilderCache *self,
- guint8 *data,
- gsize len);
+void builder_cache_checksum_str (BuilderCache *self,
+ const char *str);
+void builder_cache_checksum_strv (BuilderCache *self,
+ char **strv);
+void builder_cache_checksum_boolean (BuilderCache *self,
+ gboolean val);
+void builder_cache_checksum_uint32 (BuilderCache *self,
+ guint32 val);
+void builder_cache_checksum_data (BuilderCache *self,
+ guint8 *data,
+ gsize len);
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(BuilderCache, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (BuilderCache, g_object_unref)
G_END_DECLS
diff --git a/builder/builder-context.c b/builder/builder-context.c
index a15224e..4167de4 100644
--- a/builder/builder-context.c
+++ b/builder/builder-context.c
@@ -31,30 +31,32 @@
#include "xdg-app-utils.h"
#include "builder-context.h"
-struct BuilderContext {
- GObject parent;
+struct BuilderContext
+{
+ GObject parent;
- GFile *app_dir;
- GFile *base_dir;
- SoupSession *soup_session;
- char *arch;
+ GFile *app_dir;
+ GFile *base_dir;
+ SoupSession *soup_session;
+ char *arch;
- GFile *download_dir;
- GFile *state_dir;
- GFile *build_dir;
- GFile *cache_dir;
- GFile *ccache_dir;
+ GFile *download_dir;
+ GFile *state_dir;
+ GFile *build_dir;
+ GFile *cache_dir;
+ GFile *ccache_dir;
BuilderOptions *options;
- gboolean keep_build_dirs;
- char **cleanup;
- char **cleanup_platform;
- gboolean use_ccache;
- gboolean build_runtime;
- gboolean separate_locales;
+ gboolean keep_build_dirs;
+ char **cleanup;
+ char **cleanup_platform;
+ gboolean use_ccache;
+ gboolean build_runtime;
+ gboolean separate_locales;
};
-typedef struct {
+typedef struct
+{
GObjectClass parent_class;
} BuilderContextClass;
@@ -71,7 +73,7 @@ enum {
static void
builder_context_finalize (GObject *object)
{
- BuilderContext *self = (BuilderContext *)object;
+ BuilderContext *self = (BuilderContext *) object;
g_clear_object (&self->app_dir);
g_clear_object (&self->base_dir);
@@ -86,9 +88,9 @@ builder_context_finalize (GObject *object)
static void
builder_context_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
{
BuilderContext *self = BUILDER_CONTEXT (object);
@@ -109,9 +111,9 @@ builder_context_get_property (GObject *object,
static void
builder_context_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
BuilderContext *self = BUILDER_CONTEXT (object);
@@ -125,7 +127,7 @@ builder_context_set_property (GObject *object,
g_set_object (&self->app_dir, g_value_get_object (value));
break;
- default:
+ default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
}
@@ -158,14 +160,14 @@ builder_context_class_init (BuilderContextClass *klass)
"",
"",
G_TYPE_FILE,
- G_PARAM_READWRITE|G_PARAM_CONSTRUCT));
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
g_object_class_install_property (object_class,
PROP_BASE_DIR,
g_param_spec_object ("base-dir",
"",
"",
G_TYPE_FILE,
- G_PARAM_READWRITE|G_PARAM_CONSTRUCT));
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
}
static void
@@ -174,43 +176,43 @@ builder_context_init (BuilderContext *self)
}
GFile *
-builder_context_get_base_dir (BuilderContext *self)
+builder_context_get_base_dir (BuilderContext *self)
{
return self->base_dir;
}
GFile *
-builder_context_get_state_dir (BuilderContext *self)
+builder_context_get_state_dir (BuilderContext *self)
{
return self->state_dir;
}
GFile *
-builder_context_get_app_dir (BuilderContext *self)
+builder_context_get_app_dir (BuilderContext *self)
{
return self->app_dir;
}
GFile *
-builder_context_get_download_dir (BuilderContext *self)
+builder_context_get_download_dir (BuilderContext *self)
{
return self->download_dir;
}
GFile *
-builder_context_get_cache_dir (BuilderContext *self)
+builder_context_get_cache_dir (BuilderContext *self)
{
return self->cache_dir;
}
GFile *
-builder_context_get_build_dir (BuilderContext *self)
+builder_context_get_build_dir (BuilderContext *self)
{
return self->build_dir;
}
GFile *
-builder_context_get_ccache_dir (BuilderContext *self)
+builder_context_get_ccache_dir (BuilderContext *self)
{
return self->ccache_dir;
}
@@ -248,7 +250,7 @@ builder_context_get_arch (BuilderContext *self)
if (self->arch == NULL)
self->arch = g_strdup (xdg_app_get_arch ());
- return (const char *)self->arch;
+ return (const char *) self->arch;
}
void
@@ -275,7 +277,7 @@ builder_context_set_options (BuilderContext *self,
int
builder_context_get_n_cpu (BuilderContext *self)
{
- return (int)sysconf (_SC_NPROCESSORS_ONLN);
+ return (int) sysconf (_SC_NPROCESSORS_ONLN);
}
void
@@ -286,31 +288,31 @@ builder_context_set_keep_build_dirs (BuilderContext *self,
}
void
-builder_context_set_global_cleanup (BuilderContext *self,
- const char **cleanup)
+builder_context_set_global_cleanup (BuilderContext *self,
+ const char **cleanup)
{
g_strfreev (self->cleanup);
- self->cleanup = g_strdupv ((char **)cleanup);
+ self->cleanup = g_strdupv ((char **) cleanup);
}
const char **
-builder_context_get_global_cleanup (BuilderContext *self)
+builder_context_get_global_cleanup (BuilderContext *self)
{
- return (const char **)self->cleanup;
+ return (const char **) self->cleanup;
}
void
-builder_context_set_global_cleanup_platform (BuilderContext *self,
- const char **cleanup)
+builder_context_set_global_cleanup_platform (BuilderContext *self,
+ const char **cleanup)
{
g_strfreev (self->cleanup_platform);
- self->cleanup_platform = g_strdupv ((char **)cleanup);
+ self->cleanup_platform = g_strdupv ((char **) cleanup);
}
const char **
-builder_context_get_global_cleanup_platform (BuilderContext *self)
+builder_context_get_global_cleanup_platform (BuilderContext *self)
{
- return (const char **)self->cleanup_platform;
+ return (const char **) self->cleanup_platform;
}
gboolean
@@ -320,34 +322,34 @@ builder_context_get_keep_build_dirs (BuilderContext *self)
}
gboolean
-builder_context_get_build_runtime (BuilderContext *self)
+builder_context_get_build_runtime (BuilderContext *self)
{
return self->build_runtime;
}
void
-builder_context_set_build_runtime (BuilderContext *self,
- gboolean build_runtime)
+builder_context_set_build_runtime (BuilderContext *self,
+ gboolean build_runtime)
{
self->build_runtime = !!build_runtime;
}
gboolean
-builder_context_get_separate_locales (BuilderContext *self)
+builder_context_get_separate_locales (BuilderContext *self)
{
return self->separate_locales;
}
void
-builder_context_set_separate_locales (BuilderContext *self,
- gboolean separate_locales)
+builder_context_set_separate_locales (BuilderContext *self,
+ gboolean separate_locales)
{
self->separate_locales = !!separate_locales;
}
gboolean
-builder_context_enable_ccache (BuilderContext *self,
- GError **error)
+builder_context_enable_ccache (BuilderContext *self,
+ GError **error)
{
g_autofree char *ccache_path = g_file_get_path (self->ccache_dir);
g_autofree char *ccache_bin_path = g_build_filename (ccache_path, "bin", NULL);
@@ -381,8 +383,8 @@ builder_context_enable_ccache (BuilderContext *self,
}
char **
-builder_context_extend_env (BuilderContext *self,
- char **envp)
+builder_context_extend_env (BuilderContext *self,
+ char **envp)
{
if (self->use_ccache)
{
diff --git a/builder/builder-context.h b/builder/builder-context.h
index df5a0a2..d26fd25 100644
--- a/builder/builder-context.h
+++ b/builder/builder-context.h
@@ -29,51 +29,51 @@ G_BEGIN_DECLS
/* BuilderContext defined in builder-options.h to fix include loop */
-#define BUILDER_TYPE_CONTEXT (builder_context_get_type())
+#define BUILDER_TYPE_CONTEXT (builder_context_get_type ())
#define BUILDER_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BUILDER_TYPE_CONTEXT, BuilderContext))
#define BUILDER_IS_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BUILDER_TYPE_CONTEXT))
GType builder_context_get_type (void);
-GFile * builder_context_get_app_dir (BuilderContext *self);
-GFile * builder_context_get_base_dir (BuilderContext *self);
-GFile * builder_context_get_state_dir (BuilderContext *self);
-GFile * builder_context_get_cache_dir (BuilderContext *self);
-GFile * builder_context_get_build_dir (BuilderContext *self);
-GFile * builder_context_get_ccache_dir (BuilderContext *self);
-GFile * builder_context_get_download_dir (BuilderContext *self);
-SoupSession * builder_context_get_soup_session (BuilderContext *self);
-const char * builder_context_get_arch (BuilderContext *self);
-void builder_context_set_arch (BuilderContext *self,
- const char *arch);
-int builder_context_get_n_cpu (BuilderContext *self);
-void builder_context_set_keep_build_dirs (BuilderContext *self,
- gboolean keep_build_dirs);
-gboolean builder_context_get_keep_build_dirs (BuilderContext *self);
-void builder_context_set_global_cleanup (BuilderContext *self,
- const char **cleanup);
-const char ** builder_context_get_global_cleanup (BuilderContext *self);
-void builder_context_set_global_cleanup_platform (BuilderContext *self,
- const char **cleanup);
-const char ** builder_context_get_global_cleanup_platform (BuilderContext *self);
-BuilderOptions *builder_context_get_options (BuilderContext *self);
-void builder_context_set_options (BuilderContext *self,
- BuilderOptions *option);
-gboolean builder_context_get_build_runtime (BuilderContext *self);
-void builder_context_set_build_runtime (BuilderContext *self,
- gboolean build_runtime);
-gboolean builder_context_get_separate_locales(BuilderContext *self);
-void builder_context_set_separate_locales(BuilderContext *self,
- gboolean separate_locales);
+GFile * builder_context_get_app_dir (BuilderContext *self);
+GFile * builder_context_get_base_dir (BuilderContext *self);
+GFile * builder_context_get_state_dir (BuilderContext *self);
+GFile * builder_context_get_cache_dir (BuilderContext *self);
+GFile * builder_context_get_build_dir (BuilderContext *self);
+GFile * builder_context_get_ccache_dir (BuilderContext *self);
+GFile * builder_context_get_download_dir (BuilderContext *self);
+SoupSession * builder_context_get_soup_session (BuilderContext *self);
+const char * builder_context_get_arch (BuilderContext *self);
+void builder_context_set_arch (BuilderContext *self,
+ const char *arch);
+int builder_context_get_n_cpu (BuilderContext *self);
+void builder_context_set_keep_build_dirs (BuilderContext *self,
+ gboolean keep_build_dirs);
+gboolean builder_context_get_keep_build_dirs (BuilderContext *self);
+void builder_context_set_global_cleanup (BuilderContext *self,
+ const char **cleanup);
+const char ** builder_context_get_global_cleanup (BuilderContext *self);
+void builder_context_set_global_cleanup_platform (BuilderContext *self,
+ const char **cleanup);
+const char ** builder_context_get_global_cleanup_platform (BuilderContext *self);
+BuilderOptions *builder_context_get_options (BuilderContext *self);
+void builder_context_set_options (BuilderContext *self,
+ BuilderOptions *option);
+gboolean builder_context_get_build_runtime (BuilderContext *self);
+void builder_context_set_build_runtime (BuilderContext *self,
+ gboolean build_runtime);
+gboolean builder_context_get_separate_locales (BuilderContext *self);
+void builder_context_set_separate_locales (BuilderContext *self,
+ gboolean separate_locales);
-BuilderContext *builder_context_new (GFile *base_dir,
- GFile *app_dir);
-gboolean builder_context_enable_ccache (BuilderContext *self,
- GError **error);
-char ** builder_context_extend_env (BuilderContext *self,
- char **envp);
+BuilderContext *builder_context_new (GFile *base_dir,
+ GFile *app_dir);
+gboolean builder_context_enable_ccache (BuilderContext *self,
+ GError **error);
+char ** builder_context_extend_env (BuilderContext *self,
+ char **envp);
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(BuilderContext, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (BuilderContext, g_object_unref)
G_END_DECLS
diff --git a/builder/builder-manifest.c b/builder/builder-manifest.c
index f47a140..e6da205 100644
--- a/builder/builder-manifest.c
+++ b/builder/builder-manifest.c
@@ -36,42 +36,44 @@
#define LOCALES_SEPARATE_DIR "share/runtime/locale"
-struct BuilderManifest {
- GObject parent;
-
- char *id;
- char *id_platform;
- char *branch;
- char *runtime;
- char *runtime_commit;
- char *runtime_version;
- char *sdk;
- char *sdk_commit;
- char *metadata;
- char *metadata_platform;
- gboolean separate_locales;
- char **cleanup;
- char **cleanup_commands;
- char **cleanup_platform;
- char **finish_args;
- char **tags;
- char *rename_desktop_file;
- char *rename_appdata_file;
- char *rename_icon;
- gboolean copy_icon;
- char *desktop_file_name_prefix;
- char *desktop_file_name_suffix;
- gboolean build_runtime;
- gboolean writable_sdk;
- gboolean appstream_compose;
- char **sdk_extensions;
- char **platform_extensions;
- char *command;
+struct BuilderManifest
+{
+ GObject parent;
+
+ char *id;
+ char *id_platform;
+ char *branch;
+ char *runtime;
+ char *runtime_commit;
+ char *runtime_version;
+ char *sdk;
+ char *sdk_commit;
+ char *metadata;
+ char *metadata_platform;
+ gboolean separate_locales;
+ char **cleanup;
+ char **cleanup_commands;
+ char **cleanup_platform;
+ char **finish_args;
+ char **tags;
+ char *rename_desktop_file;
+ char *rename_appdata_file;
+ char *rename_icon;
+ gboolean copy_icon;
+ char *desktop_file_name_prefix;
+ char *desktop_file_name_suffix;
+ gboolean build_runtime;
+ gboolean writable_sdk;
+ gboolean appstream_compose;
+ char **sdk_extensions;
+ char **platform_extensions;
+ char *command;
BuilderOptions *build_options;
- GList *modules;
+ GList *modules;
};
-typedef struct {
+typedef struct
+{
GObjectClass parent_class;
} BuilderManifestClass;
@@ -118,7 +120,7 @@ enum {
static void
builder_manifest_finalize (GObject *object)
{
- BuilderManifest *self = (BuilderManifest *)object;
+ BuilderManifest *self = (BuilderManifest *) object;
g_free (self->id);
g_free (self->branch);
@@ -152,7 +154,7 @@ builder_manifest_get_property (GObject *object,
GValue *value,
GParamSpec *pspec)
{
- BuilderManifest *self = BUILDER_MANIFEST(object);
+ BuilderManifest *self = BUILDER_MANIFEST (object);
switch (prop_id)
{
@@ -282,7 +284,7 @@ builder_manifest_get_property (GObject *object,
}
static void
-builder_manifest_set_property (GObject *object,
+builder_manifest_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
@@ -707,10 +709,12 @@ builder_manifest_serialize_property (JsonSerializable *serializable,
return retval;
}
else
- return json_serializable_default_serialize_property (serializable,
- property_name,
- value,
- pspec);
+ {
+ return json_serializable_default_serialize_property (serializable,
+ property_name,
+ value,
+ pspec);
+ }
}
static gboolean
@@ -762,10 +766,12 @@ builder_manifest_deserialize_property (JsonSerializable *serializable,
return FALSE;
}
else
- return json_serializable_default_deserialize_property (serializable,
- property_name,
- value,
- pspec, property_node);
+ {
+ return json_serializable_default_deserialize_property (serializable,
+ property_name,
+ value,
+ pspec, property_node);
+ }
}
static void
@@ -776,13 +782,13 @@ serializable_iface_init (JsonSerializableIface *serializable_iface)
}
const char *
-builder_manifest_get_id (BuilderManifest *self)
+builder_manifest_get_id (BuilderManifest *self)
{
return self->id;
}
const char *
-builder_manifest_get_id_platform (BuilderManifest *self)
+builder_manifest_get_id_platform (BuilderManifest *self)
{
return self->id_platform;
}
@@ -812,7 +818,7 @@ builder_manifest_get_branch (BuilderManifest *self)
}
static char *
-xdg_app (GError **error,
+xdg_app (GError **error,
...)
{
gboolean res;
@@ -832,9 +838,9 @@ xdg_app (GError **error,
}
gboolean
-builder_manifest_start (BuilderManifest *self,
- BuilderContext *context,
- GError **error)
+builder_manifest_start (BuilderManifest *self,
+ BuilderContext *context,
+ GError **error)
{
g_autofree char *arch_option;
@@ -859,10 +865,11 @@ builder_manifest_start (BuilderManifest *self,
gboolean
builder_manifest_init_app_dir (BuilderManifest *self,
- BuilderContext *context,
- GError **error)
+ BuilderContext *context,
+ GError **error)
{
GFile *app_dir = builder_context_get_app_dir (context);
+
g_autoptr(GSubprocess) subp = NULL;
g_autoptr(GPtrArray) args = NULL;
int i;
@@ -942,8 +949,8 @@ builder_manifest_init_app_dir (BuilderManifest *self,
/* This gets the checksum of everything that globally affects the build */
void
builder_manifest_checksum (BuilderManifest *self,
- BuilderCache *cache,
- BuilderContext *context)
+ BuilderCache *cache,
+ BuilderContext *context)
{
builder_cache_checksum_str (cache, BUILDER_MANIFEST_CHECKSUM_VERSION);
builder_cache_checksum_str (cache, self->id);
@@ -965,8 +972,8 @@ builder_manifest_checksum (BuilderManifest *self,
void
builder_manifest_checksum_for_cleanup (BuilderManifest *self,
- BuilderCache *cache,
- BuilderContext *context)
+ BuilderCache *cache,
+ BuilderContext *context)
{
GList *l;
@@ -990,8 +997,8 @@ builder_manifest_checksum_for_cleanup (BuilderManifest *self,
void
builder_manifest_checksum_for_finish (BuilderManifest *self,
- BuilderCache *cache,
- BuilderContext *context)
+ BuilderCache *cache,
+ BuilderContext *context)
{
builder_cache_checksum_str (cache, BUILDER_MANIFEST_CHECKSUM_FINISH_VERSION);
builder_cache_checksum_strv (cache, self->finish_args);
@@ -1006,7 +1013,7 @@ builder_manifest_checksum_for_finish (BuilderManifest *self,
gsize len;
if (g_file_load_contents (metadata, NULL, &data, &len, NULL, &my_error))
- builder_cache_checksum_data (cache, (guchar *)data, len);
+ builder_cache_checksum_data (cache, (guchar *) data, len);
else
g_warning ("Can't load metadata file %s: %s", self->metadata, my_error->message);
}
@@ -1015,8 +1022,8 @@ builder_manifest_checksum_for_finish (BuilderManifest *self,
void
builder_manifest_checksum_for_platform (BuilderManifest *self,
- BuilderCache *cache,
- BuilderContext *context)
+ BuilderCache *cache,
+ BuilderContext *context)
{
builder_cache_checksum_str (cache, BUILDER_MANIFEST_CHECKSUM_PLATFORM_VERSION);
builder_cache_checksum_str (cache, self->id_platform);
@@ -1034,7 +1041,7 @@ builder_manifest_checksum_for_platform (BuilderManifest *self,
gsize len;
if (g_file_load_contents (metadata, NULL, &data, &len, NULL, &my_error))
- builder_cache_checksum_data (cache, (guchar *)data, len);
+ builder_cache_checksum_data (cache, (guchar *) data, len);
else
g_warning ("Can't load metadata-platform file %s: %s", self->metadata_platform, my_error->message);
}
@@ -1042,9 +1049,9 @@ builder_manifest_checksum_for_platform (BuilderManifest *self,
gboolean
builder_manifest_download (BuilderManifest *self,
- gboolean update_vcs,
- BuilderContext *context,
- GError **error)
+ gboolean update_vcs,
+ BuilderContext *context,
+ GError **error)
{
GList *l;
@@ -1053,7 +1060,7 @@ builder_manifest_download (BuilderManifest *self,
{
BuilderModule *m = l->data;
- if (! builder_module_download_sources (m, update_vcs, context, error))
+ if (!builder_module_download_sources (m, update_vcs, context, error))
return FALSE;
}
@@ -1062,15 +1069,15 @@ builder_manifest_download (BuilderManifest *self,
gboolean
builder_manifest_build (BuilderManifest *self,
- BuilderCache *cache,
- BuilderContext *context,
- GError **error)
+ BuilderCache *cache,
+ BuilderContext *context,
+ GError **error)
{
GList *l;
builder_context_set_options (context, self->build_options);
- builder_context_set_global_cleanup (context, (const char **)self->cleanup);
- builder_context_set_global_cleanup_platform (context, (const char **)self->cleanup_platform);
+ builder_context_set_global_cleanup (context, (const char **) self->cleanup);
+ builder_context_set_global_cleanup_platform (context, (const char **) self->cleanup_platform);
builder_context_set_build_runtime (context, self->build_runtime);
builder_context_set_separate_locales (context, self->separate_locales);
@@ -1093,8 +1100,10 @@ builder_manifest_build (BuilderManifest *self,
return FALSE;
}
else
- g_print ("Cache hit for %s, skipping build\n",
- builder_module_get_name (m));
+ {
+ g_print ("Cache hit for %s, skipping build\n",
+ builder_module_get_name (m));
+ }
changes = builder_cache_get_changes (cache, error);
if (changes == NULL)
@@ -1109,10 +1118,10 @@ builder_manifest_build (BuilderManifest *self,
}
static gboolean
-command (GFile *app_dir,
- char **env_vars,
+command (GFile *app_dir,
+ char **env_vars,
const char *commandline,
- GError **error)
+ GError **error)
{
g_autoptr(GSubprocessLauncher) launcher = NULL;
g_autoptr(GSubprocess) subp = NULL;
@@ -1153,25 +1162,25 @@ command (GFile *app_dir,
}
typedef gboolean (*ForeachFileFunc) (BuilderManifest *self,
- int source_parent_fd,
- const char *source_name,
- const char *full_dir,
- const char *rel_dir,
- struct stat *stbuf,
- gboolean *found,
- int depth,
- GError **error);
+ int source_parent_fd,
+ const char *source_name,
+ const char *full_dir,
+ const char *rel_dir,
+ struct stat *stbuf,
+ gboolean *found,
+ int depth,
+ GError **error);
static gboolean
foreach_file_helper (BuilderManifest *self,
- ForeachFileFunc func,
- int source_parent_fd,
- const char *source_name,
- const char *full_dir,
- const char *rel_dir,
- gboolean *found,
- int depth,
- GError **error)
+ ForeachFileFunc func,
+ int source_parent_fd,
+ const char *source_name,
+ const char *full_dir,
+ const char *rel_dir,
+ gboolean *found,
+ int depth,
+ GError **error)
{
g_auto(GLnxDirFdIterator) source_iter = {0};
struct dirent *dent;
@@ -1199,7 +1208,9 @@ foreach_file_helper (BuilderManifest *self,
if (fstatat (source_iter.fd, dent->d_name, &stbuf, AT_SYMLINK_NOFOLLOW) == -1)
{
if (errno == ENOENT)
- continue;
+ {
+ continue;
+ }
else
{
glnx_set_error_from_errno (error);
@@ -1224,10 +1235,10 @@ foreach_file_helper (BuilderManifest *self,
static gboolean
foreach_file (BuilderManifest *self,
- ForeachFileFunc func,
- gboolean *found,
- GFile *root,
- GError **error)
+ ForeachFileFunc func,
+ gboolean *found,
+ GFile *root,
+ GError **error)
{
return foreach_file_helper (self, func, AT_FDCWD,
gs_file_get_path_cached (root),
@@ -1239,14 +1250,14 @@ foreach_file (BuilderManifest *self,
static gboolean
rename_icon_cb (BuilderManifest *self,
- int source_parent_fd,
- const char *source_name,
- const char *full_dir,
- const char *rel_dir,
- struct stat *stbuf,
- gboolean *found,
- int depth,
- GError **error)
+ int source_parent_fd,
+ const char *source_name,
+ const char *full_dir,
+ const char *rel_dir,
+ struct stat *stbuf,
+ gboolean *found,
+ int depth,
+ GError **error)
{
if (S_ISREG (stbuf->st_mode) &&
depth == 3 &&
@@ -1279,11 +1290,11 @@ rename_icon_cb (BuilderManifest *self,
static int
cmpstringp (const void *p1, const void *p2)
{
- return strcmp (* (char * const *) p1, * (char * const *) p2);
+ return strcmp (*(char * const *) p1, *(char * const *) p2);
}
static gboolean
-appstream_compose (GFile *app_dir,
+appstream_compose (GFile *app_dir,
GError **error,
...)
{
@@ -1300,7 +1311,7 @@ appstream_compose (GFile *app_dir,
g_ptr_array_add (args, g_strdup ("--nofilesystem=host"));
g_ptr_array_add (args, g_file_get_path (app_dir));
g_ptr_array_add (args, g_strdup ("appstream-compose"));
-
+
va_start (ap, error);
while ((arg = va_arg (ap, const gchar *)))
g_ptr_array_add (args, g_strdup (arg));
@@ -1325,11 +1336,12 @@ appstream_compose (GFile *app_dir,
gboolean
builder_manifest_cleanup (BuilderManifest *self,
- BuilderCache *cache,
- BuilderContext *context,
- GError **error)
+ BuilderCache *cache,
+ BuilderContext *context,
+ GError **error)
{
GFile *app_dir = builder_context_get_app_dir (context);
+
g_autoptr(GFile) app_root = NULL;
GList *l;
g_auto(GStrv) env = NULL;
@@ -1364,7 +1376,7 @@ builder_manifest_cleanup (BuilderManifest *self,
builder_module_cleanup_collect (m, FALSE, context, to_remove_ht);
}
- keys = (char **)g_hash_table_get_keys_as_array (to_remove_ht, &n_keys);
+ keys = (char **) g_hash_table_get_keys_as_array (to_remove_ht, &n_keys);
qsort (keys, n_keys, sizeof (char *), cmpstringp);
/* Iterate in reverse to remove leafs first */
@@ -1423,7 +1435,7 @@ builder_manifest_cleanup (BuilderManifest *self,
to_replace = contents;
- while ( (match = strstr (to_replace, self->rename_desktop_file)) != NULL)
+ while ((match = strstr (to_replace, self->rename_desktop_file)) != NULL)
{
g_string_append_len (new_contents, to_replace, match - to_replace);
g_string_append (new_contents, desktop_basename);
@@ -1486,38 +1498,40 @@ builder_manifest_cleanup (BuilderManifest *self,
return FALSE;
if (self->rename_icon)
- g_key_file_set_string (keyfile,
- G_KEY_FILE_DESKTOP_GROUP,
- G_KEY_FILE_DESKTOP_KEY_ICON,
- self->id);
+ {
+ g_key_file_set_string (keyfile,
+ G_KEY_FILE_DESKTOP_GROUP,
+ G_KEY_FILE_DESKTOP_KEY_ICON,
+ self->id);
+ }
if (self->desktop_file_name_suffix ||
self->desktop_file_name_prefix)
- {
- desktop_keys = g_key_file_get_keys (keyfile,
- G_KEY_FILE_DESKTOP_GROUP,
- NULL, NULL);
- for (i = 0; desktop_keys[i]; i++)
- {
- if (strcmp (desktop_keys[i], "Name") == 0 ||
- g_str_has_prefix (desktop_keys[i], "Name["))
- {
- g_autofree char *name = g_key_file_get_string (keyfile, G_KEY_FILE_DESKTOP_GROUP, desktop_keys[i], NULL);
- if (name)
- {
- g_autofree char *new_name =
- g_strdup_printf ("%s%s%s",
- self->desktop_file_name_prefix ? self->desktop_file_name_prefix : "",
- name,
- self->desktop_file_name_suffix ? self->desktop_file_name_suffix : "");
- g_key_file_set_string (keyfile,
- G_KEY_FILE_DESKTOP_GROUP,
- desktop_keys[i],
- new_name);
- }
- }
- }
- }
+ {
+ desktop_keys = g_key_file_get_keys (keyfile,
+ G_KEY_FILE_DESKTOP_GROUP,
+ NULL, NULL);
+ for (i = 0; desktop_keys[i]; i++)
+ {
+ if (strcmp (desktop_keys[i], "Name") == 0 ||
+ g_str_has_prefix (desktop_keys[i], "Name["))
+ {
+ g_autofree char *name = g_key_file_get_string (keyfile, G_KEY_FILE_DESKTOP_GROUP, desktop_keys[i], NULL);
+ if (name)
+ {
+ g_autofree char *new_name =
+ g_strdup_printf ("%s%s%s",
+ self->desktop_file_name_prefix ? self->desktop_file_name_prefix : "",
+ name,
+ self->desktop_file_name_suffix ? self->desktop_file_name_suffix : "");
+ g_key_file_set_string (keyfile,
+ G_KEY_FILE_DESKTOP_GROUP,
+ desktop_keys[i],
+ new_name);
+ }
+ }
+ }
+ }
g_free (desktop_contents);
desktop_contents = g_key_file_to_data (keyfile, &desktop_size, error);
@@ -1547,7 +1561,9 @@ builder_manifest_cleanup (BuilderManifest *self,
return FALSE;
}
else
- g_print ("Cache hit for cleanup, skipping\n");
+ {
+ g_print ("Cache hit for cleanup, skipping\n");
+ }
return TRUE;
}
@@ -1555,11 +1571,12 @@ builder_manifest_cleanup (BuilderManifest *self,
gboolean
builder_manifest_finish (BuilderManifest *self,
- BuilderCache *cache,
- BuilderContext *context,
- GError **error)
+ BuilderCache *cache,
+ BuilderContext *context,
+ GError **error)
{
GFile *app_dir = builder_context_get_app_dir (context);
+
g_autoptr(GFile) manifest_file = NULL;
g_autoptr(GFile) debuginfo_dir = NULL;
g_autoptr(GFile) locale_parent_dir = NULL;
@@ -1650,12 +1667,12 @@ builder_manifest_finish (BuilderManifest *self,
metadata_file = g_file_get_child (app_dir, "metadata");
- extension_contents = g_strdup_printf("\n"
- "[Extension %s.Locale]\n"
- "directory=%s\n"
- "subdirectories=true\n",
- self->id,
- LOCALES_SEPARATE_DIR);
+ extension_contents = g_strdup_printf ("\n"
+ "[Extension %s.Locale]\n"
+ "directory=%s\n"
+ "subdirectories=true\n",
+ self->id,
+ LOCALES_SEPARATE_DIR);
output = g_file_append_to (metadata_file, G_FILE_CREATE_NONE, NULL, error);
if (output == NULL)
@@ -1668,8 +1685,8 @@ builder_manifest_finish (BuilderManifest *self,
metadata_locale_file = g_file_get_child (app_dir, "metadata.locale");
- metadata_contents = g_strdup_printf("[Runtime]\n"
- "name=%s.Locale\n", self->id);
+ metadata_contents = g_strdup_printf ("[Runtime]\n"
+ "name=%s.Locale\n", self->id);
if (!g_file_replace_contents (metadata_locale_file,
metadata_contents, strlen (metadata_contents),
NULL, FALSE,
@@ -1690,10 +1707,10 @@ builder_manifest_finish (BuilderManifest *self,
metadata_file = g_file_get_child (app_dir, "metadata");
metadata_debuginfo_file = g_file_get_child (app_dir, "metadata.debuginfo");
- extension_contents = g_strdup_printf("\n"
- "[Extension %s.Debug]\n"
- "directory=lib/debug\n",
- self->id);
+ extension_contents = g_strdup_printf ("\n"
+ "[Extension %s.Debug]\n"
+ "directory=lib/debug\n",
+ self->id);
output = g_file_append_to (metadata_file, G_FILE_CREATE_NONE, NULL, error);
if (output == NULL)
@@ -1703,8 +1720,8 @@ builder_manifest_finish (BuilderManifest *self,
NULL, NULL, error))
return FALSE;
- metadata_contents = g_strdup_printf("[Runtime]\n"
- "name=%s.Debug\n", self->id);
+ metadata_contents = g_strdup_printf ("[Runtime]\n"
+ "name=%s.Debug\n", self->id);
if (!g_file_replace_contents (metadata_debuginfo_file,
metadata_contents, strlen (metadata_contents), NULL, FALSE,
G_FILE_CREATE_REPLACE_DESTINATION,
@@ -1716,7 +1733,9 @@ builder_manifest_finish (BuilderManifest *self,
return FALSE;
}
else
- g_print ("Cache hit for finish, skipping\n");
+ {
+ g_print ("Cache hit for finish, skipping\n");
+ }
return TRUE;
}
@@ -1724,10 +1743,11 @@ builder_manifest_finish (BuilderManifest *self,
gboolean
builder_manifest_create_platform (BuilderManifest *self,
BuilderCache *cache,
- BuilderContext *context,
- GError **error)
+ BuilderContext *context,
+ GError **error)
{
GFile *app_dir = builder_context_get_app_dir (context);
+
g_autoptr(GFile) locale_dir = NULL;
int i;
@@ -1905,12 +1925,12 @@ builder_manifest_create_platform (BuilderManifest *self,
metadata_file = g_file_get_child (app_dir, "metadata.platform");
- extension_contents = g_strdup_printf("\n"
- "[Extension %s.Locale]\n"
- "directory=%s\n"
- "subdirectories=true\n",
- self->id_platform,
- LOCALES_SEPARATE_DIR);
+ extension_contents = g_strdup_printf ("\n"
+ "[Extension %s.Locale]\n"
+ "directory=%s\n"
+ "subdirectories=true\n",
+ self->id_platform,
+ LOCALES_SEPARATE_DIR);
output = g_file_append_to (metadata_file, G_FILE_CREATE_NONE, NULL, error);
if (output == NULL)
@@ -1923,8 +1943,8 @@ builder_manifest_create_platform (BuilderManifest *self,
metadata_locale_file = g_file_get_child (app_dir, "metadata.platform.locale");
- metadata_contents = g_strdup_printf("[Runtime]\n"
- "name=%s.Locale\n", self->id_platform);
+ metadata_contents = g_strdup_printf ("[Runtime]\n"
+ "name=%s.Locale\n", self->id_platform);
if (!g_file_replace_contents (metadata_locale_file,
metadata_contents, strlen (metadata_contents),
NULL, FALSE,
@@ -1937,18 +1957,20 @@ builder_manifest_create_platform (BuilderManifest *self,
return FALSE;
}
else
- g_print ("Cache hit for create platform, skipping\n");
+ {
+ g_print ("Cache hit for create platform, skipping\n");
+ }
return TRUE;
}
gboolean
-builder_manifest_run (BuilderManifest *self,
- BuilderContext *context,
- char **argv,
- int argc,
- GError **error)
+builder_manifest_run (BuilderManifest *self,
+ BuilderContext *context,
+ char **argv,
+ int argc,
+ GError **error)
{
g_autoptr(GPtrArray) args = NULL;
g_autofree char *commandline = NULL;
@@ -2014,7 +2036,7 @@ builder_manifest_run (BuilderManifest *self,
commandline = g_strjoinv (" ", (char **) args->pdata);
- if (!execvp ((char *)args->pdata[0], (char **)args->pdata))
+ if (!execvp ((char *) args->pdata[0], (char **) args->pdata))
{
g_set_error (error, G_IO_ERROR, g_io_error_from_errno (errno), "Unable to start xdg-app build");
return FALSE;
diff --git a/builder/builder-manifest.h b/builder/builder-manifest.h
index 32d966a..4e9c068 100644
--- a/builder/builder-manifest.h
+++ b/builder/builder-manifest.h
@@ -31,7 +31,7 @@ G_BEGIN_DECLS
typedef struct BuilderManifest BuilderManifest;
-#define BUILDER_TYPE_MANIFEST (builder_manifest_get_type())
+#define BUILDER_TYPE_MANIFEST (builder_manifest_get_type ())
#define BUILDER_MANIFEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BUILDER_TYPE_MANIFEST, BuilderManifest))
#define BUILDER_IS_MANIFEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BUILDER_TYPE_MANIFEST))
@@ -43,48 +43,48 @@ typedef struct BuilderManifest BuilderManifest;
GType builder_manifest_get_type (void);
-const char * builder_manifest_get_id (BuilderManifest *self);
-const char * builder_manifest_get_id_platform (BuilderManifest *self);
-BuilderOptions *builder_manifest_get_build_options (BuilderManifest *self);
-GList * builder_manifest_get_modules (BuilderManifest *self);
-const char * builder_manifest_get_branch (BuilderManifest *self);
+const char * builder_manifest_get_id (BuilderManifest *self);
+const char * builder_manifest_get_id_platform (BuilderManifest *self);
+BuilderOptions *builder_manifest_get_build_options (BuilderManifest *self);
+GList * builder_manifest_get_modules (BuilderManifest *self);
+const char * builder_manifest_get_branch (BuilderManifest *self);
-gboolean builder_manifest_start (BuilderManifest *self,
- BuilderContext *context,
- GError **error);
-gboolean builder_manifest_init_app_dir (BuilderManifest *self,
- BuilderContext *context,
- GError **error);
-gboolean builder_manifest_download (BuilderManifest *self,
- gboolean update_vcs,
- BuilderContext *context,
- GError **error);
-gboolean builder_manifest_build (BuilderManifest *self,
- BuilderCache *cache,
- BuilderContext *context,
- GError **error);
-gboolean builder_manifest_run (BuilderManifest *self,
- BuilderContext *context,
- char **argv,
- int argc,
- GError **error);
-void builder_manifest_checksum (BuilderManifest *self,
- BuilderCache *cache,
- BuilderContext *context);
-gboolean builder_manifest_cleanup (BuilderManifest *self,
- BuilderCache *cache,
- BuilderContext *context,
- GError **error);
-gboolean builder_manifest_finish (BuilderManifest *self,
- BuilderCache *cache,
- BuilderContext *context,
- GError **error);
-gboolean builder_manifest_create_platform (BuilderManifest *self,
- BuilderCache *cache,
- BuilderContext *context,
- GError **error);
+gboolean builder_manifest_start (BuilderManifest *self,
+ BuilderContext *context,
+ GError **error);
+gboolean builder_manifest_init_app_dir (BuilderManifest *self,
+ BuilderContext *context,
+ GError **error);
+gboolean builder_manifest_download (BuilderManifest *self,
+ gboolean update_vcs,
+ BuilderContext *context,
+ GError **error);
+gboolean builder_manifest_build (BuilderManifest *self,
+ BuilderCache *cache,
+ BuilderContext *context,
+ GError **error);
+gboolean builder_manifest_run (BuilderManifest *self,
+ BuilderContext *context,
+ char **argv,
+ int argc,
+ GError **error);
+void builder_manifest_checksum (BuilderManifest *self,
+ BuilderCache *cache,
+ BuilderContext *context);
+gboolean builder_manifest_cleanup (BuilderManifest *self,
+ BuilderCache *cache,
+ BuilderContext *context,
+ GError **error);
+gboolean builder_manifest_finish (BuilderManifest *self,
+ BuilderCache *cache,
+ BuilderContext *context,
+ GError **error);
+gboolean builder_manifest_create_platform (BuilderManifest *self,
+ BuilderCache *cache,
+ BuilderContext *context,
+ GError **error);
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(BuilderManifest, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (BuilderManifest, g_object_unref)
G_END_DECLS
diff --git a/builder/builder-module.c b/builder/builder-module.c
index 40d22c5..c2fb37a 100644
--- a/builder/builder-module.c
+++ b/builder/builder-module.c
@@ -35,28 +35,30 @@
#include "builder-utils.h"
#include "builder-module.h"
-struct BuilderModule {
- GObject parent;
-
- char *name;
- char *subdir;
- char **post_install;
- char **config_opts;
- char **make_args;
- char **make_install_args;
- gboolean rm_configure;
- gboolean no_autogen;
- gboolean no_parallel_make;
- gboolean cmake;
- gboolean builddir;
+struct BuilderModule
+{
+ GObject parent;
+
+ char *name;
+ char *subdir;
+ char **post_install;
+ char **config_opts;
+ char **make_args;
+ char **make_install_args;
+ gboolean rm_configure;
+ gboolean no_autogen;
+ gboolean no_parallel_make;
+ gboolean cmake;
+ gboolean builddir;
BuilderOptions *build_options;
- GPtrArray *changes;
- char **cleanup;
- char **cleanup_platform;
- GList *sources;
+ GPtrArray *changes;
+ char **cleanup;
+ char **cleanup_platform;
+ GList *sources;
};
-typedef struct {
+typedef struct
+{
GObjectClass parent_class;
} BuilderModuleClass;
@@ -89,7 +91,7 @@ enum {
static void
builder_module_finalize (GObject *object)
{
- BuilderModule *self = (BuilderModule *)object;
+ BuilderModule *self = (BuilderModule *) object;
g_free (self->name);
g_free (self->subdir);
@@ -252,7 +254,7 @@ builder_module_set_property (GObject *object,
g_set_object (&self->build_options, g_value_get_object (value));
break;
- case PROP_SOURCES:
+ case PROP_SOURCES:
g_list_free_full (self->sources, g_object_unref);
/* NOTE: This takes ownership of the list! */
self->sources = g_value_get_pointer (value);
@@ -270,7 +272,7 @@ builder_module_set_property (GObject *object,
g_strfreev (tmp);
break;
- default:
+ default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
}
@@ -426,10 +428,12 @@ builder_module_serialize_property (JsonSerializable *serializable,
return retval;
}
else
- return json_serializable_default_serialize_property (serializable,
- property_name,
- value,
- pspec);
+ {
+ return json_serializable_default_serialize_property (serializable,
+ property_name,
+ value,
+ pspec);
+ }
}
static gboolean
@@ -481,10 +485,12 @@ builder_module_deserialize_property (JsonSerializable *serializable,
return FALSE;
}
else
- return json_serializable_default_deserialize_property (serializable,
- property_name,
- value,
- pspec, property_node);
+ {
+ return json_serializable_default_deserialize_property (serializable,
+ property_name,
+ value,
+ pspec, property_node);
+ }
}
static void
@@ -495,22 +501,22 @@ serializable_iface_init (JsonSerializableIface *serializable_iface)
}
const char *
-builder_module_get_name (BuilderModule *self)
+builder_module_get_name (BuilderModule *self)
{
return self->name;
}
GList *
-builder_module_get_sources (BuilderModule *self)
+builder_module_get_sources (BuilderModule *self)
{
return self->sources;
}
gboolean
-builder_module_download_sources (BuilderModule *self,
- gboolean update_vcs,
+builder_module_download_sources (BuilderModule *self,
+ gboolean update_vcs,
BuilderContext *context,
- GError **error)
+ GError **error)
{
GList *l;
@@ -526,10 +532,10 @@ builder_module_download_sources (BuilderModule *self,
}
gboolean
-builder_module_extract_sources (BuilderModule *self,
- GFile *dest,
+builder_module_extract_sources (BuilderModule *self,
+ GFile *dest,
BuilderContext *context,
- GError **error)
+ GError **error)
{
GList *l;
@@ -541,7 +547,7 @@ builder_module_extract_sources (BuilderModule *self,
{
BuilderSource *source = l->data;
- if (!builder_source_extract (source, dest, context, error))
+ if (!builder_source_extract (source, dest, context, error))
return FALSE;
}
@@ -552,15 +558,15 @@ static const char skip_arg[] = "skip";
static const char strv_arg[] = "strv";
static gboolean
-build (GFile *app_dir,
- const char *module_name,
+build (GFile *app_dir,
+ const char *module_name,
BuilderContext *context,
- GFile *source_dir,
- const char *cwd_subdir,
- char **xdg_app_opts,
- char **env_vars,
- GError **error,
- const gchar *argv1,
+ GFile *source_dir,
+ const char *cwd_subdir,
+ char **xdg_app_opts,
+ char **env_vars,
+ GError **error,
+ const gchar *argv1,
...)
{
g_autoptr(GSubprocessLauncher) launcher = NULL;
@@ -628,7 +634,9 @@ build (GFile *app_dir,
}
}
else if (arg != skip_arg)
- g_ptr_array_add (args, g_strdup (arg));
+ {
+ g_ptr_array_add (args, g_strdup (arg));
+ }
}
g_ptr_array_add (args, NULL);
va_end (ap);
@@ -651,14 +659,15 @@ build (GFile *app_dir,
}
static gboolean
-builder_module_handle_debuginfo (BuilderModule *self,
- GFile *app_dir,
- BuilderCache *cache,
+builder_module_handle_debuginfo (BuilderModule *self,
+ GFile *app_dir,
+ BuilderCache *cache,
BuilderContext *context,
- GError **error)
+ GError **error)
{
g_autofree char *app_dir_path = g_file_get_path (app_dir);
int i;
+
g_autoptr(GPtrArray) added = NULL;
g_autoptr(GPtrArray) modified = NULL;
g_autoptr(GPtrArray) added_or_modified = g_ptr_array_new ();
@@ -676,7 +685,7 @@ builder_module_handle_debuginfo (BuilderModule *self,
for (i = 0; i < added_or_modified->len; i++)
{
- const char *rel_path = (char *)g_ptr_array_index (added_or_modified, i);
+ const char *rel_path = (char *) g_ptr_array_index (added_or_modified, i);
g_autoptr(GFile) file = g_file_resolve_relative_path (app_dir, rel_path);
g_autofree char *path = g_file_get_path (file);
g_autofree char *debug_path = NULL;
@@ -711,8 +720,8 @@ builder_module_handle_debuginfo (BuilderModule *self,
if (g_str_has_prefix (rel_path_dir, "files/"))
{
- debug_dir = g_build_filename (app_dir_path, "files/lib/debug", rel_path_dir + strlen("files/"), NULL);
- real_debug_dir = g_build_filename ("/app/lib/debug", rel_path_dir + strlen("files/"), NULL);
+ debug_dir = g_build_filename (app_dir_path, "files/lib/debug", rel_path_dir + strlen ("files/"), NULL);
+ real_debug_dir = g_build_filename ("/app/lib/debug", rel_path_dir + strlen ("files/"), NULL);
source_dir_path = g_build_filename (app_dir_path, "files/lib/debug/source", NULL);
}
else if (g_str_has_prefix (rel_path_dir, "usr/"))
@@ -752,7 +761,9 @@ builder_module_handle_debuginfo (BuilderModule *self,
file_refs = builder_get_debuginfo_file_references (path, &local_error);
if (file_refs == NULL)
- g_warning ("%s", local_error->message);
+ {
+ g_warning ("%s", local_error->message);
+ }
else
{
GFile *build_dir = builder_context_get_build_dir (context);
@@ -802,14 +813,15 @@ builder_module_handle_debuginfo (BuilderModule *self,
}
gboolean
-builder_module_build (BuilderModule *self,
- BuilderCache *cache,
+builder_module_build (BuilderModule *self,
+ BuilderCache *cache,
BuilderContext *context,
- GError **error)
+ GError **error)
{
GFile *app_dir = builder_context_get_app_dir (context);
g_autofree char *make_j = NULL;
g_autofree char *make_l = NULL;
+
g_autoptr(GFile) configure_file = NULL;
g_autoptr(GFile) cmake_file = NULL;
const char *makefile_names[] = {"Makefile", "makefile", "GNUmakefile", NULL};
@@ -836,7 +848,7 @@ builder_module_build (BuilderModule *self,
if (!gs_file_ensure_directory (build_parent_dir, TRUE,
NULL, error))
- return FALSE;
+ return FALSE;
for (count = 1; source_dir_path == NULL; count++)
{
@@ -848,7 +860,9 @@ builder_module_build (BuilderModule *self,
source_dir_count = g_file_get_child (build_parent_dir, buildname);
if (g_file_make_directory (source_dir_count, NULL, &my_error))
- source_dir_path = g_file_get_path (source_dir_count);
+ {
+ source_dir_path = g_file_get_path (source_dir_count);
+ }
else
{
if (!g_error_matches (my_error, G_IO_ERROR, G_IO_ERROR_EXISTS))
@@ -891,7 +905,9 @@ builder_module_build (BuilderModule *self,
source_subdir_relative = self->subdir;
}
else
- source_subdir = g_object_ref (source_dir);
+ {
+ source_subdir = g_object_ref (source_dir);
+ }
env = builder_options_get_env (self->build_options, context);
build_args = builder_options_get_build_args (self->build_options, context);
@@ -1000,7 +1016,9 @@ builder_module_build (BuilderModule *self,
configure_final_arg = ".";
}
else
- configure_cmd = "./configure";
+ {
+ configure_cmd = "./configure";
+ }
}
if (self->cmake)
@@ -1036,13 +1054,13 @@ builder_module_build (BuilderModule *self,
if (!self->no_parallel_make)
{
make_j = g_strdup_printf ("-j%d", builder_context_get_n_cpu (context));
- make_l = g_strdup_printf ("-l%d", 2*builder_context_get_n_cpu (context));
+ make_l = g_strdup_printf ("-l%d", 2 * builder_context_get_n_cpu (context));
}
/* Build and install */
if (!build (app_dir, self->name, context, source_dir, build_dir_relative, build_args, env, error,
- "make", make_j?make_j:skip_arg, make_l?make_l:skip_arg, strv_arg, self->make_args, NULL))
+ "make", make_j ? make_j : skip_arg, make_l ? make_l : skip_arg, strv_arg, self->make_args, NULL))
return FALSE;
if (!build (app_dir, self->name, context, source_dir, build_dir_relative, build_args, env, error,
@@ -1092,9 +1110,9 @@ builder_module_build (BuilderModule *self,
}
gboolean
-builder_module_update (BuilderModule *self,
- BuilderContext *context,
- GError **error)
+builder_module_update (BuilderModule *self,
+ BuilderContext *context,
+ GError **error)
{
GList *l;
@@ -1102,7 +1120,7 @@ builder_module_update (BuilderModule *self,
{
BuilderSource *source = l->data;
- if (!builder_source_update (source, context, error))
+ if (!builder_source_update (source, context, error))
return FALSE;
}
@@ -1151,14 +1169,14 @@ builder_module_checksum_for_cleanup (BuilderModule *self,
}
GPtrArray *
-builder_module_get_changes (BuilderModule *self)
+builder_module_get_changes (BuilderModule *self)
{
return self->changes;
}
void
-builder_module_set_changes (BuilderModule *self,
- GPtrArray *changes)
+builder_module_set_changes (BuilderModule *self,
+ GPtrArray *changes)
{
if (self->changes != changes)
{
@@ -1170,9 +1188,9 @@ builder_module_set_changes (BuilderModule *self,
static void
collect_cleanup_for_path (const char **patterns,
- const char *path,
- const char *add_prefix,
- GHashTable *to_remove_ht)
+ const char *path,
+ const char *add_prefix,
+ GHashTable *to_remove_ht)
{
int i;
@@ -1185,7 +1203,7 @@ collect_cleanup_for_path (const char **patterns,
static gboolean
matches_cleanup_for_path (const char **patterns,
- const char *path)
+ const char *path)
{
int i;
@@ -1202,10 +1220,10 @@ matches_cleanup_for_path (const char **patterns,
}
void
-builder_module_cleanup_collect (BuilderModule *self,
- gboolean platform,
- BuilderContext *context,
- GHashTable *to_remove_ht)
+builder_module_cleanup_collect (BuilderModule *self,
+ gboolean platform,
+ BuilderContext *context,
+ GHashTable *to_remove_ht)
{
GPtrArray *changed_files;
int i;
@@ -1215,12 +1233,12 @@ builder_module_cleanup_collect (BuilderModule *self,
if (platform)
{
global_patterns = builder_context_get_global_cleanup_platform (context);
- local_patterns = (const char **)self->cleanup_platform;
+ local_patterns = (const char **) self->cleanup_platform;
}
else
{
global_patterns = builder_context_get_global_cleanup (context);
- local_patterns = (const char **)self->cleanup;
+ local_patterns = (const char **) self->cleanup;
}
changed_files = self->changes;
diff --git a/builder/builder-module.h b/builder/builder-module.h
index cb8e802..513eac2 100644
--- a/builder/builder-module.h
+++ b/builder/builder-module.h
@@ -30,7 +30,7 @@ G_BEGIN_DECLS
typedef struct BuilderModule BuilderModule;
-#define BUILDER_TYPE_MODULE (builder_module_get_type())
+#define BUILDER_TYPE_MODULE (builder_module_get_type ())
#define BUILDER_MODULE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BUILDER_TYPE_MODULE, BuilderModule))
#define BUILDER_IS_MODULE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BUILDER_TYPE_MODULE))
@@ -39,39 +39,39 @@ typedef struct BuilderModule BuilderModule;
GType builder_module_get_type (void);
-const char * builder_module_get_name (BuilderModule *self);
-GList * builder_module_get_sources (BuilderModule *self);
-GPtrArray * builder_module_get_changes (BuilderModule *self);
-void builder_module_set_changes (BuilderModule *self,
- GPtrArray *changes);
+const char * builder_module_get_name (BuilderModule *self);
+GList * builder_module_get_sources (BuilderModule *self);
+GPtrArray * builder_module_get_changes (BuilderModule *self);
+void builder_module_set_changes (BuilderModule *self,
+ GPtrArray *changes);
-gboolean builder_module_download_sources (BuilderModule *self,
- gboolean update_vcs,
- BuilderContext *context,
- GError **error);
-gboolean builder_module_extract_sources (BuilderModule *self,
- GFile *dest,
- BuilderContext *context,
- GError **error);
-gboolean builder_module_build (BuilderModule *self,
- BuilderCache *cache,
- BuilderContext *context,
- GError **error);
-gboolean builder_module_update (BuilderModule *self,
- BuilderContext *context,
- GError **error);
-void builder_module_checksum (BuilderModule *self,
- BuilderCache *cache,
- BuilderContext *context);
-void builder_module_checksum_for_cleanup (BuilderModule *self,
- BuilderCache *cache,
- BuilderContext *context);
-void builder_module_cleanup_collect (BuilderModule *self,
- gboolean platform,
- BuilderContext *context,
- GHashTable *to_remove_ht);
+gboolean builder_module_download_sources (BuilderModule *self,
+ gboolean update_vcs,
+ BuilderContext *context,
+ GError **error);
+gboolean builder_module_extract_sources (BuilderModule *self,
+ GFile *dest,
+ BuilderContext *context,
+ GError **error);
+gboolean builder_module_build (BuilderModule *self,
+ BuilderCache *cache,
+ BuilderContext *context,
+ GError **error);
+gboolean builder_module_update (BuilderModule *self,
+ BuilderContext *context,
+ GError **error);
+void builder_module_checksum (BuilderModule *self,
+ BuilderCache *cache,
+ BuilderContext *context);
+void builder_module_checksum_for_cleanup (BuilderModule *self,
+ BuilderCache *cache,
+ BuilderContext *context);
+void builder_module_cleanup_collect (BuilderModule *self,
+ gboolean platform,
+ BuilderContext *context,
+ GHashTable *to_remove_ht);
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(BuilderModule, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (BuilderModule, g_object_unref)
G_END_DECLS
diff --git a/builder/builder-options.c b/builder/builder-options.c
index d4c61b3..b867b46 100644
--- a/builder/builder-options.c
+++ b/builder/builder-options.c
@@ -32,21 +32,23 @@
#include "builder-context.h"
#include "builder-utils.h"
-struct BuilderOptions {
- GObject parent;
-
- gboolean strip;
- gboolean no_debuginfo;
- char *cflags;
- char *cxxflags;
- char *prefix;
- char **env;
- char **build_args;
- char **config_opts;
+struct BuilderOptions
+{
+ GObject parent;
+
+ gboolean strip;
+ gboolean no_debuginfo;
+ char *cflags;
+ char *cxxflags;
+ char *prefix;
+ char **env;
+ char **build_args;
+ char **config_opts;
GHashTable *arch;
};
-typedef struct {
+typedef struct
+{
GObjectClass parent_class;
} BuilderOptionsClass;
@@ -73,7 +75,7 @@ enum {
static void
builder_options_finalize (GObject *object)
{
- BuilderOptions *self = (BuilderOptions *)object;
+ BuilderOptions *self = (BuilderOptions *) object;
g_free (self->cflags);
g_free (self->cxxflags);
@@ -87,9 +89,9 @@ builder_options_finalize (GObject *object)
static void
builder_options_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
{
BuilderOptions *self = BUILDER_OPTIONS (object);
@@ -138,9 +140,9 @@ builder_options_get_property (GObject *object,
static void
builder_options_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
BuilderOptions *self = BUILDER_OPTIONS (object);
gchar **tmp;
@@ -302,7 +304,7 @@ builder_options_serialize_property (JsonSerializable *serializable,
while (g_hash_table_iter_next (&iter, &key, &value))
{
JsonNode *child = json_gobject_serialize (value);
- json_object_set_member (object, (char *)key, child);
+ json_object_set_member (object, (char *) key, child);
}
retval = json_node_init_object (json_node_alloc (), object);
@@ -351,18 +353,20 @@ builder_options_serialize_property (JsonSerializable *serializable,
return retval;
}
else
- return json_serializable_default_serialize_property (serializable,
- property_name,
- value,
- pspec);
+ {
+ return json_serializable_default_serialize_property (serializable,
+ property_name,
+ value,
+ pspec);
+ }
}
static gboolean
builder_options_deserialize_property (JsonSerializable *serializable,
- const gchar *property_name,
- GValue *value,
- GParamSpec *pspec,
- JsonNode *property_node)
+ const gchar *property_name,
+ GValue *value,
+ GParamSpec *pspec,
+ JsonNode *property_node)
{
if (strcmp (property_name, "arch") == 0)
{
@@ -436,10 +440,12 @@ builder_options_deserialize_property (JsonSerializable *serializable,
return FALSE;
}
else
- return json_serializable_default_deserialize_property (serializable,
- property_name,
- value,
- pspec, property_node);
+ {
+ return json_serializable_default_deserialize_property (serializable,
+ property_name,
+ value,
+ pspec, property_node);
+ }
}
static void
@@ -450,7 +456,7 @@ serializable_iface_init (JsonSerializableIface *serializable_iface)
}
static GList *
-get_arched_options (BuilderOptions *self, BuilderContext *context)
+get_arched_options (BuilderOptions *self, BuilderContext *context)
{
GList *options = NULL;
const char *arch = builder_context_get_arch (context);
@@ -466,7 +472,7 @@ get_arched_options (BuilderOptions *self, BuilderContext *context)
}
static GList *
-get_all_options (BuilderOptions *self, BuilderContext *context)
+get_all_options (BuilderOptions *self, BuilderContext *context)
{
GList *options = NULL;
BuilderOptions *global_options = builder_context_get_options (context);
@@ -591,7 +597,9 @@ builder_options_get_env (BuilderOptions *self, BuilderContext *context)
value = eq + 1;
}
else
- key = g_strdup (key);
+ {
+ key = g_strdup (key);
+ }
envp = g_environ_setenv (envp, key, value, FALSE);
}
@@ -636,13 +644,13 @@ builder_options_get_build_args (BuilderOptions *self,
g_ptr_array_add (array, NULL);
- return (char **)g_ptr_array_free (g_steal_pointer (&array), FALSE);
+ return (char **) g_ptr_array_free (g_steal_pointer (&array), FALSE);
}
char **
builder_options_get_config_opts (BuilderOptions *self,
- BuilderContext *context,
- char **base_opts)
+ BuilderContext *context,
+ char **base_opts)
{
g_autoptr(GList) options = get_all_options (self, context);
GList *l;
@@ -672,7 +680,7 @@ builder_options_get_config_opts (BuilderOptions *self,
g_ptr_array_add (array, NULL);
- return (char **)g_ptr_array_free (g_steal_pointer (&array), FALSE);
+ return (char **) g_ptr_array_free (g_steal_pointer (&array), FALSE);
}
void
diff --git a/builder/builder-options.h b/builder/builder-options.h
index 3e0e831..66523ed 100644
--- a/builder/builder-options.h
+++ b/builder/builder-options.h
@@ -29,7 +29,7 @@ G_BEGIN_DECLS
typedef struct BuilderContext BuilderContext;
typedef struct BuilderOptions BuilderOptions;
-#define BUILDER_TYPE_OPTIONS (builder_options_get_type())
+#define BUILDER_TYPE_OPTIONS (builder_options_get_type ())
#define BUILDER_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BUILDER_TYPE_OPTIONS, BuilderOptions))
#define BUILDER_IS_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BUILDER_TYPE_OPTIONS))
@@ -38,28 +38,28 @@ typedef struct BuilderOptions BuilderOptions;
GType builder_options_get_type (void);
-const char *builder_options_get_cflags (BuilderOptions *self,
- BuilderContext *context);
-const char *builder_options_get_cxxflags (BuilderOptions *self,
- BuilderContext *context);
-const char *builder_options_get_prefix (BuilderOptions *self,
- BuilderContext *context);
-char ** builder_options_get_env (BuilderOptions *self,
- BuilderContext *context);
-char ** builder_options_get_build_args (BuilderOptions *self,
- BuilderContext *context);
-char ** builder_options_get_config_opts (BuilderOptions *self,
- BuilderContext *context,
- char **base_opts);
-void builder_options_checksum (BuilderOptions *self,
- BuilderCache *cache,
- BuilderContext *context);
+const char *builder_options_get_cflags (BuilderOptions *self,
+ BuilderContext *context);
+const char *builder_options_get_cxxflags (BuilderOptions *self,
+ BuilderContext *context);
+const char *builder_options_get_prefix (BuilderOptions *self,
+ BuilderContext *context);
+char ** builder_options_get_env (BuilderOptions *self,
+ BuilderContext *context);
+char ** builder_options_get_build_args (BuilderOptions *self,
+ BuilderContext *context);
+char ** builder_options_get_config_opts (BuilderOptions *self,
+ BuilderContext *context,
+ char **base_opts);
+void builder_options_checksum (BuilderOptions *self,
+ BuilderCache *cache,
+ BuilderContext *context);
gboolean builder_options_get_no_debuginfo (BuilderOptions *self,
BuilderContext *context);
-gboolean builder_options_get_strip (BuilderOptions *self,
- BuilderContext *context);
+gboolean builder_options_get_strip (BuilderOptions *self,
+ BuilderContext *context);
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(BuilderOptions, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (BuilderOptions, g_object_unref)
G_END_DECLS
diff --git a/builder/builder-source-archive.c b/builder/builder-source-archive.c
index 14817ee..747e974 100644
--- a/builder/builder-source-archive.c
+++ b/builder/builder-source-archive.c
@@ -32,16 +32,18 @@
#include "builder-utils.h"
#include "builder-source-archive.h"
-struct BuilderSourceArchive {
+struct BuilderSourceArchive
+{
BuilderSource parent;
- char *path;
- char *url;
- char *sha256;
- guint strip_components;
+ char *path;
+ char *url;
+ char *sha256;
+ guint strip_components;
};
-typedef struct {
+typedef struct
+{
BuilderSourceClass parent_class;
} BuilderSourceArchiveClass;
@@ -83,18 +85,25 @@ tar_decompress_flag (BuilderArchiveType type)
default:
case TAR:
return NULL;
+
case TAR_GZIP:
return "-z";
+
case TAR_COMPRESS:
return "-Z";
+
case TAR_BZIP2:
return "-j";
+
case TAR_LZIP:
return "--lzip";
+
case TAR_LZMA:
return "--lzma";
+
case TAR_LZOP:
return "--lzop";
+
case TAR_XZ:
return "-J";
}
@@ -103,7 +112,7 @@ tar_decompress_flag (BuilderArchiveType type)
static void
builder_source_archive_finalize (GObject *object)
{
- BuilderSourceArchive *self = (BuilderSourceArchive *)object;
+ BuilderSourceArchive *self = (BuilderSourceArchive *) object;
g_free (self->url);
g_free (self->path);
@@ -179,7 +188,7 @@ builder_source_archive_set_property (GObject *object,
static SoupURI *
get_uri (BuilderSourceArchive *self,
- GError **error)
+ GError **error)
{
SoupURI *uri;
@@ -200,8 +209,8 @@ get_uri (BuilderSourceArchive *self,
static GFile *
get_download_location (BuilderSourceArchive *self,
- BuilderContext *context,
- GError **error)
+ BuilderContext *context,
+ GError **error)
{
g_autoptr(SoupURI) uri = NULL;
const char *path;
@@ -233,9 +242,9 @@ get_download_location (BuilderSourceArchive *self,
static GFile *
get_source_file (BuilderSourceArchive *self,
- BuilderContext *context,
- gboolean *is_local,
- GError **error)
+ BuilderContext *context,
+ gboolean *is_local,
+ GError **error)
{
GFile *base_dir = builder_context_get_base_dir (context);
@@ -256,11 +265,12 @@ get_source_file (BuilderSourceArchive *self,
}
static GBytes *
-download_uri (const char *url,
+download_uri (const char *url,
BuilderContext *context,
- GError **error)
+ GError **error)
{
SoupSession *session;
+
g_autoptr(SoupRequest) req = NULL;
g_autoptr(GInputStream) input = NULL;
g_autoptr(GOutputStream) out = NULL;
@@ -276,25 +286,26 @@ download_uri (const char *url,
return NULL;
out = g_memory_output_stream_new_resizable ();
- if (!g_output_stream_splice (out,
- input,
- G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET | G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE,
- NULL,
- error))
+ if (!g_output_stream_splice (out,
+ input,
+ G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET | G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE,
+ NULL,
+ error))
return NULL;
return g_memory_output_stream_steal_as_bytes (G_MEMORY_OUTPUT_STREAM (out));
}
static gboolean
-builder_source_archive_download (BuilderSource *source,
- gboolean update_vcs,
+builder_source_archive_download (BuilderSource *source,
+ gboolean update_vcs,
BuilderContext *context,
- GError **error)
+ GError **error)
{
BuilderSourceArchive *self = BUILDER_SOURCE_ARCHIVE (source);
- g_autoptr (GFile) file = NULL;
- g_autoptr (GFile) dir = NULL;
+
+ g_autoptr(GFile) file = NULL;
+ g_autoptr(GFile) dir = NULL;
g_autofree char *dir_path = NULL;
g_autofree char *sha256 = NULL;
g_autofree char *base_name = NULL;
@@ -369,7 +380,7 @@ builder_source_archive_download (BuilderSource *source,
}
static gboolean
-tar (GFile *dir,
+tar (GFile *dir,
GError **error,
...)
{
@@ -384,7 +395,7 @@ tar (GFile *dir,
}
static gboolean
-unzip (GFile *dir,
+unzip (GFile *dir,
GError **error,
...)
{
@@ -445,9 +456,9 @@ get_type (GFile *archivefile)
}
static gboolean
-strip_components_into (GFile *dest,
- GFile *src,
- int level,
+strip_components_into (GFile *dest,
+ GFile *src,
+ int level,
GError **error)
{
g_autoptr(GFileEnumerator) dir_enum = NULL;
@@ -499,12 +510,13 @@ strip_components_into (GFile *dest,
static gboolean
-builder_source_archive_extract (BuilderSource *source,
- GFile *dest,
+builder_source_archive_extract (BuilderSource *source,
+ GFile *dest,
BuilderContext *context,
- GError **error)
+ GError **error)
{
BuilderSourceArchive *self = BUILDER_SOURCE_ARCHIVE (source);
+
g_autoptr(GFile) archivefile = NULL;
g_autofree char *archive_path = NULL;
BuilderArchiveType type;
@@ -543,7 +555,9 @@ builder_source_archive_extract (BuilderSource *source,
zip_dest = g_file_new_for_path (tmp_dir_path);
}
else
- zip_dest = g_object_ref (dest);
+ {
+ zip_dest = g_object_ref (dest);
+ }
if (!unzip (zip_dest, error, archive_path, NULL))
return FALSE;
diff --git a/builder/builder-source-archive.h b/builder/builder-source-archive.h
index d6d7385..33527bd 100644
--- a/builder/builder-source-archive.h
+++ b/builder/builder-source-archive.h
@@ -27,13 +27,13 @@ G_BEGIN_DECLS
typedef struct BuilderSourceArchive BuilderSourceArchive;
-#define BUILDER_TYPE_SOURCE_ARCHIVE (builder_source_archive_get_type())
+#define BUILDER_TYPE_SOURCE_ARCHIVE (builder_source_archive_get_type ())
#define BUILDER_SOURCE_ARCHIVE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BUILDER_TYPE_SOURCE_ARCHIVE, BuilderSourceArchive))
#define BUILDER_IS_SOURCE_ARCHIVE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BUILDER_TYPE_SOURCE_ARCHIVE))
GType builder_source_archive_get_type (void);
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(BuilderSourceArchive, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (BuilderSourceArchive, g_object_unref)
G_END_DECLS
diff --git a/builder/builder-source-bzr.c b/builder/builder-source-bzr.c
index f3c28d2..8fa0869 100644
--- a/builder/builder-source-bzr.c
+++ b/builder/builder-source-bzr.c
@@ -33,14 +33,16 @@
#include "builder-utils.h"
#include "xdg-app-utils.h"
-struct BuilderSourceBzr {
+struct BuilderSourceBzr
+{
BuilderSource parent;
- char *url;
- char *revision;
+ char *url;
+ char *revision;
};
-typedef struct {
+typedef struct
+{
BuilderSourceClass parent_class;
} BuilderSourceBzrClass;
@@ -56,7 +58,7 @@ enum {
static void
builder_source_bzr_finalize (GObject *object)
{
- BuilderSourceBzr *self = (BuilderSourceBzr *)object;
+ BuilderSourceBzr *self = (BuilderSourceBzr *) object;
g_free (self->url);
g_free (self->revision);
@@ -66,9 +68,9 @@ builder_source_bzr_finalize (GObject *object)
static void
builder_source_bzr_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
{
BuilderSourceBzr *self = BUILDER_SOURCE_BZR (object);
@@ -113,9 +115,9 @@ builder_source_bzr_set_property (GObject *object,
}
static gboolean
-bzr (GFile *dir,
- char **output,
- GError **error,
+bzr (GFile *dir,
+ char **output,
+ GError **error,
...)
{
gboolean res;
@@ -154,19 +156,20 @@ get_current_commit (BuilderSourceBzr *self, BuilderContext *context, GError **er
mirror_dir = get_mirror_dir (self, context);
if (!bzr (mirror_dir, &output, error,
- "revno", NULL))
+ "revno", NULL))
return NULL;
return output;
}
static gboolean
-builder_source_bzr_download (BuilderSource *source,
- gboolean update_vcs,
+builder_source_bzr_download (BuilderSource *source,
+ gboolean update_vcs,
BuilderContext *context,
- GError **error)
+ GError **error)
{
BuilderSourceBzr *self = BUILDER_SOURCE_BZR (source);
+
g_autoptr(GFile) mirror_dir = NULL;
if (self->url == NULL)
@@ -204,12 +207,13 @@ builder_source_bzr_download (BuilderSource *source,
}
static gboolean
-builder_source_bzr_extract (BuilderSource *source,
- GFile *dest,
+builder_source_bzr_extract (BuilderSource *source,
+ GFile *dest,
BuilderContext *context,
- GError **error)
+ GError **error)
{
BuilderSourceBzr *self = BUILDER_SOURCE_BZR (source);
+
g_autoptr(GFile) mirror_dir = NULL;
g_autofree char *mirror_dir_path = NULL;
g_autofree char *dest_path = NULL;
@@ -241,6 +245,7 @@ builder_source_bzr_checksum (BuilderSource *source,
{
BuilderSourceBzr *self = BUILDER_SOURCE_BZR (source);
g_autofree char *current_commit;
+
g_autoptr(GError) error = NULL;
builder_cache_checksum_str (cache, self->url);
@@ -256,7 +261,7 @@ builder_source_bzr_checksum (BuilderSource *source,
static gboolean
builder_source_bzr_update (BuilderSource *source,
BuilderContext *context,
- GError **error)
+ GError **error)
{
BuilderSourceBzr *self = BUILDER_SOURCE_BZR (source);
char *current_commit;
diff --git a/builder/builder-source-bzr.h b/builder/builder-source-bzr.h
index a99319b..25454bb 100644
--- a/builder/builder-source-bzr.h
+++ b/builder/builder-source-bzr.h
@@ -27,13 +27,13 @@ G_BEGIN_DECLS
typedef struct BuilderSourceBzr BuilderSourceBzr;
-#define BUILDER_TYPE_SOURCE_BZR (builder_source_bzr_get_type())
+#define BUILDER_TYPE_SOURCE_BZR (builder_source_bzr_get_type ())
#define BUILDER_SOURCE_BZR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BUILDER_TYPE_SOURCE_BZR, BuilderSourceBzr))
#define BUILDER_IS_SOURCE_BZR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BUILDER_TYPE_SOURCE_BZR))
GType builder_source_bzr_get_type (void);
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(BuilderSourceBzr, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (BuilderSourceBzr, g_object_unref)
G_END_DECLS
diff --git a/builder/builder-source-file.c b/builder/builder-source-file.c
index 960810f..924d4b6 100644
--- a/builder/builder-source-file.c
+++ b/builder/builder-source-file.c
@@ -32,16 +32,18 @@
#include "builder-utils.h"
#include "builder-source-file.h"
-struct BuilderSourceFile {
+struct BuilderSourceFile
+{
BuilderSource parent;
- char *path;
- char *url;
- char *sha256;
- char *dest_filename;
+ char *path;
+ char *url;
+ char *sha256;
+ char *dest_filename;
};
-typedef struct {
+typedef struct
+{
BuilderSourceClass parent_class;
} BuilderSourceFileClass;
@@ -59,7 +61,7 @@ enum {
static void
builder_source_file_finalize (GObject *object)
{
- BuilderSourceFile *self = (BuilderSourceFile *)object;
+ BuilderSourceFile *self = (BuilderSourceFile *) object;
g_free (self->path);
g_free (self->url);
@@ -71,9 +73,9 @@ builder_source_file_finalize (GObject *object)
static void
builder_source_file_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
{
BuilderSourceFile *self = BUILDER_SOURCE_FILE (object);
@@ -102,9 +104,9 @@ builder_source_file_get_property (GObject *object,
static void
builder_source_file_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
BuilderSourceFile *self = BUILDER_SOURCE_FILE (object);
@@ -137,7 +139,7 @@ builder_source_file_set_property (GObject *object,
static SoupURI *
get_uri (BuilderSourceFile *self,
- GError **error)
+ GError **error)
{
SoupURI *uri;
@@ -158,9 +160,9 @@ get_uri (BuilderSourceFile *self,
static GFile *
get_download_location (BuilderSourceFile *self,
- gboolean *is_inline,
- BuilderContext *context,
- GError **error)
+ gboolean *is_inline,
+ BuilderContext *context,
+ GError **error)
{
g_autoptr(SoupURI) uri = NULL;
const char *path;
@@ -199,10 +201,10 @@ get_download_location (BuilderSourceFile *self,
static GFile *
get_source_file (BuilderSourceFile *self,
- BuilderContext *context,
- gboolean *is_local,
- gboolean *is_inline,
- GError **error)
+ BuilderContext *context,
+ gboolean *is_local,
+ gboolean *is_inline,
+ GError **error)
{
GFile *base_dir = builder_context_get_base_dir (context);
@@ -224,11 +226,12 @@ get_source_file (BuilderSourceFile *self,
}
static GBytes *
-download_uri (const char *url,
+download_uri (const char *url,
BuilderContext *context,
- GError **error)
+ GError **error)
{
SoupSession *session;
+
g_autoptr(SoupRequest) req = NULL;
g_autoptr(GInputStream) input = NULL;
g_autoptr(GOutputStream) out = NULL;
@@ -244,26 +247,27 @@ download_uri (const char *url,
return NULL;
out = g_memory_output_stream_new_resizable ();
- if (!g_output_stream_splice (out,
- input,
- G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET | G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE,
- NULL,
- error))
+ if (!g_output_stream_splice (out,
+ input,
+ G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET | G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE,
+ NULL,
+ error))
return NULL;
return g_memory_output_stream_steal_as_bytes (G_MEMORY_OUTPUT_STREAM (out));
}
static gboolean
-builder_source_file_download (BuilderSource *source,
- gboolean update_vcs,
+builder_source_file_download (BuilderSource *source,
+ gboolean update_vcs,
BuilderContext *context,
- GError **error)
+ GError **error)
{
BuilderSourceFile *self = BUILDER_SOURCE_FILE (source);
+
g_autoptr(GFile) file = NULL;
gboolean is_local, is_inline;
- g_autoptr (GFile) dir = NULL;
+ g_autoptr(GFile) dir = NULL;
g_autofree char *dir_path = NULL;
g_autofree char *sha256 = NULL;
g_autofree char *base_name = NULL;
@@ -336,12 +340,13 @@ builder_source_file_download (BuilderSource *source,
}
static gboolean
-builder_source_file_extract (BuilderSource *source,
- GFile *dest,
+builder_source_file_extract (BuilderSource *source,
+ GFile *dest,
BuilderContext *context,
- GError **error)
+ GError **error)
{
BuilderSourceFile *self = BUILDER_SOURCE_FILE (source);
+
g_autoptr(GFile) src = NULL;
g_autoptr(GFile) dest_file = NULL;
g_autofree char *dest_filename = NULL;
@@ -352,7 +357,9 @@ builder_source_file_extract (BuilderSource *source,
return FALSE;
if (self->dest_filename)
- dest_filename = g_strdup (self->dest_filename);
+ {
+ dest_filename = g_strdup (self->dest_filename);
+ }
else
{
if (is_inline)
@@ -400,7 +407,7 @@ builder_source_file_extract (BuilderSource *source,
if (!g_file_load_contents (src, NULL, &data, &len, NULL, error))
return FALSE;
- base64 = g_base64_encode ((const guchar *)data, len);
+ base64 = g_base64_encode ((const guchar *) data, len);
g_free (self->url);
self->url = g_strdup_printf ("data:text/plain;charset=utf8;base64,%s", base64);
if (self->dest_filename == NULL || *self->dest_filename == 0)
@@ -422,11 +429,12 @@ builder_source_file_extract (BuilderSource *source,
}
static gboolean
-builder_source_file_update (BuilderSource *source,
+builder_source_file_update (BuilderSource *source,
BuilderContext *context,
- GError **error)
+ GError **error)
{
BuilderSourceFile *self = BUILDER_SOURCE_FILE (source);
+
g_autoptr(GFile) src = NULL;
gboolean is_local, is_inline;
@@ -443,7 +451,7 @@ builder_source_file_update (BuilderSource *source,
if (!g_file_load_contents (src, NULL, &data, &len, NULL, error))
return FALSE;
- base64 = g_base64_encode ((const guchar *)data, len);
+ base64 = g_base64_encode ((const guchar *) data, len);
g_free (self->url);
self->url = g_strdup_printf ("data:text/plain;charset=utf8;base64,%s", base64);
if (self->dest_filename == NULL || *self->dest_filename == 0)
@@ -462,6 +470,7 @@ builder_source_file_checksum (BuilderSource *source,
BuilderContext *context)
{
BuilderSourceFile *self = BUILDER_SOURCE_FILE (source);
+
g_autoptr(GFile) src = NULL;
g_autofree char *data = NULL;
gsize len;
@@ -473,7 +482,7 @@ builder_source_file_checksum (BuilderSource *source,
if (is_local &&
g_file_load_contents (src, NULL, &data, &len, NULL, NULL))
- builder_cache_checksum_data (cache, (guchar *)data, len);
+ builder_cache_checksum_data (cache, (guchar *) data, len);
builder_cache_checksum_str (cache, self->path);
builder_cache_checksum_str (cache, self->url);
diff --git a/builder/builder-source-file.h b/builder/builder-source-file.h
index 0804066..05e23cf 100644
--- a/builder/builder-source-file.h
+++ b/builder/builder-source-file.h
@@ -27,13 +27,13 @@ G_BEGIN_DECLS
typedef struct BuilderSourceFile BuilderSourceFile;
-#define BUILDER_TYPE_SOURCE_FILE (builder_source_file_get_type())
+#define BUILDER_TYPE_SOURCE_FILE (builder_source_file_get_type ())
#define BUILDER_SOURCE_FILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BUILDER_TYPE_SOURCE_FILE, BuilderSourceFile))
#define BUILDER_IS_SOURCE_FILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BUILDER_TYPE_SOURCE_FILE))
GType builder_source_file_get_type (void);
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(BuilderSourceFile, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (BuilderSourceFile, g_object_unref)
G_END_DECLS
diff --git a/builder/builder-source-git.c b/builder/builder-source-git.c
index ebde0ec..f7c7f65 100644
--- a/builder/builder-source-git.c
+++ b/builder/builder-source-git.c
@@ -34,14 +34,16 @@
#include "builder-utils.h"
#include "xdg-app-utils.h"
-struct BuilderSourceGit {
+struct BuilderSourceGit
+{
BuilderSource parent;
- char *url;
- char *branch;
+ char *url;
+ char *branch;
};
-typedef struct {
+typedef struct
+{
BuilderSourceClass parent_class;
} BuilderSourceGitClass;
@@ -54,17 +56,17 @@ enum {
LAST_PROP
};
-static gboolean git_mirror_repo (const char *repo_url,
- gboolean update,
- const char *ref,
+static gboolean git_mirror_repo (const char *repo_url,
+ gboolean update,
+ const char *ref,
BuilderContext *context,
- GError **error);
+ GError **error);
static void
builder_source_git_finalize (GObject *object)
{
- BuilderSourceGit *self = (BuilderSourceGit *)object;
+ BuilderSourceGit *self = (BuilderSourceGit *) object;
g_free (self->url);
g_free (self->branch);
@@ -74,9 +76,9 @@ builder_source_git_finalize (GObject *object)
static void
builder_source_git_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
{
BuilderSourceGit *self = BUILDER_SOURCE_GIT (object);
@@ -121,9 +123,9 @@ builder_source_git_set_property (GObject *object,
}
static gboolean
-git (GFile *dir,
- char **output,
- GError **error,
+git (GFile *dir,
+ char **output,
+ GError **error,
...)
{
gboolean res;
@@ -137,7 +139,7 @@ git (GFile *dir,
}
static GFile *
-git_get_mirror_dir (const char *url,
+git_get_mirror_dir (const char *url,
BuilderContext *context)
{
g_autoptr(GFile) git_dir = NULL;
@@ -165,8 +167,8 @@ get_branch (BuilderSourceGit *self)
static char *
get_url (BuilderSourceGit *self,
- BuilderContext *context,
- GError **error)
+ BuilderContext *context,
+ GError **error)
{
g_autofree char *scheme = NULL;
@@ -190,10 +192,10 @@ get_url (BuilderSourceGit *self,
static char *
-git_get_current_commit (GFile *repo_dir,
- const char *branch,
+git_get_current_commit (GFile *repo_dir,
+ const char *branch,
BuilderContext *context,
- GError **error)
+ GError **error)
{
char *output = NULL;
@@ -218,8 +220,8 @@ make_absolute_url (const char *orig_parent, const char *orig_relpath, GError **e
if (!g_str_has_prefix (relpath, "../"))
return g_strdup (orig_relpath);
- if (parent[strlen(parent) - 1] == '/')
- parent[strlen(parent) - 1] = 0;
+ if (parent[strlen (parent) - 1] == '/')
+ parent[strlen (parent) - 1] = 0;
method = strstr (parent, "://");
if (method == NULL)
@@ -251,14 +253,15 @@ make_absolute_url (const char *orig_parent, const char *orig_relpath, GError **e
}
static gboolean
-git_mirror_submodules (const char *repo_url,
- gboolean update,
- GFile *mirror_dir,
- const char *revision,
+git_mirror_submodules (const char *repo_url,
+ gboolean update,
+ GFile *mirror_dir,
+ const char *revision,
BuilderContext *context,
- GError **error)
+ GError **error)
{
g_autofree char *mirror_dir_path = NULL;
+
g_autoptr(GFile) checkout_dir_template = NULL;
g_autoptr(GFile) checkout_dir = NULL;
g_autofree char *checkout_dir_path = NULL;
@@ -327,11 +330,11 @@ git_mirror_submodules (const char *repo_url,
}
static gboolean
-git_mirror_repo (const char *repo_url,
- gboolean update,
- const char *ref,
+git_mirror_repo (const char *repo_url,
+ gboolean update,
+ const char *ref,
BuilderContext *context,
- GError **error)
+ GError **error)
{
g_autoptr(GFile) mirror_dir = NULL;
g_autofree char *current_commit = NULL;
@@ -371,10 +374,10 @@ git_mirror_repo (const char *repo_url,
}
static gboolean
-builder_source_git_download (BuilderSource *source,
- gboolean update_vcs,
+builder_source_git_download (BuilderSource *source,
+ gboolean update_vcs,
BuilderContext *context,
- GError **error)
+ GError **error)
{
BuilderSourceGit *self = BUILDER_SOURCE_GIT (source);
g_autofree char *url = NULL;
@@ -394,10 +397,10 @@ builder_source_git_download (BuilderSource *source,
}
static gboolean
-git_extract_submodule (const char *repo_url,
- GFile *checkout_dir,
+git_extract_submodule (const char *repo_url,
+ GFile *checkout_dir,
BuilderContext *context,
- GError **error)
+ GError **error)
{
g_autofree char *submodule_status = NULL;
@@ -427,7 +430,7 @@ git_extract_submodule (const char *repo_url,
Only check if the command succeeds. If it fails, the update method is not set. */
option = g_strdup_printf ("submodule.%s.update", words[1]);
if (git (checkout_dir, &update_method, NULL,
- "config", "-f", ".gitmodules", option, NULL))
+ "config", "-f", ".gitmodules", option, NULL))
{
/* Trim trailing whitespace */
g_strchomp (update_method);
@@ -473,12 +476,13 @@ git_extract_submodule (const char *repo_url,
}
static gboolean
-builder_source_git_extract (BuilderSource *source,
- GFile *dest,
+builder_source_git_extract (BuilderSource *source,
+ GFile *dest,
BuilderContext *context,
- GError **error)
+ GError **error)
{
BuilderSourceGit *self = BUILDER_SOURCE_GIT (source);
+
g_autoptr(GFile) mirror_dir = NULL;
g_autofree char *mirror_dir_path = NULL;
g_autofree char *dest_path = NULL;
@@ -517,6 +521,7 @@ builder_source_git_checksum (BuilderSource *source,
BuilderContext *context)
{
BuilderSourceGit *self = BUILDER_SOURCE_GIT (source);
+
g_autoptr(GFile) mirror_dir = NULL;
g_autofree char *current_commit = NULL;
g_autoptr(GError) error = NULL;
@@ -537,15 +542,18 @@ builder_source_git_checksum (BuilderSource *source,
g_warning ("Failed to get current git checksum: %s", error->message);
}
else
- g_warning ("No url");
+ {
+ g_warning ("No url");
+ }
}
static gboolean
builder_source_git_update (BuilderSource *source,
BuilderContext *context,
- GError **error)
+ GError **error)
{
BuilderSourceGit *self = BUILDER_SOURCE_GIT (source);
+
g_autoptr(GFile) mirror_dir = NULL;
char *current_commit;
g_autofree char *url = NULL;
diff --git a/builder/builder-source-git.h b/builder/builder-source-git.h
index 6de8017..352e3a6 100644
--- a/builder/builder-source-git.h
+++ b/builder/builder-source-git.h
@@ -27,13 +27,13 @@ G_BEGIN_DECLS
typedef struct BuilderSourceGit BuilderSourceGit;
-#define BUILDER_TYPE_SOURCE_GIT (builder_source_git_get_type())
+#define BUILDER_TYPE_SOURCE_GIT (builder_source_git_get_type ())
#define BUILDER_SOURCE_GIT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BUILDER_TYPE_SOURCE_GIT, BuilderSourceGit))
#define BUILDER_IS_SOURCE_GIT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BUILDER_TYPE_SOURCE_GIT))
GType builder_source_git_get_type (void);
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(BuilderSourceGit, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (BuilderSourceGit, g_object_unref)
G_END_DECLS
diff --git a/builder/builder-source-patch.c b/builder/builder-source-patch.c
index f4dd6da..0e49e40 100644
--- a/builder/builder-source-patch.c
+++ b/builder/builder-source-patch.c
@@ -32,14 +32,16 @@
#include "builder-utils.h"
#include "builder-source-patch.h"
-struct BuilderSourcePatch {
+struct BuilderSourcePatch
+{
BuilderSource parent;
- char *path;
- guint strip_components;
+ char *path;
+ guint strip_components;
};
-typedef struct {
+typedef struct
+{
BuilderSourceClass parent_class;
} BuilderSourcePatchClass;
@@ -55,7 +57,7 @@ enum {
static void
builder_source_patch_finalize (GObject *object)
{
- BuilderSourcePatch *self = (BuilderSourcePatch *)object;
+ BuilderSourcePatch *self = (BuilderSourcePatch *) object;
g_free (self->path);
@@ -111,8 +113,8 @@ builder_source_patch_set_property (GObject *object,
static GFile *
get_source_file (BuilderSourcePatch *self,
- BuilderContext *context,
- GError **error)
+ BuilderContext *context,
+ GError **error)
{
if (self->path == NULL || self->path[0] == 0)
{
@@ -124,12 +126,13 @@ get_source_file (BuilderSourcePatch *self,
}
static gboolean
-builder_source_patch_download (BuilderSource *source,
- gboolean update_vcs,
+builder_source_patch_download (BuilderSource *source,
+ gboolean update_vcs,
BuilderContext *context,
- GError **error)
+ GError **error)
{
BuilderSourcePatch *self = BUILDER_SOURCE_PATCH (source);
+
g_autoptr(GFile) src = NULL;
src = get_source_file (self, context, error);
@@ -146,9 +149,9 @@ builder_source_patch_download (BuilderSource *source,
}
static gboolean
-patch (GFile *dir,
+patch (GFile *dir,
GError **error,
- ...)
+ ...)
{
gboolean res;
va_list ap;
@@ -161,12 +164,13 @@ patch (GFile *dir,
}
static gboolean
-builder_source_patch_extract (BuilderSource *source,
- GFile *dest,
+builder_source_patch_extract (BuilderSource *source,
+ GFile *dest,
BuilderContext *context,
- GError **error)
+ GError **error)
{
BuilderSourcePatch *self = BUILDER_SOURCE_PATCH (source);
+
g_autoptr(GFile) patchfile = NULL;
g_autofree char *patch_path = NULL;
g_autofree char *strip_components = NULL;
@@ -189,6 +193,7 @@ builder_source_patch_checksum (BuilderSource *source,
BuilderContext *context)
{
BuilderSourcePatch *self = BUILDER_SOURCE_PATCH (source);
+
g_autoptr(GFile) src = NULL;
g_autofree char *data = NULL;
gsize len;
@@ -198,7 +203,7 @@ builder_source_patch_checksum (BuilderSource *source,
return;
if (g_file_load_contents (src, NULL, &data, &len, NULL, NULL))
- builder_cache_checksum_data (cache, (guchar *)data, len);
+ builder_cache_checksum_data (cache, (guchar *) data, len);
builder_cache_checksum_str (cache, self->path);
builder_cache_checksum_uint32 (cache, self->strip_components);
diff --git a/builder/builder-source-patch.h b/builder/builder-source-patch.h
index 39bf3a2..07295bb 100644
--- a/builder/builder-source-patch.h
+++ b/builder/builder-source-patch.h
@@ -27,13 +27,13 @@ G_BEGIN_DECLS
typedef struct BuilderSourcePatch BuilderSourcePatch;
-#define BUILDER_TYPE_SOURCE_PATCH (builder_source_patch_get_type())
+#define BUILDER_TYPE_SOURCE_PATCH (builder_source_patch_get_type ())
#define BUILDER_SOURCE_PATCH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BUILDER_TYPE_SOURCE_PATCH, BuilderSourcePatch))
#define BUILDER_IS_SOURCE_PATCH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BUILDER_TYPE_SOURCE_PATCH))
GType builder_source_patch_get_type (void);
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(BuilderSourcePatch, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (BuilderSourcePatch, g_object_unref)
G_END_DECLS
diff --git a/builder/builder-source-script.c b/builder/builder-source-script.c
index 476e29c..69bf3c6 100644
--- a/builder/builder-source-script.c
+++ b/builder/builder-source-script.c
@@ -30,14 +30,16 @@
#include "builder-utils.h"
#include "builder-source-script.h"
-struct BuilderSourceScript {
+struct BuilderSourceScript
+{
BuilderSource parent;
- char **commands;
- char *dest_filename;
+ char **commands;
+ char *dest_filename;
};
-typedef struct {
+typedef struct
+{
BuilderSourceClass parent_class;
} BuilderSourceScriptClass;
@@ -53,7 +55,7 @@ enum {
static void
builder_source_script_finalize (GObject *object)
{
- BuilderSourceScript *self = (BuilderSourceScript *)object;
+ BuilderSourceScript *self = (BuilderSourceScript *) object;
g_strfreev (self->commands);
g_free (self->dest_filename);
@@ -112,21 +114,22 @@ builder_source_script_set_property (GObject *object,
}
static gboolean
-builder_source_script_download (BuilderSource *source,
- gboolean update_vcs,
+builder_source_script_download (BuilderSource *source,
+ gboolean update_vcs,
BuilderContext *context,
- GError **error)
+ GError **error)
{
return TRUE;
}
static gboolean
-builder_source_script_extract (BuilderSource *source,
- GFile *dest,
+builder_source_script_extract (BuilderSource *source,
+ GFile *dest,
BuilderContext *context,
- GError **error)
+ GError **error)
{
BuilderSourceScript *self = BUILDER_SOURCE_SCRIPT (source);
+
g_autoptr(GFile) dest_script = NULL;
const char *dest_filename;
g_autoptr(GString) script = NULL;
@@ -157,7 +160,7 @@ builder_source_script_extract (BuilderSource *source,
NULL,
FALSE,
G_FILE_CREATE_REPLACE_DESTINATION,
- NULL, NULL,error))
+ NULL, NULL, error))
return FALSE;
perms = 0755;
diff --git a/builder/builder-source-script.h b/builder/builder-source-script.h
index 90df62b..56a7497 100644
--- a/builder/builder-source-script.h
+++ b/builder/builder-source-script.h
@@ -27,13 +27,13 @@ G_BEGIN_DECLS
typedef struct BuilderSourceScript BuilderSourceScript;
-#define BUILDER_TYPE_SOURCE_SCRIPT (builder_source_script_get_type())
+#define BUILDER_TYPE_SOURCE_SCRIPT (builder_source_script_get_type ())
#define BUILDER_SOURCE_SCRIPT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BUILDER_TYPE_SOURCE_SCRIPT, BuilderSourceScript))
#define BUILDER_IS_SOURCE_SCRIPT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BUILDER_TYPE_SOURCE_SCRIPT))
GType builder_source_script_get_type (void);
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(BuilderSourceScript, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (BuilderSourceScript, g_object_unref)
G_END_DECLS
diff --git a/builder/builder-source-shell.c b/builder/builder-source-shell.c
index dcc489f..e9ebcbb 100644
--- a/builder/builder-source-shell.c
+++ b/builder/builder-source-shell.c
@@ -30,13 +30,15 @@
#include "builder-utils.h"
#include "builder-source-shell.h"
-struct BuilderSourceShell {
+struct BuilderSourceShell
+{
BuilderSource parent;
- char **commands;
+ char **commands;
};
-typedef struct {
+typedef struct
+{
BuilderSourceClass parent_class;
} BuilderSourceShellClass;
@@ -51,7 +53,7 @@ enum {
static void
builder_source_shell_finalize (GObject *object)
{
- BuilderSourceShell *self = (BuilderSourceShell *)object;
+ BuilderSourceShell *self = (BuilderSourceShell *) object;
g_strfreev (self->commands);
@@ -60,9 +62,9 @@ builder_source_shell_finalize (GObject *object)
static void
builder_source_shell_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
{
BuilderSourceShell *self = BUILDER_SOURCE_SHELL (object);
@@ -79,9 +81,9 @@ builder_source_shell_get_property (GObject *object,
static void
builder_source_shell_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
BuilderSourceShell *self = BUILDER_SOURCE_SHELL (object);
gchar **tmp;
@@ -100,21 +102,22 @@ builder_source_shell_set_property (GObject *object,
}
static gboolean
-builder_source_shell_download (BuilderSource *source,
- gboolean update_vcs,
- BuilderContext *context,
- GError **error)
+builder_source_shell_download (BuilderSource *source,
+ gboolean update_vcs,
+ BuilderContext *context,
+ GError **error)
{
return TRUE;
}
static gboolean
run_script (BuilderContext *context,
- GFile *source_dir,
- const gchar *script,
- GError **error)
+ GFile *source_dir,
+ const gchar *script,
+ GError **error)
{
GFile *app_dir = builder_context_get_app_dir (context);
+
g_autoptr(GSubprocessLauncher) launcher = NULL;
g_autoptr(GSubprocess) subp = NULL;
g_autoptr(GPtrArray) args = NULL;
@@ -156,10 +159,10 @@ run_script (BuilderContext *context,
static gboolean
-builder_source_shell_extract (BuilderSource *source,
- GFile *dest,
- BuilderContext *context,
- GError **error)
+builder_source_shell_extract (BuilderSource *source,
+ GFile *dest,
+ BuilderContext *context,
+ GError **error)
{
BuilderSourceShell *self = BUILDER_SOURCE_SHELL (source);
int i;
@@ -180,8 +183,8 @@ builder_source_shell_extract (BuilderSource *source,
static void
builder_source_shell_checksum (BuilderSource *source,
- BuilderCache *cache,
- BuilderContext *context)
+ BuilderCache *cache,
+ BuilderContext *context)
{
BuilderSourceShell *self = BUILDER_SOURCE_SHELL (source);
diff --git a/builder/builder-source-shell.h b/builder/builder-source-shell.h
index 8de51d3..9fdbdda 100644
--- a/builder/builder-source-shell.h
+++ b/builder/builder-source-shell.h
@@ -27,13 +27,13 @@ G_BEGIN_DECLS
typedef struct BuilderSourceShell BuilderSourceShell;
-#define BUILDER_TYPE_SOURCE_SHELL (builder_source_shell_get_type())
+#define BUILDER_TYPE_SOURCE_SHELL (builder_source_shell_get_type ())
#define BUILDER_SOURCE_SHELL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BUILDER_TYPE_SOURCE_SHELL, BuilderSourceShell))
#define BUILDER_IS_SOURCE_SHELL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BUILDER_TYPE_SOURCE_SHELL))
GType builder_source_shell_get_type (void);
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(BuilderSourceShell, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (BuilderSourceShell, g_object_unref)
G_END_DECLS
diff --git a/builder/builder-source.c b/builder/builder-source.c
index bf7b2de..f8c7692 100644
--- a/builder/builder-source.c
+++ b/builder/builder-source.c
@@ -99,31 +99,31 @@ builder_source_set_property (GObject *object,
}
static gboolean
-builder_source_real_download (BuilderSource *self,
- gboolean update_vcs,
+builder_source_real_download (BuilderSource *self,
+ gboolean update_vcs,
BuilderContext *context,
- GError **error)
+ GError **error)
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
- "Download not implemented for type %s", g_type_name_from_instance ((GTypeInstance *)self));
+ "Download not implemented for type %s", g_type_name_from_instance ((GTypeInstance *) self));
return FALSE;
}
static gboolean
-builder_source_real_extract (BuilderSource *self,
- GFile *dest,
+builder_source_real_extract (BuilderSource *self,
+ GFile *dest,
BuilderContext *context,
- GError **error)
+ GError **error)
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
- "Extract not implemented for type %s", g_type_name_from_instance ((GTypeInstance *)self));
+ "Extract not implemented for type %s", g_type_name_from_instance ((GTypeInstance *) self));
return FALSE;
}
static gboolean
-builder_source_real_update (BuilderSource *self,
+builder_source_real_update (BuilderSource *self,
BuilderContext *context,
- GError **error)
+ GError **error)
{
return TRUE;
}
@@ -199,22 +199,22 @@ builder_source_from_json (JsonNode *node)
JsonObject *object = json_node_get_object (node);
const gchar *type;
- type = json_object_get_string_member (object, "type");
+ type = json_object_get_string_member (object, "type");
if (strcmp (type, "archive") == 0)
- return (BuilderSource *)json_gobject_deserialize (BUILDER_TYPE_SOURCE_ARCHIVE, node);
+ return (BuilderSource *) json_gobject_deserialize (BUILDER_TYPE_SOURCE_ARCHIVE, node);
if (strcmp (type, "file") == 0)
- return (BuilderSource *)json_gobject_deserialize (BUILDER_TYPE_SOURCE_FILE, node);
+ return (BuilderSource *) json_gobject_deserialize (BUILDER_TYPE_SOURCE_FILE, node);
if (strcmp (type, "script") == 0)
- return (BuilderSource *)json_gobject_deserialize (BUILDER_TYPE_SOURCE_SCRIPT, node);
+ return (BuilderSource *) json_gobject_deserialize (BUILDER_TYPE_SOURCE_SCRIPT, node);
if (strcmp (type, "shell") == 0)
- return (BuilderSource *)json_gobject_deserialize (BUILDER_TYPE_SOURCE_SHELL, node);
+ return (BuilderSource *) json_gobject_deserialize (BUILDER_TYPE_SOURCE_SHELL, node);
if (strcmp (type, "patch") == 0)
- return (BuilderSource *)json_gobject_deserialize (BUILDER_TYPE_SOURCE_PATCH, node);
+ return (BuilderSource *) json_gobject_deserialize (BUILDER_TYPE_SOURCE_PATCH, node);
if (strcmp (type, "git") == 0)
- return (BuilderSource *)json_gobject_deserialize (BUILDER_TYPE_SOURCE_GIT, node);
+ return (BuilderSource *) json_gobject_deserialize (BUILDER_TYPE_SOURCE_GIT, node);
if (strcmp (type, "bzr") == 0)
- return (BuilderSource *)json_gobject_deserialize (BUILDER_TYPE_SOURCE_BZR, node);
+ return (BuilderSource *) json_gobject_deserialize (BUILDER_TYPE_SOURCE_BZR, node);
else if (type == NULL)
g_warning ("Missing source type");
else
@@ -224,10 +224,10 @@ builder_source_from_json (JsonNode *node)
}
gboolean
-builder_source_download (BuilderSource *self,
- gboolean update_vcs,
+builder_source_download (BuilderSource *self,
+ gboolean update_vcs,
BuilderContext *context,
- GError **error)
+ GError **error)
{
BuilderSourceClass *class;
@@ -237,12 +237,13 @@ builder_source_download (BuilderSource *self,
}
gboolean
-builder_source_extract (BuilderSource *self,
- GFile *dest,
- BuilderContext *context,
- GError **error)
+builder_source_extract (BuilderSource *self,
+ GFile *dest,
+ BuilderContext *context,
+ GError **error)
{
BuilderSourceClass *class;
+
g_autoptr(GFile) real_dest;
class = BUILDER_SOURCE_GET_CLASS (self);
@@ -256,16 +257,18 @@ builder_source_extract (BuilderSource *self,
return FALSE;
}
else
- real_dest = g_object_ref (dest);
+ {
+ real_dest = g_object_ref (dest);
+ }
return class->extract (self, real_dest, context, error);
}
gboolean
-builder_source_update (BuilderSource *self,
- BuilderContext *context,
- GError **error)
+builder_source_update (BuilderSource *self,
+ BuilderContext *context,
+ GError **error)
{
BuilderSourceClass *class = BUILDER_SOURCE_GET_CLASS (self);
diff --git a/builder/builder-source.h b/builder/builder-source.h
index fedd387..291686c 100644
--- a/builder/builder-source.h
+++ b/builder/builder-source.h
@@ -30,60 +30,62 @@ G_BEGIN_DECLS
typedef struct BuilderSource BuilderSource;
-#define BUILDER_TYPE_SOURCE (builder_source_get_type())
+#define BUILDER_TYPE_SOURCE (builder_source_get_type ())
#define BUILDER_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BUILDER_TYPE_SOURCE, BuilderSource))
-#define BUILDER_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BUILDER_TYPE_SOURCE, BuilderSourceClass))
+#define BUILDER_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BUILDER_TYPE_SOURCE, BuilderSourceClass))
#define BUILDER_IS_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BUILDER_TYPE_SOURCE))
#define BUILDER_IS_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BUILDER_TYPE_SOURCE))
#define BUILDER_SOURCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BUILDER_TYPE_SOURCE, BuilderSourceClass))
-struct BuilderSource {
+struct BuilderSource
+{
GObject parent;
- char *dest;
+ char *dest;
};
-typedef struct {
+typedef struct
+{
GObjectClass parent_class;
- gboolean (* download) (BuilderSource *self,
- gboolean update_vcs,
- BuilderContext *context,
- GError **error);
- gboolean (* extract) (BuilderSource *self,
- GFile *dest,
+ gboolean (* download)(BuilderSource *self,
+ gboolean update_vcs,
BuilderContext *context,
- GError **error);
- gboolean (* update) (BuilderSource *self,
+ GError **error);
+ gboolean (* extract)(BuilderSource *self,
+ GFile *dest,
BuilderContext *context,
- GError **error);
- void (* checksum) (BuilderSource *self,
- BuilderCache *cache,
- BuilderContext *context);
+ GError **error);
+ gboolean (* update)(BuilderSource *self,
+ BuilderContext *context,
+ GError **error);
+ void (* checksum)(BuilderSource *self,
+ BuilderCache *cache,
+ BuilderContext *context);
} BuilderSourceClass;
GType builder_source_get_type (void);
BuilderSource * builder_source_from_json (JsonNode *node);
-JsonNode * builder_source_to_json (BuilderSource *self);
+JsonNode * builder_source_to_json (BuilderSource *self);
-gboolean builder_source_download (BuilderSource *self,
- gboolean update_vcs,
+gboolean builder_source_download (BuilderSource *self,
+ gboolean update_vcs,
BuilderContext *context,
- GError **error);
-gboolean builder_source_extract (BuilderSource *self,
- GFile *dest,
- BuilderContext *context,
- GError **error);
-gboolean builder_source_update (BuilderSource *self,
+ GError **error);
+gboolean builder_source_extract (BuilderSource *self,
+ GFile *dest,
BuilderContext *context,
- GError **error);
+ GError **error);
+gboolean builder_source_update (BuilderSource *self,
+ BuilderContext *context,
+ GError **error);
void builder_source_checksum (BuilderSource *self,
BuilderCache *cache,
BuilderContext *context);
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(BuilderSource, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (BuilderSource, g_object_unref)
G_END_DECLS
diff --git a/builder/builder-utils.c b/builder/builder-utils.c
index 267d5b5..c4cef7f 100644
--- a/builder/builder-utils.c
+++ b/builder/builder-utils.c
@@ -49,7 +49,9 @@ builder_uri_to_filename (const char *uri)
g_string_append_c (s, '_');
}
else
- g_string_append_c (s, *p);
+ {
+ g_string_append_c (s, *p);
+ }
}
return g_string_free (s, FALSE);
@@ -98,7 +100,7 @@ xdg_app_collect_matches_for_path_pattern (const char *path,
while (rest != NULL)
{
const char *slash;
- g_autofree char *prefix = g_strndup (path, rest-path);
+ g_autofree char *prefix = g_strndup (path, rest - path);
g_hash_table_insert (to_remove_ht, g_strconcat (add_prefix ? add_prefix : "", prefix, NULL), GINT_TO_POINTER (1));
while (*rest == '/')
rest++;
@@ -138,7 +140,7 @@ strip (GError **error,
gboolean
eu_strip (GError **error,
- ...)
+ ...)
{
gboolean res;
va_list ap;
@@ -150,13 +152,14 @@ eu_strip (GError **error,
return res;
}
-static gboolean elf_has_symtab (Elf *elf)
+static gboolean
+elf_has_symtab (Elf *elf)
{
Elf_Scn *scn;
GElf_Shdr shdr;
scn = NULL;
- while ((scn = elf_nextscn(elf, scn)) != NULL)
+ while ((scn = elf_nextscn (elf, scn)) != NULL)
{
if (gelf_getshdr (scn, &shdr) == NULL)
continue;
@@ -170,9 +173,10 @@ static gboolean elf_has_symtab (Elf *elf)
return FALSE;
}
-gboolean is_elf_file (const char *path,
- gboolean *is_shared,
- gboolean *is_stripped)
+gboolean
+is_elf_file (const char *path,
+ gboolean *is_shared,
+ gboolean *is_stripped)
{
g_autofree char *filename = g_path_get_basename (path);
struct stat stbuf;
@@ -189,7 +193,7 @@ gboolean is_elf_file (const char *path,
{
glnx_fd_close int fd = -1;
- fd = open (path, O_RDONLY|O_NOFOLLOW|O_CLOEXEC);
+ fd = open (path, O_RDONLY | O_NOFOLLOW | O_CLOEXEC);
if (fd >= 0)
{
Elf *elf;
@@ -222,7 +226,8 @@ gboolean is_elf_file (const char *path,
return FALSE;
}
-gboolean directory_is_empty (const char *path)
+gboolean
+directory_is_empty (const char *path)
{
GDir *dir;
gboolean empty;
@@ -239,10 +244,10 @@ gboolean directory_is_empty (const char *path)
}
static gboolean
-migrate_locale_dir (GFile *source_dir,
- GFile *separate_dir,
+migrate_locale_dir (GFile *source_dir,
+ GFile *separate_dir,
const char *subdir,
- GError **error)
+ GError **error)
{
g_autoptr(GFileEnumerator) dir_enum = NULL;
GFileInfo *next;
@@ -315,7 +320,7 @@ migrate_locale_dir (GFile *source_dir,
}
gboolean
-builder_migrate_locale_dirs (GFile *root_dir,
+builder_migrate_locale_dirs (GFile *root_dir,
GError **error)
{
g_autoptr(GFile) separate_dir = NULL;
@@ -366,81 +371,82 @@ builder_migrate_locale_dirs (GFile *root_dir,
#define DW_FORM_ref_sig8 0x20
/* keep uptodate with changes to debug_sections */
-#define DEBUG_INFO 0
-#define DEBUG_ABBREV 1
-#define DEBUG_LINE 2
-#define DEBUG_ARANGES 3
-#define DEBUG_PUBNAMES 4
-#define DEBUG_PUBTYPES 5
-#define DEBUG_MACINFO 6
-#define DEBUG_LOC 7
-#define DEBUG_STR 8
-#define DEBUG_FRAME 9
-#define DEBUG_RANGES 10
-#define DEBUG_TYPES 11
-#define DEBUG_MACRO 12
-#define DEBUG_GDB_SCRIPT 13
+#define DEBUG_INFO 0
+#define DEBUG_ABBREV 1
+#define DEBUG_LINE 2
+#define DEBUG_ARANGES 3
+#define DEBUG_PUBNAMES 4
+#define DEBUG_PUBTYPES 5
+#define DEBUG_MACINFO 6
+#define DEBUG_LOC 7
+#define DEBUG_STR 8
+#define DEBUG_FRAME 9
+#define DEBUG_RANGES 10
+#define DEBUG_TYPES 11
+#define DEBUG_MACRO 12
+#define DEBUG_GDB_SCRIPT 13
#define NUM_DEBUG_SECTIIONS 14
static const char * debug_section_names[] = {
- ".debug_info",
- ".debug_abbrev",
- ".debug_line",
- ".debug_aranges",
- ".debug_pubnames",
- ".debug_pubtypes",
- ".debug_macinfo",
- ".debug_loc",
- ".debug_str",
- ".debug_frame",
- ".debug_ranges",
- ".debug_types",
- ".debug_macro",
- ".debug_gdb_scripts",
+ ".debug_info",
+ ".debug_abbrev",
+ ".debug_line",
+ ".debug_aranges",
+ ".debug_pubnames",
+ ".debug_pubtypes",
+ ".debug_macinfo",
+ ".debug_loc",
+ ".debug_str",
+ ".debug_frame",
+ ".debug_ranges",
+ ".debug_types",
+ ".debug_macro",
+ ".debug_gdb_scripts",
};
-typedef struct {
+typedef struct
+{
unsigned char *data;
- Elf_Data *elf_data;
- size_t size;
- int sec, relsec;
+ Elf_Data *elf_data;
+ size_t size;
+ int sec, relsec;
} debug_section_t;
typedef struct
{
- Elf *elf;
- GElf_Ehdr ehdr;
- Elf_Scn **scns;
- const char *filename;
- int lastscn;
+ Elf *elf;
+ GElf_Ehdr ehdr;
+ Elf_Scn **scns;
+ const char *filename;
+ int lastscn;
debug_section_t debug_sections[NUM_DEBUG_SECTIIONS];
- GElf_Shdr *shdr;
+ GElf_Shdr *shdr;
} DebuginfoData;
typedef struct
{
unsigned char *ptr;
- uint32_t addend;
+ uint32_t addend;
} REL;
#define read_uleb128(ptr) ({ \
- unsigned int ret = 0; \
- unsigned int c; \
- int shift = 0; \
- do \
+ unsigned int ret = 0; \
+ unsigned int c; \
+ int shift = 0; \
+ do \
{ \
c = *ptr++; \
ret |= (c & 0x7f) << shift; \
shift += 7; \
} while (c & 0x80); \
\
- if (shift >= 35) \
- ret = UINT_MAX; \
- ret; \
-})
+ if (shift >= 35) \
+ ret = UINT_MAX; \
+ ret; \
+ })
-static uint16_t (*do_read_16) (unsigned char *ptr);
+static uint16_t (*do_read_16)(unsigned char *ptr);
static uint32_t (*do_read_32) (unsigned char *ptr);
static int ptr_size;
@@ -473,51 +479,53 @@ buf_read_ube32 (unsigned char *data)
#define read_1(ptr) *ptr++
#define read_16(ptr) ({ \
- uint16_t ret = do_read_16 (ptr); \
- ptr += 2; \
- ret; \
-})
+ uint16_t ret = do_read_16 (ptr); \
+ ptr += 2; \
+ ret; \
+ })
#define read_32(ptr) ({ \
- uint32_t ret = do_read_32 (ptr); \
- ptr += 4; \
- ret; \
-})
+ uint32_t ret = do_read_32 (ptr); \
+ ptr += 4; \
+ ret; \
+ })
REL *relptr, *relend;
int reltype;
#define do_read_32_relocated(ptr) ({ \
- uint32_t dret = do_read_32 (ptr); \
- if (relptr) \
+ uint32_t dret = do_read_32 (ptr); \
+ if (relptr) \
{ \
while (relptr < relend && relptr->ptr < ptr) \
++relptr; \
if (relptr < relend && relptr->ptr == ptr) \
- { \
- if (reltype == SHT_REL) \
- dret += relptr->addend; \
- else \
- dret = relptr->addend; \
- } \
+ { \
+ if (reltype == SHT_REL) \
+ dret += relptr->addend; \
+ else \
+ dret = relptr->addend; \
+ } \
} \
- dret; \
-})
+ dret; \
+ })
#define read_32_relocated(ptr) ({ \
- uint32_t ret = do_read_32_relocated (ptr); \
- ptr += 4; \
- ret; \
-})
+ uint32_t ret = do_read_32_relocated (ptr); \
+ ptr += 4; \
+ ret; \
+ })
-struct abbrev_attr {
+struct abbrev_attr
+{
unsigned int attr;
unsigned int form;
};
-struct abbrev_tag {
- unsigned int tag;
- int nattr;
+struct abbrev_tag
+{
+ unsigned int tag;
+ int nattr;
struct abbrev_attr attr[0];
};
@@ -556,13 +564,13 @@ read_abbrev (DebuginfoData *data, unsigned char *ptr)
}
if (read_uleb128 (ptr) != 0)
g_warning ("%s: DWARF abbreviation does not end with 2 zeros", data->filename);
- g_hash_table_insert (h, GINT_TO_POINTER(entry), t);
+ g_hash_table_insert (h, GINT_TO_POINTER (entry), t);
}
return h;
}
-#define IS_DIR_SEPARATOR(c) ((c)=='/')
+#define IS_DIR_SEPARATOR(c) ((c) == '/')
static char *
canonicalize_path (const char *s, char *d)
@@ -574,10 +582,8 @@ canonicalize_path (const char *s, char *d)
{
*d++ = *s++;
if (IS_DIR_SEPARATOR (*s) && !IS_DIR_SEPARATOR (s[1]))
- {
- /* Special case for "//foo" meaning a Posix namespace escape. */
- *d++ = *s++;
- }
+ /* Special case for "//foo" meaning a Posix namespace escape. */
+ *d++ = *s++;
while (IS_DIR_SEPARATOR (*s))
s++;
}
@@ -594,16 +600,15 @@ canonicalize_path (const char *s, char *d)
while (IS_DIR_SEPARATOR (*s))
++s;
}
-
- else if (s[0] == '.' && s[1] == '.'
- && (s[2] == 0 || IS_DIR_SEPARATOR (s[2])))
+ else if (s[0] == '.' && s[1] == '.' &&
+ (s[2] == 0 || IS_DIR_SEPARATOR (s[2])))
{
char *pre = d - 1; /* includes slash */
while (droot < pre && IS_DIR_SEPARATOR (*pre))
pre--;
- if (droot <= pre && ! IS_DIR_SEPARATOR (*pre))
+ if (droot <= pre && !IS_DIR_SEPARATOR (*pre))
{
- while (droot < pre && ! IS_DIR_SEPARATOR (*pre))
+ while (droot < pre && !IS_DIR_SEPARATOR (*pre))
pre--;
/* pre now points to the slash */
if (droot < pre)
@@ -630,7 +635,7 @@ canonicalize_path (const char *s, char *d)
}
else
{
- while (*s && ! IS_DIR_SEPARATOR (*s))
+ while (*s && !IS_DIR_SEPARATOR (*s))
*d++ = *s++;
}
@@ -692,7 +697,7 @@ handle_dwarf2_line (DebuginfoData *data, uint32_t off, char *comp_dir, GHashTabl
value = 1;
while (*ptr != 0)
{
- ptr = (unsigned char *) strchr ((char *)ptr, 0) + 1;
+ ptr = (unsigned char *) strchr ((char *) ptr, 0) + 1;
++value;
}
@@ -703,7 +708,7 @@ handle_dwarf2_line (DebuginfoData *data, uint32_t off, char *comp_dir, GHashTabl
while (*ptr != 0)
{
dirt[dirt_cnt++] = ptr;
- ptr = (unsigned char *) strchr ((char *)ptr, 0) + 1;
+ ptr = (unsigned char *) strchr ((char *) ptr, 0) + 1;
}
ptr++;
@@ -714,17 +719,19 @@ handle_dwarf2_line (DebuginfoData *data, uint32_t off, char *comp_dir, GHashTabl
size_t file_len, dir_len;
file = (char *) ptr;
- ptr = (unsigned char *) strchr ((char *)ptr, 0) + 1;
+ ptr = (unsigned char *) strchr ((char *) ptr, 0) + 1;
value = read_uleb128 (ptr);
if (value >= dirt_cnt)
return xdg_app_fail (error, "%s: Wrong directory table index %u", data->filename, value);
file_len = strlen (file);
- dir_len = strlen ((char *)dirt[value]);
+ dir_len = strlen ((char *) dirt[value]);
s = g_malloc (comp_dir_len + 1 + file_len + 1 + dir_len + 1);
if (*file == '/')
- memcpy (s, file, file_len + 1);
+ {
+ memcpy (s, file, file_len + 1);
+ }
else if (*dirt[value] == '/')
{
memcpy (s, dirt[value], dir_len);
@@ -749,8 +756,8 @@ handle_dwarf2_line (DebuginfoData *data, uint32_t off, char *comp_dir, GHashTabl
if (s)
g_hash_table_insert (files, s, NULL);
- (void)read_uleb128 (ptr);
- (void)read_uleb128 (ptr);
+ (void) read_uleb128 (ptr);
+ (void) read_uleb128 (ptr);
}
++ptr;
@@ -777,8 +784,8 @@ handle_attributes (DebuginfoData *data, unsigned char *ptr, struct abbrev_tag *t
{
if (t->attr[i].attr == DW_AT_stmt_list)
{
- if (form == DW_FORM_data4
- || form == DW_FORM_sec_offset)
+ if (form == DW_FORM_data4 ||
+ form == DW_FORM_sec_offset)
{
list_offs = do_read_32_relocated (ptr);
found_list_offs = 1;
@@ -790,7 +797,7 @@ handle_attributes (DebuginfoData *data, unsigned char *ptr, struct abbrev_tag *t
if (form == DW_FORM_string)
{
g_free (comp_dir);
- comp_dir = g_strdup ((char *)ptr);
+ comp_dir = g_strdup ((char *) ptr);
}
else if (form == DW_FORM_strp &&
data->debug_sections[DEBUG_STR].data)
@@ -798,22 +805,22 @@ handle_attributes (DebuginfoData *data, unsigned char *ptr, struct abbrev_tag *t
char *dir;
dir = (char *) data->debug_sections[DEBUG_STR].data
- + do_read_32_relocated (ptr);
+ + do_read_32_relocated (ptr);
g_free (comp_dir);
comp_dir = g_strdup (dir);
}
}
- else if ((t->tag == DW_TAG_compile_unit
- || t->tag == DW_TAG_partial_unit)
- && t->attr[i].attr == DW_AT_name
- && form == DW_FORM_strp
- && data->debug_sections[DEBUG_STR].data)
+ else if ((t->tag == DW_TAG_compile_unit ||
+ t->tag == DW_TAG_partial_unit) &&
+ t->attr[i].attr == DW_AT_name &&
+ form == DW_FORM_strp &&
+ data->debug_sections[DEBUG_STR].data)
{
char *name;
name = (char *) data->debug_sections[DEBUG_STR].data
- + do_read_32_relocated (ptr);
+ + do_read_32_relocated (ptr);
if (*name == '/' && comp_dir == NULL)
{
char *enddir = strrchr (name, '/');
@@ -822,10 +829,12 @@ handle_attributes (DebuginfoData *data, unsigned char *ptr, struct abbrev_tag *t
{
comp_dir = g_malloc (enddir - name + 1);
memcpy (comp_dir, name, enddir - name);
- comp_dir [enddir - name] = '\0';
+ comp_dir[enddir - name] = '\0';
}
else
- comp_dir = g_strdup ("/");
+ {
+ comp_dir = g_strdup ("/");
+ }
}
}
@@ -838,61 +847,76 @@ handle_attributes (DebuginfoData *data, unsigned char *ptr, struct abbrev_tag *t
else
ptr += 4;
break;
+
case DW_FORM_flag_present:
break;
+
case DW_FORM_addr:
ptr += ptr_size;
break;
+
case DW_FORM_ref1:
case DW_FORM_flag:
case DW_FORM_data1:
++ptr;
break;
+
case DW_FORM_ref2:
case DW_FORM_data2:
ptr += 2;
break;
+
case DW_FORM_ref4:
case DW_FORM_data4:
case DW_FORM_sec_offset:
ptr += 4;
break;
+
case DW_FORM_ref8:
case DW_FORM_data8:
case DW_FORM_ref_sig8:
ptr += 8;
break;
+
case DW_FORM_sdata:
case DW_FORM_ref_udata:
case DW_FORM_udata:
- (void)read_uleb128 (ptr);
+ (void) read_uleb128 (ptr);
break;
+
case DW_FORM_strp:
ptr += 4;
break;
+
case DW_FORM_string:
- ptr = (unsigned char *) strchr ((char *)ptr, '\0') + 1;
+ ptr = (unsigned char *) strchr ((char *) ptr, '\0') + 1;
break;
+
case DW_FORM_indirect:
form = read_uleb128 (ptr);
continue;
+
case DW_FORM_block1:
len = *ptr++;
break;
+
case DW_FORM_block2:
len = read_16 (ptr);
form = DW_FORM_block1;
break;
+
case DW_FORM_block4:
len = read_32 (ptr);
form = DW_FORM_block1;
break;
+
case DW_FORM_block:
case DW_FORM_exprloc:
len = read_uleb128 (ptr);
form = DW_FORM_block1;
g_assert (len < UINT_MAX);
break;
+
default:
g_warning ("%s: Unknown DWARF DW_FORM_%d", data->filename, form);
return NULL;
@@ -953,7 +977,9 @@ handle_dwarf2_section (DebuginfoData *data, GHashTable *files, GError **error)
do_read_32 = buf_read_ube32;
}
else
- return xdg_app_fail (0, 0, "%s: Wrong ELF data enconding", data->filename);
+ {
+ return xdg_app_fail (0, 0, "%s: Wrong ELF data enconding", data->filename);
+ }
debug_sections = data->debug_sections;
@@ -1002,7 +1028,9 @@ handle_dwarf2_section (DebuginfoData *data, GHashTable *files, GError **error)
rela.r_addend = 0;
}
else
- gelf_getrela (e_data, ndx, &rela);
+ {
+ gelf_getrela (e_data, ndx, &rela);
+ }
gelf_getsym (symdata, ELF64_R_SYM (rela.r_info), &sym);
/* Relocations against section symbols are uninteresting
in REL. */
@@ -1010,9 +1038,9 @@ handle_dwarf2_section (DebuginfoData *data, GHashTable *files, GError **error)
continue;
/* Only consider relocations against .debug_str, .debug_line
and .debug_abbrev. */
- if (sym.st_shndx != debug_sections[DEBUG_STR].sec
- && sym.st_shndx != debug_sections[DEBUG_LINE].sec
- && sym.st_shndx != debug_sections[DEBUG_ABBREV].sec)
+ if (sym.st_shndx != debug_sections[DEBUG_STR].sec &&
+ sym.st_shndx != debug_sections[DEBUG_LINE].sec &&
+ sym.st_shndx != debug_sections[DEBUG_ABBREV].sec)
continue;
rela.r_addend += sym.st_value;
rtype = ELF64_R_TYPE (rela.r_info);
@@ -1024,43 +1052,52 @@ handle_dwarf2_section (DebuginfoData *data, GHashTable *files, GError **error)
if (rtype != R_SPARC_32 && rtype != R_SPARC_UA32)
goto fail;
break;
+
case EM_386:
if (rtype != R_386_32)
goto fail;
break;
+
case EM_PPC:
case EM_PPC64:
if (rtype != R_PPC_ADDR32 && rtype != R_PPC_UADDR32)
goto fail;
break;
+
case EM_S390:
if (rtype != R_390_32)
goto fail;
break;
+
case EM_IA_64:
if (rtype != R_IA64_SECREL32LSB)
goto fail;
break;
+
case EM_X86_64:
if (rtype != R_X86_64_32)
goto fail;
break;
+
case EM_ALPHA:
if (rtype != R_ALPHA_REFLONG)
goto fail;
break;
+
#if defined(EM_AARCH64) && defined(R_AARCH64_ABS32)
case EM_AARCH64:
if (rtype != R_AARCH64_ABS32)
goto fail;
break;
+
#endif
case EM_68K:
if (rtype != R_68K_32)
goto fail;
break;
+
default:
- fail:
+fail:
return xdg_app_fail (error, "%s: Unhandled relocation %d in .debug_info section",
data->filename, rtype);
}
@@ -1076,7 +1113,9 @@ handle_dwarf2_section (DebuginfoData *data, GHashTable *files, GError **error)
relend = NULL;
}
else
- qsort (relbuf, relend - relbuf, sizeof (REL), rel_cmp);
+ {
+ qsort (relbuf, relend - relbuf, sizeof (REL), rel_cmp);
+ }
}
ptr = debug_sections[DEBUG_INFO].data;
@@ -1117,7 +1156,9 @@ handle_dwarf2_section (DebuginfoData *data, GHashTable *files, GError **error)
return xdg_app_fail (error, "%s: Invalid DWARF pointer size %d", data->filename, ptr_size);
}
else if (read_1 (ptr) != ptr_size)
- return xdg_app_fail (error, "%s: DWARF pointer size differs between CUs", data->filename);
+ {
+ return xdg_app_fail (error, "%s: DWARF pointer size differs between CUs", data->filename);
+ }
abbrev = read_abbrev (data,
debug_sections[DEBUG_ABBREV].data + value);
@@ -1127,9 +1168,11 @@ handle_dwarf2_section (DebuginfoData *data, GHashTable *files, GError **error)
guint entry = read_uleb128 (ptr);
if (entry == 0)
continue;
- t = g_hash_table_lookup (abbrev, GINT_TO_POINTER(entry));
+ t = g_hash_table_lookup (abbrev, GINT_TO_POINTER (entry));
if (t == NULL)
- g_warning ("%s: Could not find DWARF abbreviation %d", data->filename, entry);
+ {
+ g_warning ("%s: Could not find DWARF abbreviation %d", data->filename, entry);
+ }
else
{
ptr = handle_attributes (data, ptr, t, files, error);
@@ -1155,9 +1198,9 @@ strptr (Elf_Scn **scns, GElf_Shdr *shdr, int sec, off_t offset)
data = NULL;
while ((data = elf_rawdata (scn, data)) != NULL)
{
- if (data->d_buf
- && offset >= data->d_off
- && offset < data->d_off + data->d_size)
+ if (data->d_buf &&
+ offset >= data->d_off &&
+ offset < data->d_off + data->d_size)
return (const char *) data->d_buf + (offset - data->d_off);
}
}
@@ -1176,6 +1219,7 @@ builder_get_debuginfo_file_references (const char *filename, GError **error)
g_autofree GElf_Shdr *shdr = NULL;
g_autofree Elf_Scn **scns = NULL;
debug_section_t *debug_sections;
+
g_autoptr(GHashTable) files = NULL;
char **res;
@@ -1232,7 +1276,7 @@ builder_get_debuginfo_file_references (const char *filename, GError **error)
debug_sections = data.debug_sections;
for (i = 1; i < ehdr.e_shnum; ++i)
{
- if (! (shdr[i].sh_flags & (SHF_ALLOC | SHF_WRITE | SHF_EXECINSTR)) && shdr[i].sh_size)
+ if (!(shdr[i].sh_flags & (SHF_ALLOC | SHF_WRITE | SHF_EXECINSTR)) && shdr[i].sh_size)
{
const char *name = strptr (scns, shdr, ehdr.e_shstrndx, shdr[i].sh_name);
@@ -1287,7 +1331,7 @@ builder_get_debuginfo_file_references (const char *filename, GError **error)
if (elf_end (elf) < 0)
g_warning ("elf_end failed: %s\n", elf_errmsg (elf_errno ()));
- res = (char **)g_hash_table_get_keys_as_array (files, NULL);
+ res = (char **) g_hash_table_get_keys_as_array (files, NULL);
g_hash_table_steal_all (files);
return res;
}
diff --git a/builder/builder-utils.h b/builder/builder-utils.h
index 12dadab..c192e2b 100644
--- a/builder/builder-utils.h
+++ b/builder/builder-utils.h
@@ -30,25 +30,27 @@ typedef struct BuilderUtils BuilderUtils;
char *builder_uri_to_filename (const char *uri);
-gboolean strip (GError **error, ...);
-gboolean eu_strip (GError **error, ...);
+gboolean strip (GError **error,
+ ...);
+gboolean eu_strip (GError **error,
+ ...);
gboolean is_elf_file (const char *path,
- gboolean *is_shared,
- gboolean *is_stripped);
+ gboolean *is_shared,
+ gboolean *is_stripped);
char ** builder_get_debuginfo_file_references (const char *filename,
- GError **error);
+ GError **error);
gboolean directory_is_empty (const char *path);
-gboolean xdg_app_matches_path_pattern (const char *path,
- const char *pattern);
+gboolean xdg_app_matches_path_pattern (const char *path,
+ const char *pattern);
void xdg_app_collect_matches_for_path_pattern (const char *path,
const char *pattern,
const char *add_prefix,
GHashTable *to_remove_ht);
-gboolean builder_migrate_locale_dirs (GFile *root_dir,
+gboolean builder_migrate_locale_dirs (GFile *root_dir,
GError **error);
G_END_DECLS
diff --git a/builder/xdg-app-builder-main.c b/builder/xdg-app-builder-main.c
index 39dd1d7..41c5e18 100644
--- a/builder/xdg-app-builder-main.c
+++ b/builder/xdg-app-builder-main.c
@@ -69,15 +69,15 @@ static GOptionEntry entries[] = {
{ "body", 'b', 0, G_OPTION_ARG_STRING, &opt_body, "Full description (passed to build-export)", "BODY" },
{ "gpg-sign", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_key_ids, "GPG Key ID to sign the commit with", "KEY-ID"},
{ "gpg-homedir", 0, 0, G_OPTION_ARG_STRING, &opt_gpg_homedir, "GPG Homedir to use when looking for keyrings", "HOMEDIR"},
- { "force-clean",0, 0, G_OPTION_ARG_NONE, &opt_force_clean, "Erase previous contents of DIRECTORY", NULL },
+ { "force-clean", 0, 0, G_OPTION_ARG_NONE, &opt_force_clean, "Erase previous contents of DIRECTORY", NULL },
{ NULL }
};
static void
-message_handler (const gchar *log_domain,
+message_handler (const gchar *log_domain,
GLogLevelFlags log_level,
- const gchar *message,
- gpointer user_data)
+ const gchar *message,
+ gpointer user_data)
{
/* Make this look like normal console output */
if (log_level & G_LOG_LEVEL_DEBUG)
@@ -90,6 +90,7 @@ int
usage (GOptionContext *context, const char *message)
{
g_autofree gchar *help = g_option_context_get_help (context, TRUE, NULL);
+
g_printerr ("%s\n", message);
g_printerr ("%s", help);
return 1;
@@ -99,7 +100,7 @@ static const char skip_arg[] = "skip";
static gboolean
do_export (BuilderContext *build_context,
- GError **error,
+ GError **error,
gboolean runtime,
...)
{
@@ -157,6 +158,7 @@ main (int argc,
char **argv)
{
g_autofree const char *old_env = NULL;
+
g_autoptr(GError) error = NULL;
g_autoptr(BuilderManifest) manifest = NULL;
GOptionContext *context;
@@ -221,8 +223,8 @@ main (int argc,
return 1;
}
- manifest = (BuilderManifest *)json_gobject_from_data (BUILDER_TYPE_MANIFEST,
- json, -1, &error);
+ manifest = (BuilderManifest *) json_gobject_from_data (BUILDER_TYPE_MANIFEST,
+ json, -1, &error);
if (manifest == NULL)
{
g_printerr ("Can't parse '%s': %s\n", manifest_path, error->message);
@@ -364,9 +366,7 @@ main (int argc,
}
if (!opt_require_changes)
- {
- builder_cache_ensure_checkout (cache);
- }
+ builder_cache_ensure_checkout (cache);
if (!opt_build_only && opt_repo && builder_cache_has_checkout (cache))
{
@@ -398,9 +398,7 @@ main (int argc,
g_autofree char *files_arg = NULL;
if (strcmp (name, "metadata.locale") == 0)
- {
- g_print ("exporting %s.Locale to repo\n", builder_manifest_get_id (manifest));
- }
+ g_print ("exporting %s.Locale to repo\n", builder_manifest_get_id (manifest));
else
continue;
@@ -440,21 +438,21 @@ main (int argc,
{
g_print ("exporting %s to repo\n", platform_id);
- if (!do_export (build_context, &error, TRUE,
- "--metadata=metadata.platform",
- "--files=platform",
- builder_context_get_separate_locales (build_context) ? "--exclude=/share/runtime/locale/*/*" : skip_arg,
- opt_repo, app_dir_path, builder_manifest_get_branch (manifest), NULL))
- {
- g_print ("Export failed: %s\n", error->message);
- return 1;
- }
+ if (!do_export (build_context, &error, TRUE,
+ "--metadata=metadata.platform",
+ "--files=platform",
+ builder_context_get_separate_locales (build_context) ? "--exclude=/share/runtime/locale/*/*" : skip_arg,
+ opt_repo, app_dir_path, builder_manifest_get_branch (manifest), NULL))
+ {
+ g_print ("Export failed: %s\n", error->message);
+ return 1;
+ }
}
/* Export platform locales */
dir_enum2 = g_file_enumerate_children (app_dir, "standard::name,standard::type",
- G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
- NULL, NULL);
+ G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
+ NULL, NULL);
while (dir_enum2 != NULL &&
(next = g_file_enumerator_next_file (dir_enum2, NULL, NULL)))
{
@@ -464,9 +462,7 @@ main (int argc,
g_autofree char *files_arg = NULL;
if (strcmp (name, "metadata.platform.locale") == 0)
- {
- g_print ("exporting %s.Locale to repo\n", platform_id);
- }
+ g_print ("exporting %s.Locale to repo\n", platform_id);
else
continue;