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

Recursive & subpath pinning: update and add test #4876

Merged
merged 11 commits into from
May 10, 2022
Merged

Conversation

rjbou
Copy link
Collaborator

@rjbou rjbou commented Oct 21, 2021

Waiting # 5079 & # 5080 rebased on top of them

@rjbou rjbou added this to the 2.2.0~alpha milestone Oct 21, 2021
@rjbou
Copy link
Collaborator Author

rjbou commented Nov 12, 2021

There is a failure on git directory detection, cf run, and path transcription: resolved

 ### opam pin
 pin1.~dev              (uninstalled)  git    git+file://${BASEDIR}/pinnes#master
 pin1sub1.~dev          (uninstalled)  rsync  file://${BASEDIR}/pinnes (a)
-pin1sub1sub1.~dev      (uninstalled)  git    git+file://${BASEDIR}/pinnes#master (a/i)
-pin1sub1sub1sub1.~dev  (uninstalled)  git    git+file://${BASEDIR}/pinnes#master (a/i/j)
-pin1sub1sub2.~dev      (uninstalled)  rsync  file://${BASEDIR}/pinnes (a/k)
-pin1sub2.~dev          (uninstalled)  git    git+file://${BASEDIR}/pinnes#master (b)
+pin1sub1sub1.~dev      (uninstalled)  rsync  file://${BASEDIR}/pinnes (a\i)
+pin1sub1sub1sub1.~dev  (uninstalled)  rsync  file://${BASEDIR}/pinnes (a\i\j)
+pin1sub1sub2.~dev      (uninstalled)  rsync  file://${BASEDIR}/pinnes (a\k)
+pin1sub2.~dev          (uninstalled)  rsync  file://${BASEDIR}/pinnes (b)
 ### opam unpin -n --recursive pinnes

@rjbou rjbou added PR: QUEUED Pending pull request, waiting for other work to be merged or closed and removed PR: NEEDS UPDATE labels Jan 19, 2022
Comment on lines 501 to 521
module SubPath = struct

include OpamStd.AbstractString

let compare = String.compare
let equal = String.equal

let of_string s =
OpamSystem.back_to_forward s
|> OpamStd.String.remove_prefix ~prefix:"./"
|> of_string
let to_string = OpamSystem.forward_to_back
let to_pretty_string s = "("^s^")"
let to_normalised_string s = s

let (/) d s = d / to_string s
let (/?) d = function
| None -> d
| Some s -> d / to_string s

end
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added this module to help concatenation and path rewriting.

|> OpamStd.String.remove_prefix ~prefix:"./"
|> of_string
let to_string = OpamSystem.forward_to_back
let to_pretty_string s = "("^s^")"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

do we want that pretty string ? or [x/a] ? or other thing ?

Comment on lines 328 to 334
val (/): Dir.t -> t -> Dir.t
val (/?): Dir.t -> t option -> Dir.t
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

new operators for subpaths, to help using then as in most cases it is an option given to a function

src/core/opamFilename.ml Outdated Show resolved Hide resolved
src/repository/opamDarcs.ml Show resolved Hide resolved
src/repository/opamHg.ml Show resolved Hide resolved
| url, Result None -> Done (Result (OpamUrl.to_string url))
| url, Result None ->
let url =
Printf.sprintf "%s%s"
Copy link
Member

Choose a reason for hiding this comment

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

It might be wise to document this new behaviour (the string returned might not be the url anymore). Currently the return value isn’t documented in the .mli file

Copy link
Member

Choose a reason for hiding this comment

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

In fact, I’m not sure where this value is used. It might not be used at all and it might be more interesting to simply return unit

Copy link
Member

Choose a reason for hiding this comment

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

Ah I see

-> retrieved pin1sub1sub2.dev  (file://${BASEDIR}/pinnes(a/k))

mmh, I’m not sure about the implementation of OpamFilename.SubPath.to_pretty_string, it’s a bit confusing. For instance, how can one see the difference between dir-with-parethesis and dir ?(subdir) ?

What about:

-> retrieved pin1sub1sub2.dev  (file://${BASEDIR}/pinnes [subpath: a/k])

or something like that?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We don't see the difference indeed. If we can find a less verbose way to notify about subpathes, it's better, it is used in several places

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

proposal:

-> retrieved pin1sub2.dev  (git+file://${BASEDIR}/pinnes[b]#master)
-> retrieved pin1sub1sub2.dev  (file://${BASEDIR}/pinnes[a/k])

It will have more effect or url, as we need to insert the subpath in the path itself.

Same differentiation issue with [] than ().

tests/reftests/lock.test Outdated Show resolved Hide resolved
tests/reftests/rec-pin.test Outdated Show resolved Hide resolved
tests/reftests/rec-pin.test Outdated Show resolved Hide resolved
tests/reftests/rec-pin.test Outdated Show resolved Hide resolved
tests/reftests/rec-pin.test Outdated Show resolved Hide resolved
src/state/opamUpdate.ml Outdated Show resolved Hide resolved
@rjbou rjbou force-pushed the recpin branch 2 times, most recently from f514e66 to 5ed6353 Compare May 5, 2022 10:35
@rjbou rjbou removed the PR: QUEUED Pending pull request, waiting for other work to be merged or closed label May 10, 2022
@rjbou rjbou merged commit 59c6cbb into ocaml:master May 10, 2022
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.

2 participants