Skip to content

Creating source code patches

Bruno Santos edited this page Aug 16, 2024 · 10 revisions

Introduction

This page is currently just outlining the steps used to create the patch files that are provided with each release, for developers to have an easier time to see what's different between OpenFOAM and the ports provided by the blueCFD-Core project.

How to create a patch file

Due to the several changes made to ensure that OpenFOAM can be built directly on Windows, it requires a more detailed use of git diff in order to properly catch all of the changes made.

For example:

  • To create the patches between the branches blueCFD-Core-4.x and OpenFOAM-4.x, within the folder OpenFOAM-4.x, checkout branch blueCFD-Core-4.x and use the following detailed analysis command line:

    git diff -M20% --patience -C20% --find-copies-harder -l1000000 OpenFOAM-4.x
    
  • Similarly can be done for the folder ThirdParty-4.x, but in this case we don't need to pick-up file renames in detail, but we do need to ignore files that were deleted, namely the ParaView-5.0.1 folder that isn't used on Windows at the moment. So first make sure to checkout the branch blueCFD-Core-4.x and then use the following command line for getting the main differences:

    git diff --patience --diff-filter=ACMRTUXB OpenFOAM-4.x
    

Example case: Creating detailed patch files for OpenFOAM 4.x vs blueCFD-Core 2016-1

Commands used for getting patches:

cd OpenFOAM-4.x
git checkout blueCFD-Core-4.x
git diff -M20% --patience -C20% --find-copies-harder -l1000000 7dfa780c481b8b79b1ee4d5bcf3e6b839a5ef017 > ../OpenFOAM-4.x...blueCFD-Core-4.x__blueCFD-Core-2016-1.patch

cd ../ThirdParty-4.x
git checkout blueCFD-Core-4.x
git diff --patience --diff-filter=ACMRTUXB OpenFOAM-4.x > ../ThirdParty-4.x...blueCFD-Core-4.x__blueCFD-Core-2016-1.patch

cd ..
gzip < OpenFOAM-4.x...blueCFD-Core-4.x__blueCFD-Core-2016-1.patch > OpenFOAM-4.x...blueCFD-Core-4.x__blueCFD-Core-2016-1.patch.gz
gzip < ThirdParty-4.x...blueCFD-Core-4.x__blueCFD-Core-2016-1.patch > ThirdParty-4.x...blueCFD-Core-4.x__blueCFD-Core-2016-1.patch.gz

Example case: Creating detailed patch files for OpenFOAM 5.x vs blueCFD-Core 2017-2

Commands used for getting patches:

cd OpenFOAM-5.x
git checkout blueCFD-Core-5.x
git diff -M20% --patience -C20% --find-copies-harder -l1000000 OpenFOAM-5.x > ../patches/OpenFOAM-5.x...blueCFD-Core-5.x__blueCFD-Core-2017-2.patch

cd ../ThirdParty-5.x
git checkout blueCFD-Core-5.x
git diff --patience --diff-filter=ACMRTUXB OpenFOAM-5.x > ../patches/ThirdParty-5.x...blueCFD-Core-5.x__blueCFD-Core-2017-2.patch

cd ../patches/
gzip < OpenFOAM-5.x...blueCFD-Core-5.x__blueCFD-Core-2017-2.patch > OpenFOAM-5.x...blueCFD-Core-5.x__blueCFD-Core-2017-2.patch.gz
gzip < ThirdParty-5.x...blueCFD-Core-5.x__blueCFD-Core-2017-2.patch > ThirdParty-5.x...blueCFD-Core-5.x__blueCFD-Core-2017-2.patch.gz

sha1sum OpenFOAM-5.x...blueCFD-Core-5.x__blueCFD-Core-2017-2.patch.gz
sha1sum ThirdParty-5.x...blueCFD-Core-5.x__blueCFD-Core-2017-2.patch.gz

Example case: Creating detailed patch files for OpenFOAM 8 vs blueCFD-Core 2020-1

Commands used for getting patches:

cd OpenFOAM-8
git checkout blueCFD-Core-8
git diff -M20% --patience -C20% --find-copies-harder -l1000000 OpenFOAM-8 > ../patches/OpenFOAM-8...blueCFD-Core-8__blueCFD-Core-2020-1.patch

cd ../ThirdParty-8
git checkout blueCFD-Core-8
git diff --patience --diff-filter=ACMRTUXB OpenFOAM-8 > ../patches/ThirdParty-8...blueCFD-Core-8__blueCFD-Core-2020-1.patch

cd ../patches/
gzip < OpenFOAM-8...blueCFD-Core-8__blueCFD-Core-2020-1.patch > OpenFOAM-8...blueCFD-Core-8__blueCFD-Core-2020-1.patch.gz
gzip < ThirdParty-8...blueCFD-Core-8__blueCFD-Core-2020-1.patch > ThirdParty-8...blueCFD-Core-8__blueCFD-Core-2020-1.patch.gz

sha1sum OpenFOAM-8...blueCFD-Core-8__blueCFD-Core-2020-1.patch.gz
sha1sum ThirdParty-8...blueCFD-Core-8__blueCFD-Core-2020-1.patch.gz

Example case: Creating detailed patch files for OpenFOAM 12 vs blueCFD-Core 2024-1

Commands used for getting patches:

OFV=OpenFOAM-12
TPV=ThirdParty-12
BCV=blueCFD-Core-12
BCMV=blueCFD-Core-2024-1

cd ${OFV}
git checkout ${BCV}
git diff -M20% --patience -C20% --find-copies-harder -l1000000 ${OFV} > ../patches/${OFV}...${BCV}__${BCMV}.patch

cd ../${TPV}
git checkout ${BCV}
git diff --patience --diff-filter=ACMRTUXB ${OFV} > ../patches/${TPV}...${BCV}__${BCMV}.patch

cd ../patches/
gzip < ${OFV}...${BCV}__${BCMV}.patch > ${OFV}...${BCV}__${BCMV}.patch.gz
gzip < ${TPV}...${BCV}__${BCMV}.patch > ${TPV}...${BCV}__${BCMV}.patch.gz

sha1sum ${OFV}...${BCV}__${BCMV}.patch.gz
sha1sum ${TPV}...${BCV}__${BCMV}.patch.gz