From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-it0-x234.google.com (mail-it0-x234.google.com [IPv6:2607:f8b0:4001:c0b::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 8011B1A1E28 for ; Sun, 4 Sep 2016 08:55:45 -0700 (PDT) Received: by mail-it0-x234.google.com with SMTP id e124so113170943ith.0 for ; Sun, 04 Sep 2016 08:55:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=RsOZmxwl+2MqPUIf2pGVqimXlpA/seO8vaVD5sOCH+Y=; b=iPlxOtHJA0U5yqj7zysDV0zPeuf7BQs3YqIYlkTh9glprR5H03o+cJXDCGTzFhdPOP eAUOeJ+oJl8r2F2ySwXyOBK9RkQg3wfr4DoljplratZpnImiLkhPAayHEAYLiH2qTHL9 JHF+DkPL2Z9h27QEUj0QOVZTMaxVcUI487JWU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=RsOZmxwl+2MqPUIf2pGVqimXlpA/seO8vaVD5sOCH+Y=; b=OygxdDXox3nyw2gSQPp4wRbfPNpeR7ycrKTgE5Y5b7e/fMb2bkm2isIep1Lz+D5Um3 oKNwTSsQCQxCrKLO7UVb8MOAfhQwkjz55merk/UsdjuL2MJ+t9Ppvo6PjZaxaus3seIt f3P0x3ewQeixZ70Um6qKJf2uqWhh+cLYAii03fOI4qO+a91uHhchzE+tAAuDWbhha86k peqBjqDWsB1Eoyy486mVvEErXl9B1IcroioNrL9N0snTBxpVk7fNf/xEN/77mNMmLt0M 3B1QQBmhaQuoTNPNhBBLg/QGU334l1fVx9MD05BifI8DMMC9hA8pbqpJ+N5lOx7/yfca A6FQ== X-Gm-Message-State: AE9vXwP7wXKZimbDiWau6/Cyk83kZIQO6WD+rKzpq8GM+XeqKY4YWkQ0Wh7D/gZSIH1+mjBf+h8geH5lGX7yqsFR X-Received: by 10.36.214.193 with SMTP id o184mr18484996itg.5.1473004544781; Sun, 04 Sep 2016 08:55:44 -0700 (PDT) MIME-Version: 1.0 Received: by 10.36.204.195 with HTTP; Sun, 4 Sep 2016 08:55:44 -0700 (PDT) In-Reply-To: <20160904154135.4324-1-leif.lindholm@linaro.org> References: <20160904154135.4324-1-leif.lindholm@linaro.org> From: Ard Biesheuvel Date: Sun, 4 Sep 2016 16:55:44 +0100 Message-ID: To: Leif Lindholm Cc: edk2-devel-01 , Yonghong Zhu , Liming Gao Subject: Re: [RFC] edksetup.sh: detect updated BaseTools templates X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Sep 2016 15:55:45 -0000 Content-Type: text/plain; charset=UTF-8 On 4 September 2016 at 16:41, Leif Lindholm wrote: > Make edksetup.sh automatically update the cached configuration under > Conf/ when the templates under BaseTools/Conf/ change. > > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Leif Lindholm > --- > > We keep getting questions from people starting out with EDK2 development, > whenever certain options in the BaseTools template configs change and > their builds break. I don't know if this naive sledgehammer approach is > acceptable, but I'd like to make life easier for people. > Could we instead make the files under Conf/ symlinks to the templates? That way, people can still keep local changes in these files, which is presumably the reason for this arrangement, while the 'naive' user [with no interest in keeping local changes] does not have to deal with this. > edksetup.sh | 33 +++++++++++++++++++++++++++++++-- > 1 file changed, 31 insertions(+), 2 deletions(-) > > diff --git a/edksetup.sh b/edksetup.sh > index 57368b5..77f0d43 100755 > --- a/edksetup.sh > +++ b/edksetup.sh > @@ -33,12 +33,41 @@ function HelpMsg() > return 1 > } > > +function ClearCache() > +{ > + CONF_FILES="build_rule target tools_def" > + if [ -z "$EDK_TOOLS_PATH" ] > + then > + TEMPLATE_PATH=./BaseTools/Conf/ > + else > + TEMPLATE_PATH="$EDK_TOOLS_PATH/Conf/" > + fi > + > + DELETED_FILES=0 > + for File in $CONF_FILES > + do > + TEMPLATE_FILE="$TEMPLATE_PATH/$File.template" > + CACHE_FILE="Conf/$File.txt" > + if [ "$TEMPLATE_FILE" -nt "$CACHE_FILE" ] > + then > + echo "Removing outdated '$CACHE_FILE'." > + rm "$CACHE_FILE" > + DELETED_FILES=$(($DELETED_FILES + 1)) > + fi > + done > + > + unset TEMPLATE_PATH TEMPLATE_FILE CACHE_FILE > + return $DELETED_FILES > +} > + > function SetWorkspace() > { > # > - # If WORKSPACE is already set, then we can return right now > + # Check for updated BaseTools templates. If none, and > + # WORKSPACE is already set, then we can return right now > # > - if [ -n "$WORKSPACE" ] > + ClearCache > + if [ $? -ne 0 -a -n "$WORKSPACE" ] > then > return 0 > fi > -- > 2.9.3 >