[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: cleanly getting rid of manually installed transitional packages due to rename



On Thu 23 Apr 2020 at 02:53:06 (+0200), Vincent Lefevre wrote:
> On 2020-04-22 16:07:28 -0500, David Wright wrote:
> > For trivial renames, which yours looks like, as do those I've done,
> > it would be pretty easy to script. I've never made the effort,
> > because it's not something I do frequently enough, usually just once,
> > soon after I start running a new release on the first computer. Then
> > I adjust the list of packages used for the rest of them. Manually:
> > 
> >  $ apt-get -s purge pdftk
> >  The following package was automatically installed and is no longer required:
> >   pdftk-java
> >  Use 'apt autoremove' to remove it.
> >  # apt-mark manual pdftk-java
> >  pdftk-java set to manually installed.
> >  $ apt-get -s purge pdftk
> >  # apt-get purge pdftk
> >  Removing pdftk (2.02-5) ...
> > 
> > (Routine output edited out.) The first step can list more packages,
> > so checking the Depends line for the original package should show
> > which is the replacement.
> 
> I think that you are over-optimistic. Imagine the following case.
> The pdftk package has been manually installed in the past

Right…

> and is
> not a transitional package to pdftk-java

OK, let's pretend that is true…
(Not changing the names may be confusing.)

> (currently, this is like
> your example).

I can't determine what you mean by this, so I'm ignoring it.

> But the system has some package that depends on
> pdftk-java. So, when you run
> 
>   apt-get -s purge pdftk
> 
> you won't have any message about pdftk-java.

Why would I suddenly decide to purge pdftk? I installed it for a
reason and, if it's not transitional, it's still fulfilling that
purpose.

> Later in the future,
> the dependency on pdftk-java disappears, so that pdftk-java will
> be proposed for autoremoval.

No, because I'm not removing pdftk in the first place, so the rest
of this hypothetical scenario is flawed, hence ignored: {{

> But since this can occur a long time
> after the removal of pdftk, you probably have forgotten that you
> still need pdftk-java, even if you use it everyday. Well, for
> this one, one can probably guess (not sure though, as "-java"
> could also mean an extension for java), but there are packages
> for which one cannot remember/know all command they define.

}}

So let's leave that example by the side, as it's nothing to do with
transitional packages.

> I think that the script should look at the dependencies of the
> transitional package, and mark all of them as manually installed
> (even if this is currently useless due to dependencies from other
> packages).

In the cases where I think you could write a simple script, there will
typically be one dependency: the replacement package itself. The
"noise" that autoremove can generate (as in your first example¹) is
just because the replacement itself might have dependencies that
it wants to remove.

But if the transitional package has more than one dependency, then it
likely involves a split, and the change should be under consideration
by the sysadmin. After all, you might have no use at all for one
part of the split, so it might be better to remove that part,
rather than have the system automatically mark it just the opposite:
that you deliberately installed it manually.

¹ I can't test that example because I run stable/buster. Obviously
  I'm assuming that autoremove only listed those three *161 packages
  when you threatened to remove dnsutils, and not before.

Cheers,
David.


Reply to: