Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not apply patches if sub non-git repo is located in a git repo. #545

Merged
merged 4 commits into from
Jul 9, 2024

Conversation

haonanya
Copy link
Contributor

@haonanya haonanya commented Jul 5, 2024

follow up #539.
Also add an option to control patch apply which is default on. Pass -DAPPLY_PATCHES=OFF will skip patch apply process.

@@ -97,19 +97,20 @@ function(apply_patches repo_dir patches_dir base_revision target_branch ret)
return()
endif()

message(STATUS "[OPENCL-CLANG] Patching repository ${repo_dir}")
# Check if it's a git repo
if(EXISTS "${repo_dir}/.git")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

@haonanya haonanya Jul 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it seems git rev-parse --is-inside-work-tree can't work. I copy opencl-clang source code to /export/users/haonanya/ocl-clang/llvm/projects/, and git rev-parse --is-inside-work-tree return true.

[haonanya@shliclel4059 opencl-clang]$ git rev-parse --is-inside-work-tree
true
[haonanya@shliclel4059 opencl-clang]$ pwd
/export/users/haonanya/ocl-clang/llvm/projects/opencl-clang

So when llvm is as a sub-dir in a repo, the command can't detect it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see

Copy link
Contributor

@wenju-he wenju-he left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@th0ma7
Copy link

th0ma7 commented Jul 6, 2024

Tested and confirmed working as expected, I can now build with plain source tar ball and it stoped affecting my running (and unrelated) git repository.

Still I suggest adding a cmake variable to enforce not applying patches and/or using non-git repository sources as it could serve other means as well.

@haonanya haonanya requested review from cdai2 and wenju-he July 8, 2024 06:12
wenju-he
wenju-he previously approved these changes Jul 9, 2024
Copy link
Contributor

@wenju-he wenju-he left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

CMakeLists.txt Outdated
${SPIRV_BASE_REVISION}
${TARGET_BRANCH}
ret)
option(APPLY_PATCHES "option to apply patches" ON)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see options are scattered in this file, should we move them to a same place?
It is up to you and this can be done in a separate PR.

CMakeLists.txt Outdated
@@ -40,6 +40,10 @@ if(LLVM_USE_HOST_TOOLS AND OPENCL_CLANG_BUILD_EXTERNAL)
llvm_create_cross_target(${PROJECT_NAME} NATIVE "" Release)
endif()

option(LLVMSPIRV_INCLUDED_IN_LLVM
"Set to ON if libLLVMSPIRVLib is linked into libLLVM" ON)
option(APPLY_PATCHES "option to apply patches" ON)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Apply local patches"

Copy link
Contributor

@wenju-he wenju-he left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@haonanya haonanya merged commit 470cf00 into intel:ocl-open-140 Jul 9, 2024
1 check passed
@haonanya haonanya deleted the fix-git-140 branch July 9, 2024 05:28
haonanya added a commit that referenced this pull request Aug 26, 2024
…it repo. (#540)

[Backport] Do not apply patches if repo is a not a git repo.
#539
[Backport] Do not apply patches if sub non-git repo is located in a git
repo. #545
Also add an option to control patch apply which is default on. Pass
-DAPPLY_PATCHES=OFF will skip patch apply process.
haonanya added a commit that referenced this pull request Aug 26, 2024
…it repo. (#541)

[Backport] Do not apply patches if repo is a not a git repo.
#539
[Backport] Do not apply patches if sub non-git repo is located in a git
repo. #545
Also add an option to control patch apply which is default on. Pass
-DAPPLY_PATCHES=OFF will skip patch apply process.
Update LLVM_BASE_REVISION.
haonanya added a commit that referenced this pull request Aug 26, 2024
…it repo. (#542)

[Backport] Do not apply patches if repo is a not a git repo.
#539
[Backport] Do not apply patches if sub non-git repo is located in a git
repo. #545
Also add an option to control patch apply which is default on. Pass
-DAPPLY_PATCHES=OFF will skip patch apply process.
Update LLVM_BASE_REVISION.
haonanya added a commit that referenced this pull request Aug 26, 2024
…it repo. (#543)

[Backport] Do not apply patches if repo is a not a git repo.
#539
[Backport] Do not apply patches if sub non-git repo is located in a git
repo. #545
Also add an option to control patch apply which is default on. Pass
-DAPPLY_PATCHES=OFF will skip patch apply process.
Update LLVM_BASE_REVISION.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants