[Greater-commits] r3758 - trunk/packaging

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Jul 29 20:04:15 CEST 2011


Author: aheinecke
Date: 2011-07-29 20:04:12 +0200 (Fri, 29 Jul 2011)
New Revision: 3758

Modified:
   trunk/packaging/greater-installer.nsi
   trunk/packaging/makeinstaller.py
Log:
Also package usf


Modified: trunk/packaging/greater-installer.nsi
===================================================================
--- trunk/packaging/greater-installer.nsi	2011-07-29 17:49:12 UTC (rev 3757)
+++ trunk/packaging/greater-installer.nsi	2011-07-29 18:04:12 UTC (rev 3758)
@@ -29,6 +29,7 @@
 ; Variable declarations
   Var POSTGRESQL_INSTALLED
   Var SEDIMENT_SELECTED
+  Var USF_SELECTED
   Var PYTHON_PATH
 ;--------------------------------
 ;Version Information (for installer file properties)
@@ -133,7 +134,7 @@
 
   ; Also the sediment database?
   CALL CheckIfSedimentSelected
-  StrCmp $R0 "no" no_sediment
+  StrCmp $SEDIMENT_SELECTED "no" no_sediment
   File "defaultdata\sedimentdb.backup"
   ExecDos::exec '"$INSTDIR\postgres9\bin\pg_restore.exe" -C -O -d postgres -U greater \
   "$TEMP\sedimentdb.backup"' "" "$TEMP\greater_sediment_insert.log"
@@ -144,6 +145,18 @@
   Delete "$TEMP\sedimentdb.backup"
 
   no_sediment:
+  CALL CheckIfUSFSelected
+  StrCmp $USF_SELECTED "no" no_usf
+  File "defaultdata\usfdb.backup"
+  ExecDos::exec '"$INSTDIR\postgres9\bin\pg_restore.exe" -C -O -d postgres -U greater \
+  "$TEMP\usfdb.backup"' "" "$TEMP\greater_usf_insert.log"
+  ExecDos::exec '"$INSTDIR\postgres9\bin\psql" -d greater-usf -U greater -f \
+  "$TEMP\10_create_users.sql"' "" "$TEMP\greater_usf_insert.log"
+  ExecDos::exec '"$INSTDIR\postgres9\bin\psql" -d greater-usf -U greater -f \
+  "$TEMP\90_grant_access.sql"' "" "$TEMP\greater_usf_insert.log"
+  Delete "$TEMP\usfdb.backup"
+
+  no_usf:
   Delete "$TEMP\defaultdb.backup"
   Delete "$TEMP\10_create_users.sql"
   Delete "$TEMP\90_grant_access.sql"
@@ -221,9 +234,50 @@
 
 ;-----------------------------
 ; Client sections
-Section "Client (Lakes/Metal Models)" usf_section_id
-;  !include ${usf-in}
-  
+Section "Client (USF)" usf_section_id
+  !include ${usf-in}
+  ; Set Path to $PROFILE
+  SetOutPath "%HOMEDRIVE%%HOMEPATH%"
+
+  # 'all users' shell folder is used (for $DESKTOP, $SMPROGRAMS, $QUICKLAUNCH,...)
+  !insertmacro MUI_INSTALLOPTIONS_READ $R0 "installer-options.ini" \
+    "Field 4" "State"
+  SetShellVarContext all
+  IntCmp $R0 0 just_current_user all_users
+  just_current_user:
+      SetShellVarContext current
+  all_users:
+
+  # ** Start menu **
+  # Delete old Start menu entries.
+  RMDir /R  "$SMPROGRAMS\${productname_short} ${version_number}"
+  # Check if the start menu entries where requested.
+  !insertmacro MUI_INSTALLOPTIONS_READ $R0 "installer-options.ini" \
+    "Field 2" "State"
+  IntCmp $R0 0 no_start_menu
+  # Create new Start menu entries
+  CreateDirectory "$SMPROGRAMS\${productname}"
+  CreateShortCut "$SMPROGRAMS\${productname}\${productname_short} USF.lnk" \
+                 "$PYTHON_PATH" '"$INSTDIR\GREAT-ER-USF\GREAT-ER\${executable}" "greater/greater at greater-usf"' \
+                 "$INSTDIR\GREAT-ER\Resources\greater2.ico"
+  no_start_menu:
+
+  # ** Desktop Icon **
+  # Delete old Desktop link
+  Delete "$DESKTOP\${productname_short}.lnk"
+  # Check if the desktop entries where requested.
+  !insertmacro MUI_INSTALLOPTIONS_READ $R0 "installer-options.ini" \
+     "Field 3" "State"
+  IntCmp $R0 0 no_desktop
+  # Create new Desktop link
+  CreateShortCut "$DESKTOP\${productname_short} USF.lnk" \
+                 "$PYTHON_PATH" '"$INSTDIR\GREAT-ER-USF\GREAT-ER\${executable}" \
+                 "greater/greater at greater-usf"' \
+                 "$INSTDIR\GREAT-ER-USF\GREAT-ER\Resources\greater2.ico"
+  no_desktop:
+
+  Return
+
 SectionEnd
 
 Section "Client (Sediment Model)" sediment_section_id
@@ -251,7 +305,8 @@
   # Create new Start menu entries
   CreateDirectory "$SMPROGRAMS\${productname}"
   CreateShortCut "$SMPROGRAMS\${productname}\${productname_short} Sediment.lnk" \
-                 "$INSTDIR\GREAT-ER-Sediment\GREAT-ER\${executable}" "greater/greater at greater-sediment" \
+                 "$PYTHON_PATH" '"$INSTDIR\GREAT-ER-Sediment\GREAT-ER\${executable}"
+                 "greater/greater at greater-sediment"' \
                  "$INSTDIR\GREAT-ER\Resources\greater2.ico"
   no_start_menu:
 
@@ -264,8 +319,8 @@
   IntCmp $R0 0 no_desktop
   # Create new Desktop link
   CreateShortCut "$DESKTOP\${productname_short} Sediment.lnk" \
-                 "$INSTDIR\GREAT-ER-Sediment\GREAT-ER\${executable}" \
-                 "greater/greater at greater-sediment" \
+                 "$PYTHON_PATH" '"$INSTDIR\GREAT-ER-Sediment\GREAT-ER\${executable}" \
+                 "greater/greater at greater-sediment"' \
                  "$INSTDIR\GREAT-ER-Sediment\GREAT-ER\Resources\greater2.ico"
   no_desktop:
 
@@ -432,6 +487,13 @@
     StrCpy $SEDIMENT_SELECTED "yes"
     no_sediment:
 FunctionEnd
+Function CheckIfUSFSelected
+    SectionGetFlags ${usf_section_id} $R0
+    StrCpy $USF_SELECTED "no"
+    IntCmp $R0 0 no_sediment
+    StrCpy $USF_SELECTED "yes"
+    no_sediment:
+FunctionEnd
 
 ;---------------------
 ; Disable the next button on the components page as long as there
@@ -440,19 +502,19 @@
 ; Also make sure that the greater desktop is enabled as soon as
 ; at least sediment or usf is enabled
 Function .onSelChange
-  Push $0
-  Push $1
-  SectionGetFlags ${sediment_section_id} $1
-  IntOp $1 ${SF_SELECTED} & $1
-  IntOp $0 $1 | $0
-  SectionGetFlags ${usf_section_id} $1
-  IntOp $1 ${SF_SELECTED} & $1
-  IntOp $0 $1 | $0
-  SectionGetFlags ${client_section_id} $1
-  IntOp $0 $1 | $0
-  SectionSetFlags ${client_section_id} $0
-  Pop $1
-  Pop $0
+;  Push $0
+;  Push $1
+;  SectionGetFlags ${sediment_section_id} $1
+;  IntOp $1 ${SF_SELECTED} & $1
+;  IntOp $0 $1 | $0
+;  SectionGetFlags ${usf_section_id} $1
+;  IntOp $1 ${SF_SELECTED} & $1
+;  IntOp $0 $1 | $0
+;  SectionGetFlags ${client_section_id} $1
+;  IntOp $0 $1 | $0
+;  SectionSetFlags ${client_section_id} $0
+;  Pop $1
+;  Pop $0
 
   Push $0
   Push $1
@@ -493,8 +555,10 @@
 Section "un.PostgreSQL" UnSecPostgreSQL
    Banner::show /NOUNLOAD /set 76 "Uninstalling PostgreSQL..."
    ; TODO find path from registry and uninstall
+   ExecDos::exec '"$INSTDIR\postgres9\bin\pg_ctl.exe" stop -D "$INSTDIR\GREAT-ER-DB\database"'
    ExecWait '"$INSTDIR\postgres9\uninstall-postgresql.exe" --mode unattended'
    Banner::destroy 
+   RMDIR "$INSTDIR\postgres9\bin"
    RMDIR "$INSTDIR\postgres9"
    RMDIR "$INSTDIR"
    MessageBox MB_YESNO|MB_ICONQUESTION "Do you also want to delete contents of your \
@@ -508,6 +572,8 @@
 Section "un."
 
   !include ${client-un}
+  !include ${usf-un}
+  !include ${sediment-un}
   !include ${admin-un}
   ; Delete Registry keys
   DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${productname_short}"
@@ -525,6 +591,8 @@
 
   ; Cleanup
   RMDir /R "$INSTDIR\GREAT-ER"
+  RMDir /R "$INSTDIR\GREAT-ER-Sediment"
+  RMDir /R "$INSTDIR\GREAT-ER-USF"
   RMDir "$INSTDIR\GREAT-ER-DB"
   RMDir "$INSTDIR\Administration"
   Delete "$INSTDIR\Uninstall.exe"
@@ -570,11 +638,11 @@
   !insertmacro MUI_DESCRIPTION_TEXT ${SecPostgreSQL} "Installs the PostgreSQL 9.0.4 Database with \
     basic ${productname_short} datasets."
   !insertmacro MUI_DESCRIPTION_TEXT ${client_section_id} "Installs the ${productname_short} \
-      client. \r\n With the CEFIC approved models from GREAT-ER II \r\n"
+      client. $\r$\n With the CEFIC approved models from GREAT-ER II $\r$\n"
   !insertmacro MUI_DESCRIPTION_TEXT ${usf_section_id} "Installs the client together with \
-      additional Models:\r\n Lakes \r\n Metals"
+      additional Models:$\r$\n Lakes $\r$\n Metals"
   !insertmacro MUI_DESCRIPTION_TEXT ${sediment_section_id} "Installs the client together with \
-      additional Models:\r\n Sediment"
+      additional Models:$\r$\n Sediment"
   !insertmacro MUI_DESCRIPTION_TEXT ${admin_section_id} "Installs the Administration tool for the \
     GREAT-ER Database."
   !insertmacro MUI_DESCRIPTION_TEXT ${SecPython} "Installs Python Version 2.7.2 necessary for \

Modified: trunk/packaging/makeinstaller.py
===================================================================
--- trunk/packaging/makeinstaller.py	2011-07-29 17:49:12 UTC (rev 3757)
+++ trunk/packaging/makeinstaller.py	2011-07-29 18:04:12 UTC (rev 3758)
@@ -92,7 +92,7 @@
     return (os.path.abspath(in_name), os.path.abspath(un_name))
 
 def generate_administration():
-    admintool_files = ["greater.dtd", "greater.xsl"]
+    admintool_files = ["greater.dtd", "greater.xsl", "administration.pdf"]
     cmd = ["depends",
            "/c", # Console mode
            "/a:1", # Expand dependencies = on
@@ -159,7 +159,19 @@
     pass
 
 def generate_usf():
-    pass
+    instdirs = ["GREAT-ER-USF"]
+    for idir in instdirs:
+        compileall.compile_dir(idir, quiet = True)
+    def whitelist(f):
+        for bad in [".svn", "test_", ".log"]:
+            if bad in f:
+                return False
+        if os.path.basename(f).startswith("."):
+            return False
+        if "GREAT-ER-DB" in f and not "GreaterDB" in f:
+            return False
+        return True
+    return generate_files(instdirs, "usf-in.nsi", "usf-un.nsi", whitelist)
 
 def main():
     (INSTALLER_OPTIONS["client-in"],
@@ -168,8 +180,8 @@
      INSTALLER_OPTIONS["admin-un"]) = generate_administration()
     (INSTALLER_OPTIONS["sediment-in"],
      INSTALLER_OPTIONS["sediment-un"]) = generate_sediment()
-#    (INSTALLER_OPTIONS["sediment-in"],
-#     INSTALLER_OPTIONS["sediment-un"]) = generate_usf()
+    (INSTALLER_OPTIONS["usf-in"],
+     INSTALLER_OPTIONS["usf-un"]) = generate_usf()
 #    INSTALLER_OPTIONS["allfiles"],
 #    INSTALLER_OPTIONS["un-allfiles"] = generate_allfiles()
 



More information about the Greater-commits mailing list