[Dev] Removing hardcoded paths in smack .manifest and application manifest (.xml)

José Bollo jobol at nonadev.net
Wed Apr 9 16:12:44 GMT 2014


On mer, 2014-04-09 at 09:53 +0900, Semun Lee wrote:
> Hi,
> 
> We are removing hardcoded paths in the Tizen core applications according to
> the guide in https://wiki.tizen.org/wiki/Multi-user_Architecture. However,
> in that guide there is no specific guideline for hardcoded paths in
> .manifest files and Tizen application manifest (.xml) files.
> 
> .manifest file example (don't blame the exactness of the rule in the
> example):
> 
>     <manifest>
>      <request>
>         <domain name="_"/>
>      </request>
>      <assign>
>        <filesystem path="/opt/usr/apps/org.tizen.taskmgr/data" label="User"
> />
>      </assign>
>     </manifest>
> 
> Some .manifest files may contain paths to its contents, so we need to
> provide a guide to replace those paths to a macro. I think it is possible to
> provide an rpm macro that is available in the %build section of rpm .spec
> file. It may look like the below example. 
> 
>     %define configure_manifest() (sed ':@PREFIX@:%{PREFIX}:' %1 > %2)
>     %configure_manifest packaging/org.tizen.taskmgr.manifest.in
> org.tizen.taskmgr.manifest
> 	
> When a developer wants to write a path to its content in the .manifest file,
> he or she needs to write a template file of manifest file like the below,
> then the rpm macro can convert it to the real manifest file.
> 
>     <manifest>
>      <request>
>         <domain name="_"/>
>      </request>
>      <assign>
>        <filesystem path="@PREFIX@/data" label="User" />
>      </assign>
>     </manifest>
> 
> 
> And for application manifest (.xml) example:
> 
>     <?xml version="1.0" encoding="utf-8"?>
>     <manifest xmlns="http://tizen.org/ns/packages"
> package="org.tizen.taskmgr" version="0.14.5"
> install-location="internal-only">
>         <label>taskmgr</label>
>         <author email="hhh.kwon at samsung.com" href="www.samsung.com">Hong
> Kwon</author>
>         <description>Task Manager</description>
>         <ui-application appid="org.tizen.taskmgr"
> exec="/usr/apps/org.tizen.taskmgr/bin/taskmgr" nodisplay="true"
> multiple="false" type="capp" taskmanage="false">
>             <label>taskmgr</label>
>         </ui-application>
>     </manifest>
> 
> I think the developers can use similar mechanism with the .manifest file
> during its build process. If the project uses CMake, it can use
> configure_file command of CMake and replace macros in .in file to the real
> .xml file.
> 
> 
> Please, share your idea if you have better one.

Hi,

First, this example is badly chosen because the target is dependent of
the user then it can't be done at RPM installation.

Anyway, for the principles what you are explaining is right. But the
manifest is interpreted by the MSM plugin of RPM then it could by
himself expand macros in paths. Then using directly

    <manifest>
     <request>
        <domain name="_"/>
     </request>
     <assign>
       <filesystem path="%{PREFIX}/data" label="User" />
     </assign>
    </manifest>

is by far the best solution. 

But but but...
I didn't checked if the MSM plugin is able to do that. If not, it could
be patched.

Best regards
José

> 
> Best regards,
> Semun
> 
> _______________________________________________
> Dev mailing list
> Dev at lists.tizen.org
> https://lists.tizen.org/listinfo/dev




More information about the Dev mailing list