[gnue] r9638 - in trunk/gnue-forms/packaging/osx: . build-env build-env/Resources

[email protected]
Newsgroups gmane.comp.cms.gnue.cvs
Message-ID <[email protected]>
Author: johannes
Date: 2007-05-29 08:49:05 -0500 (Tue, 29 May 2007)
New Revision: 9638

Added:
   trunk/gnue-forms/packaging/osx/Description.plist
   trunk/gnue-forms/packaging/osx/Info.plist
   trunk/gnue-forms/packaging/osx/Info.plist.in
   trunk/gnue-forms/packaging/osx/build-env/
   trunk/gnue-forms/packaging/osx/build-env/Resources/
   trunk/gnue-forms/packaging/osx/build-env/Resources/README
   trunk/gnue-forms/packaging/osx/build-env/Resources/postflight
Removed:
   trunk/gnue-forms/packaging/osx/create-image
   trunk/gnue-forms/packaging/osx/dist/
   trunk/gnue-forms/packaging/osx/gnue-forms.pmproj
   trunk/gnue-forms/packaging/osx/scripts/
Modified:
   trunk/gnue-forms/packaging/osx/HOWTO-Build
   trunk/gnue-forms/packaging/osx/create-build
   trunk/gnue-forms/packaging/osx/gnue-forms.py
   trunk/gnue-forms/packaging/osx/setup.py
Log:
More work on packaging for OS X


Added: trunk/gnue-forms/packaging/osx/Description.plist
===================================================================
--- trunk/gnue-forms/packaging/osx/Description.plist	2007-05-29 09:51:08 UTC (rev 9637)
+++ trunk/gnue-forms/packaging/osx/Description.plist	2007-05-29 13:49:05 UTC (rev 9638)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>IFPkgDescriptionDescription</key>
+	<string>GNU Enterprise Forms http://www.gnuenterprise.org</string>
+	<key>IFPkgDescriptionTitle</key>
+	<string>GNU Enterprise Forms</string>
+</dict>
+</plist>

Modified: trunk/gnue-forms/packaging/osx/HOWTO-Build
===================================================================
--- trunk/gnue-forms/packaging/osx/HOWTO-Build	2007-05-29 09:51:08 UTC (rev 9637)
+++ trunk/gnue-forms/packaging/osx/HOWTO-Build	2007-05-29 13:49:05 UTC (rev 9638)
@@ -5,33 +5,10 @@
 
 # How to build a disk image containing a native OS X installer package
 
-1. Execute the script "create-build"
+1. Execute the script "create-build" with administrator privileges either via
+   sudo or as root
 
-   e.g. ./create-build
+   e.g. sudo ./create-build
 
-   This script creates a final build environment for the package as well as the
-   Application Bundle for GNUe Forms.. It will be located in the subdirectory
-   'build'
-
-2. Start the package manager (from /Developer/Tools) and load the package
-   manager project file: gnue-forms.pmproj
-
-   In the 'Contents' tab click on the 'File permissions ...' button. There
-   please click the button 'Apply Recommendations" and finally quit this dialog
-   via Ok button.
-
-   Now you can call "Project | Build" from the menu bar or by Cmd-B.
-   Determine the name of the installer package 
-   (e.g.  gnue-forms-0.6.pre3-py23) and press the Save button. You'll be
-   asked for the administrator password.
-
-   After the build is finished and there were no errors you can quit the
-   package manager. Another directory has been created - the package directory,
-   e.g. gnue-forms-0.6-pre3-py23.pkg
-
-3. Execute the script "create-image" with the package directory
-   e.g. create-image gnue-forms-0.6-pre3-py23.pkg
-
-   This will create the disc image containing the installer package as well as
-   the contents of the 'dist' subdirectory.
-
+   This script creates the installer package as well as the Application Bundle
+   for GNUe Forms.

Added: trunk/gnue-forms/packaging/osx/Info.plist
===================================================================
--- trunk/gnue-forms/packaging/osx/Info.plist	2007-05-29 09:51:08 UTC (rev 9637)
+++ trunk/gnue-forms/packaging/osx/Info.plist	2007-05-29 13:49:05 UTC (rev 9638)
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>CFBundleGetInfoString</key>
+        <string>0.6-pre4, GNUe (c) 2001-2007 Free Software Foundation</string>
+	<key>CFBundleIdentifier</key>
+	<string>org.gnuenterprise.forms</string>
+	<key>CFBundleShortVersionString</key>
+	<string>0.6.0</string>
+	<key>IFMajorVersion</key>
+	<integer>0</integer>
+	<key>IFMinorVersion</key>
+	<integer>6</integer>
+	<key>IFPkgFlagAllowBackRev</key>
+	<false/>
+	<key>IFPkgFlagAuthorizationAction</key>
+	<string>AdminAuthorization</string>
+	<key>IFPkgFlagBackgroundAlignment</key>
+	<string>topleft</string>
+	<key>IFPkgFlagBackgroundScaling</key>
+	<string>none</string>
+	<key>IFPkgFlagDefaultLocation</key>
+	<string>/</string>
+	<key>IFPkgFlagFollowLinks</key>
+	<true/>
+	<key>IFPkgFlagInstallFat</key>
+	<false/>
+	<key>IFPkgFlagInstalledSize</key>
+	<integer>2896</integer>
+	<key>IFPkgFlagIsRequired</key>
+	<false/>
+	<key>IFPkgFlagOverwritePermissions</key>
+	<false/>
+	<key>IFPkgFlagRelocatable</key>
+	<false/>
+	<key>IFPkgFlagRestartAction</key>
+	<string>NoRestart</string>
+	<key>IFPkgFlagRootVolumeOnly</key>
+	<false/>
+	<key>IFPkgFlagUpdateInstalledLanguages</key>
+	<false/>
+	<key>IFPkgFormatVersion</key>
+	<real>0.10000000149011612</real>
+</dict>
+</plist>

Added: trunk/gnue-forms/packaging/osx/Info.plist.in
===================================================================
--- trunk/gnue-forms/packaging/osx/Info.plist.in	2007-05-29 09:51:08 UTC (rev 9637)
+++ trunk/gnue-forms/packaging/osx/Info.plist.in	2007-05-29 13:49:05 UTC (rev 9638)
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>CFBundleGetInfoString</key>
+	<string>::GNUe-Version::, GNUe (c) 2001-2007 Free Software Foundation</string>
+	<key>CFBundleIdentifier</key>
+	<string>org.gnuenterprise.forms</string>
+	<key>CFBundleShortVersionString</key>
+	<string>::GNUe-ShortVersion::</string>
+	<key>IFMajorVersion</key>
+	<integer>0</integer>
+	<key>IFMinorVersion</key>
+	<integer>6</integer>
+	<key>IFPkgFlagAllowBackRev</key>
+	<false/>
+	<key>IFPkgFlagAuthorizationAction</key>
+	<string>AdminAuthorization</string>
+	<key>IFPkgFlagBackgroundAlignment</key>
+	<string>topleft</string>
+	<key>IFPkgFlagBackgroundScaling</key>
+	<string>none</string>
+	<key>IFPkgFlagDefaultLocation</key>
+	<string>/</string>
+	<key>IFPkgFlagFollowLinks</key>
+	<true/>
+	<key>IFPkgFlagInstallFat</key>
+	<false/>
+	<key>IFPkgFlagInstalledSize</key>
+	<integer>2896</integer>
+	<key>IFPkgFlagIsRequired</key>
+	<false/>
+	<key>IFPkgFlagOverwritePermissions</key>
+	<false/>
+	<key>IFPkgFlagRelocatable</key>
+	<false/>
+	<key>IFPkgFlagRestartAction</key>
+	<string>NoRestart</string>
+	<key>IFPkgFlagRootVolumeOnly</key>
+	<false/>
+	<key>IFPkgFlagUpdateInstalledLanguages</key>
+	<false/>
+	<key>IFPkgFormatVersion</key>
+	<real>0.10000000149011612</real>
+</dict>
+</plist>

Added: trunk/gnue-forms/packaging/osx/build-env/Resources/README
===================================================================
--- trunk/gnue-forms/packaging/osx/build-env/Resources/README	2007-05-29 09:51:08 UTC (rev 9637)
+++ trunk/gnue-forms/packaging/osx/build-env/Resources/README	2007-05-29 13:49:05 UTC (rev 9638)
@@ -0,0 +1,36 @@
+# README
+
+1. Prerequisites
+
+  - Python2.3
+      Mac OS X Tiger comes with python 2.3.5 installed. That's ok, since this
+      package is designed for that python environment.
+
+  - Fix for handling python2.3 site-packages:
+      Download and install a small fix for Tiger's builtin python 2.3
+      site-packages from:
+      http://pythonmac.org/packages/TigerPython23Compat.pkg.zip
+
+  - egenix.mx.datetime
+      Download and install the egenix-mx-base package from
+      http://pythonmac.org/packages/egenix_mx_base-2.0.6-py2.3-macosx10.3.zip
+
+  - PIL
+      Download and install the Python Imaging Library from
+      http://pythonmac.org/packages/PIL-1.1.5-py2.3-macosx10.3.zip
+
+  - wxPython 2.8
+      Download and install the wxPython package from
+      http://prdownloads.sourceforge.net/wxpython/wxPython2.8-osx-unicode-2.8.3.0-macosx10.3-py2.3.dmg
+      (make sure to grab a unicode-build)
+
+
+2. Installation
+
+  To install GNU Enterprise Forms double click on the installer package.
+
+
+3. Additional resources and packages:
+
+  If you're looking for a given package (like database drivers) you might visit
+  "http://www.gnuenterprise.org/downloads/depends".

Added: trunk/gnue-forms/packaging/osx/build-env/Resources/postflight
===================================================================
--- trunk/gnue-forms/packaging/osx/build-env/Resources/postflight	2007-05-29 09:51:08 UTC (rev 9637)
+++ trunk/gnue-forms/packaging/osx/build-env/Resources/postflight	2007-05-29 13:49:05 UTC (rev 9638)
@@ -0,0 +1,17 @@
+#!/bin/bash
+#
+# Postflight script: 
+# Compile and optimize all python files of gnue
+#
+
+PYTHON=python2.3
+COMPILE=/usr/lib/$PYTHON/compileall.py
+SITELIB="/usr/lib/$PYTHON/site-packages/gnue/forms"
+
+if which $PYTHON >/dev/null 2>&1 && [ -e "$COMPILE" ];
+then
+  for i in $SITELIB ; do
+    $PYTHON -O $COMPILE -q $i
+    $PYTHON $COMPILE -q $i
+  done
+fi


Property changes on: trunk/gnue-forms/packaging/osx/build-env/Resources/postflight
___________________________________________________________________
Name: svn:executable
   + *

Modified: trunk/gnue-forms/packaging/osx/create-build
===================================================================
--- trunk/gnue-forms/packaging/osx/create-build	2007-05-29 09:51:08 UTC (rev 9637)
+++ trunk/gnue-forms/packaging/osx/create-build	2007-05-29 13:49:05 UTC (rev 9638)
@@ -1,12 +1,19 @@
 #!/bin/bash
 # 
-# Create the build environment for gnue-common
+# Create a disk image containing an installer package of gnue-common
+#
 # Usage: create-build
 
+if [ $UID -ne 0 ];
+then
+  echo "Please run this script as admin (or sudo)"
+  exit 1
+fi
+
 packagedir="../.."
 if [ ! -d "$packagedir" ];
 then
-  echo "Usage: $0 <package-directory>"
+  echo "Usage: $0"
   exit 1
 fi
 
@@ -17,24 +24,113 @@
   exit 1
 fi
 
-test -d "build" || mkdir "build"
+# ---------------------------------------------------------------------------
+# Get the package-name and version from the PKG-INFO file
+# ---------------------------------------------------------------------------
 
+pkgvers=`grep "^Version" ../../PKG-INFO | cut -d" " -f2`
+pkgname=`grep "^Name" ../../PKG-INFO | cut -d" " -f2`
+volname="$pkgname-$pkgvers-py23"
+package="$pkgname-$pkgvers-py23.pkg"
+
+if [ "$package" = "--py23.pkg" ];
+then
+  echo "Cannot determine package and version"
+  exit 1
+fi
+
+# ---------------------------------------------------------------------------
+# Populate the package environment
+# ---------------------------------------------------------------------------
+
 curdir=`pwd`
+destdir="$curdir/build-env/pkg-root"
+resdir="$curdir/build-env/Resources"
 
+test -d "$destdir" || mkdir "$destdir"
+
 cd "$packagedir"
-python setup.py install --root="$curdir/build" --no-compile
+python setup.py install --root=$destdir --no-compile
 
-cd "$curdir"
 
-# Change the first line to meet our needs on Mac OS X
-# gnue-forms actually needs the window manager, so make sure to use pythonw
-# instead of python
-file="$curdir/build/usr/bin/gnue-forms"
-sed -i "" -e "s/^#\!\/usr\/bin\/python.*/#\!\/usr\/bin\/pythonw/" "$file"
+# ---------------------------------------------------------------------------
+# Build the Application bundle for GNUe Forms
+# ---------------------------------------------------------------------------
 
-cd "$curdir"
-
-# Build the Application for gnue-forms
+cd $curdir
 test -d "build-pyapp" && rm -rf "build-pyapp"
 python setup.py py2app
 test -d "build-pyapp" && rm -rf "build-pyapp"
+
+
+# ---------------------------------------------------------------------------
+# Apply the proper permissions to all files of the package
+# ---------------------------------------------------------------------------
+cd "$destdir"
+
+echo "Applying permissions ..."
+
+find . -print | while read filename
+do
+  real="/$filename"
+  if [ -e "$real" ];
+  then
+    data=`stat -f "%u %g %p" "$real"`
+
+    uid=`echo $data | cut -f1 -d" "`
+    gid=`echo $data | cut -f2 -d" "`
+    mod=`echo $data | cut -f3 -d" "`
+
+    chmod $mod "$filename"
+    chgrp $gid "$filename"
+    chown $uid "$filename"
+  else
+    chown root "$filename"
+    chgrp admin "$filename"
+
+    if [ -d "$filename" ];
+    then
+      chmod 775 "$filename"
+    else
+      if [ -x "$filename" ]; then
+        chmod 775 "$filename"
+      else
+        chmod 664 "$filename"
+      fi
+    fi
+  fi
+done
+
+
+
+# ---------------------------------------------------------------------------
+# Build the package
+# ---------------------------------------------------------------------------
+cd $curdir
+
+echo "Building the package ..."
+/Developer/Tools/packagemaker -build -p $package -f $destdir -ds -r $resdir -i Info.plist -d Description.plist
+
+
+# ---------------------------------------------------------------------------
+# Get rid of the obsolte directories
+# ---------------------------------------------------------------------------
+
+rm -rf "$destdir"
+
+
+# ---------------------------------------------------------------------------
+# Create a disk image
+# ---------------------------------------------------------------------------
+
+echo "Creating disk image ..."
+rm -f temp.dmg "$volname.dmg"
+
+hdiutil create -srcfolder $package -volname $volname temp.dmg
+
+# Convert the image
+echo "Converting disk image ..."
+hdiutil convert temp.dmg -format UDZO -o $volname.dmg
+
+rm -f temp.dmg
+rm -rf $package

Deleted: trunk/gnue-forms/packaging/osx/create-image
===================================================================
--- trunk/gnue-forms/packaging/osx/create-image	2007-05-29 09:51:08 UTC (rev 9637)
+++ trunk/gnue-forms/packaging/osx/create-image	2007-05-29 13:49:05 UTC (rev 9638)
@@ -1,38 +0,0 @@
-#!/bin/bash
-#
-# Create a disk image containing an installer package as well as the contents
-# of the dist directory
-#
-
-srcDir="$1"
-bseName=`basename $srcDir`
-pkgName=`basename $srcDir .pkg`
-
-if [ ! -d "$srcDir" -o "$pkgName" == "$bseName" ]; then
-  echo "Usage: $0 <installer-package>"
-  exit 1
-fi
-
-tmpDir="tmp-img"
-test -d "$tmpDir" && rm -rf "$tmpDir"
-mkdir "$tmpDir"
-
-# Copy the contents of the dist-dir
-echo "Preparing disk image ..."
-if [ -d "dist" ]; then
-  cp -R dist/* $tmpDir
-fi
-
-# Copy the package directory to the dist-dir
-cp -R `basename $srcDir` $tmpDir
-
-# Create an image
-echo "Creating disk image ..."
-hdiutil create -srcfolder $tmpDir -volname $pkgName temp.dmg
-
-# Convert the image
-echo "Converting disk image ..."
-hdiutil convert temp.dmg -format UDZO -o $pkgName.dmg
-
-rm -f temp.dmg
-rm -rf $tmpDir

Deleted: trunk/gnue-forms/packaging/osx/gnue-forms.pmproj
===================================================================
(Binary files differ)

Modified: trunk/gnue-forms/packaging/osx/gnue-forms.py
===================================================================
--- trunk/gnue-forms/packaging/osx/gnue-forms.py	2007-05-29 09:51:08 UTC (rev 9637)
+++ trunk/gnue-forms/packaging/osx/gnue-forms.py	2007-05-29 13:49:05 UTC (rev 9638)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env pythonw
 #
 # GNU Enterprise Forms - Main Script
 #
@@ -22,11 +22,11 @@
 # - Suite 330, Boston, MA 02111-1307, USA.
 #
 # $Id: gnue-forms,v 1.3 2003/10/05 18:04:34 btami Exp $
-
-import os, sys
-if hasattr(sys, 'frozen'):
-  sys.path.append(os.path.abspath(os.path.dirname(sys.argv[0])))
 
+import os, sys
+if hasattr(sys, 'frozen'):
+  sys.path.append(os.path.abspath(os.path.dirname(sys.argv[0])))
+
 from  gnue.forms import GFClient
 
 if __name__ == '__main__':

Modified: trunk/gnue-forms/packaging/osx/setup.py
===================================================================
--- trunk/gnue-forms/packaging/osx/setup.py	2007-05-29 09:51:08 UTC (rev 9637)
+++ trunk/gnue-forms/packaging/osx/setup.py	2007-05-29 13:49:05 UTC (rev 9638)
@@ -4,7 +4,7 @@
 
 app_name = 'GNUe Forms'
 app_vers = '0.6-pre3+svn.9611'
-short_vers= '0.6.0'
+short_vers = '0.6.0'
 
 # Build the .app file
 setup(
@@ -14,9 +14,8 @@
         site_packages=True,
         argv_emulation=True,
         excludes=['gnue'],
-        dist_dir='build/Applications',
+        dist_dir='build-env/pkg-root/Applications',
         bdist_base='build-pyapp',
-        # resources=['resources/License.txt'],
         plist=dict(
           CFBundleName = app_name,
           CFBundleShortVersionString = short_vers, # must be in X.X.X format
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.