Bug#767891: apt: Provide ability to manually mark packages as "essential"
Hi, On Mon, 3 Nov 2014 20:37:26 +1000 Anthony Townswrote: > On 3 November 2014 20:30, Anthony Towns wrote: > > On 3 November 2014 20:22, Julian Andres Klode wrote: > >> A simple way to achieve what you want is to create a local dummy > >> package that depends on the packages you want and is > >> "Essential: yes" or "Important: yes". Important being preferred, since > >> it has less restrictions on installation ordering. I actually like aj's proposed solution for another reason that is not achievable via a local dummy package: currently apt hardcodes that it treats itself as Essential:yes and the proposed solution allows the user to influence this behaviour. So instead of seeing aj's patch as a way to add more package names to what apt treats as Essential:yes (something which can certainly be achieved via a local dummy package), I see it as a way to make currently hardcoded apt behaviour (apt treating itself as Essential:yes) configurable by the user. Not having apt treat itself as Essential:yes is important for the following scenarios: - use the EDSP interface to generate installation sets similar to what can already be done with tools like dose3. Currently these sets will always include apt which makes the solution less useful. - use multistrap to create a very minimal chroot (i.e. without apt). Currently multistrap is unable to create a chroot that does not contain apt due to this limitation of apt. > > Yeah, I've done that before (and the equivs package is helpful there). But > > it's two somewhat complicated steps (build a package, install a local > > package), for something that seems more like it should be a simple > > configuration step ("these packages are important to me: ..."). > > Alternatively, it might make sense (from a user/admin's POV) to do it > via 'apt-mark', ie: > > apt-mark important xmonad > apt-mark essential sysvinit-core > > (I'm not really familiar with apt-mark though, particular if it's something > people should feel comfortable relying on) I'm also not very familiar with apt-mark but above two scenarios would be much more complicated to achieve if one had to go through apt-mark first. Using the apt configuration would make both of the above two scenarios very simple to implement, so I think a configuration variable similar to the one proposed by aj might be a good way forward. Thanks! cheers, josch signature.asc Description: signature
Bug#767891: apt: Provide ability to manually mark packages as essential
Package: apt Version: 1.0.9.3 Severity: wishlist Tags: patch Hi, It would be useful to be able to locally mark certain packages as Essential:yes so that they are never uninstalled. Trivial example: mark sysvinit-core as essential on systems you don't want to have upgraded to systemd as init. I'm including a patch that allows you to do this by: $ sudo apt-get -o pkgCacheGen::ForceEssential=systemd-sysv,apt update ... $ sudo apt-get install sysvinit-core Reading package lists... Done Building dependency tree Reading state information... Done The following packages will be REMOVED: systemd-sysv The following NEW packages will be installed: sysvinit-core WARNING: The following essential packages will be removed. This should NOT be done unless you know exactly what you are doing! systemd-sysv 0 upgraded, 1 newly installed, 1 to remove and 304 not upgraded. Need to get 0 B/130 kB of archives. After this operation, 179 kB of additional disk space will be used. You are about to do something potentially harmful. To continue type in the phrase 'Yes, do as I say!' ?] no Abort. versus: $ sudo apt-get -o pkgCacheGen::ForceEssential=apt update ... $ sudo apt-get install sysvinit-core Reading package lists... Done Building dependency tree Reading state information... Done The following packages will be REMOVED: systemd-sysv The following NEW packages will be installed: sysvinit-core 0 upgraded, 1 newly installed, 1 to remove and 304 not upgraded. Need to get 0 B/130 kB of archives. After this operation, 179 kB of additional disk space will be used. Do you want to continue? [Y/n] n Abort. Patch is (git diff -b, ignoring whitespace-only changes): --- a/apt-pkg/deb/deblistparser.cc +++ b/apt-pkg/deb/deblistparser.cc @@ -277,13 +277,20 @@ bool debListParser::UsePackage(pkgCache::PkgIterator Pkg, if (Section.FindFlag(Important,Pkg-Flags,pkgCache::Flag::Important) == false) return false; - if (strcmp(Pkg.Name(),apt) == 0) + std::vectorstd::string force_essential = _config-FindVector(pkgCacheGen::ForceEssential,apt); + for (std::vectorstd::string::const_iterator p = force_essential.begin(); p != force_essential.end(); ++p) + { + if (strcmp(p-c_str(), Pkg.Name()) == 0) { if ((essential == native Pkg-Arch != 0 myArch == Pkg.Arch()) || essential == all) Pkg-Flags |= pkgCache::Flag::Essential | pkgCache::Flag::Important; else Pkg-Flags |= pkgCache::Flag::Important; + + _error-Notice(Marking package as essential: %s,p-c_str()); + + } } if (ParseStatus(Pkg,Ver) == false) Cheers, aj -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#767891: apt: Provide ability to manually mark packages as essential
On Mon, Nov 3, 2014 at 10:26 AM, Anthony Towns a...@erisian.com.au wrote: Package: apt Version: 1.0.9.3 Severity: wishlist Tags: patch Hi, It would be useful to be able to locally mark certain packages as Essential:yes so that they are never uninstalled. Trivial example: mark sysvinit-core as essential on systems you don't want to have upgraded to systemd as init. A simple way to achieve what you want is to create a local dummy package that depends on the packages you want and is Essential: yes or Important: yes. Important being preferred, since it has less restrictions on installation ordering. It's what I do on all my machines: Create one metapackage per machine that is Important: yes, and install that. Works nicely. -- Julian Andres Klode - Debian Developer, Ubuntu Member See http://wiki.debian.org/JulianAndresKlode and http://jak-linux.org/. -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#767891: apt: Provide ability to manually mark packages as essential
On 3 November 2014 20:22, Julian Andres Klode j...@debian.org wrote: A simple way to achieve what you want is to create a local dummy package that depends on the packages you want and is Essential: yes or Important: yes. Important being preferred, since it has less restrictions on installation ordering. Yeah, I've done that before (and the equivs package is helpful there). But it's two somewhat complicated steps (build a package, install a local package), for something that seems more like it should be a simple configuration step (these packages are important to me: ...). Cheers, aj -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#767891: apt: Provide ability to manually mark packages as essential
On 3 November 2014 20:30, Anthony Towns a...@erisian.com.au wrote: On 3 November 2014 20:22, Julian Andres Klode j...@debian.org wrote: A simple way to achieve what you want is to create a local dummy package that depends on the packages you want and is Essential: yes or Important: yes. Important being preferred, since it has less restrictions on installation ordering. Yeah, I've done that before (and the equivs package is helpful there). But it's two somewhat complicated steps (build a package, install a local package), for something that seems more like it should be a simple configuration step (these packages are important to me: ...). Alternatively, it might make sense (from a user/admin's POV) to do it via 'apt-mark', ie: apt-mark important xmonad apt-mark essential sysvinit-core (I'm not really familiar with apt-mark though, particular if it's something people should feel comfortable relying on) Cheers, aj -- Anthony Towns a...@erisian.com.au -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org