Re: [PATCH 6/6] waf: Add configurations with different modules.

2018-04-09 Thread Christian Mauderer
Am 09.04.2018 um 03:50 schrieb Chris Johns:
> On 06/04/2018 22:26, Christian Mauderer wrote:
>> This allows multiple build configurations (buildsets) with different
>> modules enabled.
>>
>> Update #3351
>> ---
>>  CONTRIBUTING.md  |   7 ++-
>>  README.waf   |   3 +-
>>  builder.py   |  13 ++---
>>  buildset/default.ini |  58 ++
>>  buildset/sample.ini  |  10 
>>  libbsd.py|   2 +-
>>  rtems_waf|   2 +-
>>  waf_libbsd.py|   9 
>>  wscript  | 136 
>> +--
>>  9 files changed, 203 insertions(+), 37 deletions(-)
>>  create mode 100644 buildset/default.ini
>>  create mode 100644 buildset/sample.ini
>>
>> diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
>> index eddefe98..9e6ee83c 100644
>> --- a/CONTRIBUTING.md
>> +++ b/CONTRIBUTING.md
>> @@ -67,8 +67,7 @@ freebsd-to-rtems.py [args]
>>  ```
>>  
>>  In its default mode of operation, freebsd-to-rtems.py is used to copy code
>> -from FreeBSD to the rtems-libbsd tree and perform transformations.  In 
>> forward
>> -mode, the script may be requested to just generate the Waf script.
>> +from FreeBSD to the rtems-libbsd tree and perform transformations.
>>  
>>  In *reverse mode*, this script undoes those transformations and copies
>>  the source code back to the *master* FreeBSD tree. This allows us to do
>> @@ -126,9 +125,9 @@ How to import code from FreeBSD
>>  * Run `./freebsd-to-rtems.py -R`
>>  * Run `./freebsd-to-rtems.py`
>>  * Run `git status` and make sure your working directory is clean.  If you 
>> see modified files, then the `freebsd-to-rtems.py` script needs to be fixed 
>> first.
>> -* Add the files to import to `libbsd.py`.
>> +* Add the files to import to `libbsd.py` and your intended build set (for 
>> example `buildset/default.ini`.
>>  * Run `./freebsd-to-rtems.py`
>> -* Immediately check in the imported files without the changes to 
>> `libbsd_waf.py`.  Do not touch the imported files yourself at this point.
>> +* Immediately check in the imported files without the changes to 
>> `libbsd.py` and the buildsets.  Do not touch the imported files yourself at 
>> this point.
>>  * Port the imported files to RTEMS.  See 'Rules for Modifying FreeBSD 
>> Source'.
>>  * Add a test to the testsuite if possible.
>>  * Run `./create-kernel-namespace.sh` if you imported kernel space headers.  
>> Add only your new defines via `git add -p 
>> rtemsbsd/include/machine/rtems-bsd-kernel-namespace.h`.
>> diff --git a/README.waf b/README.waf
>> index dddc04a4..485a1899 100644
>> --- a/README.waf
>> +++ b/README.waf
>> @@ -73,7 +73,8 @@ cd rtems-libbsd
>>  git submodule init
>>  git submodule update rtems_waf
>>  waf configure --prefix="$sandbox/rtems-4.12" \
>> -  --rtems-bsps=arm/xilinx_zynq_a9_qemu
>> +  --rtems-bsps=arm/xilinx_zynq_a9_qemu \
>> +  --buildset=buildset/default.ini
> 
> Is this the default and so if you do not add a --buildset option you get this?
> 
> It might pay to highlight this if it is the case.

Yes, you are right. That is the default. I'll add a note regarding that.

> 
>>  waf
>>  waf install
>>  qemu-system-arm -no-reboot -serial null -serial mon:stdio -net none \
>> diff --git a/builder.py b/builder.py
>> index bb5791a8..c968e05c 100755
>> --- a/builder.py
>> +++ b/builder.py
>> @@ -44,6 +44,7 @@ import getopt
>>  import filecmp
>>  import difflib
>>  import codecs
>> +import copy
>>  
>>  #
>>  # Global controls.
>> @@ -487,15 +488,11 @@ class Module(object):
>>  def __init__(self, manager, name, enabled = True):
>>  self.manager = manager
>>  self.name = name
>> -self.enabled = enabled
>>  self.conditionalOn = "none"
>>  self.files = []
>>  self.cpuDependentSourceFiles = {}
>>  self.dependencies = []
>>  
>> -def isEnabled(self):
>> -return self.enabled
>> -
>>  def initCPUDependencies(self, cpu):
>>  if cpu not in self.cpuDependentSourceFiles:
>>  self.cpuDependentSourceFiles[cpu] = []
>> @@ -664,15 +661,19 @@ class ModuleManager(object):
>>  self.modules[m].processSource(direction)
>>  
>>  def setConfiguration(self, config):
>> -self.configuration = config
>> +self.configuration = copy.deepcopy(config)
>>  
>>  def getConfiguration(self):
>>  return self.configuration
>>  
>> +def updateConfiguration(self, config):
>> +self.configuration.update(config)
>> +
>>  def setModuleConfigiuration(self):
>>  mods = sorted(self.modules.keys())
>>  self.configuration['modules'] = mods
>> -self.configuration['modules-enabled'] = [m for m in mods if 
>> self.modules[m].isEnabled()]
>> +# Enabled modules are overwritten by config file. Default to all.
>> +self.configuration['modules-enabled'] = mods
>>  
>>  def generateBuild(self, only_enabled=True):
>>  modules_to_process = self.getEnabledModules()
>> di

Re: [PATCH 6/6] waf: Add configurations with different modules.

2018-04-08 Thread Chris Johns
On 06/04/2018 22:26, Christian Mauderer wrote:
> This allows multiple build configurations (buildsets) with different
> modules enabled.
> 
> Update #3351
> ---
>  CONTRIBUTING.md  |   7 ++-
>  README.waf   |   3 +-
>  builder.py   |  13 ++---
>  buildset/default.ini |  58 ++
>  buildset/sample.ini  |  10 
>  libbsd.py|   2 +-
>  rtems_waf|   2 +-
>  waf_libbsd.py|   9 
>  wscript  | 136 
> +--
>  9 files changed, 203 insertions(+), 37 deletions(-)
>  create mode 100644 buildset/default.ini
>  create mode 100644 buildset/sample.ini
> 
> diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
> index eddefe98..9e6ee83c 100644
> --- a/CONTRIBUTING.md
> +++ b/CONTRIBUTING.md
> @@ -67,8 +67,7 @@ freebsd-to-rtems.py [args]
>  ```
>  
>  In its default mode of operation, freebsd-to-rtems.py is used to copy code
> -from FreeBSD to the rtems-libbsd tree and perform transformations.  In 
> forward
> -mode, the script may be requested to just generate the Waf script.
> +from FreeBSD to the rtems-libbsd tree and perform transformations.
>  
>  In *reverse mode*, this script undoes those transformations and copies
>  the source code back to the *master* FreeBSD tree. This allows us to do
> @@ -126,9 +125,9 @@ How to import code from FreeBSD
>  * Run `./freebsd-to-rtems.py -R`
>  * Run `./freebsd-to-rtems.py`
>  * Run `git status` and make sure your working directory is clean.  If you 
> see modified files, then the `freebsd-to-rtems.py` script needs to be fixed 
> first.
> -* Add the files to import to `libbsd.py`.
> +* Add the files to import to `libbsd.py` and your intended build set (for 
> example `buildset/default.ini`.
>  * Run `./freebsd-to-rtems.py`
> -* Immediately check in the imported files without the changes to 
> `libbsd_waf.py`.  Do not touch the imported files yourself at this point.
> +* Immediately check in the imported files without the changes to `libbsd.py` 
> and the buildsets.  Do not touch the imported files yourself at this point.
>  * Port the imported files to RTEMS.  See 'Rules for Modifying FreeBSD 
> Source'.
>  * Add a test to the testsuite if possible.
>  * Run `./create-kernel-namespace.sh` if you imported kernel space headers.  
> Add only your new defines via `git add -p 
> rtemsbsd/include/machine/rtems-bsd-kernel-namespace.h`.
> diff --git a/README.waf b/README.waf
> index dddc04a4..485a1899 100644
> --- a/README.waf
> +++ b/README.waf
> @@ -73,7 +73,8 @@ cd rtems-libbsd
>  git submodule init
>  git submodule update rtems_waf
>  waf configure --prefix="$sandbox/rtems-4.12" \
> -  --rtems-bsps=arm/xilinx_zynq_a9_qemu
> +  --rtems-bsps=arm/xilinx_zynq_a9_qemu \
> +  --buildset=buildset/default.ini

Is this the default and so if you do not add a --buildset option you get this?

It might pay to highlight this if it is the case.

>  waf
>  waf install
>  qemu-system-arm -no-reboot -serial null -serial mon:stdio -net none \
> diff --git a/builder.py b/builder.py
> index bb5791a8..c968e05c 100755
> --- a/builder.py
> +++ b/builder.py
> @@ -44,6 +44,7 @@ import getopt
>  import filecmp
>  import difflib
>  import codecs
> +import copy
>  
>  #
>  # Global controls.
> @@ -487,15 +488,11 @@ class Module(object):
>  def __init__(self, manager, name, enabled = True):
>  self.manager = manager
>  self.name = name
> -self.enabled = enabled
>  self.conditionalOn = "none"
>  self.files = []
>  self.cpuDependentSourceFiles = {}
>  self.dependencies = []
>  
> -def isEnabled(self):
> -return self.enabled
> -
>  def initCPUDependencies(self, cpu):
>  if cpu not in self.cpuDependentSourceFiles:
>  self.cpuDependentSourceFiles[cpu] = []
> @@ -664,15 +661,19 @@ class ModuleManager(object):
>  self.modules[m].processSource(direction)
>  
>  def setConfiguration(self, config):
> -self.configuration = config
> +self.configuration = copy.deepcopy(config)
>  
>  def getConfiguration(self):
>  return self.configuration
>  
> +def updateConfiguration(self, config):
> +self.configuration.update(config)
> +
>  def setModuleConfigiuration(self):
>  mods = sorted(self.modules.keys())
>  self.configuration['modules'] = mods
> -self.configuration['modules-enabled'] = [m for m in mods if 
> self.modules[m].isEnabled()]
> +# Enabled modules are overwritten by config file. Default to all.
> +self.configuration['modules-enabled'] = mods
>  
>  def generateBuild(self, only_enabled=True):
>  modules_to_process = self.getEnabledModules()
> diff --git a/buildset/default.ini b/buildset/default.ini
> new file mode 100644
> index ..15b57df4
> --- /dev/null
> +++ b/buildset/default.ini
> @@ -0,0 +1,58 @@
> +#
> +# Default configuration.
> +#
> +
> +[general]
> +name = default
> +
> +[mod

[PATCH 6/6] waf: Add configurations with different modules.

2018-04-06 Thread Christian Mauderer
This allows multiple build configurations (buildsets) with different
modules enabled.

Update #3351
---
 CONTRIBUTING.md  |   7 ++-
 README.waf   |   3 +-
 builder.py   |  13 ++---
 buildset/default.ini |  58 ++
 buildset/sample.ini  |  10 
 libbsd.py|   2 +-
 rtems_waf|   2 +-
 waf_libbsd.py|   9 
 wscript  | 136 +--
 9 files changed, 203 insertions(+), 37 deletions(-)
 create mode 100644 buildset/default.ini
 create mode 100644 buildset/sample.ini

diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index eddefe98..9e6ee83c 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -67,8 +67,7 @@ freebsd-to-rtems.py [args]
 ```
 
 In its default mode of operation, freebsd-to-rtems.py is used to copy code
-from FreeBSD to the rtems-libbsd tree and perform transformations.  In forward
-mode, the script may be requested to just generate the Waf script.
+from FreeBSD to the rtems-libbsd tree and perform transformations.
 
 In *reverse mode*, this script undoes those transformations and copies
 the source code back to the *master* FreeBSD tree. This allows us to do
@@ -126,9 +125,9 @@ How to import code from FreeBSD
 * Run `./freebsd-to-rtems.py -R`
 * Run `./freebsd-to-rtems.py`
 * Run `git status` and make sure your working directory is clean.  If you see 
modified files, then the `freebsd-to-rtems.py` script needs to be fixed first.
-* Add the files to import to `libbsd.py`.
+* Add the files to import to `libbsd.py` and your intended build set (for 
example `buildset/default.ini`.
 * Run `./freebsd-to-rtems.py`
-* Immediately check in the imported files without the changes to 
`libbsd_waf.py`.  Do not touch the imported files yourself at this point.
+* Immediately check in the imported files without the changes to `libbsd.py` 
and the buildsets.  Do not touch the imported files yourself at this point.
 * Port the imported files to RTEMS.  See 'Rules for Modifying FreeBSD Source'.
 * Add a test to the testsuite if possible.
 * Run `./create-kernel-namespace.sh` if you imported kernel space headers.  
Add only your new defines via `git add -p 
rtemsbsd/include/machine/rtems-bsd-kernel-namespace.h`.
diff --git a/README.waf b/README.waf
index dddc04a4..485a1899 100644
--- a/README.waf
+++ b/README.waf
@@ -73,7 +73,8 @@ cd rtems-libbsd
 git submodule init
 git submodule update rtems_waf
 waf configure --prefix="$sandbox/rtems-4.12" \
-  --rtems-bsps=arm/xilinx_zynq_a9_qemu
+  --rtems-bsps=arm/xilinx_zynq_a9_qemu \
+  --buildset=buildset/default.ini
 waf
 waf install
 qemu-system-arm -no-reboot -serial null -serial mon:stdio -net none \
diff --git a/builder.py b/builder.py
index bb5791a8..c968e05c 100755
--- a/builder.py
+++ b/builder.py
@@ -44,6 +44,7 @@ import getopt
 import filecmp
 import difflib
 import codecs
+import copy
 
 #
 # Global controls.
@@ -487,15 +488,11 @@ class Module(object):
 def __init__(self, manager, name, enabled = True):
 self.manager = manager
 self.name = name
-self.enabled = enabled
 self.conditionalOn = "none"
 self.files = []
 self.cpuDependentSourceFiles = {}
 self.dependencies = []
 
-def isEnabled(self):
-return self.enabled
-
 def initCPUDependencies(self, cpu):
 if cpu not in self.cpuDependentSourceFiles:
 self.cpuDependentSourceFiles[cpu] = []
@@ -664,15 +661,19 @@ class ModuleManager(object):
 self.modules[m].processSource(direction)
 
 def setConfiguration(self, config):
-self.configuration = config
+self.configuration = copy.deepcopy(config)
 
 def getConfiguration(self):
 return self.configuration
 
+def updateConfiguration(self, config):
+self.configuration.update(config)
+
 def setModuleConfigiuration(self):
 mods = sorted(self.modules.keys())
 self.configuration['modules'] = mods
-self.configuration['modules-enabled'] = [m for m in mods if 
self.modules[m].isEnabled()]
+# Enabled modules are overwritten by config file. Default to all.
+self.configuration['modules-enabled'] = mods
 
 def generateBuild(self, only_enabled=True):
 modules_to_process = self.getEnabledModules()
diff --git a/buildset/default.ini b/buildset/default.ini
new file mode 100644
index ..15b57df4
--- /dev/null
+++ b/buildset/default.ini
@@ -0,0 +1,58 @@
+#
+# Default configuration.
+#
+
+[general]
+name = default
+
+[modules-enabled]
+altq = 1
+base = 1
+cam = 1
+contrib_expat = 1
+contrib_libpcap = 1
+crypto = 1
+crypto_openssl = 1
+dev_input = 1
+dev_net = 1
+dev_nic = 1
+dev_nic_broadcomm = 1
+dev_nic_dc = 1
+dev_nic_e1000 = 1
+dev_nic_fxp = 1
+dev_nic_re = 1
+dev_nic_smc = 1
+dev_usb = 1
+dev_usb_controller = 1
+dev_usb_controller_bbb = 1
+dev_usb_input = 1
+dev_usb_net = 1
+dev_usb_quirk = 1
+dev_usb_serial = 1
+dev_usb_storage = 1
+dev_usb_wlan = 1
+dev_w