Opened 15 years ago

Closed 14 years ago

#19224 closed defect (fixed)

BUG: variant_isset does not work on required variants

Reported by: raimue (Rainer Müller) Owned by: macports-tickets@…
Priority: Normal Milestone: MacPorts 1.9.0
Component: base Version: 1.7.1
Keywords: variants requires Cc:
Port:

Description

If a variant foo requires variant bar, [variant_isset bar] does not return true if +foo is selected.

Test Portfile snippet:

variant foo requires bar { 
    ui_msg "Variant foo evaluated!"
}

variant bar { 
    ui_msg "Variant bar evaluated!"
}

build {
    if {[variant_isset foo]} {
        ui_msg "Variant +foo is set!"
    }   
    if {[variant_isset bar]} {
        ui_msg "Variant +bar is set!"
    }   
}

Expected result:

Variant bar evaluated!
Variant foo evaluated!
...
--->  Building testport
Variant +foo is set!
Variant +bar is set!

Actual result:

Variant bar evaluated!
Variant foo evaluated!
...
--->  Building testport
Variant +foo is set!

Attachments (1)

patch-portutil.tcl.diff (538 bytes) - added by lperry (Perry Lee) 14 years ago.

Download all attachments as: .zip

Change History (4)

Changed 14 years ago by lperry (Perry Lee)

Attachment: patch-portutil.tcl.diff added

comment:1 Changed 14 years ago by lperry (Perry Lee)

I've attached a patch that seems to fix the bug. Any thoughts? I'm not sure if I added the logic to the correct place.

comment:2 Changed 14 years ago by lperry (Perry Lee)

Example Run:

perry@phoenix_lan ~/src/lports/devel/foo % port variants                                       Thu Oct 22 22:40:57
foo has the variants:
   bar
     * requires baz
   baz
   foo
     * requires bar
perry@phoenix_lan ~/src/lports/devel/foo % sudo port build +foo                                Thu Oct 22 22:41:00
Warning: foo has no universal variant
Variant baz evaluated!
Variant bar evaluated!
Variant foo evaluated!
--->  Computing dependencies for foo
--->  Fetching foo
--->  Verifying checksum(s) for foo
--->  Extracting foo
--->  Configuring foo
--->  Building foo
Variant +foo is set!
Variant +bar is set!
Variant +baz is set!
perry@phoenix_lan ~/src/lports/devel/foo % sudo port clean                                     Thu Oct 22 22:41:14
Warning: foo has no universal variant
--->  Cleaning foo
perry@phoenix_lan ~/src/lports/devel/foo % sudo port build +bar                                Thu Oct 22 22:41:39
Warning: foo has no universal variant
Variant baz evaluated!
Variant bar evaluated!
--->  Computing dependencies for foo
--->  Fetching foo
--->  Verifying checksum(s) for foo
--->  Extracting foo
--->  Configuring foo
--->  Building foo
Variant +bar is set!
Variant +baz is set!

comment:3 Changed 14 years ago by jmroot (Joshua Root)

Milestone: MacPorts FutureMacPorts 1.9.0
Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.