TCLLIB release version access by program

63 views
Skip to first unread message

Harald Oehlmann

unread,
Sep 16, 2022, 6:29:39 AMSep 16
to
Dear TCL team,
is there any way to get the TCLLIB release version by an API?

It would be great to get it by "package require tcllib" ;-).

Background is a compliance question by Volkswagen.
They check for every used open source component, if the provided licence
file is really in the distribution.
I currently use "package require cmdline" to get the TCLLib version.
This resulted in "1.5". There is no TCLLIB release 1.5, only 1.4 or 1.6.
Thus, I got a complaint.

Thank you and take care,
Harald

heinrichmartin

unread,
Sep 16, 2022, 8:45:12 AMSep 16
to
On Friday, September 16, 2022 at 12:29:39 PM UTC+2, Harald Oehlmann wrote:
> Dear TCL team,

not part of the team, but trying to help

> is there any way to get the TCLLIB release version by an API?
>
> It would be great to get it by "package require tcllib" ;-).

Afaik, the version of the package (see .spec file in the source) is not copied to the install target.

At first glance, you are left with two options:
* get the versions of all packages or of all used packages to create a signature of your deliverable
* get the version of the installed package (package manager, or package itself)

> I currently use "package require cmdline" to get the TCLLib version.
> This resulted in "1.5". There is no TCLLIB release 1.5, only 1.4 or 1.6.

I am not aware of any package that has its version tied to the overall version; but that would probably a way to resolve your request, i.e. add an empty[1] package tcllib.

[1] you don't want to load all packages upon "package require tcllib", do you? ;-)

Robert Heller

unread,
Sep 16, 2022, 9:03:19 AMSep 16
to
"tcllib" is not a package, it is a collection of packages. And tcllib itself
is up to release 1.19 (at least on my Ubuntu 18.04 Linux system):

% dpkg-query -l tcllib
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==============-============-============-=================================
ii tcllib 1.19-dfsg-2 all Standard Tcl Library
--
Robert Heller -- Cell: 413-658-7953 GV: 978-633-5364
Deepwoods Software -- Custom Software Services
http://www.deepsoft.com/ -- Linux Administration Services
hel...@deepsoft.com -- Webhosting Services

Rich

unread,
Sep 16, 2022, 9:45:32 AMSep 16
to
Robert Heller <hel...@deepsoft.com> wrote:
> "tcllib" is not a package, it is a collection of packages. And tcllib itself
> is up to release 1.19 (at least on my Ubuntu 18.04 Linux system):

Ubuntu is quite behind -- the latest release was 1.20 on 2019.12.02
(https://www.tcl-lang.org/software/tcllib/)

Robert Heller

unread,
Sep 16, 2022, 12:10:52 PMSep 16
to
It is on an older LTS release. I expect Ubuntu 20.04 or 22.04 will have a
newer version.

nemethi

unread,
Sep 16, 2022, 12:33:38 PMSep 16
to
Am 16.09.22 um 18:10 schrieb Robert Heller:
> At Fri, 16 Sep 2022 13:45:27 -0000 (UTC) Rich <ri...@example.invalid> wrote:
>
>>
>> Robert Heller <hel...@deepsoft.com> wrote:
>>> "tcllib" is not a package, it is a collection of packages. And tcllib itself
>>> is up to release 1.19 (at least on my Ubuntu 18.04 Linux system):
>>
>> Ubuntu is quite behind -- the latest release was 1.20 on 2019.12.02
>> (https://www.tcl-lang.org/software/tcllib/)
>
> It is on an older LTS release. I expect Ubuntu 20.04 or 22.04 will have a
> newer version.
>
>>
>>
>>
>

Ubuntu 22.04 has tcllib 1.20.

--
Csaba Nemethi https://www.nemethi.de mailto:csaba....@t-online.de

Ashok Nadkarni

unread,
Sep 16, 2022, 12:54:42 PMSep 16
to
On Friday, September 16, 2022 at 7:15:32 PM UTC+5:30, Rich wrote:
> Ubuntu is quite behind -- the latest release was 1.20 on 2019.12.02
> (https://www.tcl-lang.org/software/tcllib/)

Current release is 1.21 released May 2022. https://core.tcl-lang.org/tcllib/doc/trunk/embedded/index.md

It's not only Ubuntu releases that are behind. Tcl website pages are behind as well :-)

/Ashok

clt.to...@dfgh.net

unread,
Sep 16, 2022, 1:01:24 PMSep 16
to
You could get a dict of all packages versions in your tcllib source directory tree:

proc getPkgVer {path} {
# return a dict of all package names and their versions
# from any pkgIndex.tcl file in directories below the given path

# get a list of all lines from all pkgIndex.tcl files
foreach fn [fileutil::find $path {string match pkgIndex.tcl}] {
set ff [open $fn r]
try {lappend lines [split [read $ff] \n]} finally {close $ff}
}
# scan each line for "package ifneeded" and harvest package name and version
# assumes there is only one entry per line
dict create {*}[concat {*}[lmap line $lines {
if {[regexp {package\s+ifneeded\s+(\S+)\s+(\S+)\s} $line x pkg ver]} {
list $pkg $ver
} else {
continue
}
}]]
}

and compare versions for any installed packages:

proc installedPkgs {} {
# return a list of installed packages and their versions
lmap pkg [package names] {
set ver [package provide $pkg]
if {"" eq $ver} {
continue
} else {
list $pkg $ver
}
}
}


I've got what claims to be tcllib 1.21 from may 2022
although it takes some searching to actually find it on source forge.

Dave B

Harald Oehlmann

unread,
Sep 19, 2022, 1:55:07 AMSep 19
to
Am 16.09.2022 um 14:45 schrieb heinrichmartin:> I am not aware of any
package that has its version tied to the overall version; but that would
probably a way to resolve your request, i.e. add an empty[1] package tcllib.
>
> [1] you don't want to load all packages upon "package require tcllib", do you? ;-)

Dear TCL group,
thank you all for the answers, I appreciate. It is always good to know,
that I did not overlook something obvious.

The main pckIndex.tcl file has the release version in a comment and
states to be auto-generated.
So, technically, probably an:
package ifneeded tcllib 1.21 {package provide tcllib 1.21}
would be possible.

Yes, "package require tcllib" will only check if it exists and return
the version. It will not load any modules.

I have filed an RFE on the bug tracker.

Thank you all,
Harald

Reply all
Reply to author
Forward
0 new messages