Opened 9 years ago

Closed 9 years ago

#3617 closed defect (invalid)

FMU files include sources/include/suitesparse/Include/.svn/ directory

Reported by: cxh@… Owned by: Adeel Asghar
Priority: low Milestone:
Component: FMI Version:
Keywords: Cc: Adrian Pop

Description

The FMU files seems to include the sources/include/suitesparse/Include/.svn/ directory

cxh@terra ptII]$ mkdir /tmp/fmi2
[cxh@terra ptII]$ cd /tmp/fmi2
[cxh@terra fmi2]$ cp /home/jenkins/src/OpenModelica/OMCompiler/Examples/VanDerPol.mo .
[cxh@terra fmi2]$ cat VanDerPol.mos
loadModel(Modelica, {"3.2.1"});
getErrorString();
loadFile("VanDerPol.mo"); getErrorString();
OpenModelica.Scripting.translateModelFMU(
        className=VanDerPol,
        version="2.0");
getErrorString();
[cxh@terra fmi2]$ /usr/local/openmodelica/bin/omc --version
v1.9.4-dev.719+ga6c7cb2
[cxh@terra fmi2]$ /usr/local/openmodelica/bin/omc VanDerPol.mos
true
""
true
""
"SimCode: The model VanDerPol has been translated to FMU"
"Warning: The initial conditions are not fully specified. Use +d=initialization for more information.
"
[cxh@terra fmi2]$[cxh@terra fmi2]$ mkdir tmp
[cxh@terra fmi2]$ cd tmp
[cxh@terra tmp]$ unzip ../VanDerPol.fmu
Archive:  ../VanDerPol.fmu
   creating: binaries/
   creating: binaries/linux64/

...

  inflating: sources/include/suitesparse/Include/colamd.h
  inflating: sources/include/suitesparse/Include/umfpack.h
   creating: sources/include/suitesparse/Include/.svn/
   creating: sources/include/suitesparse/Include/.svn/prop-base/
  inflating: sources/include/suitesparse/Include/.svn/entries
  inflating: sources/include/suitesparse/Include/.svn/all-wcprops
   creating: sources/include/suitesparse/Include/.svn/text-base/

...

 extracting: sources/VanDerPol_11mix.h
  inflating: sources/config.guess
[cxh@terra tmp]$ 

Change History (5)

comment:1 by Martin Sjölund, 9 years ago

Cc: Adrian Pop added

I assume these files should disappear if you clean your OMC folders since nothing in OMC uses svn.

@adrpo: Any good reason why we copy all files in the include directory to the FMU instead of only required headers and C-files?

comment:2 by cxh@…, 9 years ago

Yes, presumably if I remove the .svn directories, then the .fmu files would not include the .svn files. The issue is that in the default, when building from the svn repository, the fmus include the .svn files. This is not a big problem, and probably does not hurt anything, but there could be vaguely proprietary information in these files such as user names or something. It would be best to avoid including extra files.

In Ptolemy II, under Mac OS X and Linux, we use the following makefile rule:

%.fmu: %.$(SHARED_LIBRARY_SUFFIX)
        # Remove files that should not be included in the .fmu file.                                                                    
	(cd $(FMUDIR); rm -rf *.o */*.o *~ \#*)
        (cd $(FMUDIR); zip -r ../$@ * -x '*/.svn/*' '*/#*#' '*/*~')

Under Windows, our .bat file looks like:

rem If the 7z.exe binary is found, then                                                                                                 
rem zip the directory tree and move to fmu directory                                                                                    
for %%X in (7z.exe) do set FOUND=%%~$PATH:X
if defined FOUND (
  cd fmu
  set FMU_FILE=
  if exist ..\..\..\..\%1.fmu del ..\..\..\..\%1.fmu
  7z.exe a -tzip -xr!.svn ..\..\..\..\%1.fmu ^
  modelDescription.xml model.png binaries sources documentation
) else (
  echo Warning: Not building the .fmu file because 7z.exe is not found
  echo 7z.exe is available as part of the fmusdk or %PTII%\ptolemy\actor\lib\fmu\fmus\win32\7z.exe
)
goto cleanup

See fmu.mk and build_fmu.bat in https://repo.eecs.berkeley.edu/svn-anon/projects/eal/ptII/trunk/ptolemy/actor/lib/fmi/fmus/template/sources/

in reply to:  2 comment:3 by Martin Sjölund, 9 years ago

Replying to cxh@…:

Yes, presumably if I remove the .svn directories, then the .fmu files would not include the .svn files.

There is no svn repository of OpenModelica...

comment:4 by cxh@…, 9 years ago

Ah! Good point!

I see that the .svn directory was likely left over from when OpenModelica did use Subversion.

bash-4.1$ ls -l /usr/local/openmodelica/include/omc/c/suitesparse/Include/.svn
total 24
-rw-r--r-- 1 jenkins jenkins  393 Dec 29  2014 all-wcprops
-rw-r--r-- 1 jenkins jenkins  548 May 11  2015 entries
drwxr-xr-x 2 jenkins jenkins 4096 May 11  2015 prop-base
drwxr-xr-x 2 jenkins jenkins 4096 May 11  2015 props
drwxr-xr-x 2 jenkins jenkins 4096 May 11  2015 text-base
drwxr-xr-x 5 jenkins jenkins 4096 May 11  2015 tmp

It is a design decision as to whether it would be better if the fmu creation process created .fmu files by explicitly mentioning each file or by zipping up the contents of the directory. Their are pros and cons to either design, but that decision is best left to the designer.

This can be closed.

comment:5 by Martin Sjölund, 9 years ago

Milestone: Future
Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.