forked from Mirrors/flatpak-builder
builder: Support specifying revision in bzr sources
parent
5b6f3749d5
commit
6a82dd4ee3
|
@ -37,6 +37,7 @@ struct BuilderSourceBzr {
|
||||||
BuilderSource parent;
|
BuilderSource parent;
|
||||||
|
|
||||||
char *url;
|
char *url;
|
||||||
|
char *revision;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -48,6 +49,7 @@ G_DEFINE_TYPE (BuilderSourceBzr, builder_source_bzr, BUILDER_TYPE_SOURCE);
|
||||||
enum {
|
enum {
|
||||||
PROP_0,
|
PROP_0,
|
||||||
PROP_URL,
|
PROP_URL,
|
||||||
|
PROP_REVISION,
|
||||||
LAST_PROP
|
LAST_PROP
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -57,6 +59,7 @@ builder_source_bzr_finalize (GObject *object)
|
||||||
BuilderSourceBzr *self = (BuilderSourceBzr *)object;
|
BuilderSourceBzr *self = (BuilderSourceBzr *)object;
|
||||||
|
|
||||||
g_free (self->url);
|
g_free (self->url);
|
||||||
|
g_free (self->revision);
|
||||||
|
|
||||||
G_OBJECT_CLASS (builder_source_bzr_parent_class)->finalize (object);
|
G_OBJECT_CLASS (builder_source_bzr_parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
|
@ -75,6 +78,10 @@ builder_source_bzr_get_property (GObject *object,
|
||||||
g_value_set_string (value, self->url);
|
g_value_set_string (value, self->url);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PROP_REVISION:
|
||||||
|
g_value_set_string (value, self->revision);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
}
|
}
|
||||||
|
@ -95,6 +102,11 @@ builder_source_bzr_set_property (GObject *object,
|
||||||
self->url = g_value_dup_string (value);
|
self->url = g_value_dup_string (value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PROP_REVISION:
|
||||||
|
g_free (self->revision);
|
||||||
|
self->revision = g_value_dup_string (value);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
}
|
}
|
||||||
|
@ -210,6 +222,14 @@ builder_source_bzr_extract (BuilderSource *source,
|
||||||
"branch", "--stacked", mirror_dir_path, dest_path, "--use-existing-dir", NULL))
|
"branch", "--stacked", mirror_dir_path, dest_path, "--use-existing-dir", NULL))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
if (self->revision)
|
||||||
|
{
|
||||||
|
g_autofree char *revarg = g_strdup_printf ("-r%s", self->revision);
|
||||||
|
if (!bzr (dest, NULL, error,
|
||||||
|
"revert", revarg, NULL))
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -223,6 +243,7 @@ builder_source_bzr_checksum (BuilderSource *source,
|
||||||
g_autoptr(GError) error = NULL;
|
g_autoptr(GError) error = NULL;
|
||||||
|
|
||||||
builder_cache_checksum_str (cache, self->url);
|
builder_cache_checksum_str (cache, self->url);
|
||||||
|
builder_cache_checksum_str (cache, self->revision);
|
||||||
|
|
||||||
current_commit = get_current_commit (self, context, &error);
|
current_commit = get_current_commit (self, context, &error);
|
||||||
if (current_commit)
|
if (current_commit)
|
||||||
|
@ -252,6 +273,13 @@ builder_source_bzr_class_init (BuilderSourceBzrClass *klass)
|
||||||
"",
|
"",
|
||||||
NULL,
|
NULL,
|
||||||
G_PARAM_READWRITE));
|
G_PARAM_READWRITE));
|
||||||
|
g_object_class_install_property (object_class,
|
||||||
|
PROP_REVISION,
|
||||||
|
g_param_spec_string ("revision",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
NULL,
|
||||||
|
G_PARAM_READWRITE));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -328,6 +328,10 @@
|
||||||
<term><option>url</option></term>
|
<term><option>url</option></term>
|
||||||
<listitem><para>URL of the bzr repostiory</para></listitem>
|
<listitem><para>URL of the bzr repostiory</para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
<varlistentry>
|
||||||
|
<term><option>revision</option></term>
|
||||||
|
<listitem><para>A specific revision to use in the branch</para></listitem>
|
||||||
|
</varlistentry>
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><option>dest</option></term>
|
<term><option>dest</option></term>
|
||||||
<listitem><para>Directory inside the source dir where the repository will be checked out.</para></listitem>
|
<listitem><para>Directory inside the source dir where the repository will be checked out.</para></listitem>
|
||||||
|
|
Loading…
Reference in New Issue