# HG changeset patch # User Aleksej Bobylev # Date 1496955089 -10800 # Node ID 71118129435e86d6b6177020daf56228cb989e7d # Parent 1caffc1900577524da16356efa2abc17cb0ca6ff cooker: try to handle removing stuff after syncing wok with wok-hg. diff -r 1caffc190057 -r 71118129435e cooker --- a/cooker Thu Jun 08 19:47:40 2017 +0300 +++ b/cooker Thu Jun 08 23:51:29 2017 +0300 @@ -528,7 +528,7 @@ # clean DB as well as log file. cd $wok for pkg in *; do - if [ ! -d "${wok}-hg/$pkg" ]; then + if [ ! -d "$wok-hg/$pkg" ]; then echo "Removing package: $pkg" | log_commits if [ -s $wok/$pkg/receipt ]; then . $wok/$pkg/receipt @@ -537,6 +537,21 @@ rm -rf $wok/$pkg $LOGS/$pkg.log sed -i "/^${pkg}$/"d $blocked $broken $commits.tmp fi + if [ -d "$wok/$pkg/stuff" ]; then + if [ ! -d "$wok-hg/$pkg/stuff" ]; then + echo "Removing stuff: $pkg/stuff" | log_commits + echo "rm -rf $wok/$pkg/stuff" | log_commits # just for test now + else + for stuff_file in $(cd $wok/$pkg/stuff; find \( -type f -o -type l \) ); do + if [ ! -f "$wok-hg/$pkg/stuff/$stuff_file" -a \ + ! -h "$wok-hg/$pkg/stuff/$stuff_file" ]; then + echo "Removing file from stuff: $wok/$pkg/stuff/$stuff_file" | log_commits + echo "rm -f $wok/$pkg/stuff/$stuff_file" | log_commits # just for test now + echo "rmdir --parents --ignore-fail-on-non-empty $(dirname "$wok/$pkg/stuff/$stuff_file")" | log_commits # just for test now + fi + done + fi + fi done # Keep previous commit and discard duplicate lines