From nobody Mon Jul 01 22:52:04 2024 X-Original-To: ports@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 4WChBP5hD1z5QNRx for ; Mon, 01 Jul 2024 22:52:13 +0000 (UTC) (envelope-from junchoon@dec.sakura.ne.jp) Received: from www121.sakura.ne.jp (www121.sakura.ne.jp [153.125.133.21]) (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 mx1.freebsd.org (Postfix) with ESMTPS id 4WChBL401Bz4G1r; Mon, 1 Jul 2024 22:52:09 +0000 (UTC) (envelope-from junchoon@dec.sakura.ne.jp) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=dec.sakura.ne.jp header.s=s2405 header.b=jAuNMkzv; dmarc=pass (policy=none) header.from=dec.sakura.ne.jp; spf=pass (mx1.freebsd.org: domain of junchoon@dec.sakura.ne.jp designates 153.125.133.21 as permitted sender) smtp.mailfrom=junchoon@dec.sakura.ne.jp Received: from kalamity.joker.local (123-1-21-232.area1b.commufa.jp [123.1.21.232]) (authenticated bits=0) by www121.sakura.ne.jp (8.17.1/8.17.1/[SAKURA-WEB]/20201212) with ESMTPA id 461Mq4sh041148; Tue, 2 Jul 2024 07:52:05 +0900 (JST) (envelope-from junchoon@dec.sakura.ne.jp) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=dec.sakura.ne.jp; s=s2405; t=1719874325; bh=2ktXPgy8lHI5rbN/5VqjB/rcOB5PwQhAf1OmUeygU70=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=jAuNMkzv9hu2TQKvS0Um8oJu8nhtlaybNwDoC1F0ZCGn/nHH5vLxbu4DJvSoBqICW KR//3UZ8YaEZdK2y0Bz/7opK8JCTle/uduZHKfEhLyF7mnkEAhEZYcQKUBoFD03j/Y fPDX0ttm+PAJYjAQUy+dLHrqGfGS3LPbIaEJsR24= Date: Tue, 2 Jul 2024 07:52:04 +0900 From: Tomoaki AOKI To: DutchDaemon - FreeBSD Forums Administrator Cc: ports@freebsd.org Subject: Re: Can `pkg prime-origins` be "trained" to pick up flavors? Message-Id: <20240702075204.2c10d58cb4402523a8af9732@dec.sakura.ne.jp> In-Reply-To: <20240702064448.1072c2a31ba44ed483730d0b@dec.sakura.ne.jp> References: <20240702022215.86f678352bf5d7c6bf3dea4d@dec.sakura.ne.jp> <748eaf90-6c2d-41e3-8334-88458c21b7c3@FreeBSD.org> <20240702064448.1072c2a31ba44ed483730d0b@dec.sakura.ne.jp> Organization: Junchoon corps X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; amd64-portbld-freebsd14.0) List-Id: Porting software to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-ports List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: freebsd-ports@freebsd.org Sender: owner-freebsd-ports@FreeBSD.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spamd-Bar: -- X-Spamd-Result: default: False [-2.38 / 15.00]; SUBJECT_ENDS_QUESTION(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.98)[-0.977]; MV_CASE(0.50)[]; DMARC_POLICY_ALLOW(-0.50)[dec.sakura.ne.jp,none]; R_DKIM_ALLOW(-0.20)[dec.sakura.ne.jp:s=s2405]; R_SPF_ALLOW(-0.20)[+ip4:153.125.133.16/28]; MIME_GOOD(-0.10)[text/plain]; ONCE_RECEIVED(0.10)[]; RCVD_COUNT_ONE(0.00)[1]; TO_DN_SOME(0.00)[]; HAS_ORG_HEADER(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:7684, ipnet:153.125.128.0/18, country:JP]; ARC_NA(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; MID_RHS_MATCH_FROM(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MLMMJ_DEST(0.00)[ports@freebsd.org]; RCVD_TLS_LAST(0.00)[]; DKIM_TRACE(0.00)[dec.sakura.ne.jp:+] X-Rspamd-Queue-Id: 4WChBL401Bz4G1r On Tue, 2 Jul 2024 06:44:48 +0900 Tomoaki AOKI wrote: > On Mon, 1 Jul 2024 20:42:47 +0200 > DutchDaemon - FreeBSD Forums Administrator > wrote: > > > On 1-7-2024 19:22, Tomoaki AOKI wrote: > > > On Mon, 1 Jul 2024 15:46:18 +0200 > > > DutchDaemon - FreeBSD Forums Administrator > > > wrote: > > > > > >> Hey, > > >> > > >> I use `pkg prime-origins` on my servers to pick up the ports that > > >> Poudriere needs to build for that (cluster of) server(s). > > >> > > >> This doesn't work for flavors, or I'm missing a trick. > > >> > > >> E.g.: I have installed the "guestagent" flavor of emulators/qemu > > >> ("qemu-guest-agent" in pkg terms), which gets built in Poudriere as > > >> "emulators/qemu@guestagent". > > >> > > >> All good and well. > > >> > > >> But `pkg prime-origins` picks it up as "emulators/qemu", which, of > > >> course, triggers Poudriere to build the whole thing, > > >> "emulators/qemu@default". > > >> > > >> Which I don't need. > > >> > > >> So either pkg needs to be amended to be able to recognize and report a > > >> flavor, or I have to put this in the jail's make.conf on Poudriere. > > >> > > >> I'm not sure if there's a place for that in a generic make.conf for all > > >> ports in that specific jail; you know, one that contains > > >> all-encompassing lines like > > >> > > >> DEFAULT_VERSIONS= php=82 apache=2.4 mysql=80 ssl=openssl python=3.9 > > >> python3=3.9 > > >> > > >> Anyone? > > > Hi. > > > pkg records informations about FLAVORs in annotations only. > > > You should search output from `pkg -A ` for each pkg. > > > > > > Does the script on brew.bsd.cafe [1] help understanding/usable? > > > > > > [1] > > > https://brew.bsd.cafe/TomAoki/sh_scripts/src/branch/main/poudlist-all > > > > > > Regards. > > > > That actually put me on a path forward, but I decided to sort of > > brute-force it, so I could run the script anywhere. > > > > In fact, Ansible runs it on all servers (grouped by build jail names on > > Poudriere) and gathers/sorts the output to populate the build lists for > > Poudriere, which then fires up the jails and builds the associated repos. > > > > for port in $( /usr/local/sbin/pkg prime-origins ) > > do > > flavor=$( /usr/local/sbin/pkg info -A "${port}" | /usr/bin/grep "flavor" > > | /usr/bin/awk '{print $NF}' | /usr/bin/grep -v "default" ) > > [ "x${flavor}" = "x" ] && echo "${port}" || echo "${port}@${flavor}" > > done > > > > That gives me exactly the output I need. > > > > Thanks! > > > > DD > > I recommend using pkgname instead of origin for sniffing FLAVORs. > If you have multiple FLAVORs for single origin, for example, has > textproc/fcitx5-qt with FLAVORs qt5 and qt6 are both installed, > > ===== Quot ===== > > % pkg info -A textproc/fcitx5-qt > fcitx5-qt5-5.1.6: > FreeBSD_version: 1401500 > build_timestamp: 2024-05-20T00:44:42+0000 > built_by : poudriere-git-3.4.99.20240424 > flavor : qt5 > port_checkout_unclean: no > port_git_hash : 5706c0f18db2 > ports_top_checkout_unclean: yes > ports_top_git_hash: 92df6b73a07c > fcitx5-qt6-5.1.6: > FreeBSD_version: 1401500 > build_timestamp: 2024-05-20T00:44:50+0000 > built_by : poudriere-git-3.4.99.20240424 > flavor : qt6 > port_checkout_unclean: no > port_git_hash : 5706c0f18db2 > ports_top_checkout_unclean: yes > ports_top_git_hash: 92df6b73a07c > % pkg info -A textproc/fcitx5-qt | /usr/bin/grep "flavor" > | /usr/bin/awk '{print $NF}' > qt5 > qt6 > > ===== End quot ===== > > So you would be better using `pkg prime-list` instead of `pkg > prime-origin` or handle the output via `xarg -n 1` for test. > > Regards. > > -- > Tomoaki AOKI Script below would work for you. for port in $( /usr/local/sbin/pkg prime-origins | sort -u ) do flavor=$( /usr/local/sbin/pkg info -A "${port}" | \ /usr/bin/grep "flavor" | /usr/bin/awk '{print $NF}' | \ /usr/bin/grep -v "default" ) [ "x${flavor}" = "x" ] && echo "${port}" || \ for flvr in ${flavor} do echo -n ${flvr} ; [ "x${flvr}" = "x" ] && echo "${port}" || \ echo "${port}@${flvr}" done done -- Tomoaki AOKI