[Gambas-user] getting Gambas version info across devices

Bruce Steers bsteers4 at gmail.com
Sat Mar 27 01:47:23 CET 2021


On Fri, 26 Mar 2021 at 23:46, Brian G <brian at westwoodsvcs.com> wrote:

> Bruce S
> I am not sure what you are trying to achieve. But if you install with the
> installer, does it not record the info so you can uninstall. And if your
> building in each of those systems, don't you also have the project you can
> query.
> I maybe don't really know what you are trying to do this  for I guess. I
> mean if you sense the os version and just do the apt query or zyppr query
> or what ever is needed  for that OS. It means a table of some kind to know
> which command  for the os version of course....
>
> It would be a lot more reliable, chroot... Or some such thing...
>
> Ummm
>
> --
> Thanks
> Brian
> Friday, 26 March 2021, 03:07PM -07:00 from Bruce Steers bsteers4 at gmail.com
> :
>
>
>
> On Fri, 26 Mar 2021 at 11:36, Bruce Steers <bsteers4 at gmail.com> wrote:
>
> >>
>
> >> This should work for gambas binary files like gbc3 or gba3
> >>    Dim project As Integer = InStr(sfile, "/gambas" & System.version &
> >> "-" & System.Version, 1, gb.Binary)
> >>    Dim length As Integer = InStr(sFile, "/", Project + 1, gb.binary) -
> >> project
> >>    Print Mid(sFile, Project + 1, length - 1)
> >>
> >> output would look like this
> >>
> >> gambas3-3.15.90+git202103222309.dd1a35456+build14e27c76f~ubuntu20.04.1
> >>
> >> "Failure is the key to success;
> >>   each mistake teaches us something"  .. Morihei Ueshiba
> >> Brian G
> >>
> >
> > You should better run "gba3 -x .startup" to get the
> > project startup configuration file contents and get the version from it.
> >
> > This is far more reliable!
> >
> > Regards,
> >
>
> Yes, well, loading a binary file into a string is pretty well going to
> have interesting side effects but in any case the the suggested approach
> for the ELF files doesn't work.
>
> For example, I have searched both gbc3 and gbx3 here and the "tickler"
> gambas3-3 does not occur in those files. I resume it is specific to ubuntu.
>
> b
>
>
> Thanks Brian and Benoit.
>
> The trouble is i also want the trunk version info.
> seems only the binary files have it, the .gambas files like gbs3 only have
> maj.min.rel info
> Using your function on gbs3 Brian my output didn't look anything like
> yours it looked like this...
> *Version=3.15.90*
>
>
> Sorry , that was the gbs3 output.
> The binary method worked for one system Debian-sid and failed for all the
> others :(
> Thank you though :)
> BruceS
>
>
>
> I think i'm happy now with it working on luck ;)
> I'm now using the shell command
> *strings /usr/bin/gbx3 |grep "3\.[0-9].\.[0-9]"*
>
> that returns something like (depending on distro)...
> bonus:~$ strings /usr/bin/gbx3 |grep "3\.[0-9].\.[0-9]"
> 3.15.90 2cbca5242 (bruces-new)
> 3.15.90
>  3.15.90 2cbca5242 (bruces-new)
>
> it the smallest return list of strings I can get that works on all systems.
>
> I'll attach the app in case anyone else has multiple gambas's installed on
> different drives...
>
> What it does...
> uses lsblk to get the drives list and mounts any unmounted drives in
> /mnt/LabelName that has a "label" set.
> if no usr/bin/gbx3 is found it unmounts that drive again.
>
> gets gbx3 version info using the above method and makes a list of the
> disks and their gambas versions.
> GridView list items can be double clicked to xdg-open dir.
>
> On closing it unmounts all the mounted drives again.
>
> It's purpose..
> I often change and/or forget what gambas version is on what drive so i run
> this so i know what one to boot when testing my apps or gambas itself.
>
> Wishing well
> BruceS
>
>
I have some systems installed with default installer others have compiled
install.

It's such a variation there is no easy way to do it "properly" all the
systems work different, even the binaries are made different.

i explained completely what i am trying to achieve in the end of the last
message.
If i want to reboot into a different os to test gambas or an app then this
lists all the gambas versions i have installed on different machines so i
know what one to boot into.
(see attached image)

That's how it looks on my main os Linux-Mint

I tried chroot (got library conflicts) and various other methods before i
did it this way, believe me , i try to do it right before i just settle for
a working hack :)  (this thread pretty much covers the process)

For this application i think just how complicated it is to do a code only
sure fire way is turning out to be not worth it.

the method i have found as far as i see only has one problem that it could
possibly read a numeric only version string before a trunk version
(includes git commit hash) but so far it's 10 for 10 on the 10 systems i
have gambas installed on.

In the attached image all the "numeric only" version strings are from
packager installed gambas versions and the ones with commit hash's are
compiled installs.

Cheers for the help though :)
BruceS
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20210327/4ee5ec57/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: snap.png
Type: image/png
Size: 82933 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20210327/4ee5ec57/attachment-0001.png>


More information about the User mailing list