Skip to content

Commit

Permalink
More fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Robert (Bobby) Evans <[email protected]>
  • Loading branch information
revans2 committed Oct 14, 2024
1 parent 3971af0 commit 0f45ab0
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 15 deletions.
10 changes: 6 additions & 4 deletions build/apply-patches
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,11 @@ fi

CHANGED_FILES=$(git status --porcelain --untracked-files=no)

if [ \( -s "$FULLY_PATCHED_FILE" \) -a \( -n "$CHANGED_FILES" \) ] ; then
echo "Patches appear to have been applied already"
exit 0
if [ \( -s "$FULLY_PATCHED_FILE" \) -a \( -n "$CHANGED_FILES" \) ] ; then
if git apply -R --check "$FULLY_PATCHED_FILE" ; then
echo "Patches appear to have been applied already"
exit 0
fi
fi

if [ -n "$CHANGED_FILES" ] ; then
Expand All @@ -64,7 +66,7 @@ fi

find "$PATCH_DIR" -maxdepth 1 -type f -print0 | sort -zV | while IFS= read -r -d '' file; do
echo "patching with: $file"
patch --no-backup-if-mismatch -f -t --reject-file=- -p1 -i "$file"
git apply -v "$file"
done

git diff > "$FULLY_PATCHED_FILE"
Expand Down
25 changes: 15 additions & 10 deletions build/unapply-patches
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,23 @@ fi
CHANGED_FILES=$(git status --porcelain --untracked-files=no)

if [ \( -s "$FULLY_PATCHED_FILE" \) -a \( -n "$CHANGED_FILES" \) ] ; then
echo "Patches appear to have been applied, so going to remove them"
patch -R --no-backup-if-mismatch -f -t --reject-file=- -p1 -i "$FULLY_PATCHED_FILE"
rm -f "$FULLY_PATCHED_FILE"

# Check for modifications, again
if [ -n "$(git status --porcelain --untracked-files=no)" ] ; then
echo "Error: CUDF repository has uncommitted changes. You might want to clean in manually if you know that is expected"
git status --porcelain --untracked-files=no
if git apply --check -R "$FULLY_PATCHED_FILE"; then
echo "Patches appear to have been applied, so going to remove them"
git apply -R -v "$FULLY_PATCHED_FILE"
rm -f "$FULLY_PATCHED_FILE"

# Check for modifications, again
if [ -n "$(git status --porcelain --untracked-files=no)" ] ; then
echo "Error: CUDF repository has uncommitted changes. You might want to clean in manually if you know that is expected"
git status --porcelain --untracked-files=no
exit 1
fi

exit 0
else
echo "Files are changed, but in a way where the full path file does not apply to remove them $FULL_PATCHED_FILE"
exit 1
fi

exit 0
fi

if [ -n "$CHANGED_FILES" ] ; then
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
<submodule.check.skip>false</submodule.check.skip>
<!-- This skips applying and unapplying patchs to CUDF. Be aware that if you
try to build the main jar without patching CUDF it could result in build
failures becasue the two often need to be in sync with each other. So use
failures because the two often need to be in sync with each other. So use
at your own risk. -->
<submodule.patch.skip>false</submodule.patch.skip>
<antrun.version>3.0.0</antrun.version>
Expand Down

0 comments on commit 0f45ab0

Please sign in to comment.