texlive[68316] Master/tlpkg/TeXLive/TLPDB.pm: (remove_package): do

commits+karl at tug.org commits+karl at tug.org
Mon Sep 18 23:15:12 CEST 2023


Revision: 68316
          https://tug.org/svn/texlive?view=revision&revision=68316
Author:   karl
Date:     2023-09-18 23:15:11 +0200 (Mon, 18 Sep 2023)
Log Message:
-----------
(remove_package): do not warn about failing to unlink(*.tlpobj),
as we remove them explicitly. Tweak messages.

Modified Paths:
--------------
    trunk/Master/tlpkg/TeXLive/TLPDB.pm

Modified: trunk/Master/tlpkg/TeXLive/TLPDB.pm
===================================================================
--- trunk/Master/tlpkg/TeXLive/TLPDB.pm	2023-09-18 20:07:06 UTC (rev 68315)
+++ trunk/Master/tlpkg/TeXLive/TLPDB.pm	2023-09-18 21:15:11 UTC (rev 68316)
@@ -2014,7 +2014,9 @@
   my $tlp = $localtlpdb->get_package($pkg);
   my $usertree = $localtlpdb->setting("usertree");
   if (!defined($tlp)) {
-    tlwarn ("TLPDB: package not present, so nothing to remove: $pkg\n");
+    # we should not be called.
+    tlwarn ("TLPDB::remove_package: package not present, ",
+            "so nothing to remove: $pkg\n");
   } else {
     my $currentarch = $self->platform();
     if ($pkg eq "texlive.infra" || $pkg eq "texlive.infra.$currentarch") {
@@ -2025,8 +2027,10 @@
     my $Master = $localtlpdb->root;
     chdir ($Master) || die "chdir($Master) failed: $!";
     my @files = $tlp->all_files;
+    #
     # also remove the .tlpobj file
     push @files, "tlpkg/tlpobj/$pkg.tlpobj";
+    #
     # and the ones from src/doc splitting
     if (-r "tlpkg/tlpobj/$pkg.source.tlpobj") {
       push @files, "tlpkg/tlpobj/$pkg.source.tlpobj";
@@ -2117,7 +2121,7 @@
     # we have already check for the existence of the dirs returned
     for my $d (keys %by_dirs) {
       if (! &TeXLive::TLUtils::dir_writable($d)) {
-        tlwarn("TLPDB: directories are not writable, cannot remove files: $d\n");
+        tlwarn("TLPDB::remove_package: directories are not writable, cannot remove files: $d\n");
         return 0;
       }
     }
@@ -2124,13 +2128,17 @@
 
     # now do the removal
     for my $entry (@goodfiles) {
-      unlink $entry or tlwarn("Could not unlink $entry: $!\n");
+      unlink($entry)
+      || $entry =~ /\.tlpobj$/ # we remove .tlpobj explicitly above
+      || tlwarn("TLPDB::remove_package: Could not unlink $entry: $!\n");
     }
     for my $d (@removals) {
-      rmdir $d or tlwarn("Could not remove directory $d: $!\n")
+      rmdir($d)
+      || tlwarn("TLPDB::remove_package: Could not rmdir $d: $!\n")
     }
     $localtlpdb->remove_tlpobj($pkg);
     TeXLive::TLUtils::announce_execute_actions("disable", $tlp);
+    
     # should we save at each removal???
     # advantage: the tlpdb actually reflects what is installed
     # disadvantage: removing a collection calls the save routine several times
@@ -2149,6 +2157,7 @@
     # files are already removed.
     # Again, desktop integration maps to desktop and menu links
     if (!$opts{'nopostinstall'}) {
+      debug(" TLPDB::remove_package: running remove postinstall");
       &TeXLive::TLUtils::do_postaction("remove", $tlp,
         $localtlpdb->option("file_assocs"),
         $localtlpdb->option("desktop_integration"),



More information about the tex-live-commits mailing list.