Преглед на файлове

dselect: Add new architecture columns to package list view

The new columns, shown by default, can be turned off with the new ‘A’
key, or bound to another key via the new “archdisplay” keybinding.
Guillem Jover преди 12 години
родител
ревизия
b13e29d687
променени са 9 файла, в които са добавени 83 реда и са изтрити 9 реда
  1. 3 0
      debian/changelog
  2. 1 1
      dselect/helpmsgs.cc
  3. 25 0
      dselect/pkgcmds.cc
  4. 17 0
      dselect/pkgdisplay.cc
  5. 2 0
      dselect/pkgkeys.cc
  6. 2 0
      dselect/pkglist.cc
  7. 4 0
      dselect/pkglist.h
  8. 18 0
      dselect/pkgtop.cc
  9. 11 8
      man/dselect.1

+ 3 - 0
debian/changelog

@@ -9,6 +9,9 @@ dpkg (1.17.12) UNRELEASED; urgency=low
       mention the version they got introduced in dpkg.
     - Fix formatting of last paragraphs inside dselect(1) --color description.
   * Rework dselect columns code, to make it easier to maintain and read.
+  * Add new architecture columns to dselect package list view. The new
+    columns, shown by default, can be turned off with the new ‘A’ key,
+    or bound to another key via the new “archdisplay” keybinding.
 
   [ Updated programs translations ]
   * German (Sven Joachim).

+ 1 - 1
dselect/helpmsgs.cc

@@ -45,7 +45,7 @@ Mark packages for later processing:\n\
 Quit, exit, overwrite (note capitals!):       ?, F1 request help (also Help)\n\
  Return  Confirm, quit (check dependencies)   i, I  toggle/cycle info displays\n\
    Q     Confirm, quit (override dep.s)       o, O  cycle through sort options\n\
- X, Esc  eXit, abandoning any changes made    v, V  change status display opts\n\
+ X, Esc  eXit, abandoning any changes made   v, A, V  change status display opts\n\
    R     Revert to state before this list      ^l   redraw display\n\
    U     set all to sUggested state             /   search (Return to cancel)\n\
    D     set all to Directly requested state  n, \\  repeat last search\n")

+ 25 - 0
dselect/pkgcmds.cc

@@ -226,6 +226,31 @@ void packagelist::resortredisplay() {
   refreshlist();
 }
 
+void
+packagelist::kd_archdisplay()
+{
+  switch (archdisplayopt) {
+  case ado_both:
+    archdisplayopt = ado_none;
+    break;
+  case ado_none:
+    archdisplayopt = ado_available;
+    break;
+  case ado_available:
+    archdisplayopt = ado_both;
+    break;
+  default:
+    internerr("unknown archdisplayopt %d", archdisplayopt);
+  }
+  setwidths();
+  leftofscreen = 0;
+  ldrawnstart = ldrawnend = -1;
+  redrawtitle();
+  redrawcolheads();
+  redrawitemsrange(topofscreen, min(topofscreen + list_height, nitems));
+  refreshlist();
+}
+
 void packagelist::kd_versiondisplay() {
   switch (versiondisplayopt) {
   case vdo_both:       versiondisplayopt= vdo_none;       break;

+ 17 - 0
dselect/pkgdisplay.cc

@@ -151,6 +151,23 @@ void packagelist::setwidths() {
 
   add_column(col_package, _("Package"), verbose ? 16 : 12);
 
+  switch (archdisplayopt) {
+  case ado_none:
+    col_archinstalled.blank();
+    col_archavailable.blank();
+    break;
+  case ado_available:
+    col_archinstalled.blank();
+    add_column(col_archavailable, _("Avail.arch"), verbose ? 14 : 10);
+    break;
+  case ado_both:
+    add_column(col_archinstalled, _("Inst.arch"), verbose ? 14 : 10);
+    add_column(col_archavailable, _("Avail.arch"), verbose ? 14 : 10);
+    break;
+  default:
+    internerr("unknown archdisplayopt %d", archdisplayopt);
+  }
+
   switch (versiondisplayopt) {
   case vdo_none:
     col_versioninstalled.blank();

+ 2 - 0
dselect/pkgkeys.cc

@@ -51,6 +51,7 @@ const keybindings::interpretation packagelist_kinterps[] = {
   { "info",             nullptr,  &packagelist::kd_info,             qa_noquit           },
   { "toggleinfo",       nullptr,  &packagelist::kd_toggleinfo,       qa_noquit           },
   { "verbose",          nullptr,  &packagelist::kd_verbose,          qa_noquit           },
+  { "archdisplay",      nullptr,  &packagelist::kd_archdisplay,      qa_noquit           },
   { "versiondisplay",   nullptr,  &packagelist::kd_versiondisplay,   qa_noquit           },
   { "help",             nullptr,  &packagelist::kd_help,             qa_noquit           },
   { "search",           nullptr,  &packagelist::kd_search,           qa_noquit           },
@@ -122,6 +123,7 @@ const keybindings::orgbinding packagelist_korgbindings[]= {
   { 'o',            "swaporder"        },
   { 'O',            "swapstatorder"    },
   { 'v',            "verbose"          },
+  { 'A',            "archdisplay"      },
   { 'V',            "versiondisplay"   },
   { CTRL('l'),      "redraw"           },
   { '/',            "search"           },

+ 2 - 0
dselect/pkglist.cc

@@ -426,6 +426,7 @@ packagelist::packagelist(keybindings *kb) : baselist(kb) {
   recursive = false;
   sortorder= so_priority;
   statsortorder= sso_avail;
+  archdisplayopt = ado_both;
   versiondisplayopt= vdo_both;
   sortmakeheads();
   finalsetup();
@@ -444,6 +445,7 @@ packagelist::packagelist(keybindings *kb, pkginfo **pkgltab) : baselist(kb) {
 
   sortorder= so_unsorted;
   statsortorder= sso_unsorted;
+  archdisplayopt = ado_none;
   versiondisplayopt= vdo_none;
   finalsetup();
 }

+ 4 - 0
dselect/pkglist.h

@@ -92,6 +92,8 @@ protected:
   column col_section;
   column col_priority;
   column col_package;
+  column col_archinstalled;
+  column col_archavailable;
   column col_versioninstalled;
   column col_versionavailable;
   column col_description;
@@ -111,6 +113,7 @@ protected:
   bool recursive, verbose;
   enum { so_unsorted, so_section, so_priority, so_alpha } sortorder;
   enum { sso_unsorted, sso_avail, sso_state } statsortorder;
+  enum { ado_none, ado_available, ado_both } archdisplayopt;
   enum { vdo_none, vdo_available, vdo_both } versiondisplayopt;
   bool calcssadone, calcsssdone;
   struct perpackagestate *headings;
@@ -204,6 +207,7 @@ protected:
   void kd_info();
   void kd_toggleinfo();
   void kd_verbose();
+  void kd_archdisplay();
   void kd_versiondisplay();
 
   packagelist(keybindings *kb); // nonrecursive

+ 18 - 0
dselect/pkgtop.cc

@@ -208,6 +208,19 @@ void packagelist::redraw1itemsel(int index, int selected) {
 
     waddch(listpad, ' ');
 
+    if (col_archinstalled.width) {
+      draw_column_sep(col_archinstalled, screenline);
+      draw_column_item(col_archinstalled, screenline, pkg->installed.arch->name);
+
+      waddch(listpad, ' ');
+    }
+    if (col_archavailable.width) {
+      draw_column_sep(col_archavailable, screenline);
+      draw_column_item(col_archavailable, screenline, pkg->available.arch->name);
+
+      waddch(listpad, ' ');
+    }
+
     if (col_versioninstalled.width) {
       draw_column_item(col_versioninstalled, screenline,
                        versiondescribe(&pkg->installed.version, vdew_nonambig));
@@ -279,6 +292,11 @@ void packagelist::redrawcolheads() {
     draw_column_head(col_priority);
     draw_column_head(col_package);
 
+    if (col_archinstalled.width)
+      draw_column_head(col_archinstalled);
+    if (col_archavailable.width)
+      draw_column_head(col_archavailable);
+
     if (col_versioninstalled.width)
       draw_column_head(col_versioninstalled);
     if (col_versionavailable.width)

+ 11 - 8
man/dselect.1

@@ -4,7 +4,7 @@
 .\" Copyright © 2000 Josip Rodin
 .\" Copyright © 2001 Joost Kooij
 .\" Copyright © 2001 Wichert Akkerman <wakkerma@debian.org>
-.\" Copyright © 2010-2011 Guillem Jover <guillem@debian.org>
+.\" Copyright © 2010-2014 Guillem Jover <guillem@debian.org>
 .\"
 .\" This is free software; you can redistribute it and/or modify
 .\" it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@
 .\" You should have received a copy of the GNU General Public License
 .\" along with this program.  If not, see <https://www.gnu.org/licenses/>.
 .
-.TH dselect 1 "2012-04-07" "Debian Project" "Debian"
+.TH dselect 1 "2014-08-11" "Debian Project" "Debian"
 .SH NAME
 dselect \- Debian package management frontend
 .
@@ -280,12 +280,15 @@ The main select screen displays a list of all packages known to the debian
 package management system. This includes packages installed on the system
 and packages known from the available packages database.
 .sp
-For every package, the list shows the package's status, priority,
-section, installed and available versions, the package name and its
-short description, all in one line. By pressing the \fB'V'\fP key,
-the display of the installed and available version can be toggled between
-on an off. By pressing the \fB'v'\fP key,
-the package status display is toggled between verbose and shorthand.
+For every package, the list shows the package's status, priority, section,
+installed and available architecture, installed and available versions,
+the package name and its short description, all in one line.
+By pressing the \fB'A'\fP key, the display of the installed and available
+architecture can be toggled between on an off.
+By pressing the \fB'V'\fP key, the display of the installed and available
+version can be toggled between on an off.
+By pressing the \fB'v'\fP key, the package status display is toggled between
+verbose and shorthand.
 Shorthand display is the default.
 .sp
 The shorthand status indication consists