479
New to Linux? Ubuntu Isn’t Your Only Option
(www.howtogeek.com)
From Wikipedia, the free encyclopedia
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.
Community icon by Alpár-Etele Méder, licensed under CC BY 3.0
That's a problem of the package, not the package manager.
Generally this fits with Debian's philosophy. But regardless I think it's out-of-scope for why Apt is good. You could make a distro with Apt and not have your packages do this.
I'm not talking about
apt
the CLI tool, but the actual package manager. The plainapt
tool is only designed to be a convenience wrapper for common workflows implemented in other tools.As you correctly pointed out, Apt has the distinction between packages installed as a dependency ("auto installed") versus packages installed directly ("manually installed"). This is precisely one of the reasons why I consider Apt the best package manager. (Yes, I know other package managers can do this, not all though.)
If you want to install a package as manual, then later mark it as auto, you can do that with
apt-mark
.Are you maintaining a PPA for others?
Frankly, I've never run into this problem.
dh_make
helps you create a package that adheres to Debian policy, and there is good reason for Debian to have those policies. But if you're just packaging something yourself, you don't have to use it. It's just a template for new packages.At the end of the day, all you really need to create a deb is to create two files
debian/control
anddebian/rules
. These are the equivalent to a PKGBUILD. The control file specifies all of the dependency metadata, and therules
file contains the install script.The difference in packaging philosophy is that PKGBUILDs are external and they download the upstream sources. On the other hand, in Debian, they rehost the upstream package and add the
debian
directory. This means that building Debian packages is mostly hermetic: you don't need access to the network.Mostly that it makes super useful distinctions between concepts. But there are other goodies.
I also do appreciate that Debian pre-configures packages to work together with the same set of conventions out of the box. But again, that's a property of the packages, not of Apt.
Sure, but the interface is probably just as important as the actual logic behind it, isn't it?
Honestly I would consider that one of the fundamental things a package manager must do, I didn't think it was a special thing haha
Yeah, I know. But if you want to manually install a package like that, you have to remember the extra step after it's finished installing instead of before the install. It's just unergonomic, for something that could be a flag (e.g. in
emerge -1
) and that I at least use fairly often.Another problem with it being a two-step thing is that if you do it unconditionally in a script, it doesn't retain the flag from before the previous installation command, you need a third step, i.e. checking if the package was installed before. My use case for this was installing dependencies for a package build which should be able to be removed again afterward, while not affecting the subset that were already installed explicitly.
Now that I think about it, it's probably a good idea to always check if a package needs to be installed before installing it if you script it, though, because otherwise it might be unnecessarily reinstalled. Fair enough.
Yeah, I maintain some software/config/meta packages for the computers at the uni I study at. Before, I'm pretty sure the packages were manually packaged with every update and I wanted to automate it a bit and also make clear how to get from the source tarballs to the final build.
Ahh, the way it's structured makes a lot more sense knowing that. Coming from packaging stuff for Arch, Gentoo and NixOS, where the packaging process is essentially the same for all three, with you usually supplying source download URLs, I had absolutely no idea how debian/rules would allow me to do anything and felt like I was missing a big thing. I guess it really is just a Makefile that you run directly, and that makes sense if you already have the sources in your tree?
This, at least version constraints, is another one I'd consider essential tbh. The rest are great though, I agree.
The logic is why I love Apt. Most robust dependency resolution algorithms I've used.
But also, I don't have any issues with the CLI. Having a distinction between
apt-get
andapt-cache
andapt-mark
doesn't feel weird to me. You're practically just separating the top-level sub commands by a dash instead of a space. Theapt
command is really just a convenience thing, and there are specialized tools for the more advanced things. Which is fine by me.Also, the top level
apt
command doesn't guarantee a stable CLI, so for scripting you're supposed to useapt-get
and friends anyway.You'd be surprised. Homebrew (the de facto standard package manager for macOS) doesn't do this. Though, you can at least lookup the "leaf" packages which are not dependencies of any other package.
And, most language-specific package managers can't do this. E.g. if you install software with
pip
orcargo
.If the package is in use, it shouldn't be an orphan.
For example, what if you race with a cleanup job that is removing orphans? (Debian is hyper stable, so I often enable unattended upgrades with autoremove. I'm not so comfortable doing that on Arch ;)
What you've described is just an
apt-get install
when you start and andapt-get remove
when you're done. Or more properly setting it as a build dependency in your source package, to let Apt handle it.But also, why uninstall build tools?
Yeah, version constraints are common. But most other package managers bail with an error when they encounter a conflict. Apt is really good about solving conflicts and proposing solutions. Often it will propose multiple solutions to your conflict for you to choose from.
Again, it's the solver part of Apt that makes it the best IMO.