aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xgbp/scripts/buildpackage.py2
-rw-r--r--gbp/scripts/buildpackage_rpm.py2
-rw-r--r--gbp/scripts/common/buildpackage.py19
3 files changed, 14 insertions, 9 deletions
diff --git a/gbp/scripts/buildpackage.py b/gbp/scripts/buildpackage.py
index 5354153..7638c85 100755
--- a/gbp/scripts/buildpackage.py
+++ b/gbp/scripts/buildpackage.py
@@ -804,7 +804,7 @@ def main(argv):
source = None
retval = 1
finally:
- drop_index()
+ drop_index(repo)
if not options.tag_only:
if options.export_dir and options.purge and not retval:
diff --git a/gbp/scripts/buildpackage_rpm.py b/gbp/scripts/buildpackage_rpm.py
index 889a863..fa5f76d 100644
--- a/gbp/scripts/buildpackage_rpm.py
+++ b/gbp/scripts/buildpackage_rpm.py
@@ -626,7 +626,7 @@ def main(argv):
gbp.log.err(err)
retval = 1
finally:
- drop_index()
+ drop_index(repo)
del_tmpdir()
if not options.tag_only:
diff --git a/gbp/scripts/common/buildpackage.py b/gbp/scripts/common/buildpackage.py
index 4facf68..e1edfb2 100644
--- a/gbp/scripts/common/buildpackage.py
+++ b/gbp/scripts/common/buildpackage.py
@@ -32,8 +32,6 @@ import gbp.log
index_name = "INDEX"
# when we want to reference the working copy in treeish context we call it:
wc_name = "WC"
-# index file name used to export working copy
-wc_index = ".git/gbp_index"
def sanitize_prefix(prefix):
@@ -172,14 +170,21 @@ def dump_tree(repo, export_dir, treeish, with_submodules, recursive=True):
return True
+def wc_index(repo):
+ """Get path of the temporary index file used for exporting working copy"""
+ return os.path.join(repo.git_dir, "gbp_index")
+
+
def write_wc(repo, force=True):
"""write out the current working copy as a treeish object"""
- repo.add_files(repo.path, force=force, index_file=wc_index)
- tree = repo.write_tree(index_file=wc_index)
+ index_file = wc_index(repo)
+ repo.add_files(repo.path, force=force, index_file=index_file)
+ tree = repo.write_tree(index_file=index_file)
return tree
-def drop_index():
+def drop_index(repo):
"""drop our custom index"""
- if os.path.exists(wc_index):
- os.unlink(wc_index)
+ index_file = wc_index(repo)
+ if os.path.exists(index_file):
+ os.unlink(index_file)