Hello,

I've become sufficiently annoyed by the lack of long descriptions in dselect that I've figured out the attached patch which, at least in my specific environment, seems to fix it. (Hopefully the patch is not too mangled by Thunderbird.)

This patch is for apt's dselect method update script. I don't know if there's a cleaner way to access the Translation files, and I don't know how to select a more suitable language rather than hardcoding "en". It does check whether dctrl-tools is installed and falls back to the old behaviour otherwise. This doesn't affect the output of "apt-cache dumpavail" so it shouldn't cause problems with other usages of that.

I'm happy for this to be hacked around and rewritten as needed; I contribute the below patch to the public domain. That said, dctrl-tools does seem a bit buggy and the below is to some extent the result of working around those bugs.

I hope this helps.

--
Charles
--- /usr/lib/dpkg/methods/apt/update.orig       2023-05-25 15:11:37.000000000 
+0100
+++ /usr/lib/dpkg/methods/apt/update    2025-10-18 18:56:17.370029179 +0100
@@ -28,10 +28,38 @@
 if $APTGET $OPTS "$APT_OPT0" "$APT_OPT1" update
 then
     echo $"Merging available information"
-    rm -f $CACHEDIR/available
+    rm -f $CACHEDIR/available "$CACHEDIR"/avail-desc "$CACHEDIR"/avail-mod
     $APTCACHE dumpavail > $CACHEDIR/available
-    $DPKG "$DPKG_OPTS" --update-avail $CACHEDIR/available
-    rm -f $CACHEDIR/available
+    if test -x /usr/bin/grep-dctrl && test -x /usr/bin/join-dctrl; then
+       # dumpavail output doesn't include descriptions any more, so
+       # add them from downloaded translations files.
+       #
+       # join-dctrl doesn't seem to be able to output only one instance
+       # of the join field while including all other fields, so we
+       # rename it, join, and strip out the renamed version.
+       #
+       # We assume English here.  This should probably be adapted to
+       # do something better, like pick the preferred language from
+       # the APT config.
+
+       # Filter translations to a known set of fields, and change
+       # "package" field name.
+       grep-dctrl --pattern= -s package,description-md5,description-en 
/var/lib/apt/lists/*_Translation-en \
+         | sed 's/^[Pp][Aa][Cc][Kk][Aa][Gg][Ee]:/Package-desc:/' \
+         | sort-dctrl -k package-desc > "$CACHEDIR"/avail-desc
+       # Filter out short descriptions from dumpavail output.
+       grep-dctrl -s description,description-md5 -I - < "$CACHEDIR"/available \
+         | sort-dctrl -k package > "$CACHEDIR"/avail-mod
+       # Insert long descriptions in their place, removing "-en" suffix
+       # from Description field name, and update dpkg.
+       join-dctrl -2 package-desc -1 package -a 1 "$CACHEDIR"/avail-mod 
"$CACHEDIR"/avail-desc \
+         | grep-dctrl -s package-desc -I - \
+         | sed 
's/^[Dd][Ee][Ss][Cc][Rr][Ii][Pp][Tt][Ii][Oo][Nn]-[Ee][Nn]:/Description:/' \
+         | "$DPKG" "$DPKG_OPTS" --update-avail
+    else
+       $DPKG "$DPKG_OPTS" --update-avail $CACHEDIR/available
+    fi
+    rm -f $CACHEDIR/available "$CACHEDIR"/avail-desc "$CACHEDIR"/avail-mod
 
     case "$CLEAN" in
        Pre-Auto|PreAuto|pre-auto)

Reply via email to