From c3431bfdd90b3d149b119038d19f6a22bc278dc0 Mon Sep 17 00:00:00 2001 From: Doug Hellmann Date: Fri, 6 Sep 2013 15:30:22 -0400 Subject: [PATCH] Clean up automated changes to requirements Some of us like to reuse sandboxes, and keep them up to date. This is very difficult to do if devstack leaves modifications to requirements.txt files after a run, since 'git pull' may refuse to overwrite those changes. This modification has devstack undo the changes to the requirements files, to leave the sandbox in a clean state again. Change-Id: Ia2d928ade8141b59b56a2c4548d760bf6911a3e5 --- functions | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/functions b/functions index e1a5f4be3a..1c45851d91 100644 --- a/functions +++ b/functions @@ -1216,7 +1216,10 @@ function setup_develop() { echo "cd $REQUIREMENTS_DIR; $SUDO_CMD python update.py $project_dir" # Don't update repo if local changes exist - if (cd $project_dir && git diff --quiet); then + (cd $project_dir && git diff --quiet) + local update_requirements=$? + + if [ $update_requirements -eq 0 ]; then (cd $REQUIREMENTS_DIR; \ $SUDO_CMD python update.py $project_dir) fi @@ -1224,6 +1227,11 @@ function setup_develop() { pip_install -e $project_dir # ensure that further actions can do things like setup.py sdist safe_chown -R $STACK_USER $1/*.egg-info + + # Undo requirements changes, if we made them + if [ $update_requirements -eq 0 ]; then + (cd $project_dir && git checkout -- requirements.txt test-requirements.txt setup.py) + fi }