diff options
author | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2012-10-25 09:25:25 +0300 |
---|---|---|
committer | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2014-06-05 14:20:04 +0300 |
commit | 9b3bc9416579b24d9f9ce0c1019369efe860efa2 (patch) | |
tree | 790c614f3edf0ec8cba3e37920c69a4cc9a53a97 | |
parent | f440810e850d3dcadcd7fc855ee3f6bea06ce303 (diff) | |
download | git-buildpackage-9b3bc9416579b24d9f9ce0c1019369efe860efa2.tar.gz git-buildpackage-9b3bc9416579b24d9f9ce0c1019369efe860efa2.tar.bz2 git-buildpackage-9b3bc9416579b24d9f9ce0c1019369efe860efa2.zip |
buildpackage: fix exporting of working copy when run from a subdir
Exporting sources failed when git-buildpackage was run from a
subdirectory of the git working directory because the path of the custom
index file was not handled correctly.
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
-rwxr-xr-x | gbp/scripts/buildpackage.py | 2 | ||||
-rw-r--r-- | gbp/scripts/common/buildpackage.py | 24 |
2 files changed, 14 insertions, 12 deletions
diff --git a/gbp/scripts/buildpackage.py b/gbp/scripts/buildpackage.py index 56e2afd2..b9f385b4 100755 --- a/gbp/scripts/buildpackage.py +++ b/gbp/scripts/buildpackage.py @@ -625,7 +625,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/common/buildpackage.py b/gbp/scripts/common/buildpackage.py index 1b03293c..f621e6c5 100644 --- a/gbp/scripts/common/buildpackage.py +++ b/gbp/scripts/common/buildpackage.py @@ -35,8 +35,6 @@ wc_names = {'WC': {'force': True, 'untracked': True}, 'WC.TRACKED': {'force': False, 'untracked': False}, 'WC.UNTRACKED': {'force': False, 'untracked': True}, 'WC.IGNORED': {'force': True, 'untracked': True}} -# index file name used to export working copy -wc_index = ".git/gbp_index" def sanitize_prefix(prefix): @@ -161,21 +159,25 @@ 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, untracked=True): """write out the current working copy as a treeish object""" - clone_index() - repo.add_files(repo.path, force=force, untracked=untracked, index_file=wc_index) - tree = repo.write_tree(index_file=wc_index) + clone_index(repo) + repo.add_files(repo.path, force=force, untracked=untracked, index_file=wc_index(repo)) + tree = repo.write_tree(index_file=wc_index(repo)) return tree -def drop_index(): +def drop_index(repo): """drop our custom index""" - if os.path.exists(wc_index): - os.unlink(wc_index) + if os.path.exists(wc_index(repo)): + os.unlink(wc_index(repo)) -def clone_index(): +def clone_index(repo): """Copy the current index file to our custom index file""" - indexfn = ".git/index" + indexfn = os.path.join(repo.git_dir, "index") if os.path.exists(indexfn): - shutil.copy2(indexfn, wc_index) + shutil.copy2(indexfn, wc_index(repo)) |