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

Mritunjay Sharma mritunjaysharma394 at gmail.com
Wed Aug 19 22:09:17 UTC 2020


[UPDATE]: Finally modified the RSB recipes to make them work with make
utility and EPICS was built successfully.

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


Thanks

Mritunjay


On Wed, Aug 19, 2020 at 2:47 PM Heinz Junkes <junkes at fhi-berlin.mpg.de>
wrote:

> Hallo Mritunjay,
>
> this was an improvement in the EPICS configuration to include the
> tool/path definitions
> from the RTEMS BSP directory:
>
> configure/os/CONFIG.Common.RTEMS:
> ...
> #-------------------------------------------------------
> # Pick up the RTEMS tool/path definitions from the RTEMS BSP directory.
> include $(RTEMS_BASE)/$(GNU_TARGET)/$(RTEMS_BSP)/Makefile.inc
> include $(RTEMS_CUSTOM)
> include $(CONFIG.CC)
>
> #-------------------------------------------------------
> # RTEMS cross-development tools
> CC = $(RTEMS_TOOLS)/bin/$(CC_FOR_TARGET) $(GCCSPECS) -fasm
> CCC = $(RTEMS_TOOLS)/bin/$(CXX)
> CPP = $(RTEMS_TOOLS)/bin/$(CC_FOR_TARGET) -x c -E
> AR = $(RTEMS_TOOLS)/bin/$(AR_FOR_TARGET)
> LD = $(RTEMS_TOOLS)/bin/$(LD_FOR_TARGET) -r
>>
> The assumption was that Makefile.inc is present in every BSP.
> If it cannot be found in the pc-386 BSP, should the BSP be adapted?
>

I will have to look into it again tomorrow and then I will revert on it.

Thanks
Mritunjay

>
>
> Viele Grüße
> Heinz Junkes
> --
> Experience directly varies with equipment ruined.
>
>
>
> > On 19. Aug 2020, at 07:09, Mritunjay Sharma <
> mritunjaysharma394 at gmail.com> wrote:
> >
> > Hi everyone,
> >
> > Before I begin my queries [ mainly regarding epics upstream], let me
> give a few updates.
> >
> > As per the suggestion of Gedare, I started building by hand the pc-386
> and xilinx_zynq_a9_qemu using
> > the terminal configured make command.
> >
> > What I did initially as an experiment is that, in
> configure/os/CONFIG_SITE.Common.RTEMS:
> >
> > I made
> > RTEMS_VERSION =
> > RTEMS_BASE =
> >
> > That is both were left blank.
> >
> > Similarly, I did it for configure/CONFIG_SITE:
> > CROSS_COMPILER_TARGET_ARCHS=
> >
> > After this, I started building EPICS for xilinx_zynq_a9_qemu from the
> 'epics-base' downloaded from this source of Heinz [
> https://gitlab.fhi.mpg.de/junkes/epics-base]
> >
> > The command I used was:
> >
> > ` make RTEMS_BASE=$HOME/development/rtems/5-arm RTEMS_VERSION=5
> CROSS_COMPILER_TARGET_ARCHS=RTEMS-xilinx_zynq_a9_qemu`
> >
> > The Build was successful for xilinx_zynq_a9_qemu.
> >
> > However, if I used the same `epics-base` and tried to build it for
> pc-386 using the command:
> >
> > `make RTEMS_BASE=$HOME/development/rtems/5 RTEMS_VERSION=5
> BUILD_ARCHS=RTEMS-pc386`
> >
> > The Build failed and I got this error:
> >
> > `make -C ./configure install
> > make[1]: Entering directory
> '/home/mritunjay/development/EPICS/epics-base/configure'
> > make -C O.RTEMS-pc386 -f ../Makefile TOP=../.. \
> >     T_A=RTEMS-pc386 install
> > make[2]: Entering directory
> '/home/mritunjay/development/EPICS/epics-base/configure/O.RTEMS-pc386'
> > ../../configure/os/CONFIG.Common.RTEMS:36:
> /home/mritunjay/development/rtems/5//pc386/Makefile.inc: No such file or
> directory
> > make[2]: *** No rule to make target
> '/home/mritunjay/development/rtems/5//pc386/Makefile.inc'.  Stop.
> > make[2]: Leaving directory
> '/home/mritunjay/development/EPICS/epics-base/configure/O.RTEMS-pc386'
> > make[1]: *** [../configure/RULES_ARCHS:58: install.RTEMS-pc386] Error 2
> > make[1]: Leaving directory
> '/home/mritunjay/development/EPICS/epics-base/configure'
> > make: *** [configure/RULES_DIRS:84: configure.install] Error 2
> > `
> > This made me try another `epics-base` of Heinz that he earlier suggested
> which is:
> https://github.com/hjunkes/epicsBaseOwnPlayground/tree/3afec267ab08568ea454789e562450b00feea5c0
> >
> > Running the same `make RTEMS_BASE=$HOME/development/rtems/5
> RTEMS_VERSION=5 BUILD_ARCHS=RTEMS-pc386`
> > the command worked here and EPICS for pc-386 was successfully built.
> >
> > Therefore, we need to make changes in the epics code base so that we can
> have one common epics-base which works for both.
> >
> > This was the update. I am modifying the RSB recipes and soon will update
> regarding the build related to it.
> >
> > Now, I am commenting on the queries further below.
> >
> >
> > On Wed, Aug 19, 2020 at 9:45 AM Gedare Bloom <gedare at rtems.org> wrote:
> > On Tue, Aug 18, 2020 at 7:13 PM Heinz Junkes <junkes at fhi-berlin.mpg.de>
> wrote:
> > >
> > > Hi Mritunjay,
> > >
> > > To define the architecture you can create a file “CONFIG_SITE.local”
> in “configure”.
> > > Look at the comment at the end of the file "CONFIG_SITE":
> > >
> > Do I have to just write `CROSS_COMPILER_TARGET_ARCHS=` in
> CONFIG_SITE.local file?
> > Please if you can tell more about what changes it can bring for us?
> > > "
> > > ...
> > > # Overrides for the settings above may appear in a CONFIG_SITE.local
> file
> > > -include $(CONFIG)/CONFIG_SITE.local.
> > > “
> > >
> >
> > Can we generate/inject the file/variables directly from scripts?
> >
> > I also have the same question.
> >
> > Thanks
> > Mritunjay Sharma
> >
> >
> > > Heinz
> > >
> > > > On 16. Aug 2020, at 12:16, Mritunjay Sharma <
> mritunjaysharma394 at gmail.com> wrote:
> > > >
> > > >
> > > >
> > > > On Sun, Aug 16, 2020 at 1:12 PM Chris Johns <chrisj at rtems.org>
> wrote:
> > > > On 16/8/20 8:29 am, Mritunjay Sharma wrote:
> > > > > On Sun, Aug 16, 2020 at 12:15 AM Gedare Bloom <gedare at rtems.org
> > > > > <mailto:gedare at rtems.org>> wrote:
> > > > >
> > > > >     Hi Mritunjay, Chris:
> > > > >
> > > > >     For the RSB, since it is user-facing, we need to be sure to
> minimize
> > > > >     its dependencies on the user environment and platform. So this
> pycli
> > > > >     can only be used if it is distributed standard with Python 2
> and
> > > > >     Python 3.
> > > > >
> > > > >     Would someone be able to apply this patch and use it to build
> epics?
> > > > >     No, because (1) they won't have pycli available, and (2) they
> don't
> > > > >     have a path /home/mritunjay
> > > > >
> > > > >
> > > > > I think what you are saying is absolutely right. It will be really
> a great help
> > > > > if Chris can guide on what next can be done.
> > > >
> > > > See below.
> > > >
> > > > > As far as 'pycli' is concerned, I have made a couple of minor
> tweaks. Gave it a
> > > > > better name 'sedpy' and made it public on GitHub.
> > > > >
> > > > > Please find the link to the
> > > > > project here: https://github.com/mritunjaysharma394/sedpy
> > > >
> > > > Thanks but I currently do not see a need for this tool.
> > > >
> > > > > I will appreciate if mentors can have a look and try this and see
> if it in any
> > > > > way can be modified
> > > > > to be used with RSB or else we will go with what is suggested.
> > > >
> > > > Please put the RSB to one side. I will let you know when we can
> return to it.
> > > >
> > > > I believe patching config files in EPCIS from the RSB is fragile.
> EPICS should
> > > > be free to change any of these files without needing to considering
> the effect
> > > > it has on the RSB. Just because we can peek inside does not means we
> are free to
> > > > exploit what we see.
> > > >
> > > > What happens if you define the needed variables on the make command
> line? For
> > > > example:
> > > >
> > > >  gmake RTEMS_BASE=$HOME/development/rtems/5 RTEMS_VERSION=5.1-rc2
> > > >
> > > > These variables are just normal make ones and so they can be
> overridden from the
> > > > command line.
> > > >
> > > > Please investigate this and see what happens?
> > > >
> > > > Hi Chris,
> > > > I investigated and used:
> > > >
> > > >  `make RTEMS_BASE=$HOME/development/rtems/5-arm RTEMS_VERSION=5`
> > > >
> > > > This worked perfectly fine and the build was successful. Thank you
> so much for telling this. It makes it so
> > > > easy. What can we do next? This surely removes the requirement of
> `sed` or the tool I built to make command line changes.
> > > >
> > > > Thanks
> > > > Mritunjay
> > > >
> > > >
> > > > Chris
> > >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20200820/0a302535/attachment.html>


More information about the devel mailing list