From nobody Wed Aug 24 17:32:23 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4MCY7r1sGpz4ZQZw; Wed, 24 Aug 2022 17:32:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4MCY7r1Q4xz3D0L; Wed, 24 Aug 2022 17:32:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1661362344; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=upW5MS/tSQ+qEHYuWMrAGuA2HwcKxBfHJEJzYyqmo5s=; b=wsAp2Cla+gE5l+TRNA0YUvJCua6Bi9dwUiBrqYDBxlkeQ140ptZ+RTPrPPhr5f05q0asSO /eG4ThbvZgiyVHUFLhtqgTy1Di5z9AyXe0SU2B2kITJiVyPccZgSmft4Xysp43EEFRjgmy tkyF/GgvurPAGDA0x+kcek80gbqj8aGDZ9EQwjszrlLAbINSvcD2BXB7QFli9es1YJQulV 3YKqh/qEKNnTW1yABxIi1d1pTuEML/7aSUFlHCLKEjANViOzG7XcHGciMSRr7qNEYSHMPm dFDD81N/4oBeLXM0RTzBE3rvsrnLTvpgI7h/3YFJ4zotBAt5g70PqE8yIyhinA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4MCY7r09tlzHXr; Wed, 24 Aug 2022 17:32:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 27OHWNEt012684; Wed, 24 Aug 2022 17:32:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 27OHWNKi012683; Wed, 24 Aug 2022 17:32:23 GMT (envelope-from git) Date: Wed, 24 Aug 2022 17:32:23 GMT Message-Id: <202208241732.27OHWNKi012683@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Brooks Davis Subject: git: e9ad2964f5de - main - pkg: Add limited --debug/-d support List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: brooks X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e9ad2964f5de925f21f54db17da8de3796381186 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1661362344; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=upW5MS/tSQ+qEHYuWMrAGuA2HwcKxBfHJEJzYyqmo5s=; b=Q8e82OoEv3b2o9iSm+BtUoZWtQ1SktQfN3Wy97lBvgH6tumSFW5/R8LkHaJQ0P0vUPKGgB 01SK/y+suWbne9b20EPNZEZ1tZg/hciWFa0t++gf1uXf4IVf0oenwn+h2H1aNorsdTWv3z vGXZg9/nhEv9UxpCtEt6xb4RBzp3db6LXW06SY7QBsl3ca8e7odLumurbbdXmf6Q9iCJJ2 dxtILboYrODKrQ7AAzIcnrYRYVs9cJoTzhTNwOZ2EjBU3r4KCDZUsOockLphMv8b4juZmn nJUqmRs1MVKt1SzYqfdIRuXoySIzt2auwwaHUCHo1M3PkA0IuCboyZlGMqjYaQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1661362344; a=rsa-sha256; cv=none; b=PleW9WoQgNy2cYtyWvz+VCe+g+28NyA5rxxRZ5rcKdxBN+RwosSMdFhs0x8Zb/3kDkvrj0 bX8vHy4S4XpgVYZpeHXFrp+eodu/EIcmom7p9Ss3rtgwHYUkyaQ7SPfM7NRcTVKhLBRyyl P4Yg1rYpkG0PKsjof0D5s3JFmc/GiJ8Oo0R+hmXhumeDVeHkJP0oSgoJZJ9wgq/+wLgDl0 DCtqOekvdqycMHOyqBMOgPTmmjGF/MirAZSglKLp5pjffKRM7eFSQSMk1kalwVhC2nVrob tBn4Tm/6Yvw8eX5TcfDzbi4S2ZshwMJRpnsQo2saQ4WEaWE/BRhFXc7el9asnA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by brooks: URL: https://cgit.FreeBSD.org/src/commit/?id=e9ad2964f5de925f21f54db17da8de3796381186 commit e9ad2964f5de925f21f54db17da8de3796381186 Author: Brooks Davis AuthorDate: 2022-08-24 17:32:09 +0000 Commit: Brooks Davis CommitDate: 2022-08-24 17:32:09 +0000 pkg: Add limited --debug/-d support Add an internal debug level global: - Level 1 (-d) currently does nothing. - Level 2 (-d -d) enables libfetch debugging (quite verbose) so it's possible to see what pkg is attempting to download without having to sniff traffic. Reviewed by: debdrup, bapt Differential Revision: https://reviews.freebsd.org/D35756 --- usr.sbin/pkg/pkg.7 | 18 +++++++++++++++--- usr.sbin/pkg/pkg.c | 10 +++++++++- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/usr.sbin/pkg/pkg.7 b/usr.sbin/pkg/pkg.7 index c8ebf8272092..d0b401edf1fa 100644 --- a/usr.sbin/pkg/pkg.7 +++ b/usr.sbin/pkg/pkg.7 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 30, 2022 +.Dd August 24, 2022 .Dt PKG 7 .Os .Sh NAME @@ -32,16 +32,17 @@ .Nd a utility for manipulating packages .Sh SYNOPSIS .Nm +.Op Fl d .Ar command ... .Nm .Cm add -.Op Fl fy +.Op Fl dfy .Op Fl r Ar reponame .Ar pkg.txz .Nm .Fl N .Nm -.Op Fl 46 +.Op Fl 46d .Cm bootstrap .Op Fl fy .Op Fl r Ar reponame @@ -121,6 +122,17 @@ If a .Ar reponame has been specified, then the configuration for that repository will be used. .El +.Sh OPTIONS +The following options are supported by +.Nm : +.Bl -tag -width indent +.It Fl d, Fl -debug +Show debug information. +May be specified more than once to increase the level of detail. +When specified twice, +.Xr fetch 3 +debug output is enabled. +.El .Sh CONFIGURATION Configuration varies in whether it is in a repository configuration file or the global configuration file. diff --git a/usr.sbin/pkg/pkg.c b/usr.sbin/pkg/pkg.c index fdc519be8492..393d1af1d69e 100644 --- a/usr.sbin/pkg/pkg.c +++ b/usr.sbin/pkg/pkg.c @@ -91,6 +91,8 @@ static const char *bootstrap_names [] = { STAILQ_HEAD(fingerprint_list, fingerprint); +static int debug; + static int extract_pkg_static(int fd, char *p, int sz) { @@ -1113,6 +1115,7 @@ main(int argc, char *argv[]) yes = false; struct option longopts[] = { + { "debug", no_argument, NULL, 'd' }, { "force", no_argument, NULL, 'f' }, { "only-ipv4", no_argument, NULL, '4' }, { "only-ipv6", no_argument, NULL, '6' }, @@ -1122,8 +1125,11 @@ main(int argc, char *argv[]) snprintf(pkgpath, MAXPATHLEN, "%s/sbin/pkg", getlocalbase()); - while ((ch = getopt_long(argc, argv, "-:fr::yN46", longopts, NULL)) != -1) { + while ((ch = getopt_long(argc, argv, "-:dfr::yN46", longopts, NULL)) != -1) { switch (ch) { + case 'd': + debug++; + break; case 'f': force = true; break; @@ -1220,6 +1226,8 @@ main(int argc, char *argv[]) break; } } + if (debug > 1) + fetchDebug = 1; if ((bootstrap_only && force) || access(pkgpath, X_OK) == -1) { /*