[gnome-ostree] ostbuild: allow specifying sources with paths instead of URIs
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-ostree] ostbuild: allow specifying sources with paths instead of URIs
- Date: Wed, 2 Jan 2013 20:12:16 +0000 (UTC)
commit e51b96a07d7bed03d249c1d1c03a49fb67f2770f
Author: Giovanni Campagna <gcampagna src gnome org>
Date: Wed Jan 2 02:19:46 2013 +0100
ostbuild: allow specifying sources with paths instead of URIs
git is able to optimize checkouts from paths using hardlinks, but it
disables that optimization when using file:/// URIs.
src/ostbuild/js/vcs.js | 22 ++++++++++++++--------
1 files changed, 14 insertions(+), 8 deletions(-)
---
diff --git a/src/ostbuild/js/vcs.js b/src/ostbuild/js/vcs.js
index 1f1dfee..e2f82ad 100644
--- a/src/ostbuild/js/vcs.js
+++ b/src/ostbuild/js/vcs.js
@@ -17,6 +17,7 @@
const Params = imports.params;
const Gio = imports.gi.Gio;
+const GLib = imports.gi.GLib;
const GSystem = imports.gi.GSystem;
const ProcUtil = imports.procutil;
@@ -25,15 +26,20 @@ const BuildUtil = imports.buildutil;
function getMirrordir(mirrordir, keytype, uri, params) {
params = Params.parse(params, {prefix: ''});
let colon = uri.indexOf('://');
- let scheme = uri.substr(0, colon);
- let rest = uri.substr(colon+3);
- let slash = rest.indexOf('/');
- let netloc = rest.substr(0, slash);
- let path = rest.substr(slash+1);
+ let scheme, rest;
+ if (colon >= 0) {
+ scheme = uri.substr(0, colon);
+ rest = uri.substr(colon+3);
+ } else {
+ scheme = 'file';
+ if (GLib.path_is_absolute(uri))
+ rest = uri.substr(1);
+ else
+ rest = uri;
+ }
let prefix = params.prefix ? params.prefix + '/' : '';
- return mirrordir.resolve_relative_path(prefix + keytype + '/' +
- scheme + '/' + netloc + '/' +
- path);
+ return mirrordir.resolve_relative_path(prefix + keytype + '/' +
+ scheme + '/' + rest);
}
function _fixupSubmoduleReferences(mirrordir, cwd, cancellable) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]