diff mbox series

Add fixdefconfig script to update lists of defconfig files from savedefconfig

Message ID 20210112030056.15102-1-joel.peshkin@broadcom.com
State Deferred
Delegated to: Tom Rini
Headers show
Series Add fixdefconfig script to update lists of defconfig files from savedefconfig | expand

Commit Message

Joel Peshkin Jan. 12, 2021, 3 a.m. UTC
Cc: Simon Glass <sjg@chromium.org>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 scripts/fixdefconfig | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
 create mode 100755 scripts/fixdefconfig

Comments

Simon Glass Jan. 13, 2021, 4:10 p.m. UTC | #1
Hi Joel,

On Mon, 11 Jan 2021 at 20:01, Joel Peshkin <joel.peshkin@broadcom.com> wrote:
>
> Cc: Simon Glass <sjg@chromium.org>
> Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
> ---
>  scripts/fixdefconfig | 25 +++++++++++++++++++++++++
>  1 file changed, 25 insertions(+)
>  create mode 100755 scripts/fixdefconfig

+Tom Rini

I normally use moveconfig for this...Tom how do you do it?

>
> diff --git a/scripts/fixdefconfig b/scripts/fixdefconfig
> new file mode 100755
> index 0000000..7f36762
> --- /dev/null
> +++ b/scripts/fixdefconfig
> @@ -0,0 +1,25 @@
> +#!/bin/bash
> +
> +if [ -z "$*" -o  "${1%_defconfig}" = "$1" ]
> +then
> +  echo "Usage:  $0 [defconfig_file...]"
> +  echo " Normalizes each listed defconfig and replaces it with the normalized"
> +  echo "version. The original is renamed with an extension of .old appended"
> +  exit 1
> +fi
> +
> +tmp=tmp_build_$$
> +mkdir $tmp
> +for config in $*
> +do
> +  base=`basename $config`
> +  make O=$tmp/$base $base \
> +    && make O=$tmp/$base $base \
> +    && make O=$tmp/$base savedefconfig \
> +    && diff -q $tmp/$base/defconfig configs/$base \
> +    || mv configs/$base configs/$base.old \
> +    && mv $tmp/$base/defconfig configs/$base
> +  rm -rf $tmp/$base
> +done
> +rmdir $tmp
> +
> --
> 1.8.3.1
>

Regards,
Simon
Tom Rini Jan. 13, 2021, 8:16 p.m. UTC | #2
On Wed, Jan 13, 2021 at 09:10:41AM -0700, Simon Glass wrote:

> Hi Joel,
> 
> On Mon, 11 Jan 2021 at 20:01, Joel Peshkin <joel.peshkin@broadcom.com> wrote:
> >
> > Cc: Simon Glass <sjg@chromium.org>
> > Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
> > ---
> >  scripts/fixdefconfig | 25 +++++++++++++++++++++++++
> >  1 file changed, 25 insertions(+)
> >  create mode 100755 scripts/fixdefconfig
> 
> +Tom Rini
> 
> I normally use moveconfig for this...Tom how do you do it?

Yes, this is a single-threaded version of "moveconfig.py -sC".  This is
useful I suppose in the case where you have to sync maybe a dozen files
rather than one or two, or all of them.  But I'm not sure it's worth
applying, sorry.
Joel Peshkin Jan. 14, 2021, 12:33 a.m. UTC | #3
No worries.  As long as there is a mechanism that will work OK.

On Wed, Jan 13, 2021 at 12:16 PM Tom Rini <trini@konsulko.com> wrote:

> On Wed, Jan 13, 2021 at 09:10:41AM -0700, Simon Glass wrote:
>
> > Hi Joel,
> >
> > On Mon, 11 Jan 2021 at 20:01, Joel Peshkin <joel.peshkin@broadcom.com>
> wrote:
> > >
> > > Cc: Simon Glass <sjg@chromium.org>
> > > Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
> > > ---
> > >  scripts/fixdefconfig | 25 +++++++++++++++++++++++++
> > >  1 file changed, 25 insertions(+)
> > >  create mode 100755 scripts/fixdefconfig
> >
> > +Tom Rini
> >
> > I normally use moveconfig for this...Tom how do you do it?
>
> Yes, this is a single-threaded version of "moveconfig.py -sC".  This is
> useful I suppose in the case where you have to sync maybe a dozen files
> rather than one or two, or all of them.  But I'm not sure it's worth
> applying, sorry.
>
> --
> Tom
>
diff mbox series

Patch

diff --git a/scripts/fixdefconfig b/scripts/fixdefconfig
new file mode 100755
index 0000000..7f36762
--- /dev/null
+++ b/scripts/fixdefconfig
@@ -0,0 +1,25 @@ 
+#!/bin/bash
+
+if [ -z "$*" -o  "${1%_defconfig}" = "$1" ]
+then
+  echo "Usage:  $0 [defconfig_file...]"
+  echo " Normalizes each listed defconfig and replaces it with the normalized"
+  echo "version. The original is renamed with an extension of .old appended"
+  exit 1
+fi
+
+tmp=tmp_build_$$
+mkdir $tmp
+for config in $*
+do
+  base=`basename $config`
+  make O=$tmp/$base $base \
+    && make O=$tmp/$base $base \
+    && make O=$tmp/$base savedefconfig \
+    && diff -q $tmp/$base/defconfig configs/$base \
+    || mv configs/$base configs/$base.old \
+    && mv $tmp/$base/defconfig configs/$base
+  rm -rf $tmp/$base
+done
+rmdir $tmp
+