[gnome-ostree] Fix ostbuild for trees/ change
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-ostree] Fix ostbuild for trees/ change
- Date: Fri, 24 Aug 2012 03:36:23 +0000 (UTC)
commit 96233af520b790dd0611e7777a382b3c275af635
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Aug 23 21:53:34 2012 -0400
Fix ostbuild for trees/ change
ostbuild import-tree was failing for me, because the hand-rolled
realpath implementation was not working with the current link
pointing into a subdirectory. Fix that by using the real realpath.
parse_snapshot_from_current was missing the trees/ part in the path
that it constructs.
src/ostbuild/pyostbuild/builtins.py | 16 +++-------------
1 files changed, 3 insertions(+), 13 deletions(-)
---
diff --git a/src/ostbuild/pyostbuild/builtins.py b/src/ostbuild/pyostbuild/builtins.py
index 24e6025..8ebdec3 100755
--- a/src/ostbuild/pyostbuild/builtins.py
+++ b/src/ostbuild/pyostbuild/builtins.py
@@ -56,18 +56,8 @@ class Builtin(object):
def _find_active_branch(self):
if self.ostree_dir is None:
return (None, None)
- current_path = os.path.join(self.ostree_dir, 'current')
- while True:
- try:
- target = os.path.join(self.ostree_dir, current_path)
- stbuf = os.lstat(target)
- except OSError, e:
- current_path = None
- break
- if not stat.S_ISLNK(stbuf.st_mode):
- break
- current_path = os.readlink(target)
- if current_path is not None:
+ current_path = os.path.realpath(os.path.join(self.ostree_dir, 'current'))
+ if os.path.isdir(current_path):
basename = os.path.basename(current_path)
return basename.rsplit('-', 1)
else:
@@ -218,7 +208,7 @@ class Builtin(object):
fatal("Repository '%s' doesn't exist" % (repo_path, ))
if self.active_branch is None:
fatal("No \"current\" link found")
- tree_path = os.path.join(self.ostree_dir, self.active_branch)
+ tree_path = os.path.join(self.ostree_dir, "trees/", self.active_branch)
self.parse_snapshot(None, os.path.join(tree_path, 'contents.json'))
def execute(self, args):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]