Changeset 82291


Ignore:
Timestamp:
Aug 12, 2011, 9:00:56 AM (9 years ago)
Author:
afb@…
Message:

rename rpm-vercomp to vercmp (not really rpm compatible)

Location:
trunk/base
Files:
1 added
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/base/doc/portfile.7

    r79593 r82291  
    21202120.It Ic md5 Ar
    21212121Compute the MD5 hashes of the file(s).
    2122 .It Ic rpm-vercomp Ar versionA Ar versionB
    2123 Compare two RPM-format versions for equality.  The return value is like
     2122.It Ic vercmp Ar versionA Ar versionB
     2123Compare two EVR-format versions for equality.  The return value is like
    21242124strcmp(), returning -1, 0, or 1 when versionA is earlier, equal to, or
    21252125later than versionB, respectively.  Note that some comparisions featuring
  • trunk/base/src/cregistry/vercomp.c

    r65474 r82291  
    4848
    4949/**
    50  * RPM version comparison. Shamelessly copied from Pextlib, with some changes to
     50 * EVR version comparison. Shamelessly copied from Pextlib, with some changes to
    5151 * use string lengths instead of strlen by default. That's necessary to make it
    5252 * work with sqlite3 collations. It should be shared with Pextlib, rather than
     
    5959 * @return              -1 if A < B; 0 if A = B; 1 if A > B
    6060 */
    61 static int rpm_vercomp (const char *versionA, int lengthA, const char *versionB,
     61static int vercmp (const char *versionA, int lengthA, const char *versionB,
    6262        int lengthB) {
    6363    const char *endA, *endB;
     
    174174/**
    175175 * VERSION collation for sqlite3. This function collates text according to
    176  * pextlib's rpm-vercomp function. This allows direct comparison and sorting of
     176 * pextlib's vercmp function. This allows direct comparison and sorting of
    177177 * version columns, such as port.version and port.revision.
    178178 *
     
    186186int sql_version(void* userdata UNUSED, int alen, const void* a, int blen,
    187187        const void* b) {
    188     return rpm_vercomp((const char*)a, alen, (const char*)b, blen);
     188    return vercmp((const char*)a, alen, (const char*)b, blen);
    189189}
  • trunk/base/src/macports1.0/macports.tcl

    r81832 r82291  
    30043004
    30053005    # check if we we need to rebuild base
    3006     set comp [rpm-vercomp $macports_version_new $macports::autoconf::macports_version]
     3006    set comp [vercmp $macports_version_new $macports::autoconf::macports_version]
    30073007    if {$use_the_force_luke == "yes" || $comp > 0} {
    30083008        if {[info exists options(ports_dryrun)] && $options(ports_dryrun) == "yes"} {
     
    32273227        set epoch [lindex $i 5]
    32283228        if { $version_installed == {} || ($epoch > $epoch_installed && $version != $version_installed) ||
    3229                 ($epoch >= $epoch_installed && [rpm-vercomp $version $version_installed] > 0)
     3229                ($epoch >= $epoch_installed && [vercmp $version $version_installed] > 0)
    32303230                || ($epoch >= $epoch_installed
    3231                     && [rpm-vercomp $version $version_installed] == 0
     3231                    && [vercmp $version $version_installed] == 0
    32323232                    && $revision > $revision_installed)} {
    32333233            set version_installed $version
     
    33613361    set will_install yes
    33623362    # check installed version against version in ports
    3363     if { ( [rpm-vercomp $version_installed $version_in_tree] > 0
    3364             || ([rpm-vercomp $version_installed $version_in_tree] == 0
    3365                 && [rpm-vercomp $revision_installed $revision_in_tree] >= 0 ))
     3363    if { ( [vercmp $version_installed $version_in_tree] > 0
     3364            || ([vercmp $version_installed $version_in_tree] == 0
     3365                && [vercmp $revision_installed $revision_in_tree] >= 0 ))
    33663366        && ![info exists options(ports_upgrade_force)] } {
    33673367        if {$portname != $newname} {
  • trunk/base/src/pextlib1.0/Makefile

    r79782 r82291  
    2323        ${TCLSH} tests/symlink.tcl ./${SHLIB_NAME}
    2424        ${TCLSH} tests/unsetenv.tcl ./${SHLIB_NAME}
     25        ${TCLSH} tests/vercomp.tcl ./${SHLIB_NAME}
  • trunk/base/src/pextlib1.0/Pextlib.c

    r79773 r82291  
    485485        Tcl_CreateObjCommand(interp, "fs-traverse", FsTraverseCmd, NULL, NULL);
    486486        Tcl_CreateObjCommand(interp, "filemap", FilemapCmd, NULL, NULL);
    487         Tcl_CreateObjCommand(interp, "rpm-vercomp", RPMVercompCmd, NULL, NULL);
     487#if 1
     488        /* the name "rpm-vercomp" is deprecated, use "vercmp" instead */
     489        Tcl_CreateObjCommand(interp, "rpm-vercomp", VercompCmd, NULL, NULL);
     490#endif
     491        Tcl_CreateObjCommand(interp, "vercmp", VercompCmd, NULL, NULL);
    488492        Tcl_CreateObjCommand(interp, "rmd160", RMD160Cmd, NULL, NULL);
    489493        Tcl_CreateObjCommand(interp, "sha256", SHA256Cmd, NULL, NULL);
  • trunk/base/src/pextlib1.0/vercomp.c

    r79593 r82291  
    22 * vercomp.c
    33 * $Id$
    4  * RPM compatible version comparison
     4 * version comparison
    55 *
    66 * Author: Landon Fuller <landonf@macports.org>
     
    4949 * If A is newer than B, return an integer > 0
    5050 * If A and B are equal, return 0
    51  * If B is newer than A, retun an integer < 0
     51 * If B is newer than A, return an integer < 0
    5252 */
    5353
    54 static int rpm_vercomp (const char *versionA, const char *versionB) {
     54static int vercmp (const char *versionA, const char *versionB) {
    5555        const char *ptrA, *ptrB;
    5656        const char *eptrA, *eptrB;
     
    156156}
    157157
    158 int RPMVercompCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
     158int VercompCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
    159159{
    160160        Tcl_Obj *tcl_result;
     
    170170        versionB = Tcl_GetString(objv[2]);
    171171
    172         rval = rpm_vercomp(versionA, versionB);
     172        rval = vercmp(versionA, versionB);
    173173
    174174        tcl_result = Tcl_NewIntObj(rval);
  • trunk/base/src/pextlib1.0/vercomp.h

    r79593 r82291  
    3333 */
    3434
    35 int RPMVercompCmd(ClientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]);
     35int VercompCmd(ClientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]);
  • trunk/base/src/port/port.tcl

    r81602 r82291  
    483483    set avr_ [split $a_(version) "_"]
    484484    set bvr_ [split $b_(version) "_"]
    485     set vercmp [rpm-vercomp [lindex $avr_ 0] [lindex $bvr_ 0]]
    486     if {$vercmp != 0} {
    487         return $vercmp
     485    set versioncmp [vercmp [lindex $avr_ 0] [lindex $bvr_ 0]]
     486    if {$versioncmp != 0} {
     487        return $versioncmp
    488488    }
    489489    set ar_ [lindex $avr_ 1]
     
    856856                set comp_result [expr $installed_epoch - $latest_epoch]
    857857                if { $comp_result == 0 } {
    858                     set comp_result [rpm-vercomp $installed_version $latest_version]
     858                    set comp_result [vercmp $installed_version $latest_version]
    859859                }
    860860            }
     
    30803080            # Compare versions, first checking epoch, then version, then revision
    30813081            set epoch_comp_result [expr $installed_epoch - $latest_epoch]
    3082             set comp_result [rpm-vercomp $installed_version $latest_version]
     3082            set comp_result [vercmp $installed_version $latest_version]
    30833083            if { $comp_result == 0 } {
    30843084                set comp_result [expr $installed_revision - $latest_revision]
  • trunk/base/src/port1.0/portconfigure.tcl

    r81557 r82291  
    357357    if {$xcodeversion == "none" || $xcodeversion == ""} {
    358358        return cc
    359     } elseif {[rpm-vercomp $xcodeversion 4.2] >= 0} {
     359    } elseif {[vercmp $xcodeversion 4.2] >= 0} {
    360360        return clang
    361     } elseif {[rpm-vercomp $xcodeversion 4.0] >= 0} {
     361    } elseif {[vercmp $xcodeversion 4.0] >= 0} {
    362362        return llvm-gcc-4.2
    363     } elseif {[rpm-vercomp $xcodeversion 3.2] >= 0 && $macosx_deployment_target != "10.4"} {
     363    } elseif {[vercmp $xcodeversion 3.2] >= 0 && $macosx_deployment_target != "10.4"} {
    364364        return gcc-4.2
    365365    } else {
  • trunk/base/src/port1.0/portlivecheck.tcl

    r80779 r82291  
    176176                        if {[regexp $the_re $line matched upver]} {
    177177                            set foundmatch 1
    178                             if {$updated_version == 0 || [rpm-vercomp $upver $updated_version] > 0} {
     178                            if {$updated_version == 0 || [vercmp $upver $updated_version] > 0} {
    179179                                set updated_version $upver
    180180                            }
  • trunk/base/src/port1.0/portutil.tcl

    r81630 r82291  
    27232723        if {$xcodeversion == "none"} {
    27242724            ui_warn "Xcode does not appear to be installed; most ports will likely fail to build."
    2725         } elseif {[rpm-vercomp $xcodeversion $min] < 0} {
     2725        } elseif {[vercmp $xcodeversion $min] < 0} {
    27262726            ui_error "The installed version of Xcode (${xcodeversion}) is too old to use on the installed OS version. Version $rec or later is recommended on Mac OS X ${macosx_version}."
    27272727            return 1
    2728         } elseif {[rpm-vercomp $xcodeversion $ok] < 0} {
     2728        } elseif {[vercmp $xcodeversion $ok] < 0} {
    27292729            ui_warn "The installed version of Xcode (${xcodeversion}) is known to cause problems. Version $rec or later is recommended on Mac OS X ${macosx_version}."
    27302730        }
  • trunk/base/tests/test/xcodeversion/Portfile

    r79489 r82291  
    2020
    2121test {
     22        # rpm-vercomp is now deprecated, change it here too when removed
     23        # from all ports and base (but keep this test here, meanwhile...)
    2224        if {$xcodeversion != "" && [rpm-vercomp $xcodeversion 2.1] >= 0} {
    2325                ui_msg "xcodeversion >= 2.1"
Note: See TracChangeset for help on using the changeset viewer.