public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [RFC] edksetup.sh: detect updated BaseTools templates
@ 2016-09-04 15:41 Leif Lindholm
  2016-09-04 15:55 ` Ard Biesheuvel
  0 siblings, 1 reply; 8+ messages in thread
From: Leif Lindholm @ 2016-09-04 15:41 UTC (permalink / raw)
  To: edk2-devel; +Cc: Yonghong Zhu, Liming Gao, Ard Biesheuvel

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.

 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



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [RFC] edksetup.sh: detect updated BaseTools templates
  2016-09-04 15:41 [RFC] edksetup.sh: detect updated BaseTools templates Leif Lindholm
@ 2016-09-04 15:55 ` Ard Biesheuvel
  2016-09-04 16:10   ` Michael Zimmermann
  0 siblings, 1 reply; 8+ messages in thread
From: Ard Biesheuvel @ 2016-09-04 15:55 UTC (permalink / raw)
  To: Leif Lindholm; +Cc: edk2-devel-01, Yonghong Zhu, Liming Gao

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
>


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [RFC] edksetup.sh: detect updated BaseTools templates
  2016-09-04 15:55 ` Ard Biesheuvel
@ 2016-09-04 16:10   ` Michael Zimmermann
  2016-09-04 20:35     ` Ard Biesheuvel
  2016-09-04 22:02     ` B Cran
  0 siblings, 2 replies; 8+ messages in thread
From: Michael Zimmermann @ 2016-09-04 16:10 UTC (permalink / raw)
  To: Ard Biesheuvel; +Cc: Leif Lindholm, edk2-devel-01, Liming Gao

> Could we instead make the files under Conf/ symlinks to the templates?
Sounds like a good idea in general but what about windows? afaik only NTFS
has support for them.

On Sun, Sep 4, 2016 at 5:55 PM, Ard Biesheuvel <ard.biesheuvel@linaro.org>
wrote:

> 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
> >
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
>


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [RFC] edksetup.sh: detect updated BaseTools templates
  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-09-04 22:02     ` B Cran
  1 sibling, 2 replies; 8+ messages in thread
From: Ard Biesheuvel @ 2016-09-04 20:35 UTC (permalink / raw)
  To: Michael Zimmermann; +Cc: Leif Lindholm, edk2-devel-01, Liming Gao

On 4 September 2016 at 17:10, Michael Zimmermann
<sigmaepsilon92@gmail.com> wrote:
>> Could we instead make the files under Conf/ symlinks to the templates?
> Sounds like a good idea in general but what about windows? afaik only NTFS
> has support for them.
>

Ah yes, excellent point.

So perhaps the BaseTools should simply default to the template if the
Conf/ version is missing? I am concerned about breaking people's
workflow where they keep non-trivial local changes in these files.


> On Sun, Sep 4, 2016 at 5:55 PM, Ard Biesheuvel <ard.biesheuvel@linaro.org>
> wrote:
>>
>> 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
>> >
>> _______________________________________________
>> edk2-devel mailing list
>> edk2-devel@lists.01.org
>> https://lists.01.org/mailman/listinfo/edk2-devel
>
>


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [RFC] edksetup.sh: detect updated BaseTools templates
  2016-09-04 20:35     ` Ard Biesheuvel
@ 2016-09-04 20:46       ` Michael Zimmermann
  2016-10-19 12:21       ` Leif Lindholm
  1 sibling, 0 replies; 8+ messages in thread
From: Michael Zimmermann @ 2016-09-04 20:46 UTC (permalink / raw)
  To: Ard Biesheuvel; +Cc: Leif Lindholm, edk2-devel-01, Liming Gao

what about creating timestamp files(or even checksums if you want to be
100% sure) after copying the templates? so you can check if somebody else
modified them.

if the timestamp files don't exist you it means that we never copied the
templates.

On Sun, Sep 4, 2016 at 10:35 PM, Ard Biesheuvel <ard.biesheuvel@linaro.org>
wrote:

> On 4 September 2016 at 17:10, Michael Zimmermann
> <sigmaepsilon92@gmail.com> wrote:
> >> Could we instead make the files under Conf/ symlinks to the templates?
> > Sounds like a good idea in general but what about windows? afaik only
> NTFS
> > has support for them.
> >
>
> Ah yes, excellent point.
>
> So perhaps the BaseTools should simply default to the template if the
> Conf/ version is missing? I am concerned about breaking people's
> workflow where they keep non-trivial local changes in these files.
>
>
> > On Sun, Sep 4, 2016 at 5:55 PM, Ard Biesheuvel <
> ard.biesheuvel@linaro.org>
> > wrote:
> >>
> >> 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
> >> >
> >> _______________________________________________
> >> edk2-devel mailing list
> >> edk2-devel@lists.01.org
> >> https://lists.01.org/mailman/listinfo/edk2-devel
> >
> >
>


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [RFC] edksetup.sh: detect updated BaseTools templates
  2016-09-04 16:10   ` Michael Zimmermann
  2016-09-04 20:35     ` Ard Biesheuvel
@ 2016-09-04 22:02     ` B Cran
  1 sibling, 0 replies; 8+ messages in thread
From: B Cran @ 2016-09-04 22:02 UTC (permalink / raw)
  To: Michael Zimmermann
  Cc: Ard Biesheuvel, edk2-devel-01, Liming Gao, Leif Lindholm

On Sep 4, 2016, at 10:10 AM, Michael Zimmermann <sigmaepsilon92@gmail.com> wrote:

>> Could we instead make the files under Conf/ symlinks to the templates?
> Sounds like a good idea in general but what about windows? afaik only NTFS
> has support for them.

Is it likely anyone is running the build off a FAT (FAT32/exFAT) filesystem nowadays?

Bruce


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [RFC] edksetup.sh: detect updated BaseTools templates
  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
  1 sibling, 1 reply; 8+ messages in thread
From: Leif Lindholm @ 2016-10-19 12:21 UTC (permalink / raw)
  To: Ard Biesheuvel
  Cc: Michael Zimmermann, edk2-devel-01, Liming Gao, Kinney, Michael D,
	Andrew Fish

So, this thread kind of petered out...

I had an internal report of a user failing to build ArmVirtQemu, and
narrowed it down to a case of outdated cached configurations.

As a temporary workaround, I've now put the proposed timestamp check
into my uefi-tools helper scripts, but that's hiding the problem
instead of solving it.

On Sun, Sep 04, 2016 at 09:35:19PM +0100, Ard Biesheuvel wrote:
> On 4 September 2016 at 17:10, Michael Zimmermann
> <sigmaepsilon92@gmail.com> wrote:
> >> Could we instead make the files under Conf/ symlinks to the templates?
> > Sounds like a good idea in general but what about windows? afaik only NTFS
> > has support for them.
> >
> 
> Ah yes, excellent point.
> 
> So perhaps the BaseTools should simply default to the template if the
> Conf/ version is missing? I am concerned about breaking people's
> workflow where they keep non-trivial local changes in these files.

This would absolutely be my preferred solution.

Andrew, Mike?

/
    Leif

> > On Sun, Sep 4, 2016 at 5:55 PM, Ard Biesheuvel <ard.biesheuvel@linaro.org>
> > wrote:
> >>
> >> 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
> >> >
> >> _______________________________________________
> >> edk2-devel mailing list
> >> edk2-devel@lists.01.org
> >> https://lists.01.org/mailman/listinfo/edk2-devel
> >
> >


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [RFC] edksetup.sh: detect updated BaseTools templates
  2016-10-19 12:21       ` Leif Lindholm
@ 2016-10-20  6:58         ` Gao, Liming
  0 siblings, 0 replies; 8+ messages in thread
From: Gao, Liming @ 2016-10-20  6:58 UTC (permalink / raw)
  To: Leif Lindholm, Ard Biesheuvel
  Cc: Michael Zimmermann, edk2-devel-01, Kinney, Michael D, Andrew Fish

Leif:
  Windows edksetup.bat has option Reconfig to always copy template files to Conf directory. For Linux, I suggest to add Reconfig option to edksetup.sh, then let user use this way.

Thanks
Liming
From: Leif Lindholm [mailto:leif.lindholm@linaro.org]
Sent: Wednesday, October 19, 2016 8:21 PM
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Michael Zimmermann <sigmaepsilon92@gmail.com>; edk2-devel-01 <edk2-devel@lists.01.org>; Gao, Liming <liming.gao@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>; Andrew Fish <afish@apple.com>
Subject: Re: [edk2] [RFC] edksetup.sh: detect updated BaseTools templates

So, this thread kind of petered out...

I had an internal report of a user failing to build ArmVirtQemu, and
narrowed it down to a case of outdated cached configurations.

As a temporary workaround, I've now put the proposed timestamp check
into my uefi-tools helper scripts, but that's hiding the problem
instead of solving it.

On Sun, Sep 04, 2016 at 09:35:19PM +0100, Ard Biesheuvel wrote:
> On 4 September 2016 at 17:10, Michael Zimmermann
> wrote:
> >> Could we instead make the files under Conf/ symlinks to the templates?
> > Sounds like a good idea in general but what about windows? afaik only NTFS
> > has support for them.
> >
>
> Ah yes, excellent point.
>
> So perhaps the BaseTools should simply default to the template if the
> Conf/ version is missing? I am concerned about breaking people's
> workflow where they keep non-trivial local changes in these files.

This would absolutely be my preferred solution.

Andrew, Mike?

/
Leif

> > On Sun, Sep 4, 2016 at 5:55 PM, Ard Biesheuvel
> > wrote:
> >>
> >> 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
> >> >
> >> _______________________________________________
> >> edk2-devel mailing list
> >> edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>
> >> https://lists.01.org/mailman/listinfo/edk2-devel
> >
> >


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-10-20  6:58 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-04 15:41 [RFC] edksetup.sh: detect updated BaseTools templates Leif Lindholm
2016-09-04 15:55 ` Ard Biesheuvel
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox