Re: An idea for a pkg option

From: Sysadmin Lists <sysadmin.lists_at_mailfence.com>
Date: Tue, 22 Mar 2022 18:05:51 UTC
Nevermind. I see now this was a feature request, not a help request sent to @freebsd-questions.

Anyway, it might be possible to use `pkg shell' to query the package's info page for an 'update available' boolean.

> ----------------------------------------
> From: Sysadmin Lists <sysadmin.lists@mailfence.com>
> Sent: Tue Mar 22 18:54:22 CET 2022
> To: Mark Millard <marklmi@yahoo.com>
> Cc: bapt@freebsd.org <bapt@FreeBSD.org>, FreeBSD Toolchain <freebsd-toolchain@freebsd.org>, <freebsd-ports@freebsd.org>, Eugene Grosbein <eugen@grosbein.net>
> Subject: Re: An idea for a pkg option
> 
> 
> `awk' could probably handle that. Something like this*:
> 
> BEGIN { system("pkg update") }
> { while ("pkg info " $1 | getline line > 0) { if ( line ~ /^Available/) { packages = package $1 " "; break } }
> END { "pkg -y upgrade " packages }
> 
> # awk -f pkg_upgrade.awk ~/origins/CA72-pkgs.txt
> 
> 1. updates pkg repo[s] once
> 2. checks each package's info for a line begins with "Available" (I think packages with available updates have such a line)
> 3. creates a list of those packages
> 4. updates them all together
> 
> * Not tested
> ** `pkg query' might have an entry for 'available update' but the manpage didn't reveal one
> *** you can use a pattern to only match specific packages inside your file; the current empty pattern matches all
> 
> > ----------------------------------------
> > From: Mark Millard <marklmi@yahoo.com>
> > Sent: Tue Mar 22 10:56:56 CET 2022
> > To: Eugene Grosbein <eugen@grosbein.net>
> > Cc: bapt@freebsd.org <bapt@FreeBSD.org>, <freebsd-ports@freebsd.org>, FreeBSD Toolchain <freebsd-toolchain@freebsd.org>
> > Subject: Re: An idea for a pkg option
> > 
> > 
> > On 2022-Mar-22, at 02:34, Eugene Grosbein <eugen@grosbein.net> wrote:
> > 
> > > 22.03.2022 16:28, Mark Millard wrote:
> > > 
> > >> So it might look something like:
> > >> 
> > >> # pkg install --available-ones-of `cat ~/origins/CA72-pkgs.txt`
> > >> Updating custom repository catalogue...
> > >> custom repository is up to date.
> > >> All repositories are up to date.
> > >> pkg: No packages available to install matching 'macchiatobin-edk2' have been found in the repositories
> > >> pkg: No packages available to install matching 'rpi3-edk2' have been found in the repositories
> > >> pkg: No packages available to install matching 'rpi4-edk2' have been found in the repositories
> > >> Checking integrity... done (0 conflicting)
> > >> The following 1 package(s) will be affected (of 0 checked):
> > >> 
> > >> New packages to be INSTALLED:
> > >> 	llvm14: 14.0.0.r4
> > >> 
> > >> Number of packages to be installed: 1
> > >> 
> > >> The process will require 864 MiB more space.
> > >> 
> > >> Proceed with this action? [y/N]: y
> > >> [1/1] Installing llvm14-14.0.0.r4...
> > >> [1/1] Extracting llvm14-14.0.0.r4: 100%
> > > 
> > > Use: pkg install -yU *.pkg
> > 
> > There may well be packages around that I do not
> > want installed unless pulled in as a dependency
> > of something that I do want. So a general wild
> > card is not what I'm after.
> > 
> > For my explicit list of what to try to install
> > (in the file) your command does not work for
> > my purpose/goal:
> > 
> > # pkg install -yU `cat ~/origins/amd64-pkgs.txt`
> > pkg: No packages available to install matching 'rpi4-edk2' have been found in the repositories
> > pkg: No packages available to install matching 'rpi4-edk2' have been found in the repositories
> > 
> > Without the two missing packages being listed in
> > the file, your command does:
> > 
> > # pkg install -yU `cat ~/origins/amd64-pkgs.txt`
> > Checking integrity... done (0 conflicting)
> > The following 1 package(s) will be affected (of 0 checked):
> > 
> > New packages to be INSTALLED:
> > 	llvm14: 14.0.0.r4
> > 
> > Number of packages to be installed: 1
> > 
> > The process will require 1 GiB more space.
> > [1/1] Installing llvm14-14.0.0.r4...
> > [1/1] Extracting llvm14-14.0.0.r4: 100%
> > 
> > 
> > ===
> > Mark Millard
> > marklmi at yahoo.com
> > 
> > 
> 
> 
> -- 
> Sent with https://mailfence.com  
> Secure and private email


-- 
Sent with https://mailfence.com  
Secure and private email