sschwarzer
2021-3-29 10:02:47

> The problem is that raco pkg requires a .git suffix on a URL that is to be interpreted as a Git repository. So this means the .git suffix isn’t just a hint for raco so that it indicates a Git repo? So raco would also try the URL without the .git suffix. In other words, the URL has to actually contain the .git suffix?


sschwarzer
2021-3-29 10:05:54

I just checked that both Github and Gitlab include the .git suffix in the git clone instructions, so this explains why it would work there (apart from special handling by raco for Github).


sschwarzer
2021-3-29 10:07:54

… and cloning from Sourcehut only works without the .git suffix, as I just checked.


mflatt
2021-3-29 14:02:07

Although I still don’t like fallbacks, we could have raco pkg try a fetch without .git if a fetch using .git fails. That would be less worrisome than trying to fall back to the Git protocol on a non-.git URL — so, maybe our second-to-last resort. (It still means that someone would need a newer client to access the package.)


sschwarzer
2021-3-29 14:11:24

Ok, this seems to have worked, thanks!

My “only” remaining problem is how to provide a binary. I have a command-line program todoreport.rkt , which can be used with racket todoreport.rkt plus command-line arguments. Now I want to install this program as todoreport, so that it can be used by a user without modifying the PATH environment variable. (I suppose this would imply that todoreport is installed in the same directory where racket, raco etc. are installed, but I may be wrong.)

I checked https://docs.racket-lang.org/pkg/index.html and https://docs.racket-lang.org/raco/info_rkt.html , but didn’t find anything relevant. Does anybody know a package that installs a binary, so I could use the package (repository tree) as a template?


mflatt
2021-3-29 14:16:11

You want racket-launcher-names in a collection’s “info.rkt”: https://docs.racket-lang.org/raco/setup-info.html

The executable will go to the same place as racket and raco only if the package is installed in “installation” scope. In “user” scope (the default for most racket installations), the executable will be in (find-user-console-bin-dir).


laurent.orseau
2021-3-29 14:20:27

Also, if the user has racket installed, and todoreport is installed as the collection file/todoreport, without doing anything else you can call it with racket -l- file/todoreport <args> ...


samth
2021-3-29 14:20:44

One thing I’m confused about — if the URL starts with git:// does it always use the git protocol? or does SourceHut not support that protocol? Or something else?


mflatt
2021-3-29 14:21:42

SourceHut does not support the Git protocol, as far as I can tell.


capfredf
2021-3-29 14:43:28

Also, it looks like “git over https” doesn’t mean the URLs have to have “.git” suffixes. It seems to be more of a convention.


samth
2021-3-29 14:51:26

Right, that’s a convention which we have taken advantage of but is not at all a requirement of the git protocol


sschwarzer
2021-3-29 17:05:52

> SourceHut does not support the Git protocol, as far as I can tell. https://git-scm.com/book/en/v2/Git-on-the-Server-The-Protocols contains information about the protocols. According to this page, using Git over https seems to be very common, so I suppose raco should support it. I think https is the most common for anonymous read-only access.

I haven’t found anything under https://man.sr.ht/git.sr.ht/ about the Git protocol specifically, but as Git cloning over https is so common, it shouldn’t really matter whether Sourcehut supports the Git protocol (the one over a special daemon, usually on port 9418).


soegaard2
2021-3-29 18:08:40

greg
2021-3-29 18:10:12

The book also suggests that the git: protocol is ideal for read-only, public access — such as by a package manger like raco pkg:

> The Git protocol is often the fastest network transfer protocol available. If you’re serving a lot of traffic for a public project or serving a very large project that doesn’t require user authentication for read access, it’s likely that you’ll want to set up a Git daemon to serve your project. It uses the same data-transfer mechanism as the SSH protocol but without the encryption and authentication overhead. So it sounds like git: might be good for Sourcehut to support, if it wants to host repos that are also packages?


greg
2021-3-29 18:13:13

If it’s about what’s common, you could argue that git: is as common as https:, because it’s supported by GitHub and GitLab and Bitbucket etc., and because a supermajority of repos are hosted on those. :slightly_smiling_face:


sschwarzer
2021-3-29 18:18:27

@greg I understand it the other way around: Since the Git protocol by default isn’t encrypted, it’s rarely used. This is also in line with the observation that Github and Gitlab only mention the https and ssh URLs as clone URLs.

As for the git:// support for Github etc., I’d be interested in which clone URL you’d use. :slightly_smiling_face: The Github documentation at https://docs.github.com/en/github/getting-started-with-github/about-remote-repositories doesn’t mention the Git protocol either. Maybe you’re confusing the git@... clone “URL” (SSH protocol) and the Git protocol?


sschwarzer
2021-3-29 18:20:29

My suspicion is that raco pkg doesn’t use the Git protocol either, also for Github and Gitlab.


samth
2021-3-29 18:20:45

It definitely uses the git protocol


samth
2021-3-29 18:20:56

It has its own implementation, in fact, in Racket


greg
2021-3-29 18:21:04

Any sentence beginning with “Maybe you’re confusing”, directed at me, has an excellent chance of being true. :slightly_smiling_face:


sschwarzer
2021-3-29 18:22:34

@samth Is that actually the Git (server) protocol to a daemon on port 9418? Of course there’s some form of protocol so that Git can fetch the repository data, but that’s a different layer from the “protocol” I’m talking about.


samth
2021-3-29 18:24:15

raco pkg is a client, so it doesn’t implement the server protocol, but it uses the same protocol that git uses when given a git:// url.


samth
2021-3-29 18:24:51

That’s why you saw the error about port 9418 from tcp-connect.


greg
2021-3-29 18:27:18

I guess the tiny valid remnant of my original point is that there are many langs/ecosystems using git repos as package sources these days, and fewer hosts, with a few very large hosts. And so if there is some option/detail in git: and/or ssh that Sourcehut could add, it would probably help multiple ways.


sschwarzer
2021-3-29 18:32:33

> raco pkg is a client, so it doesn’t implement the server protocol No doubt about that. :slightly_smiling_face: I used the terms in the same way as you’d say a web browser uses/supports the http protocol (both client and server use the same protocol, in client and server role, respectively).


sschwarzer
2021-3-29 18:36:53

@samth I can confirm that git clone <git://github.com/racket/plot> indeed works. But since the Github documentation at https://docs.github.com/en/github/getting-started-with-github/about-remote-repositories doesn’t mention this form as access, it amounts to be an undocumented feature (maybe for backward compatibility). That said, I don’t know for absolute certain whether the git:// access is mentioned somewhere in the Github docs.


sschwarzer
2021-3-29 18:38:09

Sourcehut is much younger than Github or Gitlab, so this would be a possible reason why it doesn’t support the Git protocol, since it’s probably for backward compatibility on Github and Gitlab.


sschwarzer
2021-3-29 18:40:08

> That’s why you saw the error about port 9418 from tcp-connect. 9418 is the server side port, so a client would connect to that port.


samth
2021-3-29 18:40:28

Yes, that’s my point.


sschwarzer
2021-3-29 18:41:23

I think we agree now that Github (haven’t tried Gitlab) supports git:// URLs (Git protocol) and Sourcehut doesn’t.


samth
2021-3-29 18:41:54

Right, and that raco pkg uses the Git protocol.


sschwarzer
2021-3-29 18:43:09

> Right, and that raco pkg uses the Git protocol. Also agreed. :slightly_smiling_face: My point was that raco pkg should also support Git clones over https since they’re the recommended way to anonymously clone a repo.


samth
2021-3-29 18:44:37

It does support that; it just requires a way to distinguish that from an http-served collection of files, and uses .git at the end to do that.


samth
2021-3-29 18:45:13

As Matthew said, we could change Racket to support some other signal but that wouldn’t help you right now.


sschwarzer
2021-3-29 18:47:17

> It does support that; it just requires a way to distinguish that from an http-served collection of files, and uses .git at the end to do that. Yes, that’s the problem. :slightly_smiling_face: …


sschwarzer
2021-3-29 18:49:19

> As Matthew said, we could change Racket to support some other signal but that wouldn’t help you right now. I see that https://pkgd.racket-lang.org/pkgn/create explicitly allows to choose “Git repository” as source. Would this allow the package server to make the distinction between a plain http directory and a git directory? So when going over the Racket package server, the behavior of raco pkg might not matter. That said, I don’t know how the Racket package server works.


samth
2021-3-29 18:50:05

The Racket pkg server is just serving a set of URLs — you can even see what URL it’s creating in that form.


samth
2021-3-29 18:51:33

But it does seem like that might suggest the wrong thing for hosts that don’t support the same things github/gitlab do.


sschwarzer
2021-3-29 18:52:15

> The Racket pkg server is just serving a set of URLs — you can even see what URL it’s creating in that form. Yes, I see the URL, but didn’t know whether that’s an URL by which the package server requests the repo and raco gets the package from the server or whether it’s an URL that is transmitted to raco pkg and raco pkg uses it as if the user gave the URL directly on the command line.


samth
2021-3-29 18:52:53

The package server doesn’t store anything other than the URL (and some metadata)


sschwarzer
2021-3-29 18:53:14

Ok, that clarifies it. :+1:


sschwarzer
2021-3-29 18:57:49

So my summarized understanding is that we need one (or more) of the following: • Give raco pkg a feature so that it can use the https protocol, regardless of a .git suffix is in the URL. • Convince Sourcehut to run a Git daemon to support the Git protocol, so that raco pkg can use that for cloning. Earlier I thought that Sourcehut could just offer the current https clone URL with a .git suffix as an alternative. But as I understand now, this wouldn’t help because the .git suffix signals to raco pkg that it should use the Git protocol?


samth
2021-3-29 18:58:14

No, the third option also works


sschwarzer
2021-3-29 18:58:43

So a .git suffix would allow raco pkg to get the repo via https?


samth
2021-3-29 18:58:59

Yes


sschwarzer
2021-3-29 18:59:47

@samth Thank you!


sschwarzer
2021-3-29 19:03:11

Hence an updated summary, including another point for completeness: • Give raco pkg a feature so that it can use the https protocol, regardless of a .git suffix is in the URL. • Convince Sourcehut to run a Git daemon to support the Git protocol, so that raco pkg can use that for cloning. • Convince Sourcehut to allow a .git suffix on the https clone URL, so raco pkg would fetch the repo via https. • Use another hosting service that supports a .git suffix in a clone URL or supports a Git (protocol) deamon.


gknauth
2021-3-29 19:07:59

Thank you so much for posting this. I had wanted to tune in and participate, but Fri-Sat I was volunteering at the FEMA Level 1 Vaccination Site in Philadelphia, helping to process 800 people per hour or 6000–7500 people per day in 12 hour shifts, and all I could do at the end of the day was crawl into bed in my hotel room and go to sleep. On top of that all hell was breaking loose in another area of my life, but I can’t comment on that at the moment. I’m just glad to see the happy Racket community continuing to do its thing and making the world of computing a better place.


sschwarzer
2021-3-29 19:24:45

New state at https://git.sr.ht/~sschwarzer/todo-txt . I got the launcher to work, but only after moving todoreport.rkt from file/todoreport.rkt to file/todoreport/todoreport.rkt. Before I got a “module not found” error mentioning file/todoreport/todoreport. I then tried ../todoreport.rkt instead of todoreport.rkt as the value for the racket-launcher-libraries path, but that gave me another error. With the current state the launcher seems to work, but racket -l- file/todoreport doesn’t (but racket -l- file/todoreport/todoreport works although that’s not ideal). Ideally I’d like to put todoreport.rkt directly under file in the repository, but I couldn’t figure out how to make this work. Do you have any advice?


samth
2021-3-29 19:27:56

I would just put the info.rkt file one directory up


samth
2021-3-29 19:28:10

and put todoreport.rkt in the file directory as well


sschwarzer
2021-3-29 19:33:22

> I would just put the info.rkt file one directory up The info.rkt for todoreport , then directly under file?


samth
2021-3-29 19:35:35

An info.rkt file which specifies the launcher named todoreport.


sschwarzer
2021-3-29 19:37:58

So yet another info.rkt in addition to the one under the todoreport directory?


samth
2021-3-29 19:39:13

You might not need one in the todoreport directory


sschwarzer
2021-3-29 19:42:30

I’ll give it a try …


sschwarzer
2021-3-29 19:50:52

I moved todoreport.rkt up and split todoreport/info.rkt in two. One file in the same place, but without the launcher definition. (This is now more “symmetrical” with the todo-txt collection.) One info.rkt one level up as you suggested, but with only the launcher definition. This seems to work fine now, as far as I can tell. Thanks again! :slightly_smiling_face:


sschwarzer
2021-3-29 20:51:48

sschwarzer
2021-3-29 20:53:09

I’ll ask the Sourcehut team if they want to support the .git -suffixed alias for repo URLs.


sschwarzer
2021-3-29 21:12:54

wjb
2021-3-30 05:50:04

Anyone know why scribble is trying to find path/to/scribbling/setup or path/to/scribbling/pkg while installing a documentation package? When I build, I get raco setup: error: during building docs for &lt;pkgs&gt;/scribble-minted-doc/minted/minted.scrbl raco setup: open-input-file: cannot open module file raco setup: module path: workspace/scribble-minted/scribble-minted-doc/minted/setup raco setup: path: workspace/scribble-minted/scribble-minted-doc/minted/setup raco setup: system error: no such file or directory; rkt_err=3 where ../minted/setup is not referenced anywhere, and it sometimes displays ../minted/pkg instead. (seems to depend on if I’m running raco pkg install or raco setup --only --pkgs scribble-minted-doc)

I must have misconfigured my package but I.. can’t figure out how. https://github.com/wilbowma/scribble-minted/tree/split-package


wjb
2021-3-30 06:04:43

Looks like I forgot to add (define collections 'multi) to the info.rkt


wjb
2021-3-30 06:13:12

.. or maybe that wasn’t it.. I’m getting the error again.


wjb
2021-3-30 06:37:56

Beginning to suspect this is the fault of my package, which is using require/expose to try to hack scribble itself