faunalia / HealthQGIS

A simplified QGIS for health mapping
GNU General Public License v3.0
1 stars 1 forks source link

Final procedure for packaging [open] #46

Closed ghtmtt closed 10 years ago

ghtmtt commented 10 years ago

This are all the steps for the creation of the packaging:

  1. clone the QGIS repo on your machine (git clone https://github.com/qgis/QGIS.git)
  2. go inside the cloned repo: ./ms-windows/osgeo4w
  3. for a simple package just launch the script perl creatensis.pl (see creatensis --help for all the options). Usually I use time perl creatensis.pl -verbose -version=2.2.0 -arch=x86 -releasename=QGIS. Take into account to use the -keep option: this avoids to re-compress every single package, but I never tried it.
  4. ATTENTION: if you want to add some option to your final package (data, project, plugins, customizations...) you have to: 4.1. create the addons directory INSIDE osgeo4w (so, ./osgeo4w/addons). All the additions have to be put in this directory 4.2. inside addons create the bin directory and put inside the qgis.bat.tmpl file. This file will be converted in qgis.bat, so the file that starts QGIS on windows. You can find qgis.bat.tmpl in osgeo4w 4.3. you have to edit this file with the option you want (example, start QGIS with the --configpath option). The next comment contains the qgis.bat.tmpl file 4.4. in addons I also included the qgisconfig directory that is the directory created by QGIS when it stars with the --configpath option. (I just start QGIS and typed in the terminal qgis --configpath ~/ms-windows/osgeo4w/addons/qgisconfig). In this way I have customized QGIS with additional plugins, GUI configurations, etc, and all this edits have been written in this directory 4.5. I also create the data directory in addons where I put all the data. This way, all the data will be included in the final package 4.6. Finally I save the project in the addons directory
  5. now you can launch creatensis.pl and all the additions and customization will be included
  6. the final package will be placed in the ms-windows directory and you can install it
  7. PROBLEM: the last issue in that, the first time you want to launch QGIS on windows you have to do it through the qgis.bat file (in C:\Progam Files\QGIS\bin), otherwise the .qgis-custom directory won't be created

Attention: it will take a while, especially the first time because the script has to download all the data from the osgeo server. The creation of the package will last something like 1 hour (32 bit)

screenshot from 2014-05-17 17 54 35

ghtmtt commented 10 years ago

start "QGIS" /B "%OSGEO4W_ROOT%"\bin\qgis-bin.exe %* --configpath %USERPROFILE%.qgis-custom --project %OSGEO4W_ROOT%\project.qgs

adds what should be included when QGIS starts: in this specific case --configpath (that redirects to .qgis-custom) and --project that allows to start QGIS with a project.

ghtmtt commented 10 years ago

WORKING !!! Solved the final problem. This is the final qgis.bat\ file (and so this has to be included in the qgis.bat.tmpl):

call "%~dp0\o4w_env.bat" @echo off call "%OSGEO4W_ROOT%"\apps\grass\grass-6.4.3\etc\env.bat @echo off path %OSGEO4W_ROOT%\apps\qgis\bin;%OSGEO4W_ROOT%\apps\grass\grass-6.4.3\lib;%PATH% set QGIS_PREFIX_PATH=%OSGEO4W_ROOT:\=/%/apps/qgis set GDAL_FILENAME_IS_UTF8=YES rem Set VSI cache to be used as buffer, see #6448 set VSI_CACHE=TRUE set VSI_CACHE_SIZE=1000000

if not exist %USERPROFILE%.qgis-custom ( mkdir %USERPROFILE%.qgis-custom xcopy %OSGEO4W_ROOT%\qgisconfig %USERPROFILE%.qgis-custom /s /v /e )

start "QGIS" /B "%OSGEO4W_ROOT%"\bin\qgis-bin.exe %* --configpath %USERPROFILE%.qgis-custom

@pcav when you have time, could you please try to create the package?

p.s. I added the qgis.bat.tmpl file in https://github.com/faunalia/HealthQGIS/tree/master/packaging

ghtmtt commented 10 years ago

if not exist %USERPROFILE%.qgis-custom ( mkdir %USERPROFILE%.qgis-custom xcopy %OSGEO4W_ROOT%\qgisconfig %USERPROFILE%.qgis-custom /s /v /e )

this option in the script should create the folder .qgis-custom if it doesn't exist, but, if it already exists, additional edits and customizations will be written and included.

@pcav do you think this is a good idea? I think so. Users should be able to make small changes to the GUI even if we provide them a clean environment to work.

ghtmtt commented 10 years ago

Not sure if including data+project in the package is a good idea. If we have lots of data the package will suffer for it. Maybe it is better to include them and the project file in another folder and send them separately.

I'll try if the project opens with our QGIS or not.

pcav commented 10 years ago

IMO it is useful to be able to do it. Then we can decide when to include the data, and when not.

ghtmtt commented 10 years ago

OK, so I'll include all the sample data we have now and the project file in the package. Disable it and/or removing the data is just a matter of 2 seconds.

ghtmtt commented 10 years ago

It seems that there are some problems (package won't be created) if some file is too large. I think is due to some file I put in data (so actually the problem seems related to some layer, maybe raster). The output of creatensis is:

Internal compiler error #12345: error mmapping file (1706328133, 33554432) is out of range.

Note: you may have one or two (large) stale temporary file(s) left in your temporary directory (Generally this only happens on Windows 9x). running nsis failed [makensis -V1 -DVERSION_NAME='Master' -DVERSION_NUMBER='2.2.1' -DBINARY_REVISION=1 -DVERSION_INT='2030001' -DQGIS_BASE='QGIS Master' -DINSTALLER_NAME='QGIS-OSGeo4W-2.2.1-1-Setup-x86.exe' -DDISPLAYED_NAME='QGIS 'Master' (2.2.1)' -DSHORTNAME='qgis' -DINSTALLER_TYPE=OSGeo4W -DPACKAGE_FOLDER=osgeo4w/unpacked-x86 -DLICENSE_FILE='osgeo4w/unpacked-x86/apps/qgis/doc/LICENSE' -DARCH='x86' QGIS-Installer.nsi] at creatensis.pl line 431.