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

Benoît Minisini g4mba5 at gmail.com
Tue Feb 25 02:55:41 CET 2020


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


More information about the User mailing list