Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/bockbuild.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexis Christoforides <alexis@thenull.net>2017-02-10 06:30:39 +0300
committerAlexis Christoforides <alexis@thenull.net>2017-02-10 06:31:15 +0300
commite5fba73fd22b91de869a046f0db7f3d0f369e8a2 (patch)
treeebe379ad00ab426128e4b06ba087df1c122886c4
parentb536c39231d4cd0cda51bd31706c50cebe9c9859 (diff)
Support for “shadow copying”, which is just replicating a directory tree with hardlinks.
-rwxr-xr-xbockbuild.py20
-rw-r--r--bockbuild/package.py27
-rw-r--r--bockbuild/util/util.py1
3 files changed, 38 insertions, 10 deletions
diff --git a/bockbuild.py b/bockbuild.py
index 7a58c3f..953c1cf 100755
--- a/bockbuild.py
+++ b/bockbuild.py
@@ -73,20 +73,20 @@ class Bockbuild:
self.resources = set([os.path.realpath(
os.path.join(self.root, 'packages'))]) # list of paths on where to look for packages, patches, etc.
- self.state_root = self.root # root path for all storage; artifacts, build I/O, cache, storage and output
+ config.state_root = self.root # root path for all storage; artifacts, build I/O, cache, storage and output
config.protected_git_repos.append (self.root)
config.absolute_root = os.path.commonprefix([self.root, self.execution_root])
- self.build_root = os.path.join(self.state_root, 'builds')
- self.staged_prefix = os.path.join(self.state_root, 'stage')
- self.toolchain_root = os.path.join(self.state_root, 'toolchain')
- self.artifact_root = os.path.join(self.state_root, 'artifacts')
- self.package_root = os.path.join(self.state_root, 'distribution')
- self.scratch = os.path.join(self.state_root, 'scratch')
- self.logs = os.path.join(self.state_root, 'logs')
- self.env_file = os.path.join(self.state_root, 'last-successful-build.env')
+ self.build_root = os.path.join(config.state_root, 'builds')
+ self.staged_prefix = os.path.join(config.state_root, 'stage')
+ self.toolchain_root = os.path.join(config.state_root, 'toolchain')
+ self.artifact_root = os.path.join(config.state_root, 'artifacts')
+ self.package_root = os.path.join(config.state_root, 'distribution')
+ self.scratch = os.path.join(config.state_root, 'scratch')
+ self.logs = os.path.join(config.state_root, 'logs')
+ self.env_file = os.path.join(config.state_root, 'last-successful-build.env')
self.source_cache = os.getenv('BOCKBUILD_SOURCE_CACHE') or os.path.realpath(
- os.path.join(self.state_root, 'cache'))
+ os.path.join(config.state_root, 'cache'))
self.cpu_count = get_cpu_count()
self.host = get_host()
self.uname = backtick('uname -a')
diff --git a/bockbuild/package.py b/bockbuild/package.py
index b024330..e2d25a3 100644
--- a/bockbuild/package.py
+++ b/bockbuild/package.py
@@ -774,6 +774,33 @@ class Package:
else:
warn("lipo: 32-bit version of file %s not found" % file)
+ #creates a deep hardlink copy of a directory
+ def shadow_copy (self, source, dest):
+ if os.path.commonprefix ([source, config.state_root]) == source:
+ print 'this repo includes state dir'
+ if os.path.exists(dest):
+ error ('Destination directory must not exist')
+
+ stateroot_parent = os.path.dirname (config.state_root)
+ stateroot_name = os.path.basename (config.state_root)
+ stateroot_found = False
+
+ for root, subdirs, filelist in os.walk (source):
+ relpath = os.path.relpath(root, source) # e.g. 'lib/mystuff'
+ destpath = os.path.join(dest, relpath)
+ os.makedirs(destpath)
+ #print relpath
+ if not stateroot_found and root == stateroot_parent:
+ print len(subdirs)
+ subdirs [:] = [dir for dir in subdirs if dir != stateroot_name]
+ print len(subdirs)
+ stateroot_found = True
+ for file in filelist:
+ fullpath = os.path.join (root, file)
+ os.link (fullpath, os.path.join (destpath, file))
+
+ finish(exit_codes.SUCCESS)
+
def copy_side_by_side(self, src_dir, dest_dir, bin_subdir, suffix, orig_suffix=None):
def add_suffix(filename, sfx):
fileparts = filename.split('.', 1)
diff --git a/bockbuild/util/util.py b/bockbuild/util/util.py
index 6f44259..e1d9cf5 100644
--- a/bockbuild/util/util.py
+++ b/bockbuild/util/util.py
@@ -42,6 +42,7 @@ class config:
verbose = False
protected_git_repos = [] # we do not allow modifying behavior on our profile repo or bockbuild repo.
absolute_root = None # there is no file resolution beneath this path. Displayed paths are shortened by omitting this segment.
+ state_root = None
exit_code = exit_codes.NOTSET
class CommandException (Exception): # shell command failure