AppImage - Include auto-updating logic in to appimage directly?

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: AppImage - Include auto-updating logic in to appimage directly?

Post by looo »

Kunda1 wrote: Sat Oct 10, 2020 2:59 pm Just for clarification, we're waiting on PR from antony-jr?
Thanks, sorry I'm obtuse sometimes


I guess 1.1.9 didn't fix the issue.
User avatar
antonyjr
Posts: 45
Joined: Sat Mar 21, 2020 9:35 pm
Contact:

Re: AppImage - Include auto-updating logic in to appimage directly?

Post by antonyjr »

looo wrote: Sat Oct 10, 2020 6:50 pm
Kunda1 wrote: Sat Oct 10, 2020 2:59 pm Just for clarification, we're waiting on PR from antony-jr?
Thanks, sorry I'm obtuse sometimes


I guess 1.1.9 didn't fix the issue.
@looo Please remove this line -> https://github.com/looooo/freecad.appim ... ate.py#L47 , To fix the issue. This is because the library automatically guesses the actual AppImage path by itself. No need to do it yourself.

The library only guesses stuff if the programmer did not explicitly give the AppImage path. If you give the AppImage path explicitly then you should handle your errors yourself. I guess this has to go into the documentation.

TL;DR do not use setAppImage routine at all. Just let the library guess the AppImage.

Note: you don't have to use setAppImage at all if you run it from inside the AppImage
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: AppImage - Include auto-updating logic in to appimage directly?

Post by looo »

antonyjr wrote: Mon Oct 12, 2020 9:47 pm
@looo Please remove this line -> https://github.com/looooo/freecad.appim ... ate.py#L47 , To fix the issue. This is because the library automatically guesses the actual AppImage path by itself. No need to do it yourself.
thanks @antonyjr, I removed the line [1]. Now it's your turn @Kunda :)

[1] https://github.com/looooo/freecad.appim ... e8c4b749e5
User avatar
antonyjr
Posts: 45
Joined: Sat Mar 21, 2020 9:35 pm
Contact:

Re: AppImage - Include auto-updating logic in to appimage directly?

Post by antonyjr »

looo wrote: Tue Oct 13, 2020 8:37 am
antonyjr wrote: Mon Oct 12, 2020 9:47 pm
@looo Please remove this line -> https://github.com/looooo/freecad.appim ... ate.py#L47 , To fix the issue. This is because the library automatically guesses the actual AppImage path by itself. No need to do it yourself.
thanks @antonyjr, I removed the line [1]. Now it's your turn @Kunda :)

[1] https://github.com/looooo/freecad.appim ... e8c4b749e5
@looo I can confirm that the changes are working just fine.
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: AppImage - Include auto-updating logic in to appimage directly?

Post by Kunda1 »

Yes! It works on

Code: Select all

OS: Manjaro Linux (KDE//usr/share/xsessions/plasma)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.22670 (Git) AppImage
Build type: Release
Branch: master
Hash: 12155f4aab09047c5697db0c1b3cf93b02edda03
Python version: 3.8.6
Qt version: 5.12.9
Coin version: 4.0.0
OCC version: 7.4.0
Locale: English/United States (en_US)
FreeCAD-AppImage-Success.gif
FreeCAD-AppImage-Success.gif (176.67 KiB) Viewed 1273 times
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
antonyjr
Posts: 45
Joined: Sat Mar 21, 2020 9:35 pm
Contact:

Re: AppImage - Include auto-updating logic in to appimage directly?

Post by antonyjr »

But it is worthy to note that the Latest version of AppImage Launcher has fixed this issue because this issue happened with electron-updater as well.
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: AppImage - Include auto-updating logic in to appimage directly?

Post by Kunda1 »

Some observations:
1. After the appimage dialog is complete, there is a restart option. That option will quit FreeCAD but won't restart it. I needed to invoke FC manually.

2. Even though I'm up to date on the AppImage (r22670) I can still choose to redownload it. The UI isn't friendly enough to tell me it's not necessary. It will just weirdly rename the appimage as "FreeCAD_0-revised-on-2020-10-15T07-34-32.19-22670-Linux-Conda_glibc2.12-x86_64.AppImage"

3. Notice how it adds -revised-on-2020-10-15T07-34-32 smack dab in the middle of the file name.

4. If a user has added the option to Check for AppImage updates on startup then we have a potential closed loop situation where step 1-3 keep repeating

Code: Select all

loading the plugin: True
   INFO:   setAppImage :  "/run/user/1000/appimagelauncherfs/0005.AppImage" . 
   INFO:   setAppImage :  "/home/foo/Applications/FreeCAD_0.19-22670-Linux-Conda_glibc2.12-x86_64.AppImage" . 
   INFO:   getInfo : AppImage is confirmed to be type 2. 
   INFO:   getInfo : mapping AppImage to memory. 
   INFO:   getInfo : AppImage architecture is x86_64 (64 bits). 
   INFO:   getInfo : updateString( "gh-releases-zsync|FreeCAD|FreeCAD|0.19_pre|FreeCAD*glibc2.12-x86_64.AppImage.zsync" ). 
   INFO:   getInfo : finished. 
   INFO:  setControlFileUrl : using github releases zsync transport. 
   INFO:  setControlFileUrl : github api request( QUrl("https://api.github.com/repos/FreeCAD/FreeCAD/releases/tags/0.19_pre") ). 
   INFO:   handleGithubAPIResponse : starting to parse github api response. 
   INFO:   handleGithubAPIResponse : http response code( 200 ). 
   INFO:  handleGithubAPIResponse : latest version is  "0.19_pre" 
   INFO:  handleGithubAPIResponse : asset required is  "FreeCAD*glibc2.12-x86_64.AppImage.zsync" 
   INFO:  handleGithubAPIResponse : inspecting asset( "FreeCADLibs_12.1.6_x64_VC15.7z" 
   INFO:  handleGithubAPIResponse : inspecting asset( "FreeCADLibs_12.1.6_x64_VC15.7z-SHA256.txt" 
   INFO:  handleGithubAPIResponse : inspecting asset( "FreeCAD_0.19-22670-Linux-Conda_glibc2.12-x86_64.AppImage" 
   INFO:  handleGithubAPIResponse : inspecting asset( "FreeCAD_0.19-22670-Linux-Conda_glibc2.12-x86_64.AppImage-SHA256.txt" 
   INFO:  handleGithubAPIResponse : inspecting asset( "FreeCAD_0.19-22670-Linux-Conda_glibc2.12-x86_64.AppImage.zsync" 
   INFO:   setControlFileUrl : using  QUrl("https://github.com/FreeCAD/FreeCAD/releases/download/0.19_pre/FreeCAD_0.19-22670-Linux-Conda_glibc2.12-x86_64.AppImage.zsync")  as zsync control file. 
   INFO:   handleGithubMarkdownParsed : starting to parse github api response. 
   INFO:   handleGithubMarkdownParsed : http response code( 200 ). 
   INFO:   getControlFile : sending get request to  QUrl("https://github.com/FreeCAD/FreeCAD/releases/download/0.19_pre/FreeCAD_0.19-22670-Linux-Conda_glibc2.12-x86_64.AppImage.zsync") . 
   INFO:   handleControlFile : starting to parse zsync control file. 
   INFO:   handleControlFile : http response code( 200 ). 
   INFO:   handleControlFile : searching for checksum blocks offset in the zsync control file. 
   INFO:   handleControlFile : found checksum blocks offset( 284 ) in zsync control file. 
   INFO:   handleControlFile : zsync make version confirmed to be  "0.6.2" . 
   INFO:   handleControlFile : zsync target file name confirmed to be  "FreeCAD_0.19-22670-Linux-Conda_glibc2.12-x86_64.AppImage" . 
   INFO:   handleControlFile : zsync target file MTime confirmed to be  QDateTime(2020-10-14 22:17:28.000 EDT Qt::LocalTime) . 
   INFO:   handleControlFile : zsync target file blocksize confirmed to be  4096  bytes. 
   INFO:   handleControlFile : zysnc target file length confirmed to be  863879208  bytes. 
   INFO:   handleControlFile :  3  bytes of weak checksum is available. 
   INFO:   handleControlFile :  5  bytes of strong checksum is available. 
   INFO:   handleControlFile :  2  consecutive matches is needed. 
   INFO:   handleControlFile : zsync target file url is confirmed to be  QUrl("FreeCAD_0.19-22670-Linux-Conda_glibc2.12-x86_64.AppImage") . 
   INFO:   handleControlFile : zsync target file sha1 hash is confirmed to be  "4E9B4A44945D463A5CF6F730BBD945F9916C879E" . 
   INFO:   handleControlFile : zsync target file has  210909  number of blocks. 
start with update process
   INFO:   setConfiguration : creating temporary file. 
   INFO:   setConfiguration : temporary file will temporarily reside at  "/home/foo/Applications/FreeCAD_0.19-22670-Linux-Conda_glibc2.12-x86_64.AppImage.hxDOOPffHC.part" . 
   INFO:   start : starting delta writer. 
   INFO:   getBlockRanges : emitting required block ranges. 
   INFO:   getBlockRanges : ( 172032  ,  176127 ). 
 ...
 ...
   INFO:   getBlockRanges : ( 863035392  ,  863883263 ). 
   INFO:   getBlockRanges : requesting  51  range requests to server. 
   INFO:   getBlockRanges : emitted required block ranges. 
   INFO:   verifyAndConstructTargetFile : calculating sha1 hash on temporary target file.  
   INFO:   verifyAndConstructTargetFile : comparing temporary target file sha1 hash( "4E9B4A44945D463A5CF6F730BBD945F9916C879E" ) and remote target file sha1 hash( "4E9B4A44945D463A5CF6F730BBD945F9916C879E" 
   INFO:   verifyAndConstructTargetFile : sha1 hash matches! 
   INFO:   verifyAndConstructTargetFile : file with target file name exists. 
   INFO:   verifyAndConstructTargetFile : renaming new version as  "FreeCAD_0-revised-on-2020-10-15T07-34-32.19-22670-Linux-Conda_glibc2.12-x86_64.AppImage" . 

Last line

Code: Select all

renaming new version as  "FreeCAD_0-revised-on-2020-10-15T07-34-32.19-22670-Linux-Conda_glibc2.12-x86_64.AppImage
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: AppImage - Include auto-updating logic in to appimage directly?

Post by looo »

Kunda1 wrote: Thu Oct 15, 2020 11:47 am 1. After the appimage dialog is complete, there is a restart option. That option will quit FreeCAD but won't restart it. I needed to invoke FC manually.
https://github.com/looooo/freecad.appim ... .py#L91L95

This works for me. Is it somehow possible to get an error report here?
Kunda1 wrote: Thu Oct 15, 2020 11:47 am 2. Even though I'm up to date on the AppImage (r22670) I can still choose to redownload it. The UI isn't friendly enough to tell me it's not necessary. It will just weirdly rename the appimage as "FreeCAD_0-revised-on-2020-10-15T07-34-32.19-22670-Linux-Conda_glibc2.12-x86_64.AppImage"
I guess this is expected. We do not rename the Appimage if only dependencies are updated. There are lots of dependencies involved in the bundle, so the chances one of them was updatd during the week is quite high.
Kunda1 wrote: Thu Oct 15, 2020 11:47 am 3. Notice how it adds -revised-on-2020-10-15T07-34-32 smack dab in the middle of the file name.
Appimage magic to avoid clashing names?
Kunda1 wrote: Thu Oct 15, 2020 11:47 am 4. If a user has added the option to Check for AppImage updates on startup then we have a potential closed loop situation where step 1-3 keep repeating
I didn't experienced this. If you launch the appimage with the latest checksum, no update should be available. I guess this is a conclusion from the 2. assumption.
User avatar
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

Re: AppImage - Include auto-updating logic in to appimage directly?

Post by sgrogan »

looo wrote: Thu Oct 15, 2020 12:06 pm I guess this is expected. We do not rename the Appimage if only dependencies are updated. There are lots of dependencies involved in the bundle, so the chances one of them was updatd during the week is quite high.
This is an on going issue. I would like to disable the CRON job and trigger the packaging manually, but I haven't figured out how to do this. We have the same problem with windows and Chocolatery.

Longer term it would be good to add logic to FreeCAD-AppImage/travis.yml to not deploy an update if the FreeCAD version hasn't changed.
"fight the good fight"
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: AppImage - Include auto-updating logic in to appimage directly?

Post by Kunda1 »

looo wrote: Thu Oct 15, 2020 12:06 pm
Kunda1 wrote: Thu Oct 15, 2020 11:47 am 1. After the appimage dialog is complete, there is a restart option. That option will quit FreeCAD but won't restart it. I needed to invoke FC manually.
https://github.com/looooo/freecad.appim ... .py#L91L95

This works for me. Is it somehow possible to get an error report here?
Not sure how to generate an error report. Is there a log file I can look at ?

Code: Select all

OS: Manjaro Linux (KDE//usr/share/xsessions/plasma)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.22670 (Git) AppImage
Build type: Release
Branch: master
Hash: 12155f4aab09047c5697db0c1b3cf93b02edda03
Python version: 3.8.6
Qt version: 5.12.9
Coin version: 4.0.0
OCC version: 7.4.0
Locale: English/United States (en_US)
Kunda1 wrote: Thu Oct 15, 2020 11:47 am 2. Even though I'm up to date on the AppImage (r22670) I can still choose to redownload it. The UI isn't friendly enough to tell me it's not necessary. It will just weirdly rename the appimage as "FreeCAD_0-revised-on-2020-10-15T07-34-32.19-22670-Linux-Conda_glibc2.12-x86_64.AppImage"
looo wrote: Thu Oct 15, 2020 12:06 pm I guess this is expected. We do not rename the Appimage if only dependencies are updated. There are lots of dependencies involved in the bundle, so the chances one of them was updatd during the week is quite high.
I think it may be time to tweak the UI to be more friendly. Where does one start to do that?
looo wrote: Thu Oct 15, 2020 12:06 pm
Kunda1 wrote: Thu Oct 15, 2020 11:47 am 3. Notice how it adds -revised-on-2020-10-15T07-34-32 smack dab in the middle of the file name.
Appimage magic to avoid clashing names?
Is this a setting we can tweak to add the -revised-on-2020-10-15T07-34-32 to the end of the file name instead of the middle of it?
looo wrote: Thu Oct 15, 2020 12:06 pm
Kunda1 wrote: Thu Oct 15, 2020 11:47 am 4. If a user has added the option to Check for AppImage updates on startup then we have a potential closed loop situation where step 1-3 keep repeating
I didn't experienced this. If you launch the appimage with the latest checksum, no update should be available. I guess this is a conclusion from the 2. assumption.
Even after experimenting 2 3 times with downloading was prompted to download the AppImage (which to the untrained eye looked like I was being told an AppImage update was available).
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Post Reply