[PATCH] ostbuild: don't work on the real repository for local URIs
- From: Giovanni Campagna <scampa giovanni gmail com>
- To: ostree-list gnome org
- Cc: Giovanni Campagna <gcampagna src gnome org>
- Subject: [PATCH] ostbuild: don't work on the real repository for local URIs
- Date: Tue, 31 Jul 2012 18:56:38 +0200
If a repository is specified as local:, still create a mirror in
the ostree mirror-dir and temporary checkouts as needed. This
avoids patching ending up in the upstream repository or conflicting
with non-committed work.
---
src/ostbuild/pyostbuild/buildutil.py | 2 --
src/ostbuild/pyostbuild/builtin_checkout.py | 33 +++++++--------------------
src/ostbuild/pyostbuild/vcs.py | 3 ---
3 files changed, 8 insertions(+), 30 deletions(-)
diff --git a/src/ostbuild/pyostbuild/buildutil.py b/src/ostbuild/pyostbuild/buildutil.py
index 94ad63b..11e90f6 100755
--- a/src/ostbuild/pyostbuild/buildutil.py
+++ b/src/ostbuild/pyostbuild/buildutil.py
@@ -48,8 +48,6 @@ def parse_src_key(srckey):
def get_mirrordir(mirrordir, keytype, uri, prefix=''):
- if keytype != 'git':
- fatal("Unhandled keytype '%s' for uri '%s'" % (keytype, uri))
parsed = urlparse.urlsplit(uri)
return os.path.join(mirrordir, prefix, keytype, parsed.scheme, parsed.netloc, parsed.path[1:])
diff --git a/src/ostbuild/pyostbuild/builtin_checkout.py b/src/ostbuild/pyostbuild/builtin_checkout.py
index 153ea8a..4313cee 100755
--- a/src/ostbuild/pyostbuild/builtin_checkout.py
+++ b/src/ostbuild/pyostbuild/builtin_checkout.py
@@ -64,34 +64,17 @@ class OstbuildCheckout(builtins.Builtin):
component = self.get_expanded_component(component_name)
(keytype, uri) = buildutil.parse_src_key(component['src'])
- is_local = (keytype == 'local')
-
- if is_local:
- if args.checkoutdir:
- checkoutdir = args.checkoutdir
- # Kind of a hack, but...
- if os.path.islink(checkoutdir):
- os.unlink(checkoutdir)
- if args.overwrite and os.path.isdir(checkoutdir):
- shutil.rmtree(checkoutdir)
- os.symlink(uri, checkoutdir)
- else:
- checkoutdir = uri
+ if args.checkoutdir:
+ checkoutdir = args.checkoutdir
else:
- if args.checkoutdir:
- checkoutdir = args.checkoutdir
- else:
- checkoutdir = os.path.join(os.getcwd(), component_name)
- fileutil.ensure_parent_dir(checkoutdir)
- vcs.get_vcs_checkout(self.mirrordir, keytype, uri, checkoutdir,
- component['revision'],
- overwrite=args.overwrite)
+ checkoutdir = os.path.join(os.getcwd(), component_name)
+ fileutil.ensure_parent_dir(checkoutdir)
+ vcs.get_vcs_checkout(self.mirrordir, keytype, uri, checkoutdir,
+ component['revision'],
+ overwrite=args.overwrite)
if args.clean:
- if is_local:
- log("note: ignoring --clean argument due to \"local:\" specification")
- else:
- vcs.clean(keytype, checkoutdir)
+ vcs.clean(keytype, checkoutdir)
patches = component.get('patches')
if patches is not None:
diff --git a/src/ostbuild/pyostbuild/vcs.py b/src/ostbuild/pyostbuild/vcs.py
index b8b9ff4..ee6caf6 100755
--- a/src/ostbuild/pyostbuild/vcs.py
+++ b/src/ostbuild/pyostbuild/vcs.py
@@ -25,7 +25,6 @@ from . import buildutil
from .ostbuildlog import log, fatal
def get_mirrordir(mirrordir, keytype, uri, prefix=''):
- assert keytype == 'git'
parsed = urlparse.urlsplit(uri)
return os.path.join(mirrordir, prefix, keytype, parsed.scheme, parsed.netloc, parsed.path[1:])
@@ -46,7 +45,6 @@ def _fixup_submodule_references(mirrordir, cwd):
def get_vcs_checkout(mirrordir, keytype, uri, dest, branch, overwrite=True):
module_mirror = get_mirrordir(mirrordir, keytype, uri)
- assert keytype == 'git'
checkoutdir_parent=os.path.dirname(dest)
if not os.path.isdir(checkoutdir_parent):
os.makedirs(checkoutdir_parent)
@@ -76,7 +74,6 @@ def get_vcs_checkout(mirrordir, keytype, uri, dest, branch, overwrite=True):
return dest
def clean(keytype, checkoutdir):
- assert keytype in ('git', 'dirty-git')
run_sync(['git', 'clean', '-d', '-f', '-x'], cwd=checkoutdir)
def parse_src_key(srckey):
--
1.7.10.4
[
Date Prev][Date Next] [
Thread Prev][Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]