Changeset 29028 for trunk/base


Ignore:
Timestamp:
Sep 13, 2007, 12:25:10 PM (12 years ago)
Author:
afb@…
Message:

lint system/group/platforms/categories/epoch/revision too

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/base/src/port1.0/portlint.tcl

    r28568 r29028  
    1313
    1414set_ui_prefix
     15
     16set lint_portsystem \
     17        "1.0"
     18
     19set lint_platforms [list \
     20        "darwin" \
     21        "freebsd" \
     22        "linux" \
     23        "sunos" \
     24        ]
     25
     26set lint_categories [list \
     27        "aqua" \
     28        "archivers" \
     29        "audio" \
     30        "benchmarks" \
     31        "cad" \
     32        "comms" \
     33        "cross" \
     34        "databases" \
     35        "devel" \
     36        "editors" \
     37        "emulators" \
     38        "fuse" \
     39        "games" \
     40        "genealogy" \
     41        "gnome" \
     42        "gnustep" \
     43        "graphics" \
     44        "irc" \
     45        "java" \
     46        "kde" \
     47        "lang" \
     48        "mail" \
     49        "math" \
     50        "multimedia" \
     51        "net" \
     52        "news" \
     53        "palm" \
     54        "perl" \
     55        "print" \
     56        "python" \
     57        "ruby" \
     58        "science" \
     59        "security" \
     60        "shells" \
     61        "sysutils" \
     62        "tex" \
     63        "textproc" \
     64        "www" \
     65        "x11" \
     66        "zope" \
     67        ]
    1568
    1669set lint_required [list \
     
    77130
    78131proc lint_main {args} {
    79         global UI_PREFIX portname portpath
     132        global UI_PREFIX portname portpath portresourcepath
    80133        set portfile ${portpath}/Portfile
     134        set groupdir ${portresourcepath}/group
    81135
    82136        set warnings 0
     
    137191
    138192        if {[string match "PortSystem*" $line]} {
    139             if ($seen_portsystem) {
     193            if {$seen_portsystem} {
    140194                 ui_error "Line $lineno repeats PortSystem information"
    141195                 incr errors
    142196            }
    143             ### TODO: check version
     197            regexp {PortSystem\s+([0-9.]+)} $line -> portsystem
     198            if {![info exists portsystem]} {
     199                 ui_error "Line $lineno has unrecognized PortSystem"
     200                 incr errors
     201            }
    144202            set seen_portsystem true
    145203            set require_blank true
     
    147205        }
    148206        if {[string match "PortGroup*" $line]} {
    149             if ($seen_portgroup) {
     207            if {$seen_portgroup} {
    150208                 ui_error "Line $lineno repeats PortGroup information"
    151209                 incr errors
    152210            }
    153             ### TODO: check group
     211            regexp {PortGroup\s+([a-z0-9]+)\s+([0-9.]+)} $line -> portgroup portgroupversion
     212            if {![info exists portgroup]} {
     213                 ui_error "Line $lineno has unrecognized PortGroup"
     214                 incr errors
     215            }
    154216            set seen_portgroup true
    155217            set require_blank true
     
    185247    global description long_description categories maintainers platforms homepage master_sites checksums
    186248   
    187     global lint_required lint_optional
     249    global lint_portsystem lint_platforms lint_categories lint_required lint_optional
    188250
    189251    if (!$seen_portsystem) {
    190252        ui_error "Didn't find PortSystem specification"
    191253        incr errors
    192     }  else {
    193         ui_info "OK: Found PortSystem specification"
    194     }
    195     if ($seen_portgroup) {
    196         ui_info "OK: Found PortGroup specification"
     254    }  elseif {$portsystem != $lint_portsystem} {
     255        ui_error "Unknown PortSystem: $portsystem"
     256        incr errors
     257    } else {
     258        ui_info "OK: Found PortSystem $portsystem"
     259    }
     260    if (!$seen_portgroup) {
     261        # PortGroup is optional, so missing is OK
     262    }  elseif {![file exists $groupdir/$portgroup-$portgroupversion.tcl]} {
     263        ui_error "Unknown PortGroup: $portgroup-$portgroupversion"
     264        incr errors
     265    } else {
     266        ui_info "OK: Found PortGroup $portgroup-$portgroupversion"
    197267    }
    198268
     
    213283    }
    214284
    215     # TODO: check platforms against known names
    216     # TODO: check categories against known ones
     285    foreach platform $platforms {
     286       if {[lsearch -exact $lint_platforms $platform] == -1} {
     287            ui_error "Unknown platform: $platform"
     288            incr errors
     289        } else {
     290            ui_info "OK: Found platform: $platform"
     291        }
     292    }
     293
     294    foreach category $categories {
     295       if {[lsearch -exact $lint_categories $category] == -1} {
     296            ui_error "Unknown category: $category"
     297            incr errors
     298        } else {
     299            ui_info "OK: Found category: $category"
     300        }
     301    }
    217302
    218303    foreach opt_var $lint_optional {
     
    230315    }
    231316
    232     # TODO: check that ports revision is numeric
    233     # TODO: check that any port epoch is numeric
     317    if {![string is integer -strict $portepoch]} {
     318        ui_error "Port epoch is not numeric:  $portepoch"
     319        incr errors
     320    }
     321    if {![string is integer -strict $portrevision]} {
     322        ui_error "Port revision is not numeric: $portrevision"
     323        incr errors
     324    }
    234325
    235326    if {[string match "*darwinports@opendarwin.org*" $maintainers]} {
Note: See TracChangeset for help on using the changeset viewer.