Debian source package diffs cannot represent that a file should
be executable. This is a problem for us if a patch adds a script
which is invoked directly during the build, as happened with a
recent stable update for 4.14. Update gen-auto-reconstruct to
detect this situation and restore the execute permissions in the
reconstruct script. Exclude the debian packaging directories as
the scripts here already account for the loss of execute
permissions.
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
echo "rm -f '$name'"
done
+ # Identify files with execute permissions added since the proffered tag.
+ git diff "$tag.." --raw --no-renames | awk -F '[: \t]' '{print $2, $3, $NF }' | \
+ while IFS=" " read old new name
+ do
+ # Exclude files in debian* directories
+ if [[ "$name" =~ ^debian ]]; then
+ continue
+ fi
+
+ old=$( printf "0%s" $old )
+ new=$( printf "0%s" $new )
+ changed=$(( (old ^ new) & 0111 ))
+ if [ "$changed" -ne 0 ]; then
+ echo "chmod +x '$name'"
+ fi
+ done
+
# All done, make sure this does not complete in error.
echo "exit 0"
) >"$reconstruct"