Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2006-11-16
02:29 • Closed ticket [219296ffff]: package support for alpha, beta releases plus ... artifact: 4312ec6b57 user: dgp
2001-04-04
04:47 • Ticket [219296ffff]: 1 change artifact: 39b8a9d2f9 user: dgp
2001-02-08
13:09 • Ticket [219296ffff]: 1 change artifact: edd3568507 user: dgp
13:07 • Ticket [219296ffff]: 2 changes artifact: f87867f1b1 user: dgp
2000-10-26
05:10 • New ticket [219296ffff]. artifact: 0f0725f529 user: nobody

[package] support for alpha, beta releases

Closed / Accepted219296ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 20 years ago
Descriptionplain2000-10-26 05:10:18
OriginalBugID: 2565 RFE
Version: 8.2
SubmitDate: '1999-08-18'
LastModified: '1999-12-04'
Severity: LOW
Status: UnAssn
Submitter: techsupp
ChangedBy: hobbs
OS: Other
Machine: NA
FixedDate: '2000-10-25'
ClosedDate: '2000-10-25'


Name:
Don Porter

DesiredBehavior:
As discussed in recent threads in c.l.t., the
    [package] command needs extending to support
    alpha and beta releases of packages.  The
    patch supplied here provides that enhancement,
    as well as test suite and documentation changes.
    I request that it be considered for Tcl 8.3.
    
    As a description of the changes as seen at the
    Tcl script level, here are the changed sections
    of package(n):
    
    NAME
         package - Facilities for package loading and version control
    
    SYNOPSIS
         package forget package
         package ifneeded package version ?script?
         package names
         package present ?-exact? package ?version?
         package provide package ?version?
         package require ?-exact? package ?version?
         package threshold package ?threshold?                         |
         package unknown ?command?
         package vcompare version1 version2
         package versions package
         package vsatisfies version1 version2 ?threshold?              |
    _________________________________________________________________
    ...
         package require ?-exact? package ?version?
              This command is typically  invoked  by  Tcl  code  that
              wishes  to  use  a  particular  version of a particular
              package.   The  arguments  indicate  which  package  is
              wanted, and the command ensures that a suitable version
              of the package is loaded into the interpreter.  If  the
              command succeeds, it returns the version number that is
              loaded;  otherwise it generates an error.
    
              If the -exact switch  is  specified  then  the  version  |
              argument  must  also be specified and only a release of  |
              the given version is acceptable.                         |
    
              If  -exact  is  omitted  then  the  set  of  acceptable  |
              releases is determined by the threshold associated with  |
              package (see package threshold) and the value  of  ver-  |
              sion,  if  any.  The threshold is used to rule out some  |
              releases as unacceptable. The threshold value is one of  |
              stable,  beta,  or  alpha.  If the threshold associated  |
              with package is stable, both alpha  and  beta  releases  |
              are deemed unacceptable (see VERSION NUMBERS).  That is  |
              the default. If the threshold associated  with  package  |
              has  been  set  to  beta (by a previous call to package  |
              threshold), then only alpha releases are  deemed  unac-  |
              ceptable.  If the threshold associated with package has  |
              been set to alpha, then no releases  are  deemed  unac-  |
              ceptable  by  the  threshold.   The value of version is  |
              used to determine which of the remaining  releases  are  |
              acceptable.   If  no value of version is specified, all  |
              remaining  releases  are  acceptable.   If  version  is  |
              specified,  then those remaining releases with versions  |
              later than version are acceptable as long as they  have  |
              the same major version number as version.                |
    
              If a release of package has already been  provided  (by  |
              invoking  the package provide command), then it must be  |
              acceptable by the criteria  determined  by  -exact  and  |
              version.   If  so, the command returns immediately.  If  |
              not, the command returns an error with a message noting  |
              the  incompatibility  of  the release which has already  |
              been provided with the needs expressed by this  package  |
              require command.                                         |
    
              If no release of package has  been  provided  yet,  the  |
              command  searches  the database of information provided  |
              by previous package ifneeded  commands  to  see  if  an
              acceptable version of the package is available.  If so,
              the script for the highest acceptable version number is
              invoked;  it  must do whatever is necessary to load the
              package, including  calling  package  provide  for  the
              package.   If  the  package  ifneeded database does not
              contain an acceptable version  of  the  package  and  a
              package  unknown  command  has  been  specified for the
              interpreter then that command is invoked;  when it com-
              pletes,  Tcl  checks again to see if the package is now
              provided or if there is a package ifneeded  script  for
              it.   If  all of these steps fail to provide an accept-
              able version of the package, then the  command  returns
              an error.
    
         package threshold package ?threshold?
    ||
              This command is used to set the threshold value associ-  |
              ated with package.  If the threshold argument  is  sup-  |
              plied,  it  must be one of stable, beta, or alpha.  The  |
              threshold value will influence  future  invocations  of  |
              package  require  package  as  discussed above.  If the  |
              threshold argument is omitted, the command returns  the  |
              current threshold value associated with package.
    ...
         package vsatisfies version1 version2 ?threshold?
    ||
              This command performs the same tests as package require  |
              to determine whether a release with version number ver-  |
              sion1  would  be acceptable given a requirement of ver-  |
              sion2 and a  threshold  value  of  threshold.   If  the  |
              threshold  argument  is  omitted,  a value of stable is  |
              assumed.  This command returns 1 if a release  of  ver-  |
              sion version1 is acceptable, 0 otherwise.
    
    VERSION NUMBERS
         Each release of a package should be labeled  with  a  unique  |
         version  number.  Version numbers are strings made up of one  |
         or more decimal numbers joined together by the  the  charac-  |
         ters ".", "a", or "b".  Examples of version numbers are 2 or  |
         1.162 or 3.1.13.1 or 8.3a1 or 1a35b7.  Version numbers  must  |
         begin  and  end  with a decimal number.  The first number is  |
         called the major version number.  Version  numbers  may  not  |
         have  two  or  more non-digits adjacent to one another.  The  |
         strings ".1", "1.0.3.", "1.a3", and  "1ab6"  are  not  valid  |
         version numbers.                                              |
    
         Package releases may be divided into exactly  three  classes  |
         on  the basis of their version numbers.  Stable releases are  |
         those releases labeled with a version number which does  not  |
         contain  the characters "a" or "b".  Beta releases are those  |
         releases labeled with a version number  which  does  contain  |
         the  character  "b", but does not contain the character "a".  |
         Alpha releases are labeled with a version number which  con-  |
         tains the character "a".                                      |
    
         Version numbers are ordered.  Given two version numbers, the  |
         first  is  either  less  than  (earlier  than), equal to, or  |
         greater than (later than) the second.  The  version  numbers  |
         of  stable  releases  are  compared  one decimal number at a  |
         time, from left to right.  For example, version 2.1 is later  |
         than  1.3  and  version  3.4.6 is later than 3.3.5.  Missing  |
         fields are equivalent to zeroes:  version 1.3 is the same as  |
         version  1.3.0  and  1.3.0.0, so it is earlier than 1.3.1 or  |
         1.3.0.2.  The version numbers of alpha and beta releases are  |
         compared  by substituting ".-1." for each "b" and ".-2." for  |
         each  "a"  and  following  the  same  rules  as  for  stable  |
         releases.  For example, 1.0a2 is earlier than 1.0b1 which is  |
         earlier than 1.0.  The command package vcompare compares two  |
         version numbers.                                              |
    
         Version numbers are not arbitrary labels.  They are meant to  |
         serve  as  an  indicator  of  compatibility  among different  |
         releases of a package.  A later version number is assumed to  |
         be upwards compatible with an earlier version number as long  |
         as both versions have the same major  version  number.   For  |
         example,  Tcl  scripts  written for version 2.3 of a package  |
         should work unchanged under versions 2.3.2, 2.4, and  2.5.1.  |
         Changes  in  the  major  version number signify incompatible  |
         changes:  if code is written to use version 2.1 of  a  pack-  |
         age,  it  is  not  guaranteed to work unmodified with either  |
         version 1.7.3 or version 3.1.   
                                  |
         It is useful at times to be  able  to  make  releases  which  |
         might  break  compatibility  without  incrementing the major  |
         number.  That is where alpha and  beta  releases  enter  the  |
         picture.   Strictly  following  the compatibility rules, for  |
         example, releases 1.1a1 and 1.2b3  should  both  be  upwards  |
         compatible  with release 1.0. When developing new code, how-  |
         ever, unintended incompatibilities can arise which  are  not  |
         detected  until  after the package is released and subjected  |
         to widespread testing.  Alpha and beta releases of a package  |
         are  ignored  by  package require by default.  They are only  |
         deemed acceptable by package require if a previous  call  to  |
         package  threshold has explicitly declared alpha and/or beta  |
         releases of a particular package to be acceptable for  load-  |
         ing.  Releasing an alpha or beta release of a package allows  |
         alpha and beta testers to  voluntarily  try  out  non-stable  |
         releases  by  inserting  package threshold commands in their  |
         scripts.  Meanwhile, by default other  scripts  will  ignore  |
         the  non-stable  releases,  and  accept  only  those release  |
         labeled with stable version numbers.
    ...

Patch:
http://math.nist.gov/mcsd/Staff/DPorter/tcltk/patches/tcl82package.txt

PatchFiles:
tclPkg.c
    pkg.test
    package.n
dgp Ticket [219296ffff]: 2 changes [History diff]2001-02-08 13:07:41
dgp Ticket [219296ffff]: 1 change [History diff]2001-02-08 13:09:13
dgp Ticket [219296ffff]: 1 change [History diff]2001-04-04 04:47:36
dgpplain2006-11-16 02:29:21
Logged In: YES 
user_id=80530
Originator: NO


TIP 268 answered this Request.
Log in (anonymous is fine) to add a comment.