From bbf9100a5871f906bba944f27266a5f7b90b3768 Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Thu, 12 Dec 2019 18:59:14 +0100 Subject: [PATCH] Update to version 68.0.0 --- WAPT/control | 22 +++++++---- WAPT/wapt.psproj | 32 ++++------------ extensions.rdf.j2 | 9 +---- reset_addons.bat.j2 | 14 +++++++ setup.py | 71 ++++++++++++++++++++++-------------- sogo-connector-60.0.0.xpi | 3 -- sogo-connector-68.0.0-demo.xpi | 3 ++ sogo-integrator-60.0.0-sogo-demo.xpi | 3 -- 8 files changed, 84 insertions(+), 73 deletions(-) create mode 100644 reset_addons.bat.j2 delete mode 100644 sogo-connector-60.0.0.xpi create mode 100644 sogo-connector-68.0.0-demo.xpi delete mode 100644 sogo-integrator-60.0.0-sogo-demo.xpi diff --git a/WAPT/control b/WAPT/control index a9e3add..fb1f004 100644 --- a/WAPT/control +++ b/WAPT/control @@ -1,13 +1,15 @@ package : fws-thunderbird-sogo-addons -version : 60.0.0-6 +version : 68.0.0-23 architecture : all section : base priority : optional +name : +categories : maintainer : Daniel Berteaud description : SOGo addons for Thunderbird -depends : fws-thunderbird-config +depends : fws-thunderbird(>=68),fws-thunderbird-config,fws-7zip conflicts : -maturity : PROD +maturity : RC locale : target_os : windows min_os_version : @@ -20,13 +22,17 @@ description_fr : Plugins SOGo pour le client Mozilla Thunderbird description_pl : description_de : description_es : -audit_schedule : 2d +audit_schedule : 4w editor : Inverse keywords : caldav,carddav,sogo licence : homepage : https://sogo.nu -package_uuid : +package_uuid : d93ba764-d8c8-4354-a493-1edbaf64c740 +valid_from : +valid_until : +forced_install_on : signer : Daniel Berteaud -signer_fingerprint: -signature_date : -signed_attributes : \ No newline at end of file +signer_fingerprint: 3c9415559e2dedbc4390e3faa2c28d3b67265baa5b35902d2764d9e41c3b3f0a +signature : JIdRCzu3kUMflqCOqjhubHMsEaTHj8Re+rHuu1C4MZTH3gpLdjh3zqvDWjkP1euLUIlfo1I/eh3LiwaBxYAKmbe5v0JL+lL+39tobK9UMRwDzb2ElX7W6G87lnmvuJBqWCCVge+A4e248T4t/4nFz2iAwSGIpT+DDVoxQFOdZ0duqJqKvRtmg5J21rf1mL4Vyf0uQiH3PEcw1n/Nunf0+i1YOCQvQItDO6I+wQEOIh4BnZBmAcD2l5orIaHwZlHEGEuChAUaj6T91rdIKUWH6uX6JN9KDGc14XNfHIr0qqL7jt2wrQVn5rfRhH2Cmc/TcWjGnPyKdx8Ni+Stj04yQA== +signature_date : 2019-12-12T18:39:31.100000 +signed_attributes : package,version,architecture,section,priority,name,categories,maintainer,description,depends,conflicts,maturity,locale,target_os,min_os_version,max_os_version,min_wapt_version,sources,installed_size,impacted_process,description_fr,description_pl,description_de,description_es,audit_schedule,editor,keywords,licence,homepage,package_uuid,valid_from,valid_until,forced_install_on,signer,signer_fingerprint,signature_date,signed_attributes \ No newline at end of file diff --git a/WAPT/wapt.psproj b/WAPT/wapt.psproj index 29acc4b..a78ccf6 100644 --- a/WAPT/wapt.psproj +++ b/WAPT/wapt.psproj @@ -1,5 +1,5 @@ [PyScripter] -Version=3.3.2.0 +Version=3.6.1.0 [Project] ClassName=TProjectRootNode @@ -23,11 +23,11 @@ FileName=C:\Program Files (x86)\wapt\setuphelpers.py [Project\ChildNodes\Node0\ChildNodes\Node0\ChildNodes\Node2] ClassName=TProjectFileNode -FileName=C:\Program Files (x86)\wapt\wapt-get.ini +FileName=C:\Program Files (x86)\wapt\wapt-get.py [Project\ChildNodes\Node0\ChildNodes\Node0\ChildNodes\Node3] ClassName=TProjectFileNode -FileName=C:\Program Files (x86)\wapt\wapt-get.py +FileName=C:\Program Files (x86)\wapt\wapt-get.ini [Project\ChildNodes\Node0\ChildNodes\Node0\ChildNodes\Node4] ClassName=TProjectFileNode @@ -46,10 +46,14 @@ FileName=$[Project-Path]control [Project\ChildNodes\Node0\ChildNodes\Node3] ClassName=TProjectFileNode +FileName=C:\waptdev\wapt-thunderbird-sogo-addons\reset_addons.bat.j2 + +[Project\ChildNodes\Node0\ChildNodes\Node4] +ClassName=TProjectFileNode FileName=$[Project-Path]..\setup.py [Project\ChildNodes\Node0\ChildNodes] -Count=4 +Count=5 [Project\ChildNodes\Node1] ClassName=TProjectRunConfiguationsNode @@ -74,8 +78,6 @@ Description=Run script using an external Python Interpreter ApplicationName=$[PythonExe-Short] Parameters=$[ActiveScript-Short] WorkingDirectory=$[ActiveScript-Dir] -ShortCut=0 -MessagesFormat=$[FileName] $[LineNumber] [Project\ChildNodes\Node1\ChildNodes\Node1] ClassName=TProjectRunConfiguationNode @@ -97,8 +99,6 @@ Description=Run script using an external Python Interpreter ApplicationName=$[PythonExe-Short] Parameters=$[ActiveScript-Short] WorkingDirectory=$[ActiveScript-Dir] -ShortCut=0 -MessagesFormat=$[FileName] $[LineNumber] [Project\ChildNodes\Node1\ChildNodes\Node2] ClassName=TProjectRunConfiguationNode @@ -120,8 +120,6 @@ Description=Run script using an external Python Interpreter ApplicationName=$[PythonExe-Short] Parameters=$[ActiveScript-Short] WorkingDirectory=$[ActiveScript-Dir] -ShortCut=0 -MessagesFormat=$[FileName] $[LineNumber] [Project\ChildNodes\Node1\ChildNodes\Node3] ClassName=TProjectRunConfiguationNode @@ -143,8 +141,6 @@ Description=Run script using an external Python Interpreter ApplicationName=$[PythonExe-Short] Parameters=$[ActiveScript-Short] WorkingDirectory=$[ActiveScript-Dir] -ShortCut=0 -MessagesFormat=$[FileName] $[LineNumber] [Project\ChildNodes\Node1\ChildNodes\Node4] ClassName=TProjectRunConfiguationNode @@ -166,8 +162,6 @@ Description=Run script using an external Python Interpreter ApplicationName=$[PythonExe-Short] Parameters=$[ActiveScript-Short] WorkingDirectory=$[ActiveScript-Dir] -ShortCut=0 -MessagesFormat=$[FileName] $[LineNumber] [Project\ChildNodes\Node1\ChildNodes\Node5] ClassName=TProjectRunConfiguationNode @@ -189,8 +183,6 @@ Description=Run script using an external Python Interpreter ApplicationName=$[PythonExe-Short] Parameters=$[ActiveScript-Short] WorkingDirectory=$[ActiveScript-Dir] -ShortCut=0 -MessagesFormat=$[FileName] $[LineNumber] [Project\ChildNodes\Node1\ChildNodes\Node6] ClassName=TProjectRunConfiguationNode @@ -212,8 +204,6 @@ Description=Run script using an external Python Interpreter ApplicationName=$[PythonExe-Short] Parameters=$[ActiveScript-Short] WorkingDirectory=$[ActiveScript-Dir] -ShortCut=0 -MessagesFormat=$[FileName] $[LineNumber] [Project\ChildNodes\Node1\ChildNodes\Node7] ClassName=TProjectRunConfiguationNode @@ -235,8 +225,6 @@ Description=Run script using an external Python Interpreter ApplicationName=$[PythonExe-Short] Parameters=$[ActiveScript-Short] WorkingDirectory=$[Project-Path].. -ShortCut=0 -MessagesFormat=$[FileName] $[LineNumber] [Project\ChildNodes\Node1\ChildNodes\Node8] ClassName=TProjectRunConfiguationNode @@ -258,8 +246,6 @@ Description=Run script using an external Python Interpreter ApplicationName=$[PythonExe-Short] Parameters=$[ActiveScript-Short] WorkingDirectory=$[ActiveScript-Dir] -ShortCut=0 -MessagesFormat=$[FileName] $[LineNumber] [Project\ChildNodes\Node1\ChildNodes\Node9] ClassName=TProjectRunConfiguationNode @@ -281,8 +267,6 @@ Description=Run script using an external Python Interpreter ApplicationName=$[PythonExe-Short] Parameters=$[ActiveScript-Short] WorkingDirectory=$[ActiveScript-Dir] -ShortCut=0 -MessagesFormat=$[FileName] $[LineNumber] [Project\ChildNodes\Node1\ChildNodes] Count=10 diff --git a/extensions.rdf.j2 b/extensions.rdf.j2 index f7a5ea9..aed6b4c 100644 --- a/extensions.rdf.j2 +++ b/extensions.rdf.j2 @@ -1,18 +1,13 @@ -
  • -
  • -
  • -
  • diff --git a/reset_addons.bat.j2 b/reset_addons.bat.j2 new file mode 100644 index 0000000..ed6599a --- /dev/null +++ b/reset_addons.bat.j2 @@ -0,0 +1,14 @@ + +for /f %%a in ('dir /b "%APPDATA%\Thunderbird\Profiles\*.default"') do SET TBPROFILE=%APPDATA%\Thunderbird\Profiles\%%a +IF NOT EXIST "%TBPROFILE%" GOTO :EOF +IF EXIST "%TBPROFILE%\extensions.json" ( + IF NOT EXIST "%TBPROFILE%\extensions.{{ tb_major_version }}.json" ( + rename "%TBPROFILE%\extensions.json" extensions.{{ tb_major_version }}.json + ) +) + +IF EXIST "%TBPROFILE%\addonStartup.json.lz4" ( + IF NOT EXIST "%TBPROFILE%\addonStartup.{{ tb_major_version }}.json.lz4" ( + rename "%TBPROFILE%\addonStartup.json.lz4" addonStartup.{{ tb_major_version }}.json.lz4 + ) +) \ No newline at end of file diff --git a/setup.py b/setup.py index 7924325..3b426f0 100644 --- a/setup.py +++ b/setup.py @@ -9,57 +9,72 @@ variables = { 'sogo_server': 'mail.server.local' } -# Read local variables file if available -if isfile(makepath(programfiles32,'wapt','private','symetric.txt')) and isfile(makepath(programfiles32,'wapt','private','variables.txt')): - print('Reading local encrypted variables file') - from cryptography.fernet import Fernet - import yaml - f = Fernet(open(makepath(programfiles32,'wapt','private','symetric.txt'),'r').read()) - variables.update(yaml.safe_load(f.decrypt(open(makepath(programfiles32,'wapt','private','variables.txt'),'r').read()))) - def install(): + # Read local variables file if available + if isfile(makepath(programfiles32,'wapt','private','symetric.txt')) and isfile(makepath(programfiles32,'wapt','private','variables.txt')): + print('Reading local encrypted variables file') + from cryptography.fernet import Fernet + import yaml + f = Fernet(open(makepath(programfiles32,'wapt','private','symetric.txt'),'r').read()) + variables.update(yaml.safe_load(f.decrypt(open(makepath(programfiles32,'wapt','private','variables.txt'),'r').read()))) + connector_version = control['version'].split('-',1)[0] - integrator_version = connector_version - for extension in ['connector','integrator']: - if isdir(makepath(programfiles,'Mozilla Thunderbird','distribution','extensions','sogo-%s@inverse.ca' % extension)): - remove_tree(makepath(programfiles,'Mozilla Thunderbird','distribution','extensions','sogo-%s@inverse.ca' % extension)) - mkdirs(makepath(programfiles,'Mozilla Thunderbird','distribution','extensions','sogo-%s@inverse.ca' % extension)) + major_version = control['version'].split('.',1)[0] + extension_dir = makepath(programfiles,'Mozilla Thunderbird','distribution','extensions') + + for extension in ['connector', 'integrator']: + if isdir(makepath(extension_dir, 'sogo-%s@inverse.ca' % extension)): + remove_tree(makepath(extension_dir, 'sogo-%s@inverse.ca' % extension)) + if isfile(makepath(extension_dir, 'sogo-%s@inverse.ca.xpi' % extension)): + remove_file(makepath(extension_dir, 'sogo-%s@inverse.ca.xpi' % extension)) + mkdirs(makepath(extension_dir, 'sogo-connector@inverse.ca')) - # connector can be extracted as is - unzip('sogo-connector-%s.xpi' % connector_version, makepath(programfiles,'Mozilla Thunderbird','distribution','extensions','sogo-connector@inverse.ca')) + # The extension must be customized, so first extract it + print('Extraction demo extension') + unzip('sogo-connector-%s-demo.xpi' % connector_version, makepath(extension_dir,'sogo-connector@inverse.ca')) - # Integrator must be customized, so first extract it - unzip('sogo-integrator-%s-sogo-demo.xpi' % integrator_version, makepath(programfiles,'Mozilla Thunderbird','distribution','extensions','sogo-integrator@inverse.ca')) # And replace the extensions.rdf content + print('Customizing extension') jinja2 = Environment( loader=FileSystemLoader(os.path.dirname(os.path.abspath(__file__))), trim_blocks=True ) - open(makepath(programfiles,'Mozilla Thunderbird','distribution','extensions','sogo-integrator@inverse.ca','chrome','content','extensions.rdf'),'w').write( + open(makepath(extension_dir,'sogo-connector@inverse.ca','chrome','content','sogo-connector','global','extensions.rdf'),'w').write( jinja2.get_template('extensions.rdf.j2').render( sogo_server = variables['sogo_server'] ) ) # Also remove custom settings - os.unlink(makepath(programfiles,'Mozilla Thunderbird','distribution','extensions','sogo-integrator@inverse.ca','defaults','preferences','site.js')) + os.unlink(makepath(extension_dir,'sogo-connector@inverse.ca','defaults','preferences','site.js')) + # Now create an XPI + print('Creating XPI') + run(r'"%s" a -tzip "%s" "%s"' %(makepath(programfiles, '7-Zip', '7z.exe'), makepath(extension_dir, 'sogo-connector@inverse.ca.xpi'), makepath(extension_dir, 'sogo-connector@inverse.ca', '*'))) + + # Note : we could remove the extension directory, but we keep it for easier auditing + + # Script to reset extensions.json and addonStartup.json.lz4, those files need to be removed + # for sogo-connector to be correctly loaded. At least for the 60.x -> 68.x upgrade + print('Deploy reset_addons.bat script') + open(makepath(programfiles,'Mozilla Thunderbird','reset_addons.bat'),'w').write( + jinja2.get_template('reset_addons.bat.j2').render( + tb_major_version = major_version + ) + ) def uninstall(): - print('Removing SOGo extensions for Thunderbird') - for extension in ['connector','integrator']: - remove_tree(makepath(programfiles,'Mozilla Thunderbird','distribution','extensions','sogo-%s@inverse.ca' % extension)) + print('Removing SOGo connector for Thunderbird') + remove_tree(makepath(programfiles,'Mozilla Thunderbird','distribution','extensions','sogo-connector@inverse.ca' % extension)) + +def session_setup(): + print('Reset Thunderbird addons settings on major upgrades') + run(makepath(programfiles,'Mozilla Thunderbird','reset_addons.bat')) def audit(): connector_version = control['version'].split('-',1)[0] - integrator_version = connector_version try: run('type "%s" | find /I "em:version=" | find "%s"' % (makepath(programfiles,'Mozilla Thunderbird','distribution','extensions','sogo-connector@inverse.ca','install.rdf'), connector_version)) except: print('SOGO connector version check failed') return "ERROR" - try: - run('type "%s" | find /I "em:version=" | find "%s"' % (makepath(programfiles,'Mozilla Thunderbird','distribution','extensions','sogo-integrator@inverse.ca','install.rdf'), integrator_version)) - except: - print('SOGO integrator version check failed') - return "ERROR" return "OK" \ No newline at end of file diff --git a/sogo-connector-60.0.0.xpi b/sogo-connector-60.0.0.xpi deleted file mode 100644 index c091373..0000000 --- a/sogo-connector-60.0.0.xpi +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:f860c9c69827c44376851db704d1c77a2f2778fb48222e9fa10b5206ddfb9ccd -size 265848 diff --git a/sogo-connector-68.0.0-demo.xpi b/sogo-connector-68.0.0-demo.xpi new file mode 100644 index 0000000..15b7043 --- /dev/null +++ b/sogo-connector-68.0.0-demo.xpi @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:609a41d9ebd040e6c7fef95590f49721aea0956a698d6768e1e2e3b820cb442f +size 388712 diff --git a/sogo-integrator-60.0.0-sogo-demo.xpi b/sogo-integrator-60.0.0-sogo-demo.xpi deleted file mode 100644 index d3450fa..0000000 --- a/sogo-integrator-60.0.0-sogo-demo.xpi +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:3efa5ffbe46cc4d832b80e3ff787dba4fd793d113d7f36fc1ac680f694490363 -size 166014