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

Semun Lee sm79.lee at samsung.com
Wed Apr 9 00:53:11 GMT 2014


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.

Best regards,
Semun



More information about the Dev mailing list