### Bookstore

 Computer Math and Games in Pascal (preview) Lazarus Handbook

### Author Topic: Online Package Manager  (Read 670776 times)

#### GetMem

• Hero Member
• Posts: 3490
##### Re: Online Package Manager
« Reply #2055 on: September 10, 2021, 08:51:09 pm »
Hi lainz and Aleksey

Quote
Hi, I'm asking a question, if it's possible to add Rx controls newest commit r8084 since it has a fix on rxdbgrid. If not possible no problem at all. Thanks.
I updated Rx, unfortunately I get an error both with Lazarus 2.0.12/Trunk. Please see attached image for more details. Once the error is fixed I will update the package again as soon as possible. Thank you!

#### lainz

• Hero Member
• Posts: 3848
##### Re: Online Package Manager
« Reply #2056 on: September 10, 2021, 11:13:33 pm »
Yes I had the same problem, just deleting the ifdef lines works, but is not the real solution.

• New Member
• Posts: 37
##### Re: Online Package Manager
« Reply #2057 on: September 14, 2021, 02:26:51 pm »
Hi, GetMem!

#### wp

• Hero Member
• Posts: 8877
##### Re: Online Package Manager
« Reply #2058 on: September 14, 2021, 04:36:25 pm »
GetMem, could you please update the following packages in OPM
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

#### GetMem

• Hero Member
• Posts: 3490
##### Re: Online Package Manager
« Reply #2059 on: September 14, 2021, 07:31:04 pm »

Thanks! I updated the packages.

#### wp

• Hero Member
• Posts: 8877
##### Re: Online Package Manager
« Reply #2060 on: September 16, 2021, 11:20:32 am »
GetMem, sorry - the recently updated version of CalLite still contains a compilation issue with ancient Lazarus/fpc versions: please update OPM to v0.3.9 (https://sourceforge.net/projects/lazarus-ccr/files/CalLite/callite-0.3.9.zip/download)
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

#### GetMem

• Hero Member
• Posts: 3490
##### Re: Online Package Manager
« Reply #2061 on: September 16, 2021, 11:39:15 am »
GetMem, sorry - the recently updated version of CalLite still contains a compilation issue with ancient Lazarus/fpc versions: please update OPM to v0.3.9 (https://sourceforge.net/projects/lazarus-ccr/files/CalLite/callite-0.3.9.zip/download)
Done. Thank you!

#### wp

• Hero Member
• Posts: 8877
##### Re: Online Package Manager
« Reply #2062 on: September 27, 2021, 11:53:25 pm »
Motivated by https://forum.lazarus.freepascal.org/index.php/topic,56504.msg419757.html#msg419757, I installed the EyeCandyControls today. At first it worked correctly, but later I tried it again and installed the package over the already existing one. Now the installation failed with the message
Quote
Cannot extract package: "EyeCandyControls.zip".
Error message:"Unable to create file "D:\Prog_Lazarus\packages\EC_Controls\ECLW\mf570-io.jpeg"

I repeated the installation of the package manually, and then I was prompted that this jpeg file already exists and must be overwritten.

The problem was that the file is write-protected. Therefore I must confirm to overwrite it in manual installation. In automatic installation by OPM, however, this is not possible and installation aborts.

I don't know whether this file really must be write-protected. But if this is needed we have an issue with OPM which cannot proceed in such a case.

GetMem, is it possible to modify the unzip routines of OPM such that the user can tell how to continue? Or alternatively, maybe OPM should erase all files in the destination installation directory before installation begins?
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

#### GetMem

• Hero Member
• Posts: 3490
##### Re: Online Package Manager
« Reply #2063 on: September 28, 2021, 10:12:27 am »
Hi wp,

I went with the second option(delete the destination directory before install) which is a good idea since the directory structure of a package can change in time, so a cleanup before installation should be always performed. Unfortunately DeleteDirectory(FileUtils) fails if a file is write-protected, so I wrote my own routine to delete the folder.  Now I can install EyeCandyControls several times without any issues. Can you please test with Lazarus trunk?

#### wp

• Hero Member
• Posts: 8877
##### Re: Online Package Manager
« Reply #2064 on: September 28, 2021, 12:35:34 pm »
Thank you, perfect.

I am almost sure that the following case does not apply, but just to make sure: Will the installation always go into a separate directory in the local repository for the package? Otherwise, erasing the destination directory would erase the local repository (and if that were c:\ it would erase c:\ ...).
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

#### GetMem

• Hero Member
• Posts: 3490
##### Re: Online Package Manager
« Reply #2065 on: September 28, 2021, 01:12:40 pm »
@wp

Quote
Will the installation always go into a separate directory in the local repository for the package?
Yes. Let's say you wish to install callite and you change the local repository to c:\, OPM will download the zipfile to c:\callite.zip, then extract it to c:\callite folder. Next time, before install, OPM will try to delete the c:\callite folder. Actually I tested this a few minutes ago and works as expected.

PS: Installing packages to c:\ is a very bad idea though, hopefully no one attempts the maneuver. Other then permission issues, the c drive will be full with random directories and zip files.
« Last Edit: September 28, 2021, 01:40:38 pm by GetMem »

#### wp

• Hero Member
• Posts: 8877
##### Re: Online Package Manager
« Reply #2066 on: September 28, 2021, 02:56:22 pm »
Quote
Will the installation always go into a separate directory in the local repository for the package?
Yes. Let's say you wish to install callite and you change the local repository to c:\, OPM will download the zipfile to c:\callite.zip, then extract it to c:\callite folder. Next time, before install, OPM will try to delete the c:\callite folder. Actually I tested this a few minutes ago and works as expected.
I understand. There is one thing which still confuses me. When I install callite inte my local repo the file structure is
Code: [Select]
` (local repository)  |- callite     |- callight_pkg.lpk     |- README.txt     |- source        |- calendarlite.pas  etc. `Now the package-zip itself has all folders in a callite folder, i.e. the file structure in the zip is
Code: [Select]
`  callite  |-  callight_pkg.lpk  |-  README.txt  |- source       |- calendarlite.pasetc. `So I could say that the file structure is directly transferred from the zip to the local repo.

What if had created the zip without the callite subfolder? i.e. with a directory structure like this
Code: [Select]
`  callight_pkg.lpk  README.txt  |- source     |- calendarlite.pasetc. `Wouldn't the file then go directly into the local repo folder? Now a delete of the installation folder would erase the local repo.

Or is it such that an installation always goes into its own subfolder named after the OPM name, regardless of whether the zip files are in an equally named folder already?

Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

#### GetMem

• Hero Member
• Posts: 3490
##### Re: Online Package Manager
« Reply #2067 on: September 28, 2021, 04:39:50 pm »
@wp

Quote
I understand. There is one thing which still confuses me. When I install callite inte my local repo the file structure is
Code: [Select]

(local repository)
|- callite
|- callight_pkg.lpk
|- source
|- calendarlite.pas
etc.

Now the package-zip itself has all folders in a callite folder, i.e. the file structure in the zip is
Code: [Select]

callite
|-  callight_pkg.lpk
|- source
|- calendarlite.pas
etc.

So I could say that the file structure is directly transferred from the zip to the local repo.
Yes, this is correct.

Quote
What if had created the zip without the callite subfolder? i.e. with a directory structure like this
Code: [Select]

callight_pkg.lpk
|- source
|- calendarlite.pas
etc.
You can't, if you go to OPM->Create->Create repository package, the first thing you do is select a base directory. OPM will search for *.lpk files in that folder. When the zip file is create the base folder is always included. You can test this by right clicking the package tree, then click "Show Json", each package has a non-empty "PackageBaseDir" entry(please see attached screenshot).

Let's assume a package maintainer removes the base directory from the zip and creates the structure you mentioned above(no base folder) and the package is installed via the "Install->External repostory" feature.  Even this scenario is covered in opkman_zipper unit:
Code: Pascal  [Select][+][-]
1.   if MPkg.IsDirZipped then //has base directory
2.       FUnZipper.OutputPath := FDstDir //proceed as normal
3.   else
4.      FUnZipper.OutputPath := FDstDir + MPkg.PackageBaseDir; //add base directory, which is taken from the central repository's main json(always a non-empty string).
5.

So I would say is not possible to purge the c:\ or d:\ drive. One extra fail safe I could add to my newly created CleanDirectory function is to check if the path is not a drive. This would be a windows only check of course. What do you think?

#### wp

• Hero Member
• Posts: 8877
##### Re: Online Package Manager
« Reply #2068 on: September 28, 2021, 04:56:56 pm »
No I think that's fine this way.
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

#### wp

• Hero Member
• Posts: 8877
##### Re: Online Package Manager
« Reply #2069 on: October 01, 2021, 11:44:51 pm »
As discussed in the thread https://forum.lazarus.freepascal.org/index.php/topic,56335.msg418778.html#msg418778, I am submitting my CAPTCHA component for inclusion in the online package manager.