From patchwork Tue Sep 10 09:53:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Sexton X-Patchwork-Id: 1232 Return-Path: Delivered-To: patchwork@archlinux.org Received: from apollo.archlinux.org (localhost [127.0.0.1]) by apollo.archlinux.org (Postfix) with ESMTP id 0FB9A1324A097 for ; Tue, 10 Sep 2019 09:54:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on apollo X-Spam-Level: X-Spam-Status: No, score=0.3 required=5.0 tests=DKIM_ADSP_CUSTOM_MED=0.001, DKIM_INVALID=1,DKIM_SIGNED=0.1,FREEMAIL_FROM=0.5,MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3,SPF_HELO_NONE=0.001,SPOOFED_FREEMAIL=1.998, T_DMARC_POLICY_NONE=0.01,T_DMARC_SIMPLE_DKIM=0.01 autolearn=no autolearn_force=no version=3.4.2 X-Spam-BL-Results: [127.0.9.2] Received: from orion.archlinux.org (orion.archlinux.org [88.198.91.70]) by apollo.archlinux.org (Postfix) with ESMTPS for ; Tue, 10 Sep 2019 09:54:00 +0000 (UTC) Received: from orion.archlinux.org (localhost [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id AE12C153F3FCC0; Tue, 10 Sep 2019 09:53:59 +0000 (UTC) Received: from luna.archlinux.org (luna.archlinux.org [IPv6:2a01:4f8:160:3033::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits)) (No client certificate requested) by orion.archlinux.org (Postfix) with ESMTPS; Tue, 10 Sep 2019 09:53:59 +0000 (UTC) Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id 8F0D82BDB6; Tue, 10 Sep 2019 09:53:59 +0000 (UTC) Authentication-Results: luna.archlinux.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=T+Z8YvkV Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id D95842BD5C for ; Tue, 10 Sep 2019 09:53:56 +0000 (UTC) Received: from orion.archlinux.org (orion.archlinux.org [88.198.91.70]) by luna.archlinux.org (Postfix) with ESMTPS for ; Tue, 10 Sep 2019 09:53:56 +0000 (UTC) Received: from orion.archlinux.org (localhost [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id E2FEB153F3FCBF for ; Tue, 10 Sep 2019 09:53:55 +0000 (UTC) Received: from mail-qt1-x842.google.com (mail-qt1-x842.google.com [IPv6:2607:f8b0:4864:20::842]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by orion.archlinux.org (Postfix) with ESMTPS for ; Tue, 10 Sep 2019 09:53:55 +0000 (UTC) Received: by mail-qt1-x842.google.com with SMTP id u40so19933852qth.11 for ; Tue, 10 Sep 2019 02:53:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=a7N558KIDrgc/6rbTOUgg94wMLtfyQWB7pgcdIjLYfU=; b=T+Z8YvkVZenC9yTvLPbZpJXhWMh7hxScmo4CaUta952nigO6ZZgd7nVLuvagBk4323 6XJivXz6/9dvFqrUgCFlD8rk+07iTQ6qwnLSnAwRdQ1O76U1LXlJweph+/4XiEaFXO3t 0ghN8RnvE77dahjx+DTPh8+2dlWYGhjU86hv8qHOvm4d+QCkPLCeC+0CbOGaZ2cDVl46 PU8h2BsL+/tIQdVAYuLt4sa1iauJLtheuM0Vlady5kZ3CpG6qWeHJWSPCUChiKveUPkk 8DR2ETXbObWWPG2iudVvvtFooXsc1G00WV/Q1LVOklTkMJLWMjy6fgbAytUqnt4/1ZY4 Mtug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=a7N558KIDrgc/6rbTOUgg94wMLtfyQWB7pgcdIjLYfU=; b=Rn5qS6NGbPsvDL03F+UjxroNqIaolHFkM8F4uVlMsPhDj4Y0M4K7t7527vCr2o17Jn GTDBFFDq8lw7FdeSZRmyTaZBqt7tgUpo4tUzlLKCZev8DaGbyztaf/lIAZ0SB1geC3l3 DfejUPd5e4W7nLENaFkeyLaWoSnB1IT7bKpuWpozPSad94o+Sy9DxvFi5Zkt/UN00GIi fSiCt52vE7/bnQOlQqxy/lNhxYOiiltEO5Yf7Df2K8uGKgEauYb26q0TLhUXciTATjLX hpd+iN9PMAWyHh/8K45BihTEPCLYSLFRGdzeIftD4CXC7VJLDNjnwPT/4OZ1UpcySbbT X0kw== X-Gm-Message-State: APjAAAVUyy2mpcadTp5jFPfPZZKF4Zh0K/cjJv8wVmLVUfsTVptNt8T5 zfzOnuiL4QWw8LtehxBvMB3lkSdBzDk= X-Google-Smtp-Source: APXvYqzWh8capv2A79Wy2WofDpiKwDSAWRUmOB7lKjQX6eMllIr4NfN8YW2VM6aS6sCDeELri9BVYw== X-Received: by 2002:a05:6214:370:: with SMTP id t16mr17695801qvu.245.1568109234379; Tue, 10 Sep 2019 02:53:54 -0700 (PDT) Received: from archangel.localdomain (209.50.154.216.res-cmts.eph2.ptd.net. [209.50.154.216]) by smtp.gmail.com with ESMTPSA id z5sm9994829qtb.49.2019.09.10.02.53.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2019 02:53:53 -0700 (PDT) From: Matthew Sexton To: pacman-dev@archlinux.org Date: Tue, 10 Sep 2019 05:53:52 -0400 Message-Id: <20190910095352.158387-1-wsdmatty@gmail.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Subject: [pacman-dev] [PATCH] pacman: new config to highlight testing packages X-BeenThere: pacman-dev@archlinux.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion list for pacman development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Discussion list for pacman development Errors-To: pacman-dev-bounces@archlinux.org Sender: "pacman-dev" Only during Install/Upgrade, and not to verbosepkglist Signed-off-by: Matthew Sexton --- src/pacman/conf.c | 2 ++ src/pacman/conf.h | 2 ++ src/pacman/pacman-conf.c | 1 + src/pacman/util.c | 20 ++++++++++++++++---- 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/pacman/conf.c b/src/pacman/conf.c index 2d8518c4..70c8a4f4 100644 --- a/src/pacman/conf.c +++ b/src/pacman/conf.c @@ -494,6 +494,8 @@ static int _parse_options(const char *key, char *value, config->color = isatty(fileno(stdout)) ? PM_COLOR_ON : PM_COLOR_OFF; enable_colors(config->color); } + } else if(strcmp(key, "HighlightTesting") == 0) { + config->highlighttesting = 1; } else if(strcmp(key, "DisableDownloadTimeout") == 0) { config->disable_dl_timeout = 1; } else { diff --git a/src/pacman/conf.h b/src/pacman/conf.h index f45ed436..51fa5764 100644 --- a/src/pacman/conf.h +++ b/src/pacman/conf.h @@ -117,6 +117,8 @@ typedef struct __config_t { unsigned short totaldownload; /* select -Sc behavior */ unsigned short cleanmethod; + /* Highlight packages from testing repositories */ + unsigned short highlighttesting; alpm_list_t *holdpkg; alpm_list_t *ignorepkg; alpm_list_t *ignoregrp; diff --git a/src/pacman/pacman-conf.c b/src/pacman/pacman-conf.c index df874029..1e40c138 100644 --- a/src/pacman/pacman-conf.c +++ b/src/pacman/pacman-conf.c @@ -260,6 +260,7 @@ static void dump_config(void) show_bool("VerbosePkgLists", config->verbosepkglists); show_bool("DisableDownloadTimeout", config->disable_dl_timeout); show_bool("ILoveCandy", config->chomp); + show_bool("HighlightTesting", config->highlighttesting); show_cleanmethod("CleanMethod", config->cleanmethod); diff --git a/src/pacman/util.c b/src/pacman/util.c index 8f6290db..13ac0f25 100644 --- a/src/pacman/util.c +++ b/src/pacman/util.c @@ -898,15 +898,27 @@ static void _display_targets(alpm_list_t *targets, int verbose) /* form data for both verbose and non-verbose display */ for(i = targets; i; i = alpm_list_next(i)) { + unsigned short testing = 0; + const char *repo; pm_target_t *target = i->data; - + alpm_db_t *db = alpm_pkg_get_db(target->install); + if(db) { + repo = alpm_db_get_name(db); + if (strcmp(repo, "testing") == 0 || strcmp(repo,"community-testing") == 0) { + testing = 1; + } + } if(verbose) { rows = alpm_list_add(rows, create_verbose_row(target)); } - if(target->install) { - pm_asprintf(&str, "%s-%s", alpm_pkg_get_name(target->install), - alpm_pkg_get_version(target->install)); + if (testing && config->highlighttesting) { + pm_asprintf(&str, "%s%s-%s%s", config->color == PM_COLOR_ON ? config->colstr.warn : "**", + alpm_pkg_get_name(target->install), alpm_pkg_get_version(target->install), + config->color == PM_COLOR_ON ? config->colstr.nocolor : "**"); + } else { + pm_asprintf(&str, "%s-%s", alpm_pkg_get_name(target->install), alpm_pkg_get_version(target->install)); + } } else if(isize == 0) { pm_asprintf(&str, "%s-%s", alpm_pkg_get_name(target->remove), alpm_pkg_get_version(target->remove));