Repo .zip generation issue
#1
Hi,

I have a repo for dev versions of my addon hosted on github, but the .zip files generated by the script can't be loaded by Kodi.

You can see the repo source here: https://github.com/zim514/zim514.github.io/tree/master/repo . I'm using the latest version of the ChadParry script under windows with Python 3.9.1, with Kodi 19.1. I've tried both the official latest windows and CoreElec versions of Kodi.

If I manually .zip the addons with 7zip, they work just fine so I assume my addon.xml is ok.  However, it appears that the .zip files generated by the script have a problem. They seem to download but consistently give an error that they can't be read. The generated .zip files open fine in 7zip, but not Kodi. An example broken zip is located here.

A full example log is here: oqizuxaxov (paste)

Excerpt: 

Code:
2021-07-23 14:11:21.512 T:13924 ERROR <general>: CAddonInfoBuilder::ADDON::CAddonInfoBuilder::Generate: Unable to load 'zip://special%3a%2f%2fhome%2faddons%2fpackages%2fscript.service.hue-1.0.2.zip/script.service.hue/addon.xml', Line 0 Failed to open file
2021-07-23 14:11:21.512 T:13924 ERROR <general>: CAddonInstallJob[script.service.hue]: invalid package special://home/addons/packages/script.service.hue-1.0.2.zip
Reply
#2
@Snapcase I've been using this script on linux for my internal repo for ages, no problems at all.
The broken zip you provided did not work me either, tried on both windows and linux Kodi.

I've tried building you repo zips on my linux box and the resulting zips worked perfectly.
I've tried the same on my windows box with python 3.9.6 and the resulting zips failed just as yours did.

It may be a python-on-windows bug or something extra must be done in the script to make zips created by windows python3 to behave wrt to Kodi.
It is also possible that it's Kodi bug, because all the zip capable utilities I have handy open those zips that fail with Kodi.
Suggest opening a bug report at https://github.com/chadparry/kodi-reposi...parry.org/
Reply
#3
Hmm this is curious

Code:
zipinfo linux-repository.snapcase-1.0.8.zip
Archive:  linux-repository.snapcase-1.0.8.zip
Zip file size: 125267 bytes, number of entries: 4
drwx---     0.0 fat        0 bx stor 21-Jul-24 22:01 repository.snapcase/
-rw----     0.0 fat     1156 tx defN 21-Jul-24 22:01 repository.snapcase/addon.xml
-rw----     0.0 fat   116361 bx defN 21-Jul-24 22:01 repository.snapcase/fanart.jpg
-rw----     0.0 fat    12978 bx defN 21-Jul-24 22:01 repository.snapcase/icon.png
4 files, 130495 bytes uncompressed, 124655 bytes compressed:  4.5%

zipinfo win-repository.snapcase-1.0.8.zip
Archive:  win-repository.snapcase-1.0.8.zip
Zip file size: 125137 bytes, number of entries: 3
-rw----     0.0 fat     1179 tx defN 21-Jul-24 22:20 repository.snapcase\addon.xml
-rw----     0.0 fat   116361 bx defN 21-Jul-24 22:20 repository.snapcase\fanart.jpg
-rw----     0.0 fat    12978 bx defN 21-Jul-24 22:20 repository.snapcase\icon.png
3 files, 130518 bytes uncompressed, 124659 bytes compressed:  4.5%

It seems that windows zip stores paths in windows' ways and that is not what Kodi expects.
Reply
#4
@asavah, thanks for confirming you could reproduce the problem. I'll open a bug report as you suggest.
Reply
#5
Kodi has its own implementation for handling zips, it's old, fragile, and specific.

An example was it not handling OSX finder created zips because the implementation only allowed 1 primary folder, but OSX added in its hidden folder when done via finder.

It's absolutely very likely there's going to be some packing method that just isn't handled by the implementation.

You're probably going to have to dig in yourself to fix it though if the OSX issue was anything to go by.
Reply
#6
The bug is here https://github.com/zim514/zim514.github....#L250-L252 and https://github.com/chadparry/kodi-reposi...ry.py#L218

When using os.path.join() python uses native os.sep which for windows obviously is '\'.
There might be an easy fix.
I'll post a patch if I get it to work.
Reply
#7
Try this, should work on windoze now.
https://gist.githubusercontent.com/asava..._win.patch
Reply
#8
I tried the patch and although zipinfo now reports a format that is closer to the Linux version you pasted above, Kodi still can't read it with the same log line. 

I appreciate your help on this! I'm relatively new to Kodi and Python so this is all new territory for me.

Code:
Archive:  repository.snapcase-1.0.8.zip
Zip file size: 125271 bytes, number of entries: 4
drwx---     0.0 fat        0 bx stor 21-Jul-24 17:56 repository.snapcase/
-rw----     0.0 fat     1179 tx defN 21-Jul-24 17:56 repository.snapcase/addon.xml
-rw----     0.0 fat   116361 bx defN 21-Jul-24 17:56 repository.snapcase/fanart.jpg
-rw----     0.0 fat    12978 bx defN 21-Jul-24 17:56 repository.snapcase/icon.png
4 files, 130518 bytes uncompressed, 124659 bytes compressed:  4.5%
Reply
#9
With the patch it installed flawlessly here.
I just rebuilt the zips and rechecked, installed fine.
Can you link a new Debug Log ?
Reply
#10
The zip code I wrote follow the official zip format. This has been raped by so many tools that supporting all the quirks out there is not worth it from my pov, better just force proper. The problem is not the \, that is handled. The problem is that it does not store a directory entry.

It has no problem reading osx zips, it is just that the addon validator code is very simple. So that is barking up the wrong tree..
Reply
#11
@asavah , I tried again today and it does work, thank you! I must have have confused something when I tried yesterday. I'll update the bug report with your patch and this information.
Reply
#12
@spiff Thanks for the clarification, / vs \ was the obvious difference.
However my patch for the script makes it store the directory entry properly by chance Smile thus making it work.
Reply

Logout Mark Read Team Forum Stats Members Help
Repo .zip generation issue0