Live data from Hacker News

Writing a Package Manager

antonz.org

81–90 of 106 posts

Re: Writing a Package Manager

#81

Honestly pretty strange to write a package manager for sqlite and to use directories + json files to store the data instead of sqlite.

SQL not so good for tree structures. Recursive CTEs are pretty gnarly. Graphdb would be ideal.

Why not? Just add child/parent ids

Re: Writing a Package Manager

#82
post #68

Source control is my package manager. Package managers as we usually think of them are syntax sugar and abstraction for the sake of abstraction Working on a Linux distro that is one unified/generalized/normalized code base (with the help of AI/ML) and a model to sample and establish correct state from memory of the initial code base. One way to think of it is like a game engine with action plans to allocate resources…

Most package managers work with version control already, they are not solving the same problems. Package managers deal with the building and dependency graph along with delivery of working executables. Version control solves zero of these problems.

Re: Writing a Package Manager

#83
post #2

Writing a package manager is not one of the most common programming tasks. After all, there are many out-of-the-box ones available.

Imagine what'd we be using for package management today if package manager >= #2 author said "you know what, one already exists".

I think we'd all be using 'tar'.

Re: Writing a Package Manager

#84
post #63

Earlier quoted context omitted.

Use Bazel.

I’ve heard a lot about Bazel but are there any good beginner tutorials? When I last looked it felt a little Nix-like (high learning curve to get through which I prefer to ignore for my tooling where possible)

The issue with bazel is having to roll out your own build definitions for every package you want to use that doesn't already provide bazel files.

Re: Writing a Package Manager

#85

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

FYI pip is specifically not a package manager, it's a package installer.

Pip does not attempt to resolve dependency conflicts of already installed packages, only the ones it is currently trying to install. Nor does it try to manage the life cycle of installed packages, such as removing transitive dependencies never specified or no longer needed or create consistent environments with a lock file.

As package specifications have become better defined (rather than "whatever setup.py does") and are being better enforced (e.g. Pip will soon reject version numbers that are non-compliant) there are several attempts at writing full-fledged package managers (Rye, Huak, Pixi, etc.) and I'm sure once one of them gains critical mass it will replace Pip quickly.

Re: Writing a Package Manager

#86

Earlier quoted context omitted.

You want to bring in a dependency to avoid writing one 8 line CTE?

The number of lines needed is not a good measure for gnarliness. (To be fair, I don't know if gnarliness is measurable at all.)

It isn’t gnarly at all, but recursive CTE are outside the experience of most SQL devs. Here “gnarly” is used to describe “unfamiliar”.

Re: Writing a Package Manager

#87

Wonderful post! I've written a couple of packager manager like things over the years. Although they've all been internal-only which gives some flexibility. > I like the idea of allowing both project and global scope Yikes! Hard no from me. Globals are pure evil. Avoid like the plague. Environment variables too. Kill them all with fire. > what if the user wants to reinstall the packages on another machine or CI server…

> I've typically bypassed the need for a lockfile by simply checking in the dependencies. Dependencies belong in version control! These are binary dependencies. You're checking shared object files into source control? Note that he's also doing this to add functionality to a binary installation of sqlite, which is presumably running somewhere like /usr/bin/sqlite. This isn't a custom application he's developing. The e…

Binaries absolutely should go in version control. The fact that Git is incapable of efficiently supporting that workflow is a separate topic.

Re: Writing a Package Manager

#88
post #68

Source control is my package manager. Package managers as we usually think of them are syntax sugar and abstraction for the sake of abstraction Working on a Linux distro that is one unified/generalized/normalized code base (with the help of AI/ML) and a model to sample and establish correct state from memory of the initial code base. One way to think of it is like a game engine with action plans to allocate resources…

If you haven't already researched them, you may want to investigate Plan9 and Erlang, both early systems embodying a distributed and networked philosophy of computing.

Re: Writing a Package Manager

#89

I think some day rather than the current paradigm, even including declarative package managers and environments and distros, the future will be per-user and even per-app chrooting or jails, or something similar. Apple already uses something like this today. Many people who are smart about information security have one login for shopping and banking and bill pay, one for their business, and one for cruising the web or…

> Apple already uses something like this today Some Linux distros too have things like this but unfortunately there is no buy-in across the ecosystem so "sandboxing" is done in a half-baked way. The problem is when applications in general aren't written with sandboxing in mind, and when you have to choose between apps not working properly or having a leaky sandbox, you will opt for the latter. I wish some big corp bi…

You're describing Red Hat! After spending multiple years helping with the development of Flatpak, which is a sandboxed environment with file pickers just like you describe, they recently announced[1] that they would no longer be contributing to LibreOffice in Fedora and instead will be contributing to a Flatpak version instead.

Personally, I am not so sure about Flathub (the 'official' repository for Flatpak bundles), but Flatpak itself is a welcome (and large) step towards universal sandboxing for desktop applications.

[1]: https://www.spinics.net/lists/fedora-devel/msg312784.html

Re: Writing a Package Manager

#90

Earlier quoted context omitted.

> I've typically bypassed the need for a lockfile by simply checking in the dependencies. Dependencies belong in version control! These are binary dependencies. You're checking shared object files into source control? Note that he's also doing this to add functionality to a binary installation of sqlite, which is presumably running somewhere like /usr/bin/sqlite. This isn't a custom application he's developing. The e…

Binaries absolutely should go in version control. The fact that Git is incapable of efficiently supporting that workflow is a separate topic.

I think you are right. Tarballs with version strings as filenames served from an HTTPD are effectively a poor man's version control. Git commits are immutable and efficient (storing only the delta) for text, but those same benefits could apply to binary files too if only the tooling was better. You may be interested to know that Debian actually does use Git to store binary data, although only when it is not possible to use the source files to generate the binary data directly.
Post reply on HN