[opam-devel] opam pinning to local repo

Anil Madhavapeddy anil at recoil.org
Mon Nov 17 14:02:33 GMT 2014


That's an interesting and useful option -- I would switch to that instead
of local files if it were available.  Worth creating an issue for...

-anil

> On 17 Nov 2014, at 11:15, Thomas Leonard <talex5 at gmail.com> wrote:
> 
> I'd prefer a third option: use the files as they are in the working
> directory, but only those tracked by git. I often get bitten by opam
> copying untracked files (e.g. setup.data, setup.log, previous build
> artifacts) and giving strange results.
> 
> I use the copy-if-tracked system when editing on my desktop but
> compiling on my cubieboard and it works well. You just have to
> remember to "git add" any new files... but that's a useful check
> anyway.
> 
> (BTW, you can easily snapshot the current tracked files without
> changing anything with "git stash create", which outputs an anonymous
> commit ID if there are any changes relative to HEAD)
> 
> 
> On 17 August 2014 18:01, Ashish Agarwal <agarwal1975 at gmail.com> wrote:
>> Yes, that's it. It works fine if I do -k local (which seems the same as -k
>> path, why multiple names for the same option?).
>> 
>> I guess this gives a +1 to the view in 1582 that the default should be
>> path-pin. I do often do `opam install` in order to test that my change is
>> correct, so in other words I'm not ready to git commit just yet. That is
>> necessarily the case when the change I'm making is to the opam file itself.
>> Also if I specify a folder path as the pin's target, to me the intuitive
>> result of that is to use the contents of that folder, committed or not. If I
>> specified a folder path appended with ".git#master" (or something like
>> that), then I'd be happy with that resulting in a git-pin.
>> 
>> 
>> 
>> 
>> 
>> On Sun, Aug 17, 2014 at 12:24 PM, Anil Madhavapeddy <anil at recoil.org> wrote:
>>> 
>>> I wonder if you've been bitten by the git/local autodetection.  OPAM 1.2b4
>>> spots that the local directory that you're pinning to is a git repository,
>>> and turns it into a git remote instead.  if you haven't committed the `opam`
>>> file to the local git, then it won't be seen by opam.
>>> 
>>> Can you try
>>> 
>>> opam pin -k local add foo ~/code/foo
>>> 
>>> and see if you get the expected behaviour of using the existing opam file?
>>> 
>>> This is the OPAM issue for the autodetection:
>>> https://github.com/ocaml/opam/issues/1582
>>> 
>>> If this is indeed your bug, I'm of the firmer notion that this smart
>>> probing should be deactivated before the final release.
>>> 
>>> -a
>>> 
>>> On 17 Aug 2014, at 11:16, Ashish Agarwal <agarwal1975 at gmail.com> wrote:
>>> 
>>> I'm trying out 1.2.0-beta4 and wondering what is the correct workflow for
>>> local development packages.
>>> 
>>> Say I have a local package `foo` that is not defined in any repository. I
>>> put an opam file in the root of the package's source directory, then did
>>> `opam pin add foo ~/code/foo`. However, opam doesn't detect the opam file,
>>> and instead says "package not defined, would I like to define a new
>>> package". At this point you have to answer yes, and opam creates a new opam
>>> file, which is not what I want.
>>> 
>>> Even if the package is defined in a repository, I want opam to detect the
>>> opam file in the source directory, not that defined in the repo.
>>> 
>>> The recent platform blog post says opam pin "will generate a new package
>>> on the fly by detecting the presence of an opam file within the source
>>> repository itself". Where should this opam file be?
>>> 
>>> Note I'm trying to simplify my previous workflow, where I would put the
>>> opam file in the source directory at the path
>>> "opam/packages/foo/foo.master/opam". Then I would first add this as a repo
>>> and also pin to this directory. I'm trying to avoid the first part; I
>>> shouldn't have to add a repo per package.
>>> 
>>> _______________________________________________
>>> opam-devel mailing list
>>> opam-devel at lists.ocaml.org
>>> http://lists.ocaml.org/listinfo/opam-devel
>>> 
>>> 
>> 
>> 
>> _______________________________________________
>> opam-devel mailing list
>> opam-devel at lists.ocaml.org
>> http://lists.ocaml.org/listinfo/opam-devel
>> 
> 
> 
> 
> -- 
> Dr Thomas Leonard        http://0install.net/
> GPG: 9242 9807 C985 3C07 44A6  8B9A AE07 8280 59A5 3CC1
> GPG: DA98 25AE CAD0 8975 7CDA  BD8E 0713 3F96 CA74 D8BA
> 



More information about the opam-devel mailing list