Skip to content

Commit

Permalink
Make the backports use patch files, should be easier to add new versi…
Browse files Browse the repository at this point in the history
…ons that way
StollD committed Oct 13, 2018

Verified

This commit was signed with the committer’s verified signature.
makenowjust Hiroya Fujinami
1 parent 82abd93 commit 8f5b4cd
Showing 3 changed files with 58 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -249,3 +249,7 @@ $RECYCLE.BIN/

# Mac crap
.DS_Store

# Patching
*.orig
*.rej
44 changes: 44 additions & 0 deletions tools/backport/apply-patches.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash

BACKPORT=$1

# Check if we are in the right directory
if [ ! -d "src" ]
then
echo "The command must be run from the top level directory!"
fi

# Download the patches
wget -O backport.zip https://github.com/Kopernicus/Kopernicus-Backport/archive/ksp-$BACKPORT.zip
unzip backport.zip
mv Kopernicus-Backport-ksp-$BACKPORT ksp-$BACKPORT

# Apply the patches
find ksp-$BACKPORT -path "*.patch" | while read patchfile
do
file=${patchfile#"ksp-$BACKPORT/"}
file=${file%".patch"}
patch -tuf $file $patchfile
done

# Which Kopernicus version is this based on?
source ksp-$BACKPORT/backport.sh

# Clean up the dependencies
rm build/GameData/ModuleManager.*.dll
rm -r build/GameData/ModularFlightIntegrator
rm -r build/GameData/Kopernicus/Shaders

# Download the referenced Kopernicus
wget -O kopernicus.zip https://github.com/Kopernicus/Kopernicus/releases/download/release-$VERSION/Kopernicus-$VERSION.zip
unzip kopernicus.zip -d ksp-$BACKPORT

# Move the new dependencies
cp ksp-$BACKPORT/GameData/ModuleManager.*.dll build/GameData/
cp -r ksp-$BACKPORT/GameData/ModularFlightIntegrator build/GameData/
cp -r ksp-$BACKPORT/GameData/Kopernicus/Shaders build/GameData/Kopernicus

# Cleanup
rm backport.zip
rm kopernicus.zip
rm -r ksp-$BACKPORT
10 changes: 10 additions & 0 deletions tools/backport/generate-patches.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

KOPERNICUS=$1
BACKPORT=$2

find $BACKPORT -type f -not -path "*.git*" | while read file
do
path=${file#"$BACKPORT/"}
diff -u $KOPERNICUS/$path $BACKPORT/$path > $BACKPORT/$path.patch
done

0 comments on commit 8f5b4cd

Please sign in to comment.