public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: Leif Lindholm <leif.lindholm@linaro.org>
Cc: edk2-devel-01 <edk2-devel@lists.01.org>,
	Yonghong Zhu <yonghong.zhu@intel.com>,
	Liming Gao <liming.gao@intel.com>
Subject: Re: [RFC] edksetup.sh: detect updated BaseTools templates
Date: Sun, 4 Sep 2016 16:55:44 +0100	[thread overview]
Message-ID: <CAKv+Gu_rwQe5zG7XpY==-qv8odwA89=ukw7D20T-sRmui9ksDg@mail.gmail.com> (raw)
In-Reply-To: <20160904154135.4324-1-leif.lindholm@linaro.org>

On 4 September 2016 at 16:41, Leif Lindholm <leif.lindholm@linaro.org> 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 <leif.lindholm@linaro.org>
> ---
>
> 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
>


  reply	other threads:[~2016-09-04 15:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-04 15:41 [RFC] edksetup.sh: detect updated BaseTools templates Leif Lindholm
2016-09-04 15:55 ` Ard Biesheuvel [this message]
2016-09-04 16:10   ` Michael Zimmermann
2016-09-04 20:35     ` Ard Biesheuvel
2016-09-04 20:46       ` Michael Zimmermann
2016-10-19 12:21       ` Leif Lindholm
2016-10-20  6:58         ` Gao, Liming
2016-09-04 22:02     ` B Cran

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAKv+Gu_rwQe5zG7XpY==-qv8odwA89=ukw7D20T-sRmui9ksDg@mail.gmail.com' \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox