×
Namespaces

Variants
Actions
Revision as of 04:40, 1 August 2012 by hamishwillee (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Enforcing version checking of embedded SIS file

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Tested with
Devices(s): Nokia 6210 Navigator, Nokia N95
Compatibility
Platform(s): S60 3rd Edition FP1, S60 3rd Edition FP2
Symbian^3
S60 5th Edition
S60 3rd Edition FP2
S60 3rd Edition FP1
Article
Keywords: PKG file, approp(), embedded sis, version checking
Created: User:Nokia Developer KB (03 Apr 2009)
Last edited: hamishwillee (01 Aug 2012)

This article provides a way to enforce checking the version of an embedded SIS file.

Description

The installer checks the version of the sis file being installed and warns the user about the already installed version if any. However, the installer does not check the version of embedded SIS files and simply overwrites the already installed embedded SIS file regardless of the version.

In the PKG file we can ensure that the installer overwrites the embedded SIS file only if the already installed embedded SIS file is older than the current one or no version of the embedded SIS file has been installed previously.

Solution

Note.pngNote: Starting with S60 5th Edition (Symbian 9.4) you can use the version() function to script a version check in your *.pkg file

A properties item/statement is used to set the properties of the PKG file. The properties of a PKG file can be tested for using the AppProp() function. The major, minor, and build number of the embedded SIS can be mentioned in the corresponding PKG file.

Embedded sis pkg file

 //Normal pkg file statements
; embedded sis version 3.2.5
+(0=3,1=2,2=5)

Enforcing version checking of the embedded SIS file

Now we can utilise the approp(packageid,propid) function to ensure that the installer will install the embedded SIS only if the already installed embedded SIS is older than the current one.

Base pkg file

 ;Normal pkg file formats
;It embedds 3.2.5 embedded.sisx,updates any older progressbar.sisx
; 0xA00001F9 is the package id of the embedded.sisx
IF package(0xA00001F9) ;checks for already installed embedded sis file
if ( (appprop(0xA00001F9,0) <= 3)) ;checking the major release
if ( (appprop(0xA00001F9,1) <= 2)) ;checking the minor release
if ( (appprop(0xA00001F9,2) <= 4)) ;checking the build number
@"embedded.sisx", (0xA00001F9) ;v 3.2.5
endif
endif
endif
ELSE
@"embedded.sisx", (0xA00001F9) ;v 3.2.5
ENDIF

Optimisation

Instead of comparing three property fields we can encode the version number into one property field and check only that property. Embedded sis pkg file

 ;Normal pkg file statements
; embedded sis version 3.2.5
;(3*1000000+2*1000+5)
+(0=03002005)

Base pkg file

 ;It embedds 3.2.5 progressbar.sisx,updates any older progressbar.sisx
IF package(0xA00001F9)
if ( (appprop(0xA00001F9,0) < 3002005));(3*1000000+2*1000+5)
@"progressbar_armv5.sisx", (0xA00001F9) ;v 3.2.5
endif
ELSE
@"progressbar_armv5.sisx", (0xA00001F9) ;v 3.2.5
ENDIF

The problem with the above script(s) is that it ends-up embedding the progressbar_armv5.sisx twice in the package, effectively doubling its contribution to the size of the sis file. The script could be further simplified based on the following undocumented caracteristics of the appprop() function:

  • the function returns 0 if the package with the given UID is not installed on device
  • the function returns -1 if the property queried is not defined in the package (i.e. the package exists but it is an older version, which does not have properties defined)

This implies that the desired result can be obtained also with:

 ;It embedds 3.2.5 progressbar.sisx,updates any older progressbar.sisx
if ( (appprop(0xA00001F9,0) < 3002005));(3*1000000+2*1000+5)
@"progressbar_armv5.sisx", (0xA00001F9) ;v 3.2.5
endif
This page was last modified on 1 August 2012, at 04:40.
73 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×