Recent

Author Topic: Laz AutoUpdate component - beta  (Read 69201 times)

minesadorada

  • Sr. Member
  • ****
  • Posts: 453
  • Retired
Re: Laz AutoUpdate component - beta
« Reply #60 on: January 15, 2017, 04:24:39 pm »
Thanks for testing.

Downloaded your test project. Works fine for me.
Did your \bin\updates\ folder contain the exe and whatsnew.txt?
Did the \bin folder contain newTestLazAutoUpdate.ini and whatsnew.txt?

Here's my log:
[2017-01-15 15:16:59.273 Info] Start of Log
 [2017-01-15 15:16:59.273 Info] updatehm version 0.0.15
 [2017-01-15 15:16:59.273 Info] Given parameters follow:
 [2017-01-15 15:16:59.273 Info] App name = testproject.exe
 [2017-01-15 15:16:59.273 Info] Updates folder = updates
 [2017-01-15 15:16:59.273 Info] WhatsNew filename = whatsnew.txt
 [2017-01-15 15:16:59.273 Info] Pretty Name = testproject
 [2017-01-15 15:16:59.273 Info] CopyTree = TRUE
 [2017-01-15 15:16:59.273 Info] Please wait.  Updating testproject....
 [2017-01-15 15:16:59.273 Info] Application path = D:\lazarusccr\components\lazautoupdate\latest_stable\updates\TestLazAutoUpdate-master\TestLazAutoUpdate-master\bin\testproject.exe
 [2017-01-15 15:16:59.273 Info] Updated application path = D:\lazarusccr\components\lazautoupdate\latest_stable\updates\TestLazAutoUpdate-master\TestLazAutoUpdate-master\bin\updates\testproject.exe
 [2017-01-15 15:16:59.273 Info] WhatsNew path = D:\lazarusccr\components\lazautoupdate\latest_stable\updates\TestLazAutoUpdate-master\TestLazAutoUpdate-master\bin\whatsnew.txt
 [2017-01-15 15:16:59.273 Info] Updated whatsNew path = D:\lazarusccr\components\lazautoupdate\latest_stable\updates\TestLazAutoUpdate-master\TestLazAutoUpdate-master\bin\updates\whatsnew.txt
 [2017-01-15 15:16:59.273 Info] Writing.. whatsnew.txt
 [2017-01-15 15:16:59.273 Info] Waiting 2 seconds...
 [2017-01-15 15:17:03.417 Info] Restarting testproject...
 [2017-01-15 15:17:03.431 Info] End of Log


Laz reports no memory leak on successful completion. I need to put in more code to allow for failure - it's a work-in-progress.

So I can't reproduce the error you reported so far.

Try the TestApp - it reports in more detail.
GPL Apps: Health MonitorRetro Ski Run
OnlinePackageManager Components: LazAutoUpdate, LongTimer, PoweredBy, ScrollText, PlaySound, CryptINI

lainz

  • Hero Member
  • *****
  • Posts: 4742
  • Web, Desktop & Android developer
    • https://lainz.github.io/
Re: Laz AutoUpdate component - beta
« Reply #61 on: January 15, 2017, 04:39:58 pm »
Quote
Did your \bin\updates\ folder contain the exe and whatsnew.txt?
Yes.
Quote
Did the \bin folder contain newTestLazAutoUpdate.ini and whatsnew.txt?
Yes.

TestApp works fine for me.

I'm using Lazarus 1.6 with FPC 3.0, in wich version you tested?

lainz

  • Hero Member
  • *****
  • Posts: 4742
  • Web, Desktop & Android developer
    • https://lainz.github.io/
Re: Laz AutoUpdate component - beta
« Reply #62 on: January 15, 2017, 04:47:52 pm »
OK I found the problem: compiling it with Debug doesn't works, it must be compiled as release to work, at least on my PC with Laz 1.6.

Edit: I don't know what was wrong, now compiling with Debug works fine too, that was a problem with something else.

lainz

  • Hero Member
  • *****
  • Posts: 4742
  • Web, Desktop & Android developer
    • https://lainz.github.io/
Re: Laz AutoUpdate component - beta
« Reply #63 on: January 15, 2017, 04:54:13 pm »
Well, now that I tested it works really well, I have another question:

How I get the silent version of the command line tool?

And now we can see how to add it using releases instead of master, here is a release:

https://github.com/lazarusccr/TestLazAutoUpdate/releases/tag/v1.0 (This is just a page, not a download)
https://github.com/lazarusccr/TestLazAutoUpdate/releases/download/v1.0/TestLazAutoUpdate.ini
https://github.com/lazarusccr/TestLazAutoUpdate/releases/download/v1.0/TestLazAutoUpdate.zip

So you can see the format it has. The release can have any name, doesn't need to be "v" and "number" can be like "updates" too. So the thing we can do maybe is:

Add 'GitHubDownloadFromReleases' boolean, if true use the releases, if false use 'master'.

Then if DownloadFromReleases is true you can set GitHubReleaseName, a string to set it for example to "updates" or "v1.0", that's the subfolder of the URL.

minesadorada

  • Sr. Member
  • ****
  • Posts: 453
  • Retired
Re: Laz AutoUpdate component - beta
« Reply #64 on: January 15, 2017, 05:10:59 pm »
>>How I get the silent version of the command line tool?
Not sure what you mean.  The method SilentUpdate is for use by a trayapp updater.  I haven't integrated that yet.

re releases:  I'll add it as an option to the ProjectType for consistency with the GitHubReleaseName property. (assuming the download URL works OK)

I'm glad it's working for you so far.  Thanks for uploading the test files - I'll get onto it after Ronnie O'Sullivan's snooker match finishes..

GPL Apps: Health MonitorRetro Ski Run
OnlinePackageManager Components: LazAutoUpdate, LongTimer, PoweredBy, ScrollText, PlaySound, CryptINI

lainz

  • Hero Member
  • *****
  • Posts: 4742
  • Web, Desktop & Android developer
    • https://lainz.github.io/
Re: Laz AutoUpdate component - beta
« Reply #65 on: January 15, 2017, 05:17:23 pm »
I almost forget, to download from HTTPS (GitHub releases are) you need to put the dll's in the program folder or have them installed in the system.

Quote
Not sure what you mean.  The method SilentUpdate is for use by a trayapp updater.  I haven't integrated that yet.

Ok.

Quote
re releases:  I'll add it as an option to the ProjectType for consistency with the GitHubReleaseName property. (assuming the download URL works OK)

Yes I've downloaded from that and works fine, the only thing your program needs if I remember well is an user agent like "client.AddHeader('User-Agent','Mozilla/5.0 (compatible; fpweb)');" that was for TFPHTTPClient, I'm not sure what you're using.

Ok. I think you can reuse the UpdatesFolder property instead of adding a new one. The UpdatesFolder will be the release name in that case. "v1.0". So only adding the project type will do.

minesadorada

  • Sr. Member
  • ****
  • Posts: 453
  • Retired
Re: Laz AutoUpdate component - beta
« Reply #66 on: January 15, 2017, 06:49:56 pm »
Hmm. Complicated.  Github has branches, tags, branches with tags  etc.etc.  I'm still trying to get a binary download URL for tags and releases to work.

I need to set up my own GitHub test environment.  Watch this space.

>>I almost forget, to download from HTTPS (GitHub releases are) you need to put the dll's in the program folder or have them installed in the system.
Yes I forgot about those.  I'll figure out a way to download them (like fpcup) or put them into the distribution or something.
« Last Edit: January 15, 2017, 06:52:00 pm by minesadorada »
GPL Apps: Health MonitorRetro Ski Run
OnlinePackageManager Components: LazAutoUpdate, LongTimer, PoweredBy, ScrollText, PlaySound, CryptINI

balazsszekely

  • Guest
Re: Laz AutoUpdate component - beta
« Reply #67 on: January 15, 2017, 07:16:27 pm »
Quote
Yes I forgot about those.  I'll figure out a way to download them (like fpcup) or put them into the distribution or something.
You can always download those dll's from the main repository like this(feel free to modify a few variables according to your needs).

Code: Pascal  [Select][+][-]
  1. const
  2. {$ifdef win64}
  3.  cOpenSSLURL = 'http://packages.lazarus-ide.org/openssl-1.0.2j-x64_86-win64.zip';
  4. {$endif}
  5. {$ifdef win32}
  6. cOpenSSLURL = 'http://packages.lazarus-ide.org/openssl-1.0.2j-i386-win32.zip';
  7. {$endif}
  8.  
  9. procedure CheckForOpenSSL;
  10. var
  11.   ZipFile: String;
  12.   UnZipper: TUnZipper;
  13. begin
  14.   {$IFDEF MSWINDOWS}
  15.    FOpenSSLAvaialable := FileExistsUTF8(ExtractFilePath(ParamStr(0)) + 'libeay32.dll') and
  16.                          FileExistsUTF8(ExtractFilePath(ParamStr(0)) + 'ssleay32.dll');
  17.    if not FOpenSSLAvaialable then
  18.    begin
  19.      ZipFile := ExtractFilePath(ParamStr(0)) + ExtractFileName(cOpenSSLURL);
  20.      try
  21.        FHTTPClient.Get(cOpenSSLURL, ZipFile);
  22.      except
  23.      end;
  24.      if FileExistsUTF8(ZipFile) then
  25.      begin
  26.        UnZipper := TUnZipper.Create;
  27.        try
  28.          try
  29.            UnZipper.FileName := ZipFile;
  30.            UnZipper.Examine;
  31.            UnZipper.UnZipAllFiles;
  32.          except
  33.          end;
  34.        finally
  35.          UnZipper.Free;
  36.        end;
  37.        DeleteFileUTF8(ZipFile);
  38.        FOpenSSLAvaialable := FileExistsUTF8(ExtractFilePath(ParamStr(0)) + 'libeay32.dll') and
  39.                              FileExistsUTF8(ExtractFilePath(ParamStr(0)) + 'ssleay32.dll');
  40.      end;
  41.   end;
  42.   {$ELSE}
  43.   FOpenSSLAvaialable := True;
  44.   {$ENDIF}
  45. end;

Under linux/osx it's installed by default.  You can also store the zip files on a personal server if you like.
« Last Edit: January 15, 2017, 07:18:32 pm by GetMem »

minesadorada

  • Sr. Member
  • ****
  • Posts: 453
  • Retired
Re: Laz AutoUpdate component - beta
« Reply #68 on: January 15, 2017, 07:23:54 pm »
Great minds think alike.  I was going to use http://indy.fulgan.com/SSL/openssl-1.0.2j-i386-win32.zip but the lazarus URL is better.
Your code looks good.  I'll put it into a unit.  Thanks!

==Update==
V0.2.3.0 now downloads OpenSSL files.  Thanks GetMem and lainz - this is what the forum is all about :)
I made a self-contained unit open_ssl from GetMem's code if anyone wants it.
« Last Edit: January 15, 2017, 08:13:57 pm by minesadorada »
GPL Apps: Health MonitorRetro Ski Run
OnlinePackageManager Components: LazAutoUpdate, LongTimer, PoweredBy, ScrollText, PlaySound, CryptINI

lainz

  • Hero Member
  • *****
  • Posts: 4742
  • Web, Desktop & Android developer
    • https://lainz.github.io/
Re: Laz AutoUpdate component - beta
« Reply #69 on: January 15, 2017, 08:19:26 pm »
Just a thing: When the application runs the .exe updater it runs minimized, there's a reason for that? I need it normal to display correctly the 'you want to run this application' if the application needs to run as administrator. If no needs to run as administrator it has sense to keep it minimized of course.

minesadorada

  • Sr. Member
  • ****
  • Posts: 453
  • Retired
Re: Laz AutoUpdate component - beta
« Reply #70 on: January 15, 2017, 08:33:25 pm »
Just a thing: When the application runs the .exe updater it runs minimized, there's a reason for that? I need it normal to display correctly the 'you want to run this application' if the application needs to run as administrator. If no needs to run as administrator it has sense to keep it minimized of course.
The console updater window is shelled in admin mode in Windows (using 'runas')  Windows 10 requires it to be shelled that way, so I don't have the control that TAsyncProcess properties bring.
It runs in a small window on my system, and that may be a user windows setting.
I chose a console rather than a GUI because I think it's more user-friendly (and linux-friendly) but it would be trivial to put the updatehm code into a GUI if required.

Did I understand your question?  I don't have an army of testers, so any feedback on different systems is valuable.
« Last Edit: January 15, 2017, 08:40:24 pm by minesadorada »
GPL Apps: Health MonitorRetro Ski Run
OnlinePackageManager Components: LazAutoUpdate, LongTimer, PoweredBy, ScrollText, PlaySound, CryptINI

lainz

  • Hero Member
  • *****
  • Posts: 4742
  • Web, Desktop & Android developer
    • https://lainz.github.io/
Re: Laz AutoUpdate component - beta
« Reply #71 on: January 15, 2017, 08:55:30 pm »
Ok. It starts minimized on Windows 10, at least on my PC. For that I think the user will not notice it directly, I don't know if swicthing to a GUI will solve that.

Of course when I click the icon in the taskbar it displays the yes no buttons to run or not it. And then the console is shown as always.

minesadorada

  • Sr. Member
  • ****
  • Posts: 453
  • Retired
Re: Laz AutoUpdate component - beta
« Reply #72 on: January 15, 2017, 10:19:18 pm »
Oh I See.  I don't get a Yes/No prompt on my system, where I run as admin.  For me, the update is non-interactive.
GPL Apps: Health MonitorRetro Ski Run
OnlinePackageManager Components: LazAutoUpdate, LongTimer, PoweredBy, ScrollText, PlaySound, CryptINI

lainz

  • Hero Member
  • *****
  • Posts: 4742
  • Web, Desktop & Android developer
    • https://lainz.github.io/
Re: Laz AutoUpdate component - beta
« Reply #73 on: January 15, 2017, 11:10:38 pm »
You have UAC disabled or configured in a lower setting?

minesadorada

  • Sr. Member
  • ****
  • Posts: 453
  • Retired
Re: Laz AutoUpdate component - beta
« Reply #74 on: January 15, 2017, 11:47:06 pm »
You have UAC disabled or configured in a lower setting?
First thing I did when 'upgrading' to Windows 10.
I saw some stuff online about working with UAC programmatically - there should be a solution out there.
Meanwhile I'll concentrate on GitHub integration.
GPL Apps: Health MonitorRetro Ski Run
OnlinePackageManager Components: LazAutoUpdate, LongTimer, PoweredBy, ScrollText, PlaySound, CryptINI

 

TinyPortal © 2005-2018