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> | 2013-04-03 09:46:11 +0300 |
commit | b348e3d071c04e2ce175da256920a0d24d213815 (patch) | |
tree | 4853f1289b043c754cfd7a520fe0022aeba866ad | |
parent | 50b1950d0f315c61f2b9b56fa1b52f8bf51efd8e (diff) | |
download | git-buildpackage-b348e3d071c04e2ce175da256920a0d24d213815.tar.gz git-buildpackage-b348e3d071c04e2ce175da256920a0d24d213815.tar.bz2 git-buildpackage-b348e3d071c04e2ce175da256920a0d24d213815.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 | 25 |
2 files changed, 14 insertions, 13 deletions
diff --git a/gbp/scripts/buildpackage.py b/gbp/scripts/buildpackage.py index cc0e6e25..fcc4e2a4 100755 --- a/gbp/scripts/buildpackage.py +++ b/gbp/scripts/buildpackage.py @@ -577,7 +577,7 @@ def main(argv): gbp.log.err(err) 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 759a90b1..6483218d 100644 --- a/gbp/scripts/common/buildpackage.py +++ b/gbp/scripts/common/buildpackage.py @@ -34,9 +34,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 git_archive_submodules(repo, treeish, output, prefix, comp_type, comp_level, comp_opts, format='tar'): """ @@ -148,21 +145,25 @@ def dump_tree(repo, export_dir, treeish, with_submodules): 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)) |