[Helix-client-dev] CR/CN: Added installer/archiver project. [GMPMetaEditor branch]

Petar Basic <[email protected]> Wed, 27 Jan 2010 14:08:43 +0100
Newsgroups gmane.comp.multimedia.helix.devel
Message-ID <[email protected]>
Modified by: pbasic at real.com
Date: 2010/01/27
Project: GMPMetaEditor (meta3gp.exe)

Synopsis:
Added installer/archiver project. [GMPMetaEditor branch]

Details:
A simple archive is all that is currently needed to distribute
GMPMetaEditor application.  Umakefil writes out customized target
command which calls a python script to build the archive.
'create_dist_archive.py' script copies program binaries and some other
files to the staging area.  As the last step, the script archives the
whole staging directory into a single file (ZIP on Windows, TGZ on
Solaris).

Files Modified:
datatype_rn/tools/dtdriver/apps/meta3gp/installer/Umakefil
datatype_rn/tools/dtdriver/apps/meta3gp/installer/create_dist_archive.py
datatype_rn/tools/dtdriver/apps/meta3gp/installer/platform/win32/msvcp71.dll
datatype_rn/tools/dtdriver/apps/meta3gp/installer/platform/win32/msvcp71d.dll
datatype_rn/tools/dtdriver/apps/meta3gp/installer/platform/win32/msvcr71.dll
datatype_rn/tools/dtdriver/apps/meta3gp/installer/platform/win32/msvcr71d.dll
GMPMetaEditor_internal.bif

Platforms and Profiles Affected:
All

Image Size and Heap Use impact:
None

Platforms and Profiles Build Verified:
system id: win32-i386-vc7, sunos-5.10-sparc-server
profile: helix-client-all-defines

Platforms and Profiles Functionality Verified:
x86 Windows XP SP2
Sparc SunOS 5.10

Branch:
GMPMetaEditor

Copyright assignment:
I am a RealNetworks employee or contractor.

_______________________________________________
Helix-client-dev mailing list
[email protected]
http://lists.helixcommunity.org/mailman/listinfo/helix-client-dev
datatype_rn_tools_dtdriver_apps_meta3gp_installer.diff (application/octet-stream, 8.3 KB)
Index: Umakefil
===================================================================
RCS file: Umakefil
diff -N Umakefil
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ Umakefil	26 Jan 2010 22:20:26 -0000
@@ -0,0 +1,28 @@
+
+UmakefileVersion(2,0)
+
+import sys
+import sysinfo
+import log
+
+# determine build type
+build_type = ""
+if project.BuildOption("debug"):
+    build_type = "dbg"
+elif project.BuildOption("release"):
+    build_type = "rel"
+else:
+    log.error("Cannot determine build type.\n")
+    sys.exit(1)
+
+project.writeln( 'all:' )
+project.writeln( '\t python create_dist_archive.py \"%s\" \"%s\" \"%s\" \"%s\" \"%s\" \"%s\" \"%s\" \"%s\" \"%s\" \"%s\"' % \
+                (project.project_dir, project.output_dir, project.object_dir, project.src_root_path, project.target_dir, \
+                project.platform.exe_suffix, project.platform.dll_suffix, build_type, project.platform.name, sysinfo.arch))
+project.writeln( '' )
+
+project.writeln( 'copy:' )
+project.writeln( '' )
+
+project.writeln( 'depend: ' )
+project.writeln( '' )
Index: create_dist_archive.py
===================================================================
RCS file: create_dist_archive.py
diff -N create_dist_archive.py
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ create_dist_archive.py	26 Jan 2010 22:20:26 -0000
@@ -0,0 +1,186 @@
+
+import sys
+import os
+import shutil
+import zipfile
+import tarfile
+import glob
+
+# open log file
+log = open("create_dist_archive.log", "w")
+log.write("---------- create_dist_archive ----------\n")
+
+# pickup script parameters
+project_dir = sys.argv[1]
+log.write("project_dir = [%s]\n" % (project_dir,))
+
+output_dir = sys.argv[2]
+log.write("output_dir = [%s]\n" % (output_dir,))
+
+object_dir = sys.argv[3]
+log.write("object_dir = [%s]\n" % (object_dir,))
+
+src_root_path = sys.argv[4]
+log.write("src_root_path = [%s]\n" % (src_root_path,))
+
+target_dir = sys.argv[5]
+log.write("target_dir = [%s]\n" % (target_dir,))
+
+exe_suffix = sys.argv[6]
+log.write("exe_suffix = [%s]\n" % (exe_suffix,))
+
+dll_suffix = sys.argv[7]
+log.write("dll_suffix = [%s]\n" % (dll_suffix,))
+
+build_type = sys.argv[8]
+log.write("build_type = [%s]\n" % (build_type,))
+
+platform_name = sys.argv[9]
+log.write("platform_name = [%s]\n" % (platform_name,))
+
+architecture_name = sys.argv[10]
+log.write("architecture_name = [%s]\n" % (architecture_name,))
+
+# platform dependent variables
+archive_type = ""
+if platform_name == "win32":
+    archive_type = "zip"
+elif platform_name == "sunos5":
+    archive_type = "tgz"
+else:
+    log.write("Unsupported platform.\n")
+    sys.exit(1)
+
+# prepare staging directory
+archiveBasename = "GMPMetaEditor"
+stagingDirname = archiveBasename
+stage_dir = os.path.join(output_dir, stagingDirname)
+
+if os.path.exists(stage_dir):
+    log.write("Deleting staging directory: [%s]\n" % (stage_dir,))
+    shutil.rmtree(stage_dir, False)
+
+log.write("Creating staging directory: [%s]\n" % (stage_dir,))
+os.makedirs(stage_dir)
+
+# declare distribution files
+class DistFile:
+    def __init__(self, src_path, filename, filetype = None, dst_path = None, platform = None, build_type = None):
+        self.src_path = src_path
+        self.filename = filename
+        self.filetype = filetype
+        self.dst_path = dst_path
+        self.platform = platform
+        self.build_type = build_type
+
+dist_files = [
+    DistFile("datatype/tools/dtdriver/apps/meta3gp", "meta3gp", filetype="exe"),
+    DistFile("datatype/tools/metaeditor", "metaeditor", filetype="dll"),
+    DistFile("datatype/tools/dtdriver/dtdrplin", "hxdtdriver", filetype="dll"),
+    DistFile("datatype/mp4/fileformat", "mp4fformat", filetype="dll"),
+    DistFile("datatype/mp4/filewriter", "mp4wrtr", filetype="dll"),
+    DistFile("client/medpltfm", "hxmedpltfm", filetype="dll"),
+    DistFile("filesystem/local", "smplfsys", filetype="dll"),
+    DistFile("datatype_rn/tools/dtdriver/apps/meta3gp/installer/platform/win32", "msvcp71.dll", platform="win32", build_type="rel"),
+    DistFile("datatype_rn/tools/dtdriver/apps/meta3gp/installer/platform/win32", "msvcp71d.dll", platform="win32", build_type="dbg"),
+    DistFile("datatype_rn/tools/dtdriver/apps/meta3gp/installer/platform/win32", "msvcr71.dll", platform="win32", build_type="rel"),
+    DistFile("datatype_rn/tools/dtdriver/apps/meta3gp/installer/platform/win32", "msvcr71d.dll", platform="win32", build_type="dbg"),
+    DistFile("datatype_rn/tools/dtdriver/apps/meta3gp/installer", "README.txt", dst_path="doc"),
+    DistFile("datatype_rn/tools/dtdriver/apps/meta3gp/installer", "SOLARIS.txt", dst_path="doc", platform="sunos5"),
+]
+
+# copy distribution files to staging directory
+for df in dist_files:
+    if df.platform and df.platform != platform_name:
+        continue
+
+    if df.build_type and df.build_type != build_type:
+        continue
+
+    if df.filetype == "exe":
+        src_path = os.path.normpath(os.path.join(src_root_path, df.src_path, output_dir, df.filename))
+        if exe_suffix != "":
+            src_path = src_path + "." + exe_suffix
+    elif df.filetype == "dll":
+        src_path = os.path.normpath(os.path.join(src_root_path, df.src_path, output_dir, df.filename))
+        if dll_suffix != "":
+            src_path = src_path + "." + dll_suffix
+    else:
+        src_path = os.path.normpath(os.path.join(src_root_path, df.src_path, df.filename))
+
+    if df.dst_path and df.dst_path != "":
+        dst_path = os.path.normpath(os.path.join(stage_dir, df.dst_path))
+    else:
+        dst_path = os.path.normpath(stage_dir)
+
+    if not os.path.exists(dst_path):
+        log.write("Creating directory: [%s]\n" % (dst_path,))
+        os.makedirs(dst_path)
+
+    log.write("Copying distribution file: [%s] -> [%s]\n" % (src_path, dst_path))
+    shutil.copy(src_path, dst_path)
+
+# obtain version numbers of main executable
+def read_ver_file(filename):
+    version_str = None
+
+    log.write("Reading version file: [%s]\n" % (filename,))
+    file = open(filename, "r")
+    if file:
+        for line in file:
+            fields = line.split()
+            if "TARVER_STRING_VERSION" in fields:
+                version_str = fields[2].strip('"').strip("'")
+                break
+        file.close()
+        if not version_str:
+            log.write("Failed to read version from: [%s]\n" % (filename,))
+    else:
+        log.write("Cannot open file: [%s]\n" % (filename,))
+
+    return version_str
+
+version_str = read_ver_file(os.path.normpath(os.path.join(src_root_path, "datatype/tools/dtdriver/apps/meta3gp/meta3gp.ver")))
+if not version_str:
+    sys.exit(1)
+log.write("Found version string: %s\n" % (version_str,))
+
+# create archive file
+def add_to_zip(zf, path, arcname):
+    if os.path.isfile(path):
+        path = os.path.normpath(path)
+        arcname = os.path.normpath(arcname)
+        log.write("Adding file to archive: [%s] as [%s]\n" % (path, arcname))
+        zf.write(path, arcname, zipfile.ZIP_DEFLATED)
+    elif os.path.isdir(path):
+        for name in glob.glob(os.path.normpath(path + "/*")):
+            add_to_zip(zf, name, arcname + "/" + os.path.basename(name))
+
+archiveFilename = '%s-%s-%s-%s-%s.%s' % (archiveBasename, version_str, build_type, platform_name, architecture_name, archive_type)
+archiveFilename = os.path.normpath(os.path.join(output_dir, archiveFilename))
+
+if os.path.exists(archiveFilename):
+    log.write("Deleting archive file: [%s]\n" % (archiveFilename,))
+    os.remove(archiveFilename)
+
+log.write("Compressing directory [%s] into archive file [%s]\n" % (os.path.normpath(stage_dir), archiveFilename))
+
+if archive_type == "zip":
+    zf = zipfile.ZipFile(archiveFilename, "w")
+    add_to_zip(zf, os.path.normpath(stage_dir), stagingDirname)
+    zf.close()
+elif archive_type == "tgz":
+    tf = tarfile.open(archiveFilename, "w:gz")
+    tf.add(os.path.normpath(stage_dir), stagingDirname, True)
+    tf.close()
+else:
+    log.write("Unsupported archive type.\n")
+    sys.exit(1)
+
+# copy archive file
+log.write("Copying archive file: [%s] -> [%s]\n" % (archiveFilename, os.path.normpath(target_dir)))
+shutil.copy(archiveFilename, os.path.normpath(target_dir))
+
+# close log file
+log.write("Done.\n")
+log.close()
GMPMetaEditor_internal.bif.diff (application/octet-stream, 4.6 KB)
Index: GMPMetaEditor_internal.bif
===================================================================
RCS file: /home/source/build/BIF/GMPMetaEditor_internal.bif,v
retrieving revision 1.13
diff -d -H -w -U30 -r1.13 GMPMetaEditor_internal.bif
--- GMPMetaEditor_internal.bif	23 Jan 2010 19:15:20 -0000	1.13
+++ GMPMetaEditor_internal.bif	26 Jan 2010 22:35:05 -0000
@@ -1,38 +1,38 @@
 <?xml version="1.0" ?>
 <!-- $Id: -->
 <build id="GMPMetaEditor_internal">
   <!-- defaults --> 
   <cvs root="real"/>
   <cvs branch="GMPMetaEditor"/>
 
-  <default target="datatype_tools_dtdriver_apps_meta3gp" profile="helix-client-all-defines"/>
+  <default target="datatype_rn_tools_dtdriver_apps_meta3gp_installer" profile="helix-client-all-defines"/>
   <targets>
     <!-- AUDIO_CROSSFADE -->
     <module id="audio_crossfade" name="audio/crossfade" group="core">
       <cvs root="helix"/>
     
       <includeplatforms>
         mac unix win32 wince
       </includeplatforms>
     
       <excludeprofiles>
         helix-client-brewext helix-client-local-aac
       </excludeprofiles>
     
       <dependlist>
         audio_fixptutil
       </dependlist>
     
       <source_dependlist>
         audio_include common_container common_dbgtool common_include common_runtime
         common_system common_util
       </source_dependlist>
     </module>
 
     <!-- AUDIO_DEVICE -->
     <module id="audio_device" name="audio/device" group="core">
       <cvs root="helix"/>
     
       <includeplatforms>
         brew mac openwave symbian tm1 unix win32 wince
       </includeplatforms>
@@ -1947,60 +1947,78 @@
       <source_dependlist>
         client_common_container client_include common_include datatype_rm_include datatype_rm_video_common
         video_include
       </source_dependlist>
     </module>
 
     <!-- DATATYPE_TOOLS_DTDRIVER_APPS_META3GP -->
     <module id="datatype_tools_dtdriver_apps_meta3gp" name="datatype/tools/dtdriver/apps/meta3gp" group="core">
       <cvs root="helix"/>
     
       <attribute id="has_version_file"/>
     
       <includeplatforms>
         unix win32
       </includeplatforms>
     
       <defines>
         HELIX_FEATURE_3GPP_METAINFO=1
         HELIX_FEATURE_ITUNES_METAINFO=1
       </defines>
     
       <dependlist>
         client_common_container client_common_system client_common_util client_medpltfm client_videosvc
         common_container common_dbgtool common_fileio common_include common_log_logutil
         common_runtime common_system common_util datatype_common_util datatype_include
         datatype_mp4_fileformat datatype_mp4_filewriter datatype_tools_dtdriver_common datatype_tools_dtdriver_dtdrplin datatype_tools_dtdriver_engine
         datatype_tools_metaeditor datatype_tools_minicntx filesystem_local sha256sdk_name
       </dependlist>
     </module>
 
+    <!-- DATATYPE_RN_TOOLS_DTDRIVER_APPS_META3GP_INSTALLER -->
+    <module id="datatype_rn_tools_dtdriver_apps_meta3gp_installer" name="datatype_rn/tools/dtdriver/apps/meta3gp/installer" group="core">
+      <cvs root="helixprvt"/>
+    
+      <includeplatforms>
+        unix win32
+      </includeplatforms>
+    
+      <dependlist>
+        client_medpltfm
+        datatype_mp4_fileformat
+        datatype_mp4_filewriter
+        datatype_tools_dtdriver_dtdrplin
+        datatype_tools_metaeditor
+        datatype_tools_dtdriver_apps_meta3gp
+        filesystem_local
+      </dependlist>
+    </module>
+
     <!-- DATATYPE_TOOLS_DTDRIVER_COMMON -->
     <module id="datatype_tools_dtdriver_common" name="datatype/tools/dtdriver/common" group="core">
       <cvs root="helix"/>
     
       <includeplatforms>
         mac openwave symbian unix win32 wince
       </includeplatforms>
     
       <source_dependlist>
         common_container common_dbgtool common_include common_runtime common_util
         datatype_include
       </source_dependlist>
     </module>
 
     <!-- DATATYPE_TOOLS_DTDRIVER_DECODER -->
     <module id="datatype_tools_dtdriver_decoder" name="datatype/tools/dtdriver/decoder" group="core">
       <cvs root="helix"/>
     
       <attribute id="no_build"/>
     
       <dependlist>
         datatype_tools_dtdriver_decoder_audio datatype_tools_dtdriver_decoder_common datatype_tools_dtdriver_decoder_video
       </dependlist>
     </module>
 
     <!-- DATATYPE_TOOLS_DTDRIVER_DECODER_AUDIO -->
     <module id="datatype_tools_dtdriver_decoder_audio" name="datatype/tools/dtdriver/decoder/audio" group="core">
       <cvs root="helix"/>
     
       <includeplatforms>