From nobody Fri Oct 11 21:16:43 2024 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 4XQKF80vPsz5ZQpN; Fri, 11 Oct 2024 21:16:44 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XQKF76ZWdz4LGh; Fri, 11 Oct 2024 21:16:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728681403; 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=yld7pz2054IS1N7GOzWTpIoVmgiomVCjdwV02a7bGYo=; b=IZoAeaeTSnbIhK/310v7e4u0Hf97T+x0TTaF1UeCBquXIxVrWMXQ+H9MYDMLqU0fQgSbam PCoRPbkznKktLDUVuG6OIgt8uQEXXP03s2o5GCjAJZInwiwW9BqcawgFEqz8wDbNsqfr15 Wxmoc9LmdL0ozYf7UAxIMfORxYgvqEHHFpgQgYfZZPX1RyKzpYnFtXCjpqw/MrJXk66Z9I WMFuW/2fxNRWortUtoPT6pFyw5BKKhxHuo4AijAgCcFlvnD7D+JY+EIVcUFL1JZxjRHPGR ftO1wnm5bvUUZynWtgBC9iGe9YgZF+bg/LZvzxWa7ACo0ziw6BPLY2TsyAGGkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728681403; 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=yld7pz2054IS1N7GOzWTpIoVmgiomVCjdwV02a7bGYo=; b=qTGodauXx2nbYwro1iydmk/xmf2keDrr0WBYmtIKqzt9CemcrZ21anlBtjRsG6LndTD27l hXje2+RkD8FoHroMhUO+l3z+n7vPTtRkMDdlphj/2GVBzr0D10kT5KLqeku60O2TJS/sZI b1ADkucTvBH/1BKsrTjr+yR/E8tqpacXpHEQ66M3/yV1eE4RcGR9Cl628pww5gTCd68UvE G9+nzhhnlZix1wuYO/R9gAj+CXMzuDkRbBnxVnP3oLTmQiPikzA5gi7FQpBASO8/IFAU4C uvKMytyQ2+OkLrOKj/emcwDrkaKsl5A+TokkGjbnJAV7f+K3b0ysicZStG1YvQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1728681403; a=rsa-sha256; cv=none; b=DVu6DO2DQ8mZKL9hDG1XZihZMNV2afjPtyFvolf8vjhPJu8kEPr4sjtYIHWkDP85RUEL56 sx0tgSSlsMA4enAusj38Y1NDB98C7dnrVVmlMRmP5ZfdZWsVhYg3U8LyZvx+A//IH06VjL lAqJNNSeg1Dcyr5uomHMtLEYtI/z08oclnCSikWOe+bzxhO3CRtIx6E4pbjfByMrHuMQEw gA+AwQXNNYAg3j+5yD9+tykIA++3ZNM1InS9/aP+YjjYTrUMTC968CvjmRnOtOO4OLdRgr WreFZOiJQfrODwNVB7RBrcwnCV/W9cltBnOCG5bR+mciBEO3mYNtJ9dseVSC1g== 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 4XQKF7631DzxrS; Fri, 11 Oct 2024 21:16:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 49BLGhYk033967; Fri, 11 Oct 2024 21:16:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49BLGhAm033964; Fri, 11 Oct 2024 21:16:43 GMT (envelope-from git) Date: Fri, 11 Oct 2024 21:16:43 GMT Message-Id: <202410112116.49BLGhAm033964@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Simon J. Gerraty" Subject: git: 87b759f0fa1f - main - Add targets/pseudo/bootstrap-packages 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: sjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 87b759f0fa1f7554d50ce640c40138512bbded44 Auto-Submitted: auto-generated The branch main has been updated by sjg: URL: https://cgit.FreeBSD.org/src/commit/?id=87b759f0fa1f7554d50ce640c40138512bbded44 commit 87b759f0fa1f7554d50ce640c40138512bbded44 Author: Simon J. Gerraty AuthorDate: 2024-10-11 21:15:47 +0000 Commit: Simon J. Gerraty CommitDate: 2024-10-11 21:15:47 +0000 Add targets/pseudo/bootstrap-packages Try to compensate for the lack any origin for a DIRDEPS build. bootstrap-packages will extract the PACKAGE lines from the tree's Makefiles and use them to populate targets/packages/Makefile.depend and targets/packages/*/Makefile.depend so we can at least try to keep the Makefile.depend files throughout the tree up to date. This is far from ideal, as we cannot (easily) take into account options that affect the contents of various packages. Reviewed by: stevek Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D47065 --- targets/pseudo/bootstrap-packages/Makefile | 23 ++++++ .../bootstrap-packages/bootstrap-packages.sh | 96 ++++++++++++++++++++++ 2 files changed, 119 insertions(+) diff --git a/targets/pseudo/bootstrap-packages/Makefile b/targets/pseudo/bootstrap-packages/Makefile new file mode 100644 index 000000000000..6523e88f84db --- /dev/null +++ b/targets/pseudo/bootstrap-packages/Makefile @@ -0,0 +1,23 @@ +# SPDX-License-Identifier: BSD-2-Clause +# +# Compensate (a bit) for the lack of per package makefiles or other means +# of knowing what goes in each package in the base system. +# We can derive some of the information we want from the makefiles that +# set PACKAGE. + +all: +.if ${.MAKE.LEVEL} > 0 +all: packages +.endif + +PACKAGES?= ${.CURDIR:H:H}/packages + +packages: package-makefile.list + @${.CURDIR}/bootstrap-packages.sh PACKAGES=${PACKAGES} ${.ALLSRC} + +package-makefile.list: + @(cd ${SRCTOP} && \ + find ${TOPS:U*bin etc lib*} -name 'Makefile' | \ + xargs grep '^PACKAGE[[:space:]]*=' ) | \ + sed 's/[[:space:]]*=[[:space:]]*/=/' > ${.TARGET} + diff --git a/targets/pseudo/bootstrap-packages/bootstrap-packages.sh b/targets/pseudo/bootstrap-packages/bootstrap-packages.sh new file mode 100755 index 000000000000..a2fe250d68a3 --- /dev/null +++ b/targets/pseudo/bootstrap-packages/bootstrap-packages.sh @@ -0,0 +1,96 @@ +#!/bin/sh + +# SPDX-License-Identifier: BSD-2-Clause + +# Our input is the output of something like: +# +# (cd ${SRCTOP} && +# find *bin etc lib* -name Makefile | +# xargs grep '^PACKAGE[[:space:]]*=' ) +# +# With some cleanup and looks like: +# +# usr.bin/ofed/libibverbs/Makefile:PACKAGE=FreeBSD-rdma +# usr.bin/last/Makefile:PACKAGE=acct +# usr.bin/lastcomm/Makefile:PACKAGE=acct +# usr.bin/users/Makefile:PACKAGE=acct +# usr.bin/who/Makefile:PACKAGE=acct +# usr.sbin/ac/Makefile:PACKAGE=acct +# usr.sbin/accton/Makefile:PACKAGE=acct +# usr.sbin/lastlogin/Makefile:PACKAGE=acct +# .. +# +# which we use to populate $PACKAGES/*/Makefile.depend +# and $PACKAGES/Makefile.depend to make it easier to keep +# Makefile.depend files throughout the tree up-to-date. +# +# The result is not ideal, as we do not (yet) take into account all +# the MK_* knobs that can impact DIRDEPS. +# + +Mydir=`dirname $0` + +while : +do + case "$1" in + *=*) eval "$1"; shift;; + *) break;; + esac +done + +to_reldir() { + sed "s,$SRCTOP/,," +} + +SRCTOP=${SRCTOP:-$(realpath $Mydir/../../..)} +PACKAGES=${PACKAGES:-$(realpath $Mydir/../..)} +case "$PACKAGES" in +/*) ;; +*) PACKAGES=$SRCTOP/$PACKAGES;; +esac + +script_name=$(realpath $0 | to_reldir) + +start_depend() { + depfile=$1 + + mkdir -p ${depfile%/*} + cat < $depfile +# Generated by $script_name + +DIRDEPS= \\ +EOF +} + +end_depend() { + depfile=$1 + + cat <> $depfile + +.include +EOF +} + +start_depend $PACKAGES/Makefile.depend || exit 1 +sort -t= -k2 "$@" | sed 's,/Makefile:PACKAGE=, ,' | +( + lpackage= + while read reldir package + do + case "$package" in \ + lib?{LIB}) package=${reldir##*/};; + lib?{LIB:tl}) package=`echo ${reldir##*/} | tr 'A-Z' 'a-z'`;; + esac + if test "$package" != "$lpackage"; then \ + test -z "$lpackage" || end_depend $ddeps + target=$PACKAGES/$package + ddeps=$target/Makefile.depend + start_depend $ddeps + lpackage=$package + echo " $target \\" + fi + echo " $reldir \\" >> $ddeps + done + end_depend $ddeps +) | to_reldir >> $PACKAGES/Makefile.depend +end_depend $PACKAGES/Makefile.depend