[Gambas-user] Update ide Package module for shared libraries, Make installation packages to have preinst and postinst scripts

Brian G brian at westwoodsvcs.com
Tue Feb 25 03:39:54 CET 2020


I only want to save major releases i.e. 4.0 to 5.0 as a production applications may use different version of the library. 


Right now every level is removed by an install package only the last one remains. The system shared libraries keep multiple versions for that reason.




That's not true about the users ~ lib it keeps all the versions. But not the .Deb file installs.


I am not moving the files only preventing them from being deleted. 


I am using gbs3 from inside the ide, so it should already be installed. At least I thought so. Oh well. 






thank you


brian







On Mon, Feb 24, 2020 at 5:56 PM -0800, "Benoît Minisini" <g4mba5 at gmail.com> wrote:










Le 25/02/2020 à 02:07, Brian G a écrit :
> Since with Gambas shared libraries we can not use the dh_mkshlib as it 
> also changes system paths etc
> 
> I would like to add the following code to generate preinst and postinst 
> scripts for preserving older versions of shared libraries
> 
> This change is from the package.module in the ide , there could be some 
> imposed rules for these script regarding how they process the shared 
> libraries.
> 
> This would be done to preserve applications that use older versions of 
> the libraries. Linux shared libraries do allow this and usually create 
> a  link to  the most current as a default version.
> 
> This is from the Debian build, But can be added for the others as well.
> 
> I am including a testexec library which contains the created scripts as 
> examples
> 
> Case Project.TYPE_LIBRARY
>        Dim PrePostFiles As File
>        PrePostFiles = Open sPackagePath &/ "debian/preinst" For Create
>        Print #PrePostFiles, "#!/usr/bin/gbs" & System.version
>        Print #PrePostFiles, "print \"Gambas Running Pre Install Shared 
> Library Process\""
>        Print #PrePostFiles, "if not exist(\"/usr/lib/gambas" & 
> System.version &/ LCase($sVendor) & "\") then quit 0"   ' never 
> installed before
>        Print #PrePostFiles, "print \"Gambas Running Pre Install Shared 
> Library Process Checking for .lib\""
>        Print #PrePostFiles, "If Not Exist(\"/usr/lib/gambas" & 
> System.version &/ LCase($sVendor) &/ ".lib\") then mkdir 
> \"/usr/lib/gambas" & System.version &/ LCase($sVendor) &/ ".lib\""
>        Print #PrePostFiles, "print \"Gambas Running Pre Install Shared 
> Library Process Checking each file LIKE:" & $sName & "*\""
>        Print #PrePostFiles, "For each i as string in 
> dir(\"/usr/lib/gambas" & System.version &/ LCase($sVendor) & "\",\"" & 
> $sName & "*\",gb.file)"
>        Print #PrePostFiles, "Print \"Gambas Pre Install Moving : \" ; i"
>        Print #PrePostFiles, "Move \"/usr/lib/gambas" & System.version &/ 
> LCase($sVendor) & "\" &/ i To \"/usr/lib/gambas" & System.version &/ 
> LCase($sVendor) &/ ".lib\" &/ i"
>        Print #PrePostFiles, "Next"
>        Print #PrePostFiles, "print \"Gambas Ending Pre Install Shared 
> Library Process\""
>        Close #PrePostFiles
>        Chmod sPackagePath &/ "debian/preinst" To "rwxr-xr-x"
>        PrePostFiles = Open sPackagePath &/ "debian/postinst" For Create
>        Print #PrePostFiles, "#!/usr/bin/gbs" & System.version
>        Print #PrePostFiles, "print \"Gambas Running Post Install Shared 
> Library Process\""
>        Print #PrePostFiles, "if not exist(\"/usr/lib/gambas" & 
> System.version &/ LCase($sVendor) &/ ".lib\") then quit 0"   ' never 
> installed before
>        Print #PrePostFiles, "For Each i As String In 
> Dir(\"/usr/lib/gambas" & System.version &/ LCase($sVendor) &/ ".lib\")"
>        Print #PrePostFiles, "Print \"Gambas Post Install Chking Lib: \";i"
>        Print #PrePostFiles, "If Not Exist(\"/usr/lib/gambas" & 
> System.version &/ LCase($sVendor) & "\" &/  i) Then"
>        Print #PrePostFiles, "Print \"Gambas Post Install Making 
> Available Lib: \";i"
>        Print #PrePostFiles, " Move \"/usr/lib/gambas" & System.version 
> &/ LCase($sVendor) &/ ".lib\" &/ i To \"/usr/lib/gambas" & 
> System.version &/ LCase($sVendor) & "/\" &/ i"
>        Print #PrePostFiles, "Else"
>        Print #PrePostFiles, " Kill \"/usr/lib/gambas" & System.version 
> &/ LCase($sVendor) &/ ".lib\" &/ i"
>        Print #PrePostFiles, " Print\"Gambas Post Install :\"; i ; \"  - 
> Newer version same level installed\""
>        Print #PrePostFiles, "Endif"
>        Print #PrePostFiles, "next"
>        Close #PrePostFiles
>        Chmod sPackagePath &/ "debian/postinst" To "rwxr-xr-x"
>        Print #hFile, "src/"; $sName; "/"; $sLibraryName; ".gambas 
> usr/lib/gambas" & System.Version; "/"; LCase($sVendor)
>      Case Project.TYPE_NORMAL
>     .........
> 
> Thank You
> Brian G
> 
> 
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
> 

Why, when installing a library package, do you want to save a possible 
already installed library of the same name ?

The library already has its major and minor version in its name. So you 
can already install different versions of the same library.

And doing that breaks the packager, by moving files installed from 
another package.

Moreover, you must not use gbs inside a package script.

What the hell is that !?

-- 
Benoît Minisini

----[ http://gambaswiki.org/wiki/doc/netiquette ]----





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20200225/8253634b/attachment.html>


More information about the User mailing list