New Ticket     Tickets     Wiki     Browse Source     Timeline     Roadmap     Ticket Reports     Search

Ticket #19224 (closed defect: fixed)

Opened 4 years ago

Last modified 3 years ago

BUG: variant_isset does not work on required variants

Reported by: raimue@… 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

patch-portutil.tcl.diff (538 bytes) - added by perry@… 4 years ago.

Change History

Changed 4 years ago by perry@…

comment:1 Changed 4 years ago by perry@…

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 4 years ago by perry@…

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 3 years ago by jmr@…

  • Status changed from new to closed
  • Resolution set to fixed
  • Milestone changed from MacPorts Future to MacPorts 1.9.0
Note: See TracTickets for help on using tickets.