Wiki
Download
Manual
Eggs
API
Tests
Bugs
show
edit
history
You can edit this page using
wiki syntax
for markup.
Article contents:
== Outdated egg! This is an egg for CHICKEN 4, the unsupported old release. You're almost certainly looking for [[/eggref/5/versions|the CHICKEN 5 version of this egg]], if it exists. If it does not exist, there may be equivalent functionality provided by another egg; have a look at the [[https://wiki.call-cc.org/chicken-projects/egg-index-5.html|egg index]]. Otherwise, please consider porting this egg to the current version of CHICKEN. == versions [[toc:]] === Introduction This extension provides procedures for handling versioning of arbitrary packages. It should simplify determining when new packages are available based on some string containing version data. This should, hopefully, make life easier for maintainers. === Example <enscript type="scheme"> (use versions) (define full-version (string->version "label1.2.4.5.6extra")) (define v1 (string->version "1.2.0")) (define v2 (string->version "2.0")) (printf "V1: ~A V2: ~A~%" (version->string v1) (version->string (version:bump v2))) (printf "Sorted: ~A~%" (map version->string (version-sort (list v2 v1 full-version)))) </enscript> === Version Strings Version strings have the following format: [LABEL][MAJOR][MINOR][MICRO][PATCH][EXTRA] MAJOR, MINOR, MICRO (if given), and all segments of PATCH (if given) must be separated by dots (.). The version strings have the following semantics: <table> <tr><th>Segment</th><th>Required?</th><th>Format</th><th>Description</th></tr> <tr><td>LABEL</td><td>no</td><td>[any chars]</td><td>Any characters, including digits, are allowed. If the LABEL ends with a digit character, some separator character BESIDES . is required; otherwise, the end of LABEL will be parsed as the MAJOR value. The LABEL segment usually corresponds to the name of the package.</td></tr> <tr><td>MAJOR</td><td>yes</td><td>[integer]</td><td>Major release version.</td></tr> <tr><td>MINOR</td><td>yes</td><td>[integer]</td><td>Minor release version.</td></tr> <tr><td>MICRO</td><td>no</td><td>[integer]</td><td>Micro release version.</td></tr> <tr><td>PATCH</td><td>no</td><td>([integer])...</td><td>Patch version. This may be composed of any number of segments; there is no limit. (This is to allow parsing of version control tree versions.)</td></tr> <tr><td>EXTRA</td><td>no</td>[any chars]</td><td>Extra version suffix, usually for local or maintainer versions. It must be separated from the final element by a non-digit, non-dot character.</td></tr> </table> === Version Records <record>version</record> <procedure>(make-version MAJOR MINOR #!key (label #f) (micro #f) (patch #f) (extra #f))</procedure> Creates a new version record with the given components. MAJOR, MINOR, and MICRO (if given) must be exact non-negative integers. LABEL and EXTRA, if given, must be non-null strings. PATCH (if given) must be either a non-negative exact integer or a list/vector composed of non-negative exact integers. <procedure> (version? OBJ)</procedure> Returns #t if OBJ is a version record. <procedure> (version:label VERSION)</procedure> <procedure> (version:major VERSION)</procedure> <procedure> (version:minor VERSION)</procedure> <procedure> (version:micro VERSION)</procedure> <procedure> (version:patch VERSION)</procedure> <procedure> (version:extra VERSION)</procedure> Returns the specified field of the VERSION record. === Conversion Procedures <procedure>(string->version VERSION-STRING)</procedure> If VERSION-STRING is a string with valid version data, returns a version record with its parsed components. Otherwise, return #f. <procedure> (version->string VERSION)</procedure> Returns the string representation of the given VERSION record. ==== Conversion Rules Two version objects, v1 and v2 are ordered via the rules below. (The version: prefix is ommitted for conciseness.) All string fields are compared with the string=?, string<?, and string>? procedures. All numeric fields or numeric field components are compared with the fx=, fx<, and fx> procedures. The patch field, below, is first checked against the entire field for existence, then each element (if it exists) is compared in order, with an implicit last element of #f. === Comparison Procedures In each of the following procedures, VER1 and VER2 may be either version records or version strings. <procedure>(version-compare VER1 VER2)</procedure> Returns -1 if VER1<VER2, 0 if VER1=VER2, and 1 if VER1>VER2. <procedure>(version=? VER1 VER2)</procedure> <procedure>(version<? VER1 VER2)</procedure> <procedure>(version<=? VER1 VER2)</procedure> <procedure>(version>=? VER1 VER2)</procedure> <procedure>(version>? VER1 VER2)</procedure> Comparison predicates for versions, according to the rules given above. <procedure>(version-exact? VER1 VER2)</procedure> Equivalent to (version=? VER1 VER2). <procedure>(version-older? VER1 VER2)</procedure> Equivalent to (version<? VER1 VER2). <procedure> (version-newer? VER1 VER2)</procedure> Equivalent to (version>? VER1 VER2). === Sorting Procedures <procedure>(version-sort VERSION-LIST [ASCENDING? #t])</procedure> Sorts VERSION-LIST (a list of version strings and/or records). If ASCENDING? is given and #f, VERSION-LIST is sorted in descending order. ASCENDING? defaults to #t. === Bumping Procedures ==== Functional interface All of the following procedures return a fresh version object. <procedure>(bump:major VERSION #!key (to #f))</procedure> Returns a version with the major-part incremented or set to {{to}} if given. <procedure>(bump:minor VERSION #!key (to #f))</procedure> Returns a version with the minor-part incremented or set to {{to}} if given. <procedure>(bump:micro VERSION #!key (to #f))</procedure> Returns a version with the micro-part incremented or set to {{to}} if given. <procedure>(bump:patch VERSION #!key (to #f))</procedure> Returns a version with the patch-part incremented or set to {{to}} if given. <procedure>(bump VERSION)</procedure> Returns a version with the lowest possible part incremented. This procedure tries to do the right thing, and should generaly really do. ==== Mutating interface The following procedures mutate the version record in place. <procedure>(bump:major! VERSION #!key (to #f))</procedure> Increase the major-part of the version by 1 or set to {{to}} if given. <procedure>(bump:minor! VERSION #!key (to #f))</procedure> Increase the minor-part of the version by 1 or set to {{to}} if given. <procedure>(bump:micro! VERSION #!key (to #f))</procedure> Increase the micro-part of the version by 1 or set to {{to}} if given. <procedure>(bump:patch! VERSION #!key (to #f))</procedure> Increase the last number ofthe patch-part by 1 or set to {{to}} if given. <procedure>(bump! VERSION)</procedure> Increase the lowest possible part by 1. This procedure tries to do the right thing, and should generaly really do. === Licence Copyright (C) 2008, Lenny Frank. All rights reserved. Copyright (C) 2011, David Krentzlin. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the Software), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED AS-IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Description of your changes:
I would like to authenticate
Authentication
Username:
Password:
Spam control
What do you get when you subtract 22 from 14?