LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Coding a package manager in Rust (https://www.linuxquestions.org/questions/linux-software-2/coding-a-package-manager-in-rust-4175680097/)

solarhurricane1337 08-08-2020 08:27 AM

Coding a package manager in Rust
 
since i'm an idiot, i have decided that i am going to build a linux package manager in rust. i'm planning to host the packages on a github repo, unless you can convince me to do otherwise. i've already got a basic sketch for a package format in my head, but i have a few questions.

1. my package manager is focused on speed, so should i use lzo, lz4, or zstd for the quickest decompression speeds?

2. how can i implement install, uninstall, query, and upgrade commands?

3. how can i make the program source configuration files (mirrors, xfer settings, etc)?

4. once i have mastered the basics, how can i implement more advanced stuff like an alternatives system and dependency management?

dugan 08-08-2020 08:31 AM

If speed is the actually THE focus, then don’t compress at all.

Dependencies would be modeled using a data structure called a “directed acyclic graph”, and queried using algorithms named “depth first search” and “topological sort”.

pan64 08-08-2020 08:46 AM

Hello, and welcome here, at LQ

I would suggest you to read how the debian and rpm based package managers work (like apt and zypper amongst others), how they handle dependencies, how they look for packages at all...
What does install, uninstall, (reinstall), query, remove, update, upgrade (rollback?) mean?
How can we create and maintain a deb or rpm mirror...
What to do in case of an error (to keep the system in a consistent state....)

KGIII 08-08-2020 07:16 PM

Reading your post, the only listed reason I can see for you doing this is 'speed.'

Is that really justification? Is package management really slowing you down? What niche does this fill? Who is your anticipated end-user?

The list of questions I could ask is pretty long, but let's just start there. They're mostly rhetorical anyhow.

If you're doing it for a hobby, to learn, or just to spend some time (or whatever), that's just fine. After all, it's your time that's going to be invested. But, do you expect it to take off, have input from other developers, maybe make it as a default in a distro some day?

Before writing a line of code, I'd better define your reasons and your expectations. I'd establish a clear goal, pick a project management solution, and start lining up goals. I'd query potential users for their expectations and see if they align with your expectations.

Again, it's your time. I'm just expressing what I'd do before committing to a time investment. Personally, I expect consistency, reliability, stability, and (reasonably) bug-free operation from a package manager. Speed is way down on the list of my priorities. I suspect that's true for most Linux users.

This isn't meant to dissuade you, by any means.

ondoho 08-09-2020 05:07 AM

^ Agreed.
Quote:

Originally Posted by solarhurricane1337 (Post 6153759)
since i'm an idiot, i have decided that i am going to build a linux package manager in rust. i'm planning to host the packages on a github repo, unless you can convince me to do otherwise. i've already got a basic sketch for a package format in my head, but i have a few questions.

1. my package manager is focused on speed, so should i use lzo, lz4, or zstd for the quickest decompression speeds?

2. how can i implement install, uninstall, query, and upgrade commands?

3. how can i make the program source configuration files (mirrors, xfer settings, etc)?

4. once i have mastered the basics, how can i implement more advanced stuff like an alternatives system and dependency management?

1. Make it work first, worry about compression later
2. That question is too wide. Do you have any coding experience at all?
3. That's very basic stuff. Do you have any coding experience at all?
4. Make the basics work first, worry about this later

All in all, your post reads more like "Can you recommend me some good beginners' coding tutorials".

bifferos 08-10-2020 06:21 AM

Not a package manager as such (doesn't uninstall!), however I wrote a parallel-tasking dependency-managing Slackware package builder in about 5 days solid. I'm sure I would need to triple that to do the same thing in Rust.
https://github.com/bifferos/afterpkg

Python will give you all the libraries you need and instant compile time, if you really want it in Rust, I'd convert it after you've got it working.


All times are GMT -5. The time now is 11:47 PM.