Browse code

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

Doug Hellmann authored on 2013/09/07 04:30:22
Showing 1 changed files
... ...
@@ -1216,7 +1216,10 @@ function setup_develop() {
1216 1216
     echo "cd $REQUIREMENTS_DIR; $SUDO_CMD python update.py $project_dir"
1217 1217
 
1218 1218
     # Don't update repo if local changes exist
1219
-    if (cd $project_dir && git diff --quiet); then
1219
+    (cd $project_dir && git diff --quiet)
1220
+    local update_requirements=$?
1221
+
1222
+    if [ $update_requirements -eq 0 ]; then
1220 1223
         (cd $REQUIREMENTS_DIR; \
1221 1224
             $SUDO_CMD python update.py $project_dir)
1222 1225
     fi
... ...
@@ -1224,6 +1227,11 @@ function setup_develop() {
1224 1224
     pip_install -e $project_dir
1225 1225
     # ensure that further actions can do things like setup.py sdist
1226 1226
     safe_chown -R $STACK_USER $1/*.egg-info
1227
+
1228
+    # Undo requirements changes, if we made them
1229
+    if [ $update_requirements -eq 0 ]; then
1230
+        (cd $project_dir && git checkout -- requirements.txt test-requirements.txt setup.py)
1231
+    fi
1227 1232
 }
1228 1233
 
1229 1234