Re: [PATCH] wscript: Update install directory to include RTEMS Version

2024-02-20 Thread Chris Johns
Hi,

Looks good with the addition of a loop shown befow.

Did you install into a clean path and test the BSP list can be reported in
rtems-test?

Chris

On 20/2/2024 2:27 pm, aaron.nyh...@unfoldedeffective.com wrote:
> From: Aaron N 
> 
> Closes #4929
> ---
>  config/wscript | 2 +-
>  linkers/wscript| 2 +-
>  misc/tools/boot.py | 2 +-
>  misc/wscript   | 4 ++--
>  rtemstoolkit/macros.py | 3 +++
>  rtemstoolkit/wscript   | 4 ++--
>  tester/covoar/wscript  | 4 ++--
>  tester/rt/options.py   | 2 +-
>  tester/wscript | 8 
>  wscript| 3 ++-
>  10 files changed, 19 insertions(+), 15 deletions(-)
> 
> diff --git a/config/wscript b/config/wscript
> index 6ae6226..d3d77aa 100644
> --- a/config/wscript
> +++ b/config/wscript
> @@ -39,6 +39,6 @@ def build(bld):
>  # Install the configuration files.
>  #
>  config = bld.path.find_dir('.')
> -bld.install_files('${PREFIX}/share/rtems/config',
> +bld.install_files('${PREFIX_SHARE_RTEMS}/config',
>config.ant_glob('**/*.ini'), cwd = config,
>relative_trick = True)
> diff --git a/linkers/wscript b/linkers/wscript
> index 2d2d7f0..5d9c5cf 100644
> --- a/linkers/wscript
> +++ b/linkers/wscript
> @@ -114,7 +114,7 @@ def build(bld):
>  cxxflags = conf['cxxflags'] + conf['warningflags'],
>  linkflags = conf['linkflags'],
>  use = modules)
> -bld.install_files('${PREFIX}/share/rtems/trace-linker',
> +bld.install_files('${PREFIX_SHARE_RTEMS}/trace-linker',
>['libc.ini',
> 'libc-heap.ini',
> 'rtems.ini',
> diff --git a/misc/tools/boot.py b/misc/tools/boot.py
> index 6e8065a..c6e40f8 100644
> --- a/misc/tools/boot.py
> +++ b/misc/tools/boot.py
> @@ -138,7 +138,7 @@ class bootloader(object):
>  if path.exists(path.join(command_path, boot_ini)):
>  rtdir = command_path
>  else:
> -rtdir = '%{_prefix}/share/rtems'
> +rtdir = '%{PREFIX_SHARE_RTEMS}'
>  boot_ini = '%s/%s' % (rtdir, boot_ini)
>  self.build = None
>  self.macros = macros.macros(rtdir = rtdir, show_minimal = True)
> diff --git a/misc/wscript b/misc/wscript
> index 5775dcf..0e4dd1d 100644
> --- a/misc/wscript
> +++ b/misc/wscript
> @@ -82,13 +82,13 @@ def build(bld):
>'tools/getmac/__init__.py',
>'tools/getmac/getmac.py'],
>  install_from = '.',
> -install_path = '${PREFIX}/share/rtems/misc')
> +install_path = '${PREFIX_SHARE_RTEMS}/misc')
>  bld.install_files('${PREFIX}/bin',
>['rtems-boot-image',
> 'rtems-tftp-proxy',
> 'tools/mkimage.py'],
>chmod = 0o755)
> -bld.install_files('${PREFIX}/share/rtems/tools/config',
> +bld.install_files('${PREFIX_SHARE_RTEMS}/tools/config',
>'tools/config/rtems-boot.ini')
>  
>  def tags(ctx):
> diff --git a/rtemstoolkit/macros.py b/rtemstoolkit/macros.py
> index 136f52d..fb235d9 100644
> --- a/rtemstoolkit/macros.py
> +++ b/rtemstoolkit/macros.py
> @@ -43,6 +43,7 @@ import string
>  from rtemstoolkit import error
>  from rtemstoolkit import log
>  from rtemstoolkit import path
> +from rtemstoolkit import version
>  
>  #
>  # Macro tables
> @@ -92,6 +93,8 @@ class macros:
>  self.rtpath = path.abspath(path.dirname(inspect.getfile(macros)))
>  if path.dirname(self.rtpath).endswith('/share/rtems'):
>  self.prefix = 
> path.dirname(self.rtpath)[:-len('/share/rtems')]
> +elif path.dirname(self.rtpath).endswith('/share/rtems' + 
> version()):
> +self.prefix = path.dirname(self.rtpath)[:-len('/share/rtems' 
> + version())]

Could this be a loop on a list of paths? eg

 for p in ['/share/rtems', '/share/rtems' + version()]:
 

>  else:
>  self.prefix = '.'
>  self.macros['global'] = {}
> diff --git a/rtemstoolkit/wscript b/rtemstoolkit/wscript
> index d1d5127..ac3521c 100644
> --- a/rtemstoolkit/wscript
> +++ b/rtemstoolkit/wscript
> @@ -158,8 +158,8 @@ def build(bld):
>'version.py',
>'windows.py'],
>  install_from = '.',
> -install_path = '${PREFIX}/share/rtems/rtemstoolkit')
> -bld.install_files('${PREFIX}/share/rtems/rtemstoolkit',
> +install_path = '${PREFIX_SHARE_RTEMS}/rtemstoolkit')
> +bld.install_files('${PREFIX_SHARE_RTEMS}/rtemstoolkit',
>'python-wrapper.sh',
>relative_trick = True)
>  
> diff --git a/tester/covoar/wscript b/tester/covoar/wscript
> index 8dab4d8..f5ff071 100644
> --- a/tester/covoar/wscript
> +++ b/tester/covoar/wscript
> @@ -135,8 +135,8 @@ def build(bld):
>  bld.program(target = 'covoar',
>  source 

[PATCH] wscript: Update install directory to include RTEMS Version

2024-02-20 Thread aaron . nyholm
From: Aaron N 

Closes #4929
---
 config/wscript | 2 +-
 linkers/wscript| 2 +-
 misc/tools/boot.py | 2 +-
 misc/wscript   | 4 ++--
 rtemstoolkit/macros.py | 3 +++
 rtemstoolkit/wscript   | 4 ++--
 tester/covoar/wscript  | 4 ++--
 tester/rt/options.py   | 2 +-
 tester/wscript | 8 
 wscript| 3 ++-
 10 files changed, 19 insertions(+), 15 deletions(-)

diff --git a/config/wscript b/config/wscript
index 6ae6226..d3d77aa 100644
--- a/config/wscript
+++ b/config/wscript
@@ -39,6 +39,6 @@ def build(bld):
 # Install the configuration files.
 #
 config = bld.path.find_dir('.')
-bld.install_files('${PREFIX}/share/rtems/config',
+bld.install_files('${PREFIX_SHARE_RTEMS}/config',
   config.ant_glob('**/*.ini'), cwd = config,
   relative_trick = True)
diff --git a/linkers/wscript b/linkers/wscript
index 2d2d7f0..5d9c5cf 100644
--- a/linkers/wscript
+++ b/linkers/wscript
@@ -114,7 +114,7 @@ def build(bld):
 cxxflags = conf['cxxflags'] + conf['warningflags'],
 linkflags = conf['linkflags'],
 use = modules)
-bld.install_files('${PREFIX}/share/rtems/trace-linker',
+bld.install_files('${PREFIX_SHARE_RTEMS}/trace-linker',
   ['libc.ini',
'libc-heap.ini',
'rtems.ini',
diff --git a/misc/tools/boot.py b/misc/tools/boot.py
index 6e8065a..c6e40f8 100644
--- a/misc/tools/boot.py
+++ b/misc/tools/boot.py
@@ -138,7 +138,7 @@ class bootloader(object):
 if path.exists(path.join(command_path, boot_ini)):
 rtdir = command_path
 else:
-rtdir = '%{_prefix}/share/rtems'
+rtdir = '%{PREFIX_SHARE_RTEMS}'
 boot_ini = '%s/%s' % (rtdir, boot_ini)
 self.build = None
 self.macros = macros.macros(rtdir = rtdir, show_minimal = True)
diff --git a/misc/wscript b/misc/wscript
index 5775dcf..0e4dd1d 100644
--- a/misc/wscript
+++ b/misc/wscript
@@ -82,13 +82,13 @@ def build(bld):
   'tools/getmac/__init__.py',
   'tools/getmac/getmac.py'],
 install_from = '.',
-install_path = '${PREFIX}/share/rtems/misc')
+install_path = '${PREFIX_SHARE_RTEMS}/misc')
 bld.install_files('${PREFIX}/bin',
   ['rtems-boot-image',
'rtems-tftp-proxy',
'tools/mkimage.py'],
   chmod = 0o755)
-bld.install_files('${PREFIX}/share/rtems/tools/config',
+bld.install_files('${PREFIX_SHARE_RTEMS}/tools/config',
   'tools/config/rtems-boot.ini')
 
 def tags(ctx):
diff --git a/rtemstoolkit/macros.py b/rtemstoolkit/macros.py
index 136f52d..fb235d9 100644
--- a/rtemstoolkit/macros.py
+++ b/rtemstoolkit/macros.py
@@ -43,6 +43,7 @@ import string
 from rtemstoolkit import error
 from rtemstoolkit import log
 from rtemstoolkit import path
+from rtemstoolkit import version
 
 #
 # Macro tables
@@ -92,6 +93,8 @@ class macros:
 self.rtpath = path.abspath(path.dirname(inspect.getfile(macros)))
 if path.dirname(self.rtpath).endswith('/share/rtems'):
 self.prefix = path.dirname(self.rtpath)[:-len('/share/rtems')]
+elif path.dirname(self.rtpath).endswith('/share/rtems' + 
version()):
+self.prefix = path.dirname(self.rtpath)[:-len('/share/rtems' + 
version())]
 else:
 self.prefix = '.'
 self.macros['global'] = {}
diff --git a/rtemstoolkit/wscript b/rtemstoolkit/wscript
index d1d5127..ac3521c 100644
--- a/rtemstoolkit/wscript
+++ b/rtemstoolkit/wscript
@@ -158,8 +158,8 @@ def build(bld):
   'version.py',
   'windows.py'],
 install_from = '.',
-install_path = '${PREFIX}/share/rtems/rtemstoolkit')
-bld.install_files('${PREFIX}/share/rtems/rtemstoolkit',
+install_path = '${PREFIX_SHARE_RTEMS}/rtemstoolkit')
+bld.install_files('${PREFIX_SHARE_RTEMS}/rtemstoolkit',
   'python-wrapper.sh',
   relative_trick = True)
 
diff --git a/tester/covoar/wscript b/tester/covoar/wscript
index 8dab4d8..f5ff071 100644
--- a/tester/covoar/wscript
+++ b/tester/covoar/wscript
@@ -135,8 +135,8 @@ def build(bld):
 bld.program(target = 'covoar',
 source = ['covoar.cc'],
 use = ['ccovoar'] + modules,
-install_path = '${PREFIX}/share/rtems/tester/bin',
+install_path = '${PREFIX_SHARE_RTEMS}/tester/bin',
 cflags = ['-O2', '-g'],
 cxxflags = ['-std=c++11', '-O2', '-g'],
 includes = ['.'] + rtl_includes)
-bld.install_files('${PREFIX}/share/rtems/tester/covoar', ['covoar.css', 
'table.js'])
+bld.install_files('${PREFIX_SHARE_RTEMS}/tester/covoar', ['covoar.css', 
'table.js'])
diff --git a/tester/rt/options.py