diff options
author | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2014-12-01 11:36:52 +0200 |
---|---|---|
committer | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2014-12-16 09:55:14 +0200 |
commit | edcfc9498a790bd3d3c436082ac144798fb7a8f5 (patch) | |
tree | d3580d28c73ab149935bf4dcfeedfecaacc00204 /gbp | |
parent | 797bd96d945d17d3869ea7fe27a7abc98fb91195 (diff) |
pq: allow running actions in repo subdir
This should make the usage of gbp-pq more flexible and prevent mistakes
caused by e.g. running gbp-pq import under some subdirectory.
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Diffstat (limited to 'gbp')
-rwxr-xr-x | gbp/scripts/pq.py | 4 | ||||
-rwxr-xr-x | gbp/scripts/pq_rpm.py | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/gbp/scripts/pq.py b/gbp/scripts/pq.py index c32a36f..af9c90d 100755 --- a/gbp/scripts/pq.py +++ b/gbp/scripts/pq.py @@ -353,6 +353,10 @@ def main(argv): gbp.log.err("%s is not a git repository" % (os.path.abspath('.'))) return 1 + if os.path.abspath('.') != repo.path: + gbp.log.warn("Switching to topdir before running commands") + os.chdir(repo.path) + try: current = repo.get_branch() if action == "export": diff --git a/gbp/scripts/pq_rpm.py b/gbp/scripts/pq_rpm.py index 5166b5c..98b979f 100755 --- a/gbp/scripts/pq_rpm.py +++ b/gbp/scripts/pq_rpm.py @@ -455,6 +455,10 @@ def main(argv): gbp.log.err("%s is not a git repository" % (os.path.abspath('.'))) return 1 + if os.path.abspath('.') != repo.path: + gbp.log.warn("Switching to topdir before running commands") + os.chdir(repo.path) + try: # Create base temporary directory for this run options.tmp_dir = tempfile.mkdtemp(dir=options.tmp_dir, |