soegaard2
2021-3-28 09:39:28

@phillip I only know of https://docs.racket-lang.org/raco/exe.html?q=raco%20exe but that’s only adjacent to what you are asking.


sschwarzer
2021-3-28 18:52:20

I’m working on the package at https://git.sr.ht/~sschwarzer/todo-txt . Since it deals with a file format, I thought it would make sense to put the package into the file collection, so it can be require d with (require file/todo-txt). Does this make sense? Or should I rather use just "todo-txt" as collection?


samth
2021-3-28 19:02:08

Yes that’s a perfectly reasonable thing to do


sschwarzer
2021-3-28 19:17:48

@samth I guess this refers to the file “subcollection”?


samth
2021-3-28 19:18:25

Yes, you can see lots of packages that do this with the data collection


sschwarzer
2021-3-28 19:23:12

I’m trying to test-install my package from the above Git repo with $ raco pkg install <https://git.sr.ht/~sschwarzer/todo-txt#main> but I get Downloading checksum for todo-txt Cloning remote directory <https://git.sr.ht/~sschwarzer/todo-txt#main> raco pkg install: could not find MANIFEST for package source source: <https://git.sr.ht/~sschwarzer/todo-txt#main> possible solution: If the URL is intended to refer to a Git repository, use <https://git.sr.ht/~sschwarzer/todo-txt.git#main> so that the URL ends in ".git" On the other hand, when I do add the .git suffix as suggested, I get the error Querying Git references for todo-txt at <git://git.sr.ht/~sschwarzer/todo-txt.git#main> tcp-connect: connection failed hostname: <http://git.sr.ht\|git.sr.ht> port number: 9418 system error: Connection refused; errno=111 context...: /sd/racket/current/collects/racket/contract/private/arrow-val-first.rkt:486:18 /sd/racket/current/collects/net/git-checkout.rkt:238:0: initial-connect /sd/racket/current/collects/net/git-checkout.rkt:54:2: retry-loop /sd/racket/current/collects/pkg/private/stage.rkt:59:2: lookup-normally /sd/racket/current/collects/pkg/private/stage.rkt:107:0: stage-package/info /sd/racket/current/collects/pkg/private/install.rkt:141:0: install-packages /sd/racket/current/collects/pkg/private/install.rkt:925:4 /sd/racket/current/collects/racket/contract/private/arrow-val-first.rkt:555:3 /sd/racket/current/collects/racket/file.rkt:437:8 /sd/racket/current/collects/racket/file.rkt:426:0: call-with-file-lock /sd/racket/current/collects/pkg/main.rkt:216:16 body of (submod "/sd/racket/current/collects/pkg/main.rkt" main) /sd/racket/current/collects/raco/raco.rkt:41:0 body of "/sd/racket/current/collects/raco/raco.rkt" body of "/sd/racket/current/collects/raco/main.rkt" Now, I could add a MANIFEST file, but I suppose raco install should have accepted one of the syntaxes (with or without .git), right?


samth
2021-3-28 19:24:01

The manifest file is unlikely to work


samth
2021-3-28 19:24:23

The .git syntax ought to


samth
2021-3-28 19:25:06

Does that server support the regular git protocol?


sschwarzer
2021-3-28 19:26:06

I’m not sure how to do that though. Would I create a file subdirectory in my Git repo and move the contents there that are currently at the root of the repo, and change the collection in the info.rkt to “file”? I tried keeping the directory structure and changing the collection to “file/todo-rkt”, but that gives me a contract violation for an invalid collection value.


samth
2021-3-28 19:26:28

Yes


sschwarzer
2021-3-28 19:29:25

I got something mixed up above. I wanted to paste this as the last output: $ raco pkg install <https://git.sr.ht/~sschwarzer/todo-txt.git#main> Querying Git references for todo-txt at <https://git.sr.ht/~sschwarzer/todo-txt.git#main> pkg: Git checkout initial protocol failed; the given URL might not refer to a Git repository given URL: <https://git.sr.ht/~sschwarzer/todo-txt.git#main> context...: /sd/racket/current/collects/pkg/private/stage.rkt:762:25 /sd/racket/current/collects/net/git-checkout.rkt:336:0: parse-initial-refs /sd/racket/current/collects/net/git-checkout.rkt:73:8 /sd/racket/current/collects/net/git-checkout.rkt:54:2: retry-loop /sd/racket/current/collects/pkg/private/stage.rkt:59:2: lookup-normally /sd/racket/current/collects/pkg/private/stage.rkt:107:0: stage-package/info /sd/racket/current/collects/pkg/private/install.rkt:141:0: install-packages /sd/racket/current/collects/pkg/private/install.rkt:925:4 /sd/racket/current/collects/racket/contract/private/arrow-val-first.rkt:555:3 /sd/racket/current/collects/racket/file.rkt:437:8 /sd/racket/current/collects/racket/file.rkt:426:0: call-with-file-lock /sd/racket/current/collects/pkg/main.rkt:216:16 body of (submod "/sd/racket/current/collects/pkg/main.rkt" main) /sd/racket/current/collects/raco/raco.rkt:41:0 body of "/sd/racket/current/collects/raco/raco.rkt" body of "/sd/racket/current/collects/raco/main.rkt" I still get a traceback, but it’s a bit different.

That said, the traceback further up is when trying the git:// protocol.


sschwarzer
2021-3-28 19:29:55

I think it should. I’m confused.


sschwarzer
2021-3-28 19:30:14

Let me try a git clone with git://.


sschwarzer
2021-3-28 19:32:11

No, that doesn’t work (connection refused).

But $ git clone <https://git.sr.ht/~sschwarzer/todo-txt> todo-txt2 does work.


capfredf
2021-3-28 19:36:20

at command line, you need to run git clone with <mailto:git@git.sr.ht\|git@git.sr.ht>:~sschwarzer/todo-txt


sschwarzer
2021-3-28 19:41:37

sschwarzer
2021-3-28 19:44:21

@capfredf Yes, but I try to “simulate” how the package server would clone the repo when someone tries to install my package later with raco pkg install todo-txt.


sschwarzer
2021-3-28 19:45:18

I wonder why raco pkg install https://... doesn’t work although git clone https://... works.


capfredf
2021-3-28 19:47:56

This is a little weird. raco pkg install --clone &lt;dir&gt; you-pkg-git-url also works


sschwarzer
2021-3-28 19:48:31

But then, to test how raco pkg install would pick up my repo and use the directory layout, the git clone <mailto:git@git.sr.ht\|git@git.sr.ht>:... would work.


capfredf
2021-3-28 19:52:06

I am not sure if git-checkout uses git clone git@ under the hood, because the latter requires ssh authentication.


capfredf
2021-3-28 19:52:25

but git-checkout has no problem accessing your repo via https


capfredf
2021-3-28 19:52:37

&gt; (git-checkout "<http://git.sr.ht\|git.sr.ht>" "~sschwarzer/todo-txt" #:dest-dir #f #:transport 'https) Contacting <http://git.sr.ht\|git.sr.ht> Getting refs "f58e60532f0f03c7b9a8cc80fc19d5a129d76ae2"


sschwarzer
2021-3-28 19:53:43

I have the ssh key configured in .ssh/config , so it’s picked up from there and the git clone git@... would most likely not work when used “anonymously.”


sschwarzer
2021-3-28 19:54:55

> but git-checkout has no problem accessing your repo via https That’s indeed funny. (I didn’t know about (git-checkout ...) , interesting.)


samth
2021-3-28 19:57:34

raco pkg install does not use ssh or the git binary (unless you use —clone)


capfredf
2021-3-28 20:00:19

Alternatively, maybe you could push your package to a bitbucket repo, run pkg install with that repo’s url, and see what will happen


sschwarzer
2021-3-28 20:04:50

@capfredf Interesting idea, I’m going to try this (for additional debugging info since other workarounds seem to be more usable).


sschwarzer
2021-3-28 20:49:57

I’m currently not able to do the Bitbucket test because my account seems to be messed up (maybe due to the removal of the Mercurial support some time ago). I mailed the Bitbucket support.


samth
2021-3-28 20:51:55

Yes. Note the use of multi


sschwarzer
2021-3-28 21:56:59

The current state is here: https://git.sr.ht/~sschwarzer/todo-txt

When I’m in my local Git working directory named todo-txt and type raco pkg install ../todo-txt , I see some progress output (no exception). I had expected that I then would be able to open a racket shell and import the module with (require file/todo-txt) , but I get &gt; (require file/todo-txt) ; open-input-file: cannot open module file ; module path: file/todo-txt ; path: /sd/racket/current/collects/file/todo-txt.rkt ; system error: no such file or directory; rkt_err=3 ; [,bt for context] The last part of the file definitely looks wrong because I expected that the module would be imported from /sd/racket/current/collects/file/todo-txt/main.rkt. Does the main.rkt “trick” not work for multi-collection packages?

But probably something else is more fundamentally wrong because I don’t see file/todo-rkt under /sd/racket/current/collects. Maybe related is that raco pkg show shows todo-txt as a linked package. How is (require file/todo-txt) supposed to find a linked package?


samth
2021-3-28 22:17:26

You definitely need a file named todo-txt.rkt


mflatt
2021-3-29 01:24:27

The problem is that raco pkg requires a .git suffix on a URL that is to be interpreted as a Git repository. That rule is a way to distinguish Git-repo references from remote-archive references, since the latter came first in the raco pkg implementation.


mflatt
2021-3-29 01:27:59

Removing that limitation will require changing the specification of package sources, maybe by recognizing a query in a URL to declares “this is meant to be a Git reference over HTTPS”.


mflatt
2021-3-29 01:29:57

I’m not sure how many pieces of infrastructure need to change, but at least the raco pkg client (so users would need a new enough Racket to get a package using the revised rules) and the http://pkgs.racket-lang.org\|pkgs.racket-lang.org server.


capfredf
2021-3-29 02:14:57

@mflatt how about we have raco pkg first interpret a URL without a .git suffix as a remote archive reference but if it fails, try the URL as a git repo reference?


mflatt
2021-3-29 02:28:59

Fallbacks and search paths create trouble, so I’d treat that as a last resort.