From 0c4438e2e3175184521b968f5774a6b13d62aa79 Mon Sep 17 00:00:00 2001 From: Tomas Pospisek Date: Thu, 8 Mar 2018 15:16:51 +0100 Subject: [PATCH 1/3] This patch makes the UI display security updates with a 'U' instead of a 'u'. This patch is the counterpart to this apt-dater-host commit ... https://github.com/sourcepole/apt-dater-host/commit/8ac83e003c5aaff17d6fcaf5f0e4166b5d061640 ... which make apt-dater-host report security updates with a flag 'U' instead of a 'u'. --- src/apt-dater.h | 1 + src/stats.c | 5 +++++ src/ui.c | 4 +++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/apt-dater.h b/src/apt-dater.h index 7eda3555..1df3e0d2 100644 --- a/src/apt-dater.h +++ b/src/apt-dater.h @@ -181,6 +181,7 @@ typedef enum { #ifdef FEAT_CLUSTERS #define HOST_STATUS_CLUSTERED 512 #endif +#define HOST_STATUS_PKGSECUPDATE 1024 #define HOST_FORBID_REFRESH 1 #define HOST_FORBID_UPGRADE 2 diff --git a/src/stats.c b/src/stats.c index 5d32027f..8ce50fba 100644 --- a/src/stats.c +++ b/src/stats.c @@ -323,6 +323,11 @@ gboolean getUpdatesFromStat(HostNode *n) pkgnode->flag = HOST_STATUS_PKGUPDATE; n->nupdates++; break; + case 'U': + n->status = n->status | HOST_STATUS_PKGUPDATE | HOST_STATUS_PKGSECUPDATE; + pkgnode->flag = HOST_STATUS_PKGUPDATE | HOST_STATUS_PKGSECUPDATE; + n->nupdates++; + break; case 'h': n->status = n->status | HOST_STATUS_PKGKEPTBACK; pkgnode->flag = HOST_STATUS_PKGKEPTBACK; diff --git a/src/ui.c b/src/ui.c index 23769390..67789216 100644 --- a/src/ui.c +++ b/src/ui.c @@ -1476,7 +1476,9 @@ void drawPackageEntry (DrawNode *n) attron(n->attrs); mvremln(n->scrpos, 0, COLS); - if(((PkgNode *) n->p)->flag & HOST_STATUS_PKGUPDATE) + if(((PkgNode *) n->p)->flag & HOST_STATUS_PKGSECUPDATE) + mvaddstr(n->scrpos, 7, "U:"); + else if(((PkgNode *) n->p)->flag & HOST_STATUS_PKGUPDATE) mvaddstr(n->scrpos, 7, "u:"); else if(((PkgNode *) n->p)->flag & HOST_STATUS_PKGKEPTBACK) mvaddstr(n->scrpos, 7, "h:"); From 3db59efe932f18377635ed52d9f704c7e5142019 Mon Sep 17 00:00:00 2001 From: Tomas Pospisek Date: Thu, 8 Mar 2018 16:13:36 +0100 Subject: [PATCH 2/3] fix spelling error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Patch retrieved from Debian package of apt-dater. Original source: http://http.debian.net/debian/pool/main/a/apt-dater/apt-dater_1.0.3-6.debian.tar.xz Patch created by Patrick Matthäi --- man/apt-dater.8 | 2 +- man/apt-dater.html | 2 +- man/apt-dater.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/man/apt-dater.8 b/man/apt-dater.8 index f64c6059..a6cd3e1d 100644 --- a/man/apt-dater.8 +++ b/man/apt-dater.8 @@ -39,7 +39,7 @@ This manual page documents briefly the command\&. .PP \fBapt\-dater\fR -is a program to manage package updats on a large number of remote hosts using SSH\&. +is a program to manage package updates on a large number of remote hosts using SSH\&. .SH "OPTIONS" .PP \fBapt\-dater\fR diff --git a/man/apt-dater.html b/man/apt-dater.html index a771b0af..6f9d61af 100644 --- a/man/apt-dater.html +++ b/man/apt-dater.html @@ -1,4 +1,4 @@ APT-DATER

Name

apt-dater — terminal-based remote package update manager

Synopsis

apt-dater [[-(c config|v|[n]r)]]

DESCRIPTION

This manual page documents briefly the - apt-dater command.

apt-dater is a program to manage package updats on a large + apt-dater command.

apt-dater is a program to manage package updates on a large number of remote hosts using SSH.

OPTIONS

apt-dater accepts the following command parameters:

-c config

Use alternative config file. Default is $XDG_CONFIG_HOME/apt-dater/apt-dater.xml.

-v

Show apt-dater version and copyright statement.

-r

Refresh hosts and create XML report on stdout. apt-dater must be compiled with XMLREPORT feature.

-n

Prevent hosts to be refreshed before create XML report (useful for cronjobs which do not have access to SSH key(s)).

ENVIRONMENT

MAINTAINER

The maintainer's name (i.e. used by debtrack). If not set, the GECOS entry for the current user will be used. This environment variable could be forwarded to remote hosts with the ssh(1) SendEnv+AcceptEnv options.

FILES

~/.config/apt-dater/apt-dater.xml

The configuration file of apt-dater

~/.config/apt-dater/hosts.xml

Contains all hosts you would like to manage

SEE ALSO

apt-dater.xml(5), apt-get(1), debtrack, ssh(1), XDG Base Directory Specification.

diff --git a/man/apt-dater.xml b/man/apt-dater.xml index 6b4a9645..0ddd7b3f 100644 --- a/man/apt-dater.xml +++ b/man/apt-dater.xml @@ -92,7 +92,7 @@ and docbook-xsl in your Build-Depends control field. This manual page documents briefly the &dhpackage; command. - &dhpackage; is a program to manage package updats on a large + &dhpackage; is a program to manage package updates on a large number of remote hosts using SSH. From 7d7113888996f2b0255a7b043974a11fa331b012 Mon Sep 17 00:00:00 2001 From: Tomas Pospisek Date: Fri, 30 Mar 2018 11:18:56 +0200 Subject: [PATCH 3/3] implement apt-dater side of new proposal to differentiate security updates see https://github.com/DE-IBH/apt-dater-host/pull/25#issuecomment-377160705 and following comments --- src/apt-dater.h | 1 + src/stats.c | 20 +++++++++++++++----- src/ui.c | 18 +++++++++++++----- 3 files changed, 29 insertions(+), 10 deletions(-) diff --git a/src/apt-dater.h b/src/apt-dater.h index 1df3e0d2..642ceb6f 100644 --- a/src/apt-dater.h +++ b/src/apt-dater.h @@ -143,6 +143,7 @@ typedef struct _update { gchar *version; gint flag; gchar *data; + gchar *security_update_version; } PkgNode; typedef struct _session { diff --git a/src/stats.c b/src/stats.c index 8ce50fba..ce35cf6f 100644 --- a/src/stats.c +++ b/src/stats.c @@ -169,6 +169,8 @@ void freePkgNode(PkgNode *n) g_free(n->version); if(n->data) g_free(n->data); + if(n->security_update_version) + g_free(n->security_update_version); g_free(n); } } @@ -323,11 +325,6 @@ gboolean getUpdatesFromStat(HostNode *n) pkgnode->flag = HOST_STATUS_PKGUPDATE; n->nupdates++; break; - case 'U': - n->status = n->status | HOST_STATUS_PKGUPDATE | HOST_STATUS_PKGSECUPDATE; - pkgnode->flag = HOST_STATUS_PKGUPDATE | HOST_STATUS_PKGSECUPDATE; - n->nupdates++; - break; case 'h': n->status = n->status | HOST_STATUS_PKGKEPTBACK; pkgnode->flag = HOST_STATUS_PKGKEPTBACK; @@ -352,6 +349,19 @@ gboolean getUpdatesFromStat(HostNode *n) g_strfreev(argv); continue; } + + if(i > 3) { /* read SecurityUpdateVersion */ + switch(argv[3][0]) { + case 's': + pkgnode->security_update_version = g_strdup(&argv[3][2]); + n->status = n->status | HOST_STATUS_PKGSECUPDATE; + pkgnode->flag = pkgnode->flag | HOST_STATUS_PKGSECUPDATE; + break; + default: + /* unknow SecurityUpdateVersion content - ignore */ + g_warning("ignoring unknown SecurityUpdateVersion contents '%s'", argv[3]); + } + } g_strfreev(argv); n->packages = g_list_insert_sorted(n->packages, pkgnode, cmpPackages); diff --git a/src/ui.c b/src/ui.c index 67789216..379ddcd1 100644 --- a/src/ui.c +++ b/src/ui.c @@ -1469,6 +1469,14 @@ void drawHostEntry (DrawNode *n) } } +int snprintf_statusln(char* statusln, char* format, DrawNode *n) +{ + return snprintf(statusln, BUF_MAX_LEN, format, + ((PkgNode *) n->p)->version, + ((PkgNode *) n->p)->data ? ((PkgNode *) n->p)->data : "none", + ((PkgNode *) n->p)->security_update_version ? ((PkgNode *) n->p)->security_update_version : "none"); +} + void drawPackageEntry (DrawNode *n) { char statusln[BUF_MAX_LEN]; @@ -1477,7 +1485,7 @@ void drawPackageEntry (DrawNode *n) mvremln(n->scrpos, 0, COLS); if(((PkgNode *) n->p)->flag & HOST_STATUS_PKGSECUPDATE) - mvaddstr(n->scrpos, 7, "U:"); + mvaddstr(n->scrpos, 7, "s:"); else if(((PkgNode *) n->p)->flag & HOST_STATUS_PKGUPDATE) mvaddstr(n->scrpos, 7, "u:"); else if(((PkgNode *) n->p)->flag & HOST_STATUS_PKGKEPTBACK) @@ -1493,13 +1501,13 @@ void drawPackageEntry (DrawNode *n) attroff(A_BOLD); attroff(n->attrs); if(n->selected == TRUE) { - if(((PkgNode *) n->p)->data) { + if((((PkgNode *) n->p)->data) || (((PkgNode *) n->p)->security_update_version)) { if (((PkgNode *) n->p)->flag & HOST_STATUS_PKGBROKEN) - snprintf(statusln, BUF_MAX_LEN, "%s (%s)", ((PkgNode *) n->p)->version, ((PkgNode *) n->p)->data); + snprintf_statusln(statusln, "%s (%s) (security: %s)", n); else - snprintf(statusln, BUF_MAX_LEN, "%s -> %s", ((PkgNode *) n->p)->version, ((PkgNode *) n->p)->data); + snprintf_statusln(statusln, "%s -> %s (security: %s)", n); } else - snprintf(statusln, BUF_MAX_LEN, "%s", ((PkgNode *) n->p)->version); + snprintf_statusln( statusln, "%s", n); drawMenu(VK_INSTALL); drawStatus(statusln, TRUE); }