From owner-freebsd-current@freebsd.org Fri Aug 30 19:33:20 2019 Return-Path: Delivered-To: freebsd-current@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 72946D6759 for ; Fri, 30 Aug 2019 19:33:20 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mailman.nyi.freebsd.org (unknown [127.0.1.3]) by mx1.freebsd.org (Postfix) with ESMTP id 46KqQS2RtRz4Sfm for ; Fri, 30 Aug 2019 19:33:20 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mailman.nyi.freebsd.org (Postfix) id 53FF3D6758; Fri, 30 Aug 2019 19:33:20 +0000 (UTC) Delivered-To: current@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 53C37D6757 for ; Fri, 30 Aug 2019 19:33:20 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46KqQS1b8Hz4Sfl; Fri, 30 Aug 2019 19:33:20 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id E25559012; Fri, 30 Aug 2019 19:33:19 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-wr1-f48.google.com with SMTP id j16so8036452wrr.8; Fri, 30 Aug 2019 12:33:19 -0700 (PDT) X-Gm-Message-State: APjAAAV1rNfadqvxUVhlMnYQRTVhOmtngu9m22nK8CLIKYqgDcD4pXJx IzhUyVGkGApycEvZ4A/8roUiQ8Dxjc9uFLdA5JY= X-Google-Smtp-Source: APXvYqylyey9HTnU6wDr0rkx5ARc5Xqk71TtApBdx7foLv9OJuqVy8Ro0CpGDzfJ0eNjQCYZQU4L2wIPMqokzND+tec= X-Received: by 2002:adf:a55d:: with SMTP id j29mr19558097wrb.275.1567193598927; Fri, 30 Aug 2019 12:33:18 -0700 (PDT) MIME-Version: 1.0 References: <20190816120524.21b7fd19@ernst.home> <7b46b0a5-903f-5d8d-c7df-9eafda504445@FreeBSD.org> In-Reply-To: From: Kyle Evans Date: Fri, 30 Aug 2019 14:33:06 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: problem with LOCAL_MODULES To: Kyle Evans Cc: John Baldwin , gljennjohn@gmail.com, current Content-Type: text/plain; charset="UTF-8" X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Aug 2019 19:33:20 -0000 On Fri, Aug 30, 2019 at 2:26 PM Kyle Evans wrote: > > On Fri, Aug 30, 2019 at 2:11 PM John Baldwin wrote: > > > > On 8/30/19 10:42 AM, Kyle Evans wrote: > > > On Fri, Aug 16, 2019 at 7:38 PM John Baldwin wrote: > > >> > > >> On 8/16/19 3:05 AM, Gary Jennejohn wrote: > > >>> I tried to build a kernel today and it failed in modules-all even > > >>> though I had LOCAL_MODULES="" in /etc/src.conf, as recommended by > > >>> jhb. > > >>> > > >>> That's wrong. It has to be LOCAL_MODULES=, otherwise > > >>> /sys/conf/kern.post.mk seems to conclude that there should be a > > >>> module under /usr/local/sys/modules with the name "". > > >> > > >> I think this will permit both versions to work: > > >> > > >> Index: sys/conf/kern.post.mk > > >> =================================================================== > > >> --- kern.post.mk (revision 351151) > > >> +++ kern.post.mk (working copy) > > >> @@ -76,6 +76,7 @@ modules-${target}: > > >> cd $S/modules; ${MKMODULESENV} ${MAKE} \ > > >> ${target:S/^reinstall$/install/:S/^clobber$/cleandir/} > > >> .endif > > >> +.if !empty(LOCAL_MODULES) > > >> .for module in ${LOCAL_MODULES} > > >> @${ECHODIR} "===> ${module} (${target:S/^reinstall$/install/:S/^clobber$/cleandir/})" > > >> @cd ${LOCAL_MODULES_DIR}/${module}; ${MKMODULESENV} ${MAKE} \ > > >> @@ -83,6 +84,7 @@ modules-${target}: > > >> ${target:S/^reinstall$/install/:S/^clobber$/cleandir/} > > >> .endfor > > >> .endif > > >> +.endif > > >> .endfor > > >> > > >> # Handle ports (as defined by the user) that build kernel modules > > >> > > > > > > I think I'd like to see this with !empty(LOCAL_MODULES) && > > > EXISTS(${LOCAL_MODULES_DIR}) or maybe just the latter condition to > > > prevent accidental foot-shooting... I was testing a problem with doing > > > this stuff in a poudriere build for swills@ and set LOCAL_MODULES="" > > > only to get an error because LOCAL_MODULES_DIR doesn't yet exist on > > > the machine I was testing with -- which we can trivially avoid. > > > > Did this work for you? Gary said in a followup that it didn't work, > > so that's why I hadn't committed it. > > > > Hmm... I went back and tested his exact scenario, and no- > LOCAL_MODULES isn't empty at this point because word processing that > leaves us with an empty string hasn't yet been done. An .if > !empty(module) inside the loop is much happier- I'm not seeing any > modifiers that would give us the behavior we wanted for figuring this > out before entering the loop. It turns out I'm silly... this is sufficient for both of our problems (because it's the same problem) and hopefully my mail client doesn't goof this up: diff --git a/sys/conf/kern.post.mk b/sys/conf/kern.post.mk index ff10daf1a0a..09bfffad095 100644 --- a/sys/conf/kern.post.mk +++ b/sys/conf/kern.post.mk @@ -77,10 +77,12 @@ modules-${target}: ${target:S/^reinstall$/install/:S/^clobber$/cleandir/} .endif .for module in ${LOCAL_MODULES} +.if !empty(module) @${ECHODIR} "===> ${module} (${target:S/^reinstall$/install/:S/^clobber$/cleandir/})" @cd ${LOCAL_MODULES_DIR}/${module}; ${MKMODULESENV} ${MAKE} \ DIRPRFX="${module}/" \ ${target:S/^reinstall$/install/:S/^clobber$/cleandir/} +.endif .endfor .endif .endfor