-
Notifications
You must be signed in to change notification settings - Fork 401
Enforce dry run not changing opam root #6565
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
Draft
rjbou
wants to merge
18
commits into
ocaml:master
Choose a base branch
from
rjbou:dry-run
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
6822379
reftest: add track info to dot install
rjbou a43d7a2
reftest: add dryrun test
rjbou 50ef927
fx
rjbou a587e0e
test
rjbou 125a153
With dry-run, don't create build dir
rjbou 32e178f
With dry-run, don't save cache
rjbou 67ee202
With dry-run, don't backup switch
rjbou 174ff5d
With dry-run, don't cleanup artefacts
rjbou d635b47
With dry-run, don't remove switch (no-op)
rjbou 6728f2a
With dry-run, don't remove build directory for building
rjbou c99c4b0
With dry-run, don't store overlay on pinning
rjbou 9c77cba
With dry-run, don't remove overlay and pinning source dir on unpinning
rjbou 834a113
With dry-run, don't create remove dir
rjbou 70a8c5a
With dry-run, don't write reinstall file
rjbou c71232e
With dry-run, don't write inferred switch invariant
rjbou e1f4d13
With dry-run, don't copy pin sources
rjbou 7c8ff63
With dry-run, don't sync sources on pinning, when fetching pin sources
rjbou e098697
With dry-run, don't sync sources on pinning
rjbou File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -283,7 +283,24 @@ let pinned_package st ?version ?(autolock=false) ?(working_dir=false) name = | |
| Filename.dir_sep ^ OpamFilename.SubPath.to_string sp) subpath)) | ||
| @@+ fun () -> | ||
| (* Do the update *) | ||
| let srcdir0 = srcdir in | ||
| let srcdir, srcdir_find = | ||
| if OpamStateConfig.(!r.dryrun) then | ||
| let tmpdir = OpamFilename.mk_tmp_dir () in | ||
| tmpdir, OpamFilename.SubPath.(tmpdir /? subpath) | ||
| else | ||
| srcdir, srcdir_find | ||
| in | ||
| fetch_dev_package urlf srcdir ~working_dir ?subpath nv @@+ fun result -> | ||
| let result = | ||
| match OpamStateConfig.(!r.dryrun), result with | ||
| | true, Result () -> | ||
| let base f = OpamFilename.Base.of_string (OpamFilename.Dir.to_string f) in | ||
| (match OpamRepositoryBackend.get_diff (OpamFilename.Dir.of_string "/") (base srcdir) (base srcdir0) with | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. temporary hack, get_diff needs to change arguments and take absolute path, or have 2 functions. |
||
| | Some _ -> Result () | ||
| | None -> Up_to_date ()) | ||
| | _, (Result () | Up_to_date () | Not_available _) -> result | ||
| in | ||
| let new_source_opam = | ||
| OpamPinned.find_opam_file_in_source ?locked name srcdir_find | ||
| >>= fun (f, lock) -> | ||
|
|
@@ -332,16 +349,6 @@ let pinned_package st ?version ?(autolock=false) ?(working_dir=false) name = | |
| | Some a, Some b -> not (equal_opam a b) | ||
| in | ||
| let save_overlay opam = | ||
| OpamFilename.mkdir overlay_dir; | ||
| let opam_file = OpamPath.Switch.Overlay.opam root st.switch name in | ||
| List.iter OpamFilename.remove | ||
| OpamPath.Switch.Overlay.([ | ||
| OpamFile.filename opam_file; | ||
| OpamFile.filename (url root st.switch name); | ||
| OpamFile.filename (descr root st.switch name); | ||
| ]); | ||
| let files_dir = OpamPath.Switch.Overlay.files root st.switch name in | ||
| OpamFilename.rmdir files_dir; | ||
| let opam = | ||
| OpamFile.OPAM.with_url urlf @@ | ||
| OpamFile.OPAM.with_name name opam | ||
|
|
@@ -351,19 +358,30 @@ let pinned_package st ?version ?(autolock=false) ?(working_dir=false) name = | |
| then OpamFile.OPAM.with_version version opam | ||
| else opam | ||
| in | ||
| List.iter (fun (rel_file, content, hash) -> | ||
| match content with | ||
| | Some (lazy content) when OpamHash.check_string content hash -> | ||
| OpamFilename.write (OpamFilename.create files_dir rel_file) content | ||
| | None | Some _ -> | ||
| OpamConsole.warning "Ignoring file %s with invalid hash" | ||
| (OpamFilename.Base.to_string rel_file)) | ||
| (OpamFile.OPAM.get_extra_files | ||
| ~get_repo_files:(OpamRepositoryState.get_repo_files st.switch_repos) | ||
| opam); | ||
| OpamFile.OPAM.write opam_file | ||
| (OpamFile.OPAM.with_extra_files_opt None opam); | ||
| opam | ||
| if OpamStateConfig.(!r.dryrun) then opam else | ||
| (OpamFilename.mkdir overlay_dir; | ||
| let opam_file = OpamPath.Switch.Overlay.opam root st.switch name in | ||
| List.iter OpamFilename.remove | ||
| OpamPath.Switch.Overlay.([ | ||
| OpamFile.filename opam_file; | ||
| OpamFile.filename (url root st.switch name); | ||
| OpamFile.filename (descr root st.switch name); | ||
| ]); | ||
| let files_dir = OpamPath.Switch.Overlay.files root st.switch name in | ||
| OpamFilename.rmdir files_dir; | ||
| List.iter (fun (rel_file, content, hash) -> | ||
| match content with | ||
| | Some (lazy content) when OpamHash.check_string content hash -> | ||
| OpamFilename.write (OpamFilename.create files_dir rel_file) content | ||
| | None | Some _ -> | ||
| OpamConsole.warning "Ignoring file %s with invalid hash" | ||
| (OpamFilename.Base.to_string rel_file)) | ||
| (OpamFile.OPAM.get_extra_files | ||
| ~get_repo_files:(OpamRepositoryState.get_repo_files st.switch_repos) | ||
| opam); | ||
| OpamFile.OPAM.write opam_file | ||
| (OpamFile.OPAM.with_extra_files_opt None opam); | ||
| opam) | ||
| in | ||
| match result, new_source_opam with | ||
| | Result _, Some new_opam | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i didn't check if all these temp dir created are well cleaned