How can I create a linux distribution package for a julia package?

I barely know anything about julia, but I may want to learn julia if it’s possible for me to create linux distribution packages for julia packages.

It seems to involve JULIA_DEPOT_PATH. But, I don’t really know.

Is it possible to install a julia package locally in /usr/share/julia without downloading anything from the internet? My linux distribution downloads and installs dependencies and prevents language-specific build tools from downloading anything from the internet. This works for R and python.

The easiest way to add a package from a location on disk is probably do do pkg> dev /path/to/package, though then you have to manually clone the repo with the package first. The only problem is that the package manager will try to install all dependencies of that package also.
There is Pkg.offline mode that tells Pkg to not download stuff that isn’t already present, though then you have to manually make sure all dependencies are present.
You can maybe do this on another computer, and then copy over the depot directory, though if it is a different architecture any artifacts will be for that architecture and won’t work.


What if a julia module directory is not a git directory? Is dev command really suitable for preparing a linux distribution package?

Maybe not. I mostly listed other alternatives since I don’t think there is any convenient way to do it through a linux package manager, and didn’t see the point of involving it.

But if you must do it you could probably set up the full depot path you need with all packages, and just package that up. After install you just need to set depot path and maybe offline mode. I think that should work.

If you re doing scientific computing look at Spack and Easybuild
I think this is a good question and would love to see a discussion on here about shipping Julia packages via Spack/Easybuild

Do you need to handle platform-dependent artifacts, or binaries of any kind? Are you thinking of binary distro packages (à la .deb), or source packages (where you ship only source codes and the recipes needed to build anything platform-dependent on the target system, à la .dsc)?

I’m assuming it’s still possible for you to build/prepare the distro package itself on a machine that can access the Internet, i.e there is some machine somewhere, that you can access and where Pkg.add will work. Is that true? Can we assume that this machine has the same architecture than your target system?

I ship source packages.

Gentoo Linux blocks internet access during package build for reproducibility. Gentoo downloads and installs dependencies. It’s possible to allow exceptions, but I don’t want to do that.

Gentoo Linux builds nearly all packages.

The machine that builds packages is the target machine usually. But, binary packages can be distributed to computers that use the same CPU architecture.