build setup v5 using windows with sources

40
Build setup v5 using windows with sources - save/restore db First, it's necessary to clean your computer : Uninstall GTK, GTK-dev if you don’t have version 2.12.9 Uninstall all programs with GTK include like the gimp or Dia (to build openerp module with UML) Uninstall python-2.5 and all modules, at the end delete the folder python25 After uninstall openerp you should clean up too delete files/folders : vista : in C:\user\admin_user .openerprc (or .terprc), openerp-client.log, in C:\Users\Administrateur\AppData\Roaming\ postgresql in C:\user delete all user postgresql "openpgsvc" xp : C:\Documents and Settings\USER\Application Data\ postgresql C:\Documents and Settings\USER\ all user postgresql "openpgsvc", .openerprc (or .terprc), openerp-client.log, clean your folder C:\WINDOWS\Prefetch (all postgres files) Clean registry with programs like glary utilities XOR ccleaner http://www.glaryutilities.com/ http://www.piriform.com/ccleaner/download you must clean completly registry (start->execute type regedit) with keyword (CTRL+F check just key) openerp (delete allinone, client, web openerpc .....), openpg, pga (pgadmin III, pgagent), postgresql, pgsql. clean before all new installation of openerp.

Upload: kalmen

Post on 27-Dec-2015

59 views

Category:

Documents


0 download

DESCRIPTION

Build openERP v5 windows setup with source.

TRANSCRIPT

Page 1: Build Setup v5 Using Windows With Sources

Build setup v5 using windows with sources - save/restore db

First, it's necessary to clean your computer : Uninstall GTK, GTK-dev if you don’t have version 2.12.9 Uninstall all programs with GTK include like the gimp or Dia (to build

openerp module with UML) Uninstall python-2.5 and all modules, at the end delete the folder python25 After uninstall openerp you should clean up too

delete files/folders :vista :in C:\user\admin_user .openerprc (or .terprc), openerp-client.log,in C:\Users\Administrateur\AppData\Roaming\ postgresqlin C:\user delete all user postgresql "openpgsvc"

xp :C:\Documents and Settings\USER\Application Data\ postgresqlC:\Documents and Settings\USER\ all user postgresql "openpgsvc", .openerprc (or .terprc), openerp-client.log,clean your folder C:\WINDOWS\Prefetch (all postgres files)

Clean registry with programs like glary utilities XOR ccleanerhttp://www.glaryutilities.com/http://www.piriform.com/ccleaner/download

you must clean completly registry (start->execute type regedit) with keyword (CTRL+F check just key) openerp (delete allinone, client, web openerpc .....), openpg, pga (pgadmin III, pgagent), postgresql, pgsql.clean before all new installation of openerp.

install python 2.5 :http://www.python.org/download/releases/2.5.4/install standalone bazaar and last version python 2.5 based and install its.http://wiki.bazaar.canonical.com/WindowsDownloads:

create a folder to stock sources and build :C:\openerp

Page 2: Build Setup v5 Using Windows With Sources

download manually all python libraries :http://bazaar.launchpad.net/~openerp/op ... endencies/orautomatically with bazaar :Open a windows console start->execute cmd okcd C:\ openerp (enter)bzr branch lp:~openerp/openerp/win-installer-trunk (enter) (don’t worry for the warning’s message of launchpad, stand the end, a few minutes)

a new folder has been created : C:\openerp\win-installer-trunk copy all in win-installer\ and copy it in C:\openerp install programs and libraries (with installation and options by

default=>else scripts don’t work) which are in the folder dependencies, just this listing and in this order :

Finally you must just install the listing of libraries given by the OpenERP Quick Installation Guide (nothing else to download) :

differences with OpenERP Quick Installation Guide :do not install pytz-2008i (because in server\bin\addons\base\res\res_user.py, the fonction _tz_get call pytz.all_timezones, and in pytz-2008i there is not all_timezones)

egenix-pyopenssl is not in the listing, but is downloaded with bazaar in dependencies.numpy-1.1.1 becomes numpy 1.2.1 (bug with numpy-1.1.1)

Page 3: Build Setup v5 Using Windows With Sources

nsis-2.40-setup.exe

graphviz-2.20.2.exe(do not install pytz-2008i.win32.exe but if you want, you must add at the end the listing of timezone all_timezone and common-timezone)egenix-mx-base-3.1.1.win32-py2.5.msiegenix-pyopenssl-0.8.0_0.9.8i_1.win32-py2.5.msi (not in the OpenERP Quick Installation Guide)

PyXML-0.8.4.win32-py2.5.exelibxml2-python-2.7.1.win32-py2.5.exelxml-2.1.2.win32-py2.5.exematplotlib-0.98.3.win32-py2.5.exenumpy-1.2.1-win32-superpack-python2.5.exePIL-1.1.6.win32-py2.5.exePyChart-1.39.win32.exe ( created by Stephane Wirtel )ReportLab-2.2.win32-py2.5.exevobject-0.7.1.win32.exe ( created by Stephane Wirtel )pygobject-2.14.1-1.win32-py2.5.exepygtk-2.12.1-2.win32-py2.5.exepycairo-1.4.12-1.win32-py2.5.exeinstall by default (in C:\GTK with options by default) gtk-2.12.9-win32-2.exe install by default (in C:\GTK with options by default )gtk-dev-2.12.9-win32-2.exe pydot-1.0.2.win32.exe ( created by Stephane Wirtel )pyparsing-1.5.0.win32.exepywin32-212.win32-py2.5.exepy2exe-0.6.8.win32-py2.5.exe

hippo-canvas-0.3.0-win32.zip unzip (files "libhippocanvas-1-0.dll" and"hippo.pyd") in C:\Python25\DLLs\

msvcp71.zip unzip dll (msvcp71.dll) in C:\WINDOWS\SYSTEM32 if it is not installed

psycopg2-2.0.8.win32-py2.5-pg8.3.4-release.exesetuptools-0.6c9.win32-py2.5.exeMako-0.3.1.win32.exe

Page 4: Build Setup v5 Using Windows With Sources

in C:\python25\Lib\site-packages\matplotlib\figure.pyline 623 and 624 comment the line with "#"you must have :#add_axes.__doc__ = add_axes.__doc__ % (", ".join(get_projection_names()), '%(Axes)s')#add_axes.__doc__ = dedent(add_axes.__doc__) % artist.kwdocddelete figure.pyo and figure.pyc

(if you want an editor with line number download notepad++ : http://notepad-plus.sourceforge.net/fr/site.htm)

verify environment variables :on deskop right clic on computer->properties->advanced parameters system->environment variablein system variable clic on "path":you should have :%GTK_BASEPATH%\bin;C:\Python25;C:\Python25\scripts;C:\Program Files\NSIS\bin;C:\Program Files\NSIS;C:\Program Files\Graphviz2.20\bin;

Do this if there is an error pytz timezone in client gtk(bug fixed)

search name of your local timezone in your windows :start->execute type regeditgo to HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Time Zones/search your timezoneby example for me "Romance Standard Time" -> subkey on the right "std" value "Paris, Madrid"copy python25\Lib\site-packages\pytz\zoneinfo\Europe\Paris in python25\Lib\site-packages\pytz\zoneinfo\Paris, Madridin python25\Lib\site-packages\pytz\__init__.py at the end of the script in all_timezones list add the line :'Paris, Madrid',you must do this with your own timezone installed on your computer.

You have now installed all you need to build the different setup withfollowing scripts :warning : the trunk version is not stable, but you can change 5.0 by trunk if you want.

Page 5: Build Setup v5 Using Windows With Sources

scripts without update of sources :

BUILD OPENERP ALLINONE AND INDEPENDENT SERVER, CLIENT GTK AND CLIENT WEB :

In C:\openerp\make.bat right click modifyFile->Save as name_of_script.bat

Delete all, paste, save, read commentary of this :

::beginning of script:: Disabled/Enable echoing@echo off

:: Set some script wide variableset POSTGRESQL_MSI=postgresql-8.3-int.msiset OPENERP_NSIS=setup.nsiset OPENERP_DEMO_DIR=demo

:: Get current date (YYYYMMDD)set TODAY=%DATE:~6,4%%DATE:~3,2%%DATE:~0,2%:: Save current directoryset TOPDIR=%CD%

:: Set correct a subdirectory for packaging,:: dont trash the current directory...set SUBDIR=%1if "%1"=="" goto usageif "%2"=="" goto usageset VERSION=%2

goto create_subdir

:usageecho "make.bat TITLE_OF_BUILD VERSION"goto end

:: Prepare sub-directory:create_subdirecho Creating subdir %SUBDIR%.mkdir %SUBDIR%echo.

echo Copying PostgreSQL installer...

Page 6: Build Setup v5 Using Windows With Sources

copy /Y %POSTGRESQL_MSI% %SUBDIR%echo.echo Copying OpenERP Nullsoft installer script...copy /Y %OPENERP_NSIS% %SUBDIR%echo.echo Copying `demo' files...mkdir %SUBDIR%\demoxcopy /E /I /Y %OPENERP_DEMO_DIR% %SUBDIR%\democd %SUBDIR%

:: Get sources from launchpad:bzr_clone

echo.echo Downloading OpenERP Server/Development version...bzr clone lp:~openerp/openobject-server/5.0 serverecho OpenERP Server downloaded !

echo.echo Downloading OpenERP Client/Development version...bzr clone lp:~openerp/openobject-client/5.0 clientecho OpenERP Client downloaded !

echo.echo Downloading OpenERP Web Client/Development version...bzr clone lp:~openerp/openobject-client-web/5.0 client-webecho OpenERP Web Client downloaded !

echo.echo Downloading OpenERP Addons/Development version...bzr clone lp:openobject-addons/5.0 server\bin\addonsecho OpenERP Addons downloaded !

:: delete ":" for each line if you want extra-addons:echo.:echo Downloading OpenERP extra-addons/Development version...:bzr branch lp:openobject-addons/extra-5.0 extra-addons:xcopy /E /Y extra-addons\* server\bin\addons\:echo OpenERP extra-addons downloaded !

:clean build and dist python file compiled:rmdir /S /Q client-web\win32\build:rmdir /S /Q client-web\build

Page 7: Build Setup v5 Using Windows With Sources

:rmdir /S /Q server\win32\build:rmdir /S /Q server\build:rmdir /S /Q server\win32\dist:rmdir /S /Q server\dist:rmdir /S /Q client\build:rmdir /S /Q client\dist:del /F client\msgfmt.pyc:del /F client\mydistutils.pyc:del /F C:\openerp\trunk\client-web\win32\util.pyc

:packaging

:: package clients echo.echo begin client buildcd clientpython setup.py --quiet py2exemakensis /DVERSION=%VERSION% /V1 setup.nsimove /Y openerp-client-setup-%VERSION%.exe ..makensis /DVERSION=%VERSION% /DALLINONE=1 /V1 setup.nsiecho.echo end clients build

:: package servers echo.echo begin server buildcd ..cd server\win32python setup.py --quiet py2execd ..python setup.py --quiet py2exemakensis /DVERSION=%VERSION% /V1 setup.nsimove /Y openerp-server-setup-%VERSION%.exe ..makensis /DVERSION=%VERSION% /DALLINONE=1 /V1 setup.nsiecho.echo end servers build

:: package client-web echo.echo begin client-web buildcd ..cd client-webdel /F win32\openerp-web*python win32\setup.py --quiet bdist_wininstmove /Y win32\openerp-web* win32\openerp-web-setup-%VERSION%.exe

Page 8: Build Setup v5 Using Windows With Sources

makensis /DVERSION=%VERSION% /V1 win32\setup.nsimove /Y win32\openerp-web-* ..makensis /DVERSION=%VERSION% /DALLINONE=1 /V1 win32\setup.nsimove /Y win32\openerp-web-* openerp-web-setup-%VERSION%.exeecho.echo end client-web build

:: package all-in-oneecho.echo begin allinone buildcd ..makensis /DVERSION=%VERSION% /V1 setup.nsiecho.echo end allinone build

:end

:: Do some clean-up,:: return to TOPDIR, and unset script environment vars:cleanupcd %TOPDIR%set POSTGRESQL_MSI=set OPENERP_NSIS=set OPENERP_DEMO_DIR=set TODAY=set TOPDIR=set SUBDIR=

pause::end of script

Save the file

to lauch a script :

start->execute type cmd, in the console, type:Cd C:\ openerp\ (enter)name_of_script.bat trunk 5.0.6-ok (enter, some minutes)

trunk is the folder which will be created, in which sources and build willbe stocked (you can choose what you want)5.0.6-ok is the name for the build (you can choose what you want)

The build setup is stocked in my case, in the folder C:\ openerp\trunk

You can install your openerp allinone setup (uninstall precedent first

Page 9: Build Setup v5 Using Windows With Sources

naturally)

NOTICE :

If you don’t change the folder to stock build and sources, (first argumentafter make.bat, here : trunk, bazaar don’t download a second time thesources.

If you want to insert a database in the allinone installer or server followthis (not tested) :In the folder C:\...\wininstaller-trunk\trunk\server in the file setup.nsi,insert this command at the end :ExecWait '"$PROGRAMFILES\\PostgreSQL4TinyERP\\bin\pg_dump" -d postgres -C"$PROGRAMFILES\\OpenERP Server\\addons\mydatabase.backup" -U openpg'IfErrors 0 +2MessageBox MB_OK "Database Dump Finished"Type the good PATH, database name and id admin for postgresql(openpg bydefault for all in one)

Page 10: Build Setup v5 Using Windows With Sources

BUILD OPENERP SETUP ALLINONE :

In C:\openerp\make.bat right click modifyFile->Save as make-allinone.bat

Delete all, paste, save, read commentary of this :

::beginning of script:: Disabled/Enable echoing@echo off

:: Set some script wide variableset POSTGRESQL_MSI=postgresql-8.3-int.msiset OPENERP_NSIS=setup.nsiset OPENERP_DEMO_DIR=demo

:: Get current date (YYYYMMDD)set TODAY=%DATE:~6,4%%DATE:~3,2%%DATE:~0,2%:: Save current directoryset TOPDIR=%CD%

:: Set correct a subdirectory for packaging,:: dont trash the current directory...set SUBDIR=%1if "%1"=="" goto usageif "%2"=="" goto usageset VERSION=%2

goto create_subdir

:usageecho "make.bat TITLE_OF_BUILD VERSION"goto end

:: Prepare sub-directory:create_subdirecho Creating subdir %SUBDIR%.mkdir %SUBDIR%echo.

echo Copying PostgreSQL installer...copy /Y %POSTGRESQL_MSI% %SUBDIR%echo.echo Copying OpenERP Nullsoft installer script...copy /Y %OPENERP_NSIS% %SUBDIR%echo.

Page 11: Build Setup v5 Using Windows With Sources

echo Copying `demo' files...mkdir %SUBDIR%\demoxcopy /E /I /Y %OPENERP_DEMO_DIR% %SUBDIR%\democd %SUBDIR%

:: Get sources from launchpad:bzr_clone

echo.echo Downloading OpenERP Server/Development version...bzr clone lp:~openerp/openobject-server/5.0 serverecho OpenERP Server downloaded !

echo.echo Downloading OpenERP Client/Development version...bzr clone lp:~openerp/openobject-client/5.0 clientecho OpenERP Client downloaded !

echo.echo Downloading OpenERP Web Client/Development version...bzr clone lp:~openerp/openobject-client-web/5.0 client-webecho OpenERP Web Client downloaded !

echo.echo Downloading OpenERP Addons/Development version...bzr clone lp:openobject-addons/5.0 server\bin\addons\echo OpenERP Addons downloaded !

:: delete ":" for each line if you want extra-addons:echo.:echo Downloading OpenERP extra-addons/Development version...:bzr branch lp:openobject-addons/extra-5.0 extra-addons:xcopy /E /Y extra-addons\* server\bin\addons\:echo OpenERP extra-addons downloaded !

:clean build and dist python file compiled:rmdir /S /Q client-web\win32\build:rmdir /S /Q client-web\build:rmdir /S /Q server\win32\build:rmdir /S /Q server\build:rmdir /S /Q server\win32\dist:rmdir /S /Q server\dist:rmdir /S /Q client\build

Page 12: Build Setup v5 Using Windows With Sources

:rmdir /S /Q client\dist:del /F client\msgfmt.pyc:del /F client\mydistutils.pyc:del /F C:\openerp\trunk\client-web\win32\util.pyc

:packaging

:: package client for allinoneecho.echo begin client buildcd clientpython setup.py --quiet py2exemakensis /DVERSION=%VERSION% /DALLINONE=1 /V1 setup.nsiecho.echo end client build

:: package server for allinoneecho.echo begin server buildcd ..cd server\win32python setup.py --quiet py2execd ..python setup.py --quiet py2exemakensis /DVERSION=%VERSION% /DALLINONE=1 /V1 setup.nsiecho.echo end server build

:: package client-web for allinoneecho.echo begin client-web buildcd ..cd client-webdel /F win32\openerp-web*python win32\setup.py --quiet bdist_wininst move /Y win32\openerp-web* win32\openerp-web-setup-%VERSION%.exemakensis /DVERSION=%VERSION% /DALLINONE=1 /V1 win32\setup.nsi :move /Y win32\openobject-web-setup-* win32\openerp-web-setup-%VERSION%.exe move /Y win32\openerp-web-setup-%VERSION%.exe . echo.echo end client-web build

:: package all-in-oneecho.echo begin allinone build

Page 13: Build Setup v5 Using Windows With Sources

cd ..makensis /DVERSION=%VERSION% /V1 setup.nsiecho.echo end allinone build

:end

:: Do some clean-up,:: return to TOPDIR, and unset script environment vars:cleanupcd %TOPDIR%set POSTGRESQL_MSI=set OPENERP_NSIS=set OPENERP_DEMO_DIR=set TODAY=set TOPDIR=set SUBDIR=

pause::end of script

Page 14: Build Setup v5 Using Windows With Sources

BUILD SERVER+CLIENT-GTK+CLIENT-WEB INDEPENDANT

In C:\openerp\win-installer-trunk\ make.bat right click modifyFile->Save as make-allinone-solo.bat

Delete all, paste, save, read commentary of this :

::beginning of script:: Disabled/Enable echoing@echo off

:: Set some script wide variableset POSTGRESQL_MSI=postgresql-8.3-int.msiset OPENERP_NSIS=setup.nsiset OPENERP_DEMO_DIR=demo

:: Get current date (YYYYMMDD)set TODAY=%DATE:~6,4%%DATE:~3,2%%DATE:~0,2%:: Save current directoryset TOPDIR=%CD%

:: Set correct a subdirectory for packaging,:: dont trash the current directory...set SUBDIR=%1if "%1"=="" goto usageif "%2"=="" goto usageset VERSION=%2

goto create_subdir

:usageecho "make.bat TITLE_OF_BUILD VERSION"goto end

:: Prepare sub-directory:create_subdirecho Creating subdir %SUBDIR%.mkdir %SUBDIR%echo.

echo Copying PostgreSQL installer...copy /Y %POSTGRESQL_MSI% %SUBDIR%echo.echo Copying OpenERP Nullsoft installer script...copy /Y %OPENERP_NSIS% %SUBDIR%

Page 15: Build Setup v5 Using Windows With Sources

echo.echo Copying `demo' files...mkdir %SUBDIR%\demoxcopy /E /I /Y %OPENERP_DEMO_DIR% %SUBDIR%\democd %SUBDIR%

:: Get sources from launchpad:bzr_clone

echo.echo Downloading OpenERP Server/Development version...bzr clone lp:~openerp/openobject-server/5.0 serverecho OpenERP Server downloaded !

echo.echo Downloading OpenERP Client/Development version...bzr clone lp:~openerp/openobject-client/5.0 clientecho OpenERP Client downloaded !

echo.echo Downloading OpenERP Web Client/Development version...bzr clone lp:~openerp/openobject-client-web/5.0 client-webecho OpenERP Web Client downloaded !

echo.echo Downloading OpenERP Addons/Development version...bzr clone lp:openobject-addons/5.0 server\bin\addons\echo OpenERP Addons downloaded !

:: delete ":" for each line if you want extra-addons:echo.:echo Downloading OpenERP extra-addons/Development version...:bzr branch lp:openobject-addons/extra-5.0 extra-addons:xcopy /E /Y extra-addons\* server\bin\addons\:echo OpenERP extra-addons downloaded !

:clean build and dist python file compiled:rmdir /S /Q client-web\win32\build:rmdir /S /Q client-web\build:rmdir /S /Q server\win32\build:rmdir /S /Q server\build:rmdir /S /Q server\win32\dist

Page 16: Build Setup v5 Using Windows With Sources

:rmdir /S /Q server\dist:rmdir /S /Q client\build:rmdir /S /Q client\dist:del /F client\msgfmt.pyc:del /F client\mydistutils.pyc:del /F C:\openerp\trunk\client-web\win32\util.pyc

:packaging

:: package client echo.echo begin client buildcd clientpython setup.py --quiet py2exemakensis /DVERSION=%VERSION% /V1 setup.nsiecho.echo end client build

:: package serverecho.echo begin server buildcd ..cd server\win32python setup.py --quiet py2execd ..python setup.py --quiet py2exemakensis /DVERSION=%VERSION% /V1 setup.nsiecho.echo end server build

:: package client-web echo.echo begin client-web buildcd ..cd client-webdel /F win32\openerp-web*python win32\setup.py --quiet bdist_wininstmove /Y win32\openerp-web-setup-* win32\openerp-web-setup-%VERSION%.exemakensis /DVERSION=%VERSION% /V1 win32\setup.nsimove /Y win32\openerp-web-setup-%VERSION%.exe .echo.echo end client-web build

cd ..

Page 17: Build Setup v5 Using Windows With Sources

copy server\openerp-server-setup-%VERSION%.exe .copy client\openerp-client-setup-%VERSION%.exe .copy client-web\openerp-web-setup-%VERSION%.exe .

:end

:: Do some clean-up,:: return to TOPDIR, and unset script environment vars:cleanupcd %TOPDIR%set POSTGRESQL_MSI=set OPENERP_NSIS=set OPENERP_DEMO_DIR=set TODAY=set TOPDIR=set SUBDIR=

pause::end of script

Page 18: Build Setup v5 Using Windows With Sources

script for automatic update of openerp sources :

install bzr library if not installed yet:easy_install bzrlib (package setuptools must be installed before)

download bzr_set.py in command line :cd c:\openerpbzr branch lp:openerpxcopy .\openrp\bzr_set.py trunkmodify lines 56 58 with (change web by client-web and addons-extra by extra-addons):

'extra-addons': (BASEURL + '~openerp-commiter/openobject-addons/' + extraversion + '-extra-addons', False),'client-web': (BASEURL + '~openerp/openobject-client-web/' + webversion, True),

for xp users :lauch a first time bzr_set.py :in console mode :cd c:\openerp\trunkpython C:\openerp\trunk\bzr_set.py

after this step copy all files and folders of addons in c:\openerp\trunk\server\bin\addons

in bzr_set.py modify'addons': (BASEURL + '~openerp/openobject-addons/' + version, True)by'server\\bin\\addons': (BASEURL + '~openerp/openobject-addons/' + version, True)

for users vista and 7 only : (should not work on xp because new command mklink which computes symbolic link for windows doesn't work on xp, sorry!) :

use symlink used in bzr_set.py to have symbolic link for addons in script with automatic update :

download corrected lib by myself for python 2.5 of package jaraco and cbprint.py, extract directly in site-packages :http://dl.free.fr/plhSte5yH/jaraco.zip

for info steps to correct package jaraco.windows :https://bugs.launchpad.net/bzr/+bug/81689?comments=all

in bzr_set.py add line in the head of file :__import__('jaraco.windows.filesystem').windows.filesystem.patch_os_module()

keep your bazar repositery (do not copy addons in server\bin\addons, and don't replace in repository 'addons'

Page 19: Build Setup v5 Using Windows With Sources

by 'server\\bin\\addons')bzr_repository = {'server': (BASEURL + '~openerp/openobject-server/' + version, True),'client': (BASEURL + '~openerp/openobject-client/' + version, True),'addons': (BASEURL + '~openerp/openobject-addons/' + version, True),'extra-addons': (BASEURL + '~openerp-commiter/openobject-addons/' + extraversion + '-extra-addons', False),'client-web': (BASEURL + '~openerp/openobject-client-web/' + webversion, True),

symlink should work now in script bzr_set.py

this method could be used to add extra addons automatically too, or others branchs, I think you should add the line in bzr_link :bzr_links = {'addons\\*': 'server\\bin\\addons','extra-addons\\*': 'server\\bin\\addons',.........}but warning, verify if there not modules which have the same name :to test if you need it.

Page 20: Build Setup v5 Using Windows With Sources

script to build allinone with automatic update of sources with bzr_set.py :(to have independant package change script used without update, change part "get sources)

::beginning:: Disabled/Enable echoing@echo off

:: Set some script wide variableset POSTGRESQL_MSI=postgresql-8.3-int.msiset OPENERP_NSIS=setup.nsiset OPENERP_DEMO_DIR=demo

:: Get current date (YYYYMMDD)set TODAY=%DATE:~6,4%%DATE:~3,2%%DATE:~0,2%:: Save current directoryset TOPDIR=%CD%

:: Set correct a subdirectory for packaging,:: dont trash the current directory...set SUBDIR=%1if "%1"=="" goto usageif "%2"=="" goto usageset VERSION=%2

goto create_subdir

:usageecho "make.bat TITLE_OF_BUILD VERSION"goto end

:: Prepare sub-directory:create_subdirecho Creating subdir %SUBDIR%.mkdir %SUBDIR%echo.

echo Copying PostgreSQL installer...copy /Y %POSTGRESQL_MSI% %SUBDIR%echo.echo Copying OpenERP Nullsoft installer script...copy /Y %OPENERP_NSIS% %SUBDIR%echo.echo Copying `demo' files...mkdir %SUBDIR%\demoxcopy /E /I /Y %OPENERP_DEMO_DIR% %SUBDIR%\democd %SUBDIR%

Page 21: Build Setup v5 Using Windows With Sources

::unchecked this lines if you don't want to update:: for other scripts just change section Get sources like this :

:: Get sources from launchpad, download sources if not done, update sources to last revisionpython c:\openerp\trunk\bzr_set.py

::save and clean original files of server\bin\addons:rmdir /S /Q server\bin\addons-temp:mkdir server\bin\addons-temp:mkdir server\bin\addons-temp\base:xcopy /E /Y server\bin\addons\base\* server\bin\addons-temp\base:xcopy /E /Y server\bin\addons\__init__.py server\bin\addons-temp:xcopy /E /Y server\bin\addons\gen_graph.sh server\bin\addons-temp:xcopy /E /Y server\bin\addons\module_graph.py server\bin\addons-temp:rmdir /S /Q server\bin\addons:mkdir server\bin\addons:xcopy /E /Y server\bin\addons-temp\* server\bin\addons\:rmdir /S /Q server\bin\addons-temp

::update server with new addons and extra addons::revision 1850 extra addons modules automatic install in server code:xcopy /E /Y addons\* server\bin\addons\:xcopy /E /-Y extra-addons\* server\bin\addons\

:: Do some clean-up,:rmdir /S /Q client-web\win32\build:rmdir /S /Q client-web\build:rmdir /S /Q server\win32\build:rmdir /S /Q server\build:rmdir /S /Q server\win32\dist:rmdir /S /Q server\dist:rmdir /S /Q client\build:rmdir /S /Q client\dist:del /F client\msgfmt.pyc:del /F client\mydistutils.pyc:del /F C:\openerp\trunk\client-web\win32\util.pyc

:packaging

:: package client for allinoneecho.echo beginning client build

Page 22: Build Setup v5 Using Windows With Sources

cd clientpython setup.py --quiet py2exemakensis /DVERSION=%VERSION% /DALLINONE=1 /V1 setup.nsiecho.echo client build

:: package server for allinoneecho.echo beginning server buildcd ..cd server\win32python setup.py --quiet py2execd ..python setup.py --quiet py2exemakensis /DVERSION=%VERSION% /DALLINONE=1 /V1 setup.nsiecho.echo server build

:: package client-web for allinoneecho.echo beginning client web buildcd ..cd client-web del /F win32\openerp-web*python win32\setup.py --quiet bdist_wininstmove /Y win32\openerp-web* win32\openerp-web-setup-%VERSION%.exemakensis /DVERSION=%VERSION% /DALLINONE=1 /V1 win32\setup.nsi move /Y win32\openerp-web-setup-%VERSION%.exe . echo client-web build

:: package all-in-oneecho.echo beginning allinone buildcd ..makensis /DVERSION=%VERSION% /V1 setup.nsiecho.echo all in one buildecho.

::check uncheck if you want to keep or delete individual package:del /F client-web\openerp-web-* .\:del /F client\openerp-client-* .\:del /F server\openerp-server-* .\

:end

Page 23: Build Setup v5 Using Windows With Sources

:: Do some clean-up,:: return to TOPDIR, and unset script environment vars:cleanupcd %TOPDIR%set POSTGRESQL_MSI=set OPENERP_NSIS=set OPENERP_DEMO_DIR=set TODAY=set TOPDIR=set SUBDIR=

pause::end of script

Page 24: Build Setup v5 Using Windows With Sources

3 possibilities to backup restore databases :

1) create scripts to delelete, save or restore a database in openerp :

create a simple file .cmd by create a file text with at the end the type of file .cmdyou will have just click on this file to lauch your script, to modify it, right click and modify.I remember you to save a second backup of your data and system before to run this type of script.modify paths names ans option with your own configuration and context.It is possbile you have a message which says that a user is already connected, in this case, stop openerp server (after the script restart it naturally)if you have a doubt, consult postgresql documentation online with keyword pg_dump, pg_dump, dropdb.if a password is asked, put this of server.conf db_passwordI use commands made also in openerp's code, to see it :http://bazaar.launchpad.net/~openerp/op ... ervices.py

this scripts are for v5, for v6 change openerp-service by openerp-server, if you have v5 and v6 on the same machine, put the two at the beginning and at the end of each script :@net stop openerp-service@net stop openerp-server.....@net start openerp-service@net start openerp-server

export add this lines in export.cmd :

Code:@echo off@net stop openerp-service@set PGPASSWORD=db_password@"absolute_path_to\postgresql\bin\pg_dump.exe" -F c -O -U db_user -h localhost -p 5432 database_name  > "absolute_path_to_name_backup"@set PGPASSWORD=@net start openerp-servicepause

variables db_user db_password are this of path_to\server\openerp-server.conf

import add this lines in import.cmd :

Code:@echo off@net stop openerp-service@set PGPASSWORD=db_password@"absolute_path_to\postgresql\bin\createdb.exe" -U db_user -T template0 database_name_to_create@"absolute_path_to\postgresql\bin\pg_restore.exe" -O -U db_user -h localhost -p 5432 -d

Page 25: Build Setup v5 Using Windows With Sources

database_name_to_create "absolute_path_of_database_backup"@set PGPASSWORD=@net start openerp-servicepause

variables db_user db_password are this of path_to\server\openerp-server.conf

(it is possible you have a warning, don't worry, stand the end of the command, the database is restored)

delete a database add this lines to drop.cmd (with allinone, by default it is openpgpwd)

Code:@echo off@net stop openerp-service@set PGPASSWORD=db_password@"absolute_path_to\postgresql\bin\dropdb.exe" -U db_user database_name_to_delete@set PGPASSWORD=@net start openerp-servicepause

variables db_user db_password are this of path_to\server\openerp-server.conf

2) manually with graphic interface pgadmin III (thanks to JuanjoA to remember that)open pgadmin III (start->programs->postgresql->pgadmin II), click on servers-postgresql (on the high left), password asked is db_password in your installed server\openerp-server.conf (with allinone, by default it is openpgpwd)right click on database you want use option you want : drop, backup, restore

3) automatic job (backup), with pgagent (integrated in pgadmin III) :read documentation :http://www.postgresonline.com/journal/a ... ckups.htm

Page 26: Build Setup v5 Using Windows With Sources

for users vista and 7 only : (should not work on xp because new command mklink which computes symbolic link for windows doesn't work on xp, sorry!) :

use symlink used in bzr_set.py to have symbolic link for addons in script with automatic update :

install jaraco.windows to have symlink works in py2.5 with bazaar (should work for 2.6 and higher) : open a windows console and tape : easy_install jaraco.windows a second time to be sure there is no errors (strange message appears and cleared the first time) files jaraco.windows-1.8-py2.5.egg, jaraco.util-3.1-py2.5.eg, ...., are installed in site-packages but this package doesn't work on python 2.5 then : edit site-packages\easy-install.pth, delete line : ./jaraco.windows-1.8-py2.5.egg delete file jaraco.windows-1.8-py2.5.egg download corrected lib by myself for python 2.5 of package jaraco and cbprint.py, extract directly in site-packages : http://dl.free.fr/getfile.pl?file=/oyt262ZC

for info steps to correct package jaraco.windows for python 2.5: https://bugs.launchpad.net/bzr/+bug/81689?comments=all

in bzr_set.py add line in the head of file : __import__('jaraco.windows.filesystem').windows.filesystem.patch_os_module()

keep your bazar repositery (do not copy addons in server\bin\addons, and don't replace in repository 'addons' by 'server\\bin\\addons') bzr_repository = { 'server': (BASEURL + '~openerp/openobject-server/' + version, True), 'client': (BASEURL + '~openerp/openobject-client/' + version, True), 'addons': (BASEURL + '~openerp/openobject-addons/' + version, True), 'extra-addons': (BASEURL + '~openerp-commiter/openobject-addons/' + extraversion + '-extra-addons', False), 'client-web': (BASEURL + '~openerp/openobject-client-web/' + webversion, True),

symlink should work now in script bzr_set.py

this method could be used to add extra addons automatically too, or others branchs, I think you should add the line in bzr_link : bzr_links = { 'addons\\*': 'server\\bin\\addons', 'extra-addons\\*': 'server\\bin\\addons', ......... } but warning, verify if there not modules which have the same name : to test if you need it.

Page 27: Build Setup v5 Using Windows With Sources

create a del-openerp.bat file

a little script to delete file, folder and registry key which are not deleted after uninstall allinone (if you had an error during utilisation of openerp, some other keys can be undeleted), tested with version 5.0.14 with windows vista (older version should be ok too).

::start script:: Disabled/Enable echoing@echo off

rmdir /S /Q C:\Users\openpgsvcrmdir /S /Q C:\Users\Administrateur\AppData\Roaming\postgresqldel /F C:\Users\Administrateur\.openerprcdel /F C:\Users\Administrateur\openerp-client.logreg delete "HKLM\SOFTWARE\OpenERP All In One" /f reg delete "HKLM\SYSTEM\ControlSet011\Services\Eventlog\Application\openerp-service" /freg delete "HKLM\SYSTEM\ControlSet011\Services\Eventlog\Application\openerp-web" /freg delete "HKLM\SYSTEM\ControlSet011\Services\openerp-service" /freg delete "HKLM\SYSTEM\ControlSet011\Services\openerp-web" /freg delete "HKLM\SYSTEM\ControlSet011\Services\Eventlog\Application\pgAgent" /freg delete "HKLM\SYSTEM\ControlSet011\Services\Eventlog\Application\PostgreSQL" /freg delete "HKLM\SYSTEM\ControlSet011\Services\pgsql-8.3" /freg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\MenuOrder\Start Menu\Programs\OpenERP Client" /freg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\MenuOrder\Start Menu\Programs\OpenERP Server" /freg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\MenuOrder\Start Menu\Programs\OpenERP Web" /f

pause::end script

run the .bat script in command line (go to the path where your file is stored, tape the complete name.bat, tape "enter") or right clic on the file "execute as"

adapt with your own config (xp,7), experience, test. hope this will be util.

Page 28: Build Setup v5 Using Windows With Sources

add to the script (vista): reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\MenuOrder\Start Menu\Programs\OpenERP Client" /f reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\MenuOrder\Start Menu\Programs\OpenERP Server" /f reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\MenuOrder\Start Menu\Programs\OpenERP Web" /f

can be written in setup.nsi which build allinone in section "ADD YOUR OWN FILES HERE ...": RMDIR /r "C:\Users\openpgsvc " RMDIR /r "C:\Users\Administrateur\AppData\Roaming\postgresql" DELETE "C:\Users\Administrateur\.openerprc" DELETE "C:\Users\Administrateur\openerp-client.log" DeleteRegKey HKLM "SOFTWARE\OpenERP All In One" DeleteRegKey HKLM "SYSTEM\ControlSet011\Services\Eventlog\Application\openerp-service" DeleteRegKey HKLM "SYSTEM\ControlSet011\Services\Eventlog\Application\openerp-web" DeleteRegKey HKLM "SYSTEM\ControlSet011\Services\openerp-service" DeleteRegKey HKLM "SYSTEM\ControlSet011\Services\openerp-web" DeleteRegKey HKLM "SYSTEM\ControlSet011\Services\Eventlog\Application\pgAgent" DeleteRegKey HKLM "SYSTEM\ControlSet011\Services\Eventlog\Application\PostgreSQL" DeleteRegKey HKLM "SYSTEM\ControlSet011\Services\pgsql-8.3" DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Explorer\MenuOrder\Start Menu\Programs\OpenERP Client" DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Explorer\MenuOrder\Start Menu\Programs\OpenERP Server" DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Explorer\MenuOrder\Start Menu\Programs\OpenERP Web"

Page 29: Build Setup v5 Using Windows With Sources

for info a new script python is available in the win-installer-trunk branch, to build standalone independant packages, or, standalone independant packages and allinone (possibility to download sources archive.tar.gz, from openerp website => see option --url default) , here :http://bazaar.launchpad.net/~openerp/op ... evision/43thanks to author Stephane Wirtel (openerp).

command to tape to build independant + allinone with your sources on your disk (build independant by default, for allinone too, add option --allinone):python make.py --keep --win32 --directory absolute_path_to_your_sources --url http://localhost:8000 --allinone(rename folders client, client-web and server by openerp-client, openerp-server, openerp-web, and have in the same path files postgresql-8.3.msi, setup.nsi and folder demo)

command to tape to build independant + allinone without sources on your diskpython make.py --keep --win32 --directory absolute_path_to_write_your_sources --allinone

don't forget to see the 'help' for each option.

you should have a http server which run, if you have a http problem error 404 or other error http, open a second console and tape this command to run a http server:python -m SimpleHTTPServer (info Stephane Wirtel)

for this which use also bzr_set.py to just update sources, rename in file bzr_set.py in bazaar_repository (which define all branch), first word 'client' by 'openrp-client', 'server' by 'openerp-server', and 'client-web' by ' openerp-web'

Page 30: Build Setup v5 Using Windows With Sources

If like me you have vista (perhaps for seven too), you have no icon for shortcut on desktop, or in list of programs (even for stop/start server).It's due to the fact vista use icon with png format, and xp ico format.I tried to use a png to build for icon but py2exe doesn't support it.Then it exists an other solution, add in files setup.nsi the path to display icons for all shortcut (but always no icon for executables)

in server\pixmaps open openerp-icon.png with by example program xnview (or other program which can generate a .ico format), and save in the same path with name openerp-service.ico (choose in the list ico format).copy this new file and paste it in client-web\win32\pixmaps.

You can modify this for v5 and v6.

for client\setup.nsi :

add text in green color to this linesCreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\OpenERP Client.lnk" "$INSTDIR\openerp-client.exe" "" "$INSTDIR\pixmaps\openerp-icon.ico"CreateShortCut "$DESKTOP\OpenERP Client.lnk" "$INSTDIR\openerp-client.exe" "" "$INSTDIR\pixmaps\openerp-icon.ico"

for server\setup.nsi:in :Section "OpenERP Server" SecOpenERPServernsExec::Exec "net stop openerp-service"sleep 2

SetOutPath "$INSTDIR"

add lines (because folder pixmaps and icons are not imported with py2exe) :File /r "pixmaps\openerp-icon.ico"File /r "pixmaps\openerp-service.ico"

add green text to this linesCreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\OpenERP Server.lnk" "$INSTDIR\openerp-server.exe" "" "$INSTDIR\openerp-icon.ico"CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Start service.lnk" "$INSTDIR\service\start.bat" "" "$INSTDIR\openerp-service.ico"CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Stop service.lnk" "$INSTDIR\service\stop.bat" "" "$INSTDIR\openerp-service.ico"

for client-web\win32\setup.nsi :in :Section "OpenERP Web" SecOpenERPWebnsExec::Exec "net stop openerp-web"

Page 31: Build Setup v5 Using Windows With Sources

sleep 2add lines :SetOutPath "$INSTDIR"File /r "pixmaps\openerp-service.ico"

ad text in green colorCreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Start OpenERP Web.lnk" "$INSTDIR\bin\start.bat" "" "$INSTDIR\openerp-service.ico"CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Stop OpenERP Web.lnk" "$INSTDIR\bin\stop.bat" "" "$INSTDIR\openerp-service.ico"