[GSoC 2020]: Need help in writing sed alternative in Python for RSB recipes

Heinz Junkes junkes at fhi-berlin.mpg.de
Sun Aug 23 14:38:04 UTC 2020


Hallo Mritunjay,

that sounds good. But shouldn't the dependencies for the RTEMS basic installation
be taken into account. Maybe I don't understand the purpose of the source-builder.
But I thought that the necessary rtems-modules (compiler for architecture, libbsd, etc.) are checked
and if something is missing, they are installed? And when do the tests (epics: make runtests and qemu)
come into play? 
Gruss Heinz


> On 23. Aug 2020, at 00:08, Mritunjay Sharma <mritunjaysharma394 at gmail.com> wrote:
> 
> [Good news and Update]: 
> 
> Thank you so much Chris! Your advice to search for macros using --trace solved the problem of hard coding!
> It took two complete days to figure out this beautiful thing but it is every worth it. 
> 
> Now the user has to just enter the below command and it will make things work: 
> 
> `../source-builder/sb-builder --with-rtems-bsp="xilinx_zynq_a9_qemu" --log=log_epics epics-7-1  --trace --prefix=$HOME/development/rtems/5-arm`
> 
> Note: prefix will depend on the user. 
> 
> What made this possible? Your suggestion and the changes in code mentioned below:
> 
> ```diff --git a/rtems/config/epics/epics-7-1.cfg b/rtems/config/epics/epics-7-1.cfg
> index aeb39a9..4b20f82 100644
> --- a/rtems/config/epics/epics-7-1.cfg
> +++ b/rtems/config/epics/epics-7-1.cfg
> @@ -6,6 +6,8 @@
>   %define release 1
>  %endif
>  
> +%include %{_configdir}/rtems-bsp.cfg
> +
>  #
>  # EPICS Version
>  #
> diff --git a/source-builder/config/epics-7-1.cfg b/source-builder/config/epics-7-1.cfg
> index a9581a2..a47aecb 100644
> --- a/source-builder/config/epics-7-1.cfg
> +++ b/source-builder/config/epics-7-1.cfg
> @@ -40,7 +40,10 @@ URL:  https://epics.mpg.de/
>  
>    %{build_build_flags}
>  
> -  %{__make} PREFIX=%{_prefix} RTEMS_BASE=$HOME/development/rtems/5-arm RTEMS_VERSION=5 CROSS_COMPILER_TARGET_ARCHS=RTEMS-xilinx_zynq_a9_qemu
> +  #
> +  # Using macros to dynamically path to RTEMS_BASE and RTEMS_VERSION using --with-rtems-bsp
> +  #
> +  %{__make} PREFIX=%{_prefix} RTEMS_BASE=%{_exec_prefix} RTEMS_VERSION=%{rtems_version}
>  
>    cd ${build_top}
>  
> @@ -50,6 +53,5 @@ URL:  https://epics.mpg.de/
>    rm -rf $SB_BUILD_ROOT
>  
>    cd ${source_dir_epics}
> -  %{__make} DESTDIR=$SB_BUILD_ROOT PREFIX=%{_prefix} RTEMS_BASE=$HOME/development/rtems/5-arm RTEMS_VERSION=5 CROSS_COMPILER_TARGET_ARCHS=RTEMS-xilinx_zynq_a9_qemu
> -
> +  %{__make} DESTDIR=$SB_BUILD_ROOT PREFIX=%{_prefix} RTEMS_BASE=%{_exec_prefix} RTEMS_VERSION=%{rtems_version}
>    cd ${build_top}
> ```
> 
> These couple of changes made this build successful using RSB recipe. The only problem remains 
> is that a warning of 'no hash found' is coming, even though I have added it. 
> 
> The above changes can be found pushed here: https://github.com/RTEMS/rtems-source-builder/commit/a505877157f63f6ae17906276b3ffcb699ed1297
> 
> Please do give feedback and suggest improvements so that the recipe can become mergeable. 
> 
> Thanks
> Mritunjay Sharma
> 
> 
> 
> 
> 
> 
> 
> On Thu, Aug 20, 2020 at 8:51 AM Chris Johns <chrisj at rtems.org> wrote:
> On 20/8/20 8:09 am, Mritunjay Sharma wrote:
> > [UPDATE]: Finally modified the RSB recipes to make them work with make utility
> > and EPICS was built successfully.
> 
> Great you have had some success but there is a lot more work before it is usable.
> 
> > iff --git a/source-builder/config/epics-7-1.cfg b/source-builder/config/epics-7-1.cfg
> > index f51c6582..a9581a2e 100644
> > --- a/source-builder/config/epics-7-1.cfg
> > +++ b/source-builder/config/epics-7-1.cfg
> > @@ -21,7 +21,6 @@ URL:          https://epics.mpg.de/
> >  #
> >  %source set epics --rsb-file=epics-base-%{epics_version}.tar.gz https://gitlab.fhi.mpg.de/junkes/epics-base/-/archive/%{epics_version}/epics-base-%{epics_version}.tar.gz
> >  
> > -
> >  #
> >  # Prepare the source code.
> >  #
> > @@ -31,20 +30,9 @@ URL:         https://epics.mpg.de/
> >    source_dir_epics="epics-base-%{epics_version}"
> >  
> >    %source setup epics -q -n epics-base-%{epics_version}
> > -#
> > -# Changing the RTEMS Version in epics-base/configure/os/CONFIG_SITE.Common.RTEMS
> > -#
> > -sed -i 's/RTEMS_VERSION = .*/RTEMS_VERSION = 5/g' configure/os/CONFIG_SITE.Common.RTEMS
> > -
> > -#
> > -# Changing the RTEMS Base in epics-base/configure/os/CONFIG_SITE.Common.RTEMS
> > -#
> > -sed -i "s/^RTEMS_BASE .*/RTEMS_BASE = \/home\/mritunjay\/development\/rtems\/\$\(RTEMS_VERSION\)\-arm/g" configure/os/CONFIG_SITE.Common.RTEMS
> >  
> >    cd ${build_top}
> >  
> > -
> > -
> >  %build
> >    build_top=$(pwd)
> >  
> > @@ -52,7 +40,7 @@ sed -i "s/^RTEMS_BASE .*/RTEMS_BASE = \/home\/mritunjay\/development\/rtems\/\$\
> >  
> >    %{build_build_flags}
> >  
> > -  %{__make} PREFIX=%{_prefix}
> > +  %{__make} PREFIX=%{_prefix} RTEMS_BASE=$HOME/development/rtems/5-arm RTEMS_VERSION=5 CROSS_COMPILER_TARGET_ARCHS=RTEMS-xilinx_zynq_a9_qemu
> >  
> >    cd ${build_top}
> >  
> > @@ -62,6 +50,6 @@ sed -i "s/^RTEMS_BASE .*/RTEMS_BASE = \/home\/mritunjay\/development\/rtems\/\$\
> >    rm -rf $SB_BUILD_ROOT
> >  
> >    cd ${source_dir_epics}
> > -  %{__make} DESTDIR=$SB_BUILD_ROOT PREFIX=%{_prefix} install
> > +  %{__make} DESTDIR=$SB_BUILD_ROOT PREFIX=%{_prefix} RTEMS_BASE=$HOME/development/rtems/5-arm RTEMS_VERSION=5 CROSS_COMPILER_TARGET_ARCHS=RTEMS-xilinx_zynq_a9_qemu
> 
> Mritunjay, can you see what is wrong here? Lets have a look ...
> 
> $ stat $HOME/development/rtems/5-arm
> stat: /home/chris/development/rtems/5-arm: stat: No such file or directory
> 
> This will not work for me and it will not work for an RSB vertical stack build.
> This last requirement is important.
> 
> You cannot hard code values. The RSB provides the RTEMS version, BSP details and
> paths as RSB macro variables. Please review these by using the --trace option
> and log file and please ask if you have any questions.
> 
> Chris

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2542 bytes
Desc: not available
URL: <http://lists.rtems.org/pipermail/devel/attachments/20200823/2f93b041/attachment.bin>


More information about the devel mailing list