diff options
author | Aaron Bentley <abentley@panoramicfeedback.com> | 2005-05-19 16:40:33 +0000 |
---|---|---|
committer | Aaron Bentley <abentley@panoramicfeedback.com> | 2005-05-19 16:40:33 +0000 |
commit | a2c9b6f19c4e8669fa328757211b68fcd0243cf7 (patch) | |
tree | ae2344c3ff6675d91f36e7c8ff56a6fe7e425641 /libbe/arch.py | |
parent | 8a9a710c4044f3f27ca8d7f05482155a4bf254c3 (diff) | |
download | bugseverywhere-a2c9b6f19c4e8669fa328757211b68fcd0243cf7.tar.gz |
Distinguished between 'paranoid' and non-paranoid add-id
The paranoid adds are only used for the .be root. Paranoia is a big time-suck
on Arch trees, because they require a full inventory.
Diffstat (limited to 'libbe/arch.py')
-rw-r--r-- | libbe/arch.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/libbe/arch.py b/libbe/arch.py index e2d867f..3152073 100644 --- a/libbe/arch.py +++ b/libbe/arch.py @@ -89,7 +89,7 @@ def add_dir_rule(rule, dirname, root): inv_filename = os.path.join(dirname, '.arch-inventory') file(inv_filename, "ab").write(rule) if os.path.realpath(inv_filename) not in list_added(root): - add_id(inv_filename, no_force=True) + add_id(inv_filename, paranoid=False) def force_source(filename, root): rule = "source %s\n" % rel_filename(filename, root) @@ -97,10 +97,10 @@ def force_source(filename, root): if os.path.realpath(filename) not in list_added(root): raise CantAddFile(filename) -def add_id(filename, no_force=False): +def add_id(filename, paranoid=False): invoke_client("add-id", filename) root = tree_root(filename) - if os.path.realpath(filename) not in list_added(root) and not no_force: + if paranoid and os.path.realpath(filename) not in list_added(root): force_source(filename, root) @@ -112,29 +112,29 @@ def test_helper(type): dirname = os.path.join(t, ".boo") return dirname, t -def mkdir(path): +def mkdir(path, paranoid=False): """ >>> import shutil >>> dirname,t = test_helper("easy") - >>> mkdir(dirname) + >>> mkdir(dirname, paranoid=False) >>> assert os.path.realpath(dirname) in list_added(t) >>> assert not os.path.exists(os.path.join(t, ".arch-inventory")) >>> shutil.rmtree(t) >>> dirname,t = test_helper("tricky") - >>> mkdir(dirname) + >>> mkdir(dirname, paranoid=True) >>> assert os.path.realpath(dirname) in list_added(t) >>> assert os.path.exists(os.path.join(t, ".arch-inventory")) >>> shutil.rmtree(t) >>> dirname,t = test_helper("impossible") >>> try: - ... mkdir(dirname) + ... mkdir(dirname, paranoid=True) ... except CantAddFile, e: ... print "Can't add file" Can't add file >>> shutil.rmtree(t) """ os.mkdir(path) - add_id(path) + add_id(path, paranoid=paranoid) def set_file_contents(path, contents): add = not os.path.exists(path) |