Live data from Hacker News

Writing a Package Manager

antonz.org

31–40 of 106 posts

Re: Writing a Package Manager

#31

Earlier quoted context omitted.

Like silverblue with toolbox?

Something like Silverblue will only ever work with a rigid set in stone ROM-friendly base. You can't even do fixes with that, so Linux is right out. Lisp on bare metal, FORTH, anything. BASIC. It has to be small.

Er, what? SB handles updates fine. The base/host OS is separate from what goes on in the containers anyways.

Re: Writing a Package Manager

#32
So, how does it handle diamonds in the dependency graph? How does it handle version compatibility? IMO these are the most interesting aspects of a package manager, other stuff are implementation detail.

Although there is a mention for semver at the end:

> Decide what versioning scheme to use (Probably semver, or something like it/enhancing it with a total order).

I wonder if total order is appropriate (assuming the relation <= means compatibility), but it sure simplifies things. Basically throw away the major version, embed that in the name of the package if you have to.

Re: Writing a Package Manager

#34
Wonderful post, how about using standard OCI to unify products?

We have also been working hard recently on a package manager for configuring language KCL, which currently supports Git, OCI, and more.

Re: Writing a Package Manager

#35

It's surprisingly to me that no-one has built a asdf style package manager. (I'm not talking about system package managers, their language software packages are always out of date and get installed globally instead of locally to a project). Having a unified interface to a package manager per language that will use the languages registry could be really nice (I guess you'd have some core dependency management function…

Nix solves that problem.

(While creating some new ones.)

Re: Writing a Package Manager

#37

Why do we need a separate package manager for every programming language and every extensible library/app?

Need is the wrong word, sometimes it is necessary. Look at npm, long time they not include new features and made less progress. That time yarn was born. pnpm and other followed, cause npm did not have features, security solutions, and other things that people want.

In theory we need only one for all, but in reality, that is impossible.

Re: Writing a Package Manager

#38
post #25

The author added a lockfile without understanding why they exist. A lockfile is meant to "freeze" dependency version resolution when package authors can specify dependencies on other packages using version ranges... it also "freezes" choices of transitive packages' versions when different packages depend on the same one, but with different versions. They chose to not handle package dependencies at all, and I believe…

A version number is just a label, and labels are mutable. A lock-file containing hashes will always resolve to the same packages (or fail).

Depending on a single specific version is wrong. A library can be changed to fix a bug without changing the interface in any breaking way. It should be possible for a user (also their package manager, automatically) to replace the library with the new version in this case.

Re: Writing a Package Manager

#39
Bit of a tangent here but what’s a pip/npm/cargo like package manager for C++? For example ‘pip install boost’? I’ve never worked it out for hobby projects and never worked with it commercially

Re: Writing a Package Manager

#40

Earlier quoted context omitted.

A version number is just a label, and labels are mutable. A lock-file containing hashes will always resolve to the same packages (or fail).

Depending on a single specific version is wrong. A library can be changed to fix a bug without changing the interface in any breaking way. It should be possible for a user (also their package manager, automatically) to replace the library with the new version in this case.

Depending on how important supply chain security is to your industry/company/team, validating the hash of every package is critical. If an attacker can manage an interception/man in the middle attack on your CI network, the hash check provides protection. If an attacker compromises the server you get packages from, having a hash provides protection as well. Automatically trusting the server's response to be correct, or automatically upgrading to newer versions (even if the package author strictly adheres to SemVer), puts you at risk at attacks similar to what we saw with SolarWinds around 2021.
Post reply on HN