Writing a package manager

a year ago by cm0002 to c/programming

Without spending a year on it.
zombiewarrior 12 points a year ago
path: 0 18248437, hotness: undefined, score: 12, children: 3
cm0002 15 points a year ago

step 5: There are now 57 other ones out there lol

path: 0 18248437 18249047, hotness: undefined, score: 15, children: 0
Deebster 4 points a year ago

But none for SQLite extensions, which is what the article is about.

path: 0 18248437 18250275, hotness: undefined, score: 4, children: 1
30p87 1 point a year ago

A lot are in the arch repos, and the rest in the AUR ¯\(ツ)/¯

path: 0 18248437 18250275 18251149, hotness: undefined, score: 1, children: 0
eager_eagle 9 points a year ago

This way, if users don't need separate project environments, they will just run sqlpkg as is and install packages in their home folder (e.g. ~/.sqlpkg)

XDG dirs or nothing. Don't touch my home directory.

path: 0 18253867, hotness: undefined, score: 9, children: 0
shape_warrior_t 6 points a year ago

Interesting way of handling project vs global scope:

Some package managers (e.g. npm) use per-project scope by default, but also allow you to install packages globally using flags (npm install -g). Others (e.g. brew) use global scope.

I like the idea of allowing both project and global scope, but I do not like the flags approach. Why don't we apply a heuristic:

If there is a .sqlpkg folder in the current directory, use project scope. Otherwise, use global scope.

This way, if users don't need separate project environments, they will just run sqlpkg as is and install packages in their home folder (e.g. ~/.sqlpkg). Otherwise, they'll create a separate .sqlpkg for each project (we can provide a helper init command for this).

Seems rather implicit, though, especially if the command output doesn't specify which scope a package was installed in. If a user moves to a subdirectory, forgets they are there, and then tries to install a package, the package will unexpectedly install in global scope (though this particular version of the problem can be solved by also looking in parent directories).

path: 0 18250087, hotness: undefined, score: 6, children: 2
nous 6 points a year ago

Yeah I don't like this either. So many chances for a mistake, be in the wrong dir, file misspelled, something not cloned correctly or anything else not setup as you think it might be and suddenly the package manage does something you don't expect (like try to install globally rather then in a project or vice versa).

path: 0 18250087 18250404, hotness: undefined, score: 6, children: 0
devfuuu 3 points a year ago

It's absolutely horrible indeed. Confusing with where you are, accidentally thinking you doing one thing and doing another, versions conflicts or other things happening without understanding...

path: 0 18250087 18250595, hotness: undefined, score: 3, children: 0
atzanteol 3 points a year ago

path: 0 18249140, hotness: undefined, score: 3, children: 2
UndercoverUlrikHD 8 points a year ago

First paragraphs in the article

Writing a package manager is not one of the most common programming tasks. After all, there are many out-of-the-box ones available. Yet, somehow I've found myself in exactly this situation.

How so?

I'm a big fan of SQLite and its extensions. Given the large number of such extensions in the wild, I wanted a structured approach to managing them. Which usually involves, well, a package manager. Except there is none for SQLite. So I decided to build one!

path: 0 18249140 18249435, hotness: undefined, score: 8, children: 1
atzanteol 2 points a year ago

Having a reason is not the same as having a good reason.

Hence my facetious "but why?" (I had read the article - they don't justify it well).

path: 0 18249140 18249435 18255124, hotness: undefined, score: 2, children: 0
programming
programming

@programming.dev

login for more options
28819
3721
3327

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev


go to feed...