summaryrefslogtreecommitdiff
path: root/builder
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2015-12-21 10:39:23 +0100
committerAlexander Larsson <alexl@redhat.com>2015-12-21 10:39:23 +0100
commit1264335458c181edd64f1b66f578ff73ca599892 (patch)
tree76d6ab78d9d6b5f4fcf6cf7922b7eb4cd060604d /builder
parentea543c8f93c24fb628efe3884c8e421176fdb02e (diff)
downloadxdg-app-1264335458c181edd64f1b66f578ff73ca599892.tar.gz
builder: Add --disable-updates
Download sources, but never update existing sources (like git or bzr).
Diffstat (limited to 'builder')
-rw-r--r--builder/builder-manifest.c3
-rw-r--r--builder/builder-manifest.h1
-rw-r--r--builder/builder-module.c3
-rw-r--r--builder/builder-module.h1
-rw-r--r--builder/builder-source-archive.c1
-rw-r--r--builder/builder-source-bzr.c3
-rw-r--r--builder/builder-source-file.c1
-rw-r--r--builder/builder-source-git.c11
-rw-r--r--builder/builder-source-patch.c1
-rw-r--r--builder/builder-source-script.c1
-rw-r--r--builder/builder-source.c4
-rw-r--r--builder/builder-source.h2
-rw-r--r--builder/xdg-app-builder-main.c4
13 files changed, 28 insertions, 8 deletions
diff --git a/builder/builder-manifest.c b/builder/builder-manifest.c
index 7e35269..e028da1 100644
--- a/builder/builder-manifest.c
+++ b/builder/builder-manifest.c
@@ -674,6 +674,7 @@ builder_manifest_checksum_for_finish (BuilderManifest *self,
gboolean
builder_manifest_download (BuilderManifest *self,
+ gboolean update_vcs,
BuilderContext *context,
GError **error)
{
@@ -684,7 +685,7 @@ builder_manifest_download (BuilderManifest *self,
{
BuilderModule *m = l->data;
- if (! builder_module_download_sources (m, context, error))
+ if (! builder_module_download_sources (m, update_vcs, context, error))
return FALSE;
}
diff --git a/builder/builder-manifest.h b/builder/builder-manifest.h
index 6daeadf..d5aba09 100644
--- a/builder/builder-manifest.h
+++ b/builder/builder-manifest.h
@@ -48,6 +48,7 @@ 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,
diff --git a/builder/builder-module.c b/builder/builder-module.c
index 5e79f3b..36a874f 100644
--- a/builder/builder-module.c
+++ b/builder/builder-module.c
@@ -470,6 +470,7 @@ builder_module_get_sources (BuilderModule *self)
gboolean
builder_module_download_sources (BuilderModule *self,
+ gboolean update_vcs,
BuilderContext *context,
GError **error)
{
@@ -479,7 +480,7 @@ builder_module_download_sources (BuilderModule *self,
{
BuilderSource *source = l->data;
- if (!builder_source_download (source, context, error))
+ if (!builder_source_download (source, update_vcs, context, error))
return FALSE;
}
diff --git a/builder/builder-module.h b/builder/builder-module.h
index 832f168..f07d173 100644
--- a/builder/builder-module.h
+++ b/builder/builder-module.h
@@ -46,6 +46,7 @@ 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,
diff --git a/builder/builder-source-archive.c b/builder/builder-source-archive.c
index 306e55d..dd20a71 100644
--- a/builder/builder-source-archive.c
+++ b/builder/builder-source-archive.c
@@ -252,6 +252,7 @@ download_uri (const char *url,
static gboolean
builder_source_archive_download (BuilderSource *source,
+ gboolean update_vcs,
BuilderContext *context,
GError **error)
{
diff --git a/builder/builder-source-bzr.c b/builder/builder-source-bzr.c
index a1aaefc..f3c28d2 100644
--- a/builder/builder-source-bzr.c
+++ b/builder/builder-source-bzr.c
@@ -162,6 +162,7 @@ get_current_commit (BuilderSourceBzr *self, BuilderContext *context, GError **er
static gboolean
builder_source_bzr_download (BuilderSource *source,
+ gboolean update_vcs,
BuilderContext *context,
GError **error)
{
@@ -190,7 +191,7 @@ builder_source_bzr_download (BuilderSource *source,
!g_file_move (mirror_dir_tmp, mirror_dir, 0, NULL, NULL, NULL, error))
return FALSE;
}
- else
+ else if (update_vcs)
{
g_print ("Updating bzr repo %s\n", self->url);
diff --git a/builder/builder-source-file.c b/builder/builder-source-file.c
index a27f0e9..d4f1b8e 100644
--- a/builder/builder-source-file.c
+++ b/builder/builder-source-file.c
@@ -255,6 +255,7 @@ download_uri (const char *url,
static gboolean
builder_source_file_download (BuilderSource *source,
+ gboolean update_vcs,
BuilderContext *context,
GError **error)
{
diff --git a/builder/builder-source-git.c b/builder/builder-source-git.c
index 52d40f8..9e15a61 100644
--- a/builder/builder-source-git.c
+++ b/builder/builder-source-git.c
@@ -55,6 +55,7 @@ enum {
};
static gboolean git_mirror_repo (const char *repo_url,
+ gboolean update,
const char *ref,
BuilderContext *context,
GError **error);
@@ -251,6 +252,7 @@ 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,
BuilderContext *context,
@@ -313,7 +315,7 @@ git_mirror_submodules (const char *repo_url,
if (url == NULL)
return FALSE;
- if (!git_mirror_repo (url, words[0], context, error))
+ if (!git_mirror_repo (url, update, words[0], context, error))
return FALSE;
}
}
@@ -326,6 +328,7 @@ git_mirror_submodules (const char *repo_url,
static gboolean
git_mirror_repo (const char *repo_url,
+ gboolean update,
const char *ref,
BuilderContext *context,
GError **error)
@@ -349,7 +352,7 @@ git_mirror_repo (const char *repo_url,
!g_file_move (mirror_dir_tmp, mirror_dir, 0, NULL, NULL, NULL, error))
return FALSE;
}
- else
+ else if (update)
{
g_print ("Fetching git repo %s\n", repo_url);
if (!git (mirror_dir, NULL, error,
@@ -361,7 +364,7 @@ git_mirror_repo (const char *repo_url,
if (current_commit == NULL)
return FALSE;
- if (!git_mirror_submodules (repo_url, mirror_dir, current_commit, context, error))
+ if (!git_mirror_submodules (repo_url, update, mirror_dir, current_commit, context, error))
return FALSE;
return TRUE;
@@ -369,6 +372,7 @@ git_mirror_repo (const char *repo_url,
static gboolean
builder_source_git_download (BuilderSource *source,
+ gboolean update_vcs,
BuilderContext *context,
GError **error)
{
@@ -380,6 +384,7 @@ builder_source_git_download (BuilderSource *source,
return FALSE;
if (!git_mirror_repo (url,
+ update_vcs,
get_branch (self),
context,
error))
diff --git a/builder/builder-source-patch.c b/builder/builder-source-patch.c
index 3f5315d..f4dd6da 100644
--- a/builder/builder-source-patch.c
+++ b/builder/builder-source-patch.c
@@ -125,6 +125,7 @@ get_source_file (BuilderSourcePatch *self,
static gboolean
builder_source_patch_download (BuilderSource *source,
+ gboolean update_vcs,
BuilderContext *context,
GError **error)
{
diff --git a/builder/builder-source-script.c b/builder/builder-source-script.c
index e2de46f..476e29c 100644
--- a/builder/builder-source-script.c
+++ b/builder/builder-source-script.c
@@ -113,6 +113,7 @@ builder_source_script_set_property (GObject *object,
static gboolean
builder_source_script_download (BuilderSource *source,
+ gboolean update_vcs,
BuilderContext *context,
GError **error)
{
diff --git a/builder/builder-source.c b/builder/builder-source.c
index ac508a1..7ab242d 100644
--- a/builder/builder-source.c
+++ b/builder/builder-source.c
@@ -99,6 +99,7 @@ builder_source_set_property (GObject *object,
static gboolean
builder_source_real_download (BuilderSource *self,
+ gboolean update_vcs,
BuilderContext *context,
GError **error)
{
@@ -219,6 +220,7 @@ builder_source_from_json (JsonNode *node)
gboolean
builder_source_download (BuilderSource *self,
+ gboolean update_vcs,
BuilderContext *context,
GError **error)
{
@@ -226,7 +228,7 @@ builder_source_download (BuilderSource *self,
class = BUILDER_SOURCE_GET_CLASS (self);
- return class->download (self, context, error);
+ return class->download (self, update_vcs, context, error);
}
gboolean
diff --git a/builder/builder-source.h b/builder/builder-source.h
index af7459b..fedd387 100644
--- a/builder/builder-source.h
+++ b/builder/builder-source.h
@@ -47,6 +47,7 @@ typedef struct {
GObjectClass parent_class;
gboolean (* download) (BuilderSource *self,
+ gboolean update_vcs,
BuilderContext *context,
GError **error);
gboolean (* extract) (BuilderSource *self,
@@ -67,6 +68,7 @@ BuilderSource * builder_source_from_json (JsonNode *node);
JsonNode * builder_source_to_json (BuilderSource *self);
gboolean builder_source_download (BuilderSource *self,
+ gboolean update_vcs,
BuilderContext *context,
GError **error);
gboolean builder_source_extract (BuilderSource *self,
diff --git a/builder/xdg-app-builder-main.c b/builder/xdg-app-builder-main.c
index 33c8adb..2639a8a 100644
--- a/builder/xdg-app-builder-main.c
+++ b/builder/xdg-app-builder-main.c
@@ -37,6 +37,7 @@ static gboolean opt_disable_cache;
static gboolean opt_download_only;
static gboolean opt_build_only;
static gboolean opt_disable_download;
+static gboolean opt_disable_updates;
static gboolean opt_require_changes;
static gboolean opt_keep_build_dirs;
@@ -45,6 +46,7 @@ static GOptionEntry entries[] = {
{ "version", 0, 0, G_OPTION_ARG_NONE, &opt_version, "Print version information and exit", NULL },
{ "disable-cache", 0, 0, G_OPTION_ARG_NONE, &opt_disable_cache, "Disable cache", NULL },
{ "disable-download", 0, 0, G_OPTION_ARG_NONE, &opt_disable_download, "Don't download any new sources", NULL },
+ { "disable-updates", 0, 0, G_OPTION_ARG_NONE, &opt_disable_updates, "Only download missing sources, never update to latest vcs version", NULL },
{ "download-only", 0, 0, G_OPTION_ARG_NONE, &opt_download_only, "Only download sources, don't build", NULL },
{ "build-only", 0, 0, G_OPTION_ARG_NONE, &opt_build_only, "Stop after build, don't run clean and finish phases", NULL },
{ "require-changes", 0, 0, G_OPTION_ARG_NONE, &opt_require_changes, "Don't create app dir if no changes", NULL },
@@ -159,7 +161,7 @@ main (int argc,
if (!opt_disable_download)
{
- if (!builder_manifest_download (manifest, build_context, &error))
+ if (!builder_manifest_download (manifest, !opt_disable_updates, build_context, &error))
{
g_print ("error: %s\n", error->message);
return 1;