On 2024-03-11 15:18:44 +0100, Chris Hofstaedtler wrote:
> Thus, a good approximation of the default deborphan functionality
> (no additional options passed) is:
> 
> $ apt-mark auto '~i !~M (~slibs|~soldlibs|~slibdevel|~sintrospection|~sdebug)'
> possibly followed by

No, to mimic deborphan, you should exclude ~slibdevel and ~sdebug
from this list. So

  apt-mark auto '~i !~M (~slibs|~soldlibs|~sintrospection)'

Let's recall the deborphan(1) man page:

  The default operation is to search within the libs, oldlibs and
                                                ^^^^  ^^^^^^^
  introspection sections to hunt down unused libraries.
  ^^^^^^^^^^^^^

Indeed, -dev packages are necessary to do development work on
non-Debian software (or just build such software); so, if such
packages have been manually installed, they must probably remain
installed and not be marked as auto.

Similarly, -dbgsym packages are typically installed by the user for
debugging purpose. However, such packages should be removed when
the associated library package would be removed if the -dbgsym
package were not there, but the above pattern will not catch that.
This was already an issue with deborphan:

  https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=742196

On 2024-03-17 15:54:27 +0200, Martin-Éric Racine wrote:
> Another issue I've run into to try and replace deborphan with some
> apt-mark recipe: apt-mark's regex syntax is not documented. The man
> page merely lists the commands and options available.

I suspect that this is apt-patterns(7). The apt-mark(8) man page just
gives a reference to apt-get(8), which mentions apt-patterns(7), but
I think that a more direct reference should be given.

> For instance, I have no idea how you came up with the above regex
> recipe, or how I would tell apt-mark to never mark as "auto" anything
> with a priority important or higher.

I don't think that you should care of the priority. This was needed
for deborphan in order to ignore the "required" priority, but AFAIK,
apt will never propose to remove such packages.

The only thing that is missing with patterns is to be able to specify
a package list from a file, in order to mimic deborphan's keep-list:
/var/lib/deborphan/keep

But one could still write a simple wrapper to add "!?name(package_name)"
to the pattern for each package_name found in a keep-list file. It could
even be possible to provide regular expressions, which deborphan did not
support. For instance you could have a pattern_file file with

  ~i !~M (~slibs|~soldlibs|~sintrospection) !~n(pkg1|pkg2|pkg3)

and use

  apt-mark auto "$(cat /path/to/pattern_file)"

Before doing that, you could check with

  apt-mark showmanual "$(cat /path/to/pattern_file)"

-- 
Vincent Lefèvre <vinc...@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)

Reply via email to