#1168 closed defect (fixed)
The last post-, pre- and proc- is executed for every redefinition (in variants)
Reported by: | pguyot (Paul Guyot) | Owned by: | macports-tickets@… |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | base | Version: | 1.0 |
Keywords: | Cc: | ||
Port: |
Description
If one defines a post- or a pre- procedure in two variants and selects both variants, only the last redefinition will be executed and it will be executed twice.
Example: PortSystem 1.0 name qpopper version 4.0.5 revision 3 categories mail maintainers pguyot@… distfiles ${name}${version}${extract.suffix} master_sites ftp://ftp.qualcomm.com/eudora/servers/unix/popper/ \
http://core.ring.gr.jp/archives/net/mail/qpopper/ \ http://www.ring.gr.jp/archives/net/mail/qpopper/ \ ftp://ftp.nctu.edu.tw/network/mail/qpopper/
checksums md5 e00853280c9e899711f0b0239d3d8f86 worksrcdir ${portname}${portversion}
variant darwin {
post-extract {
ui_msg "darwin"
}
}
variant foo {
post-extract {
ui_msg "foo"
}
}
variant pam {
post-extract {
ui_msg "pam"
}
}
port extract +foo +pam +darwin
will result to pam pam pam
instead of darwin foo pam
The bug is actually that a hook is registered with only one name while in the ditem pre/post/proc array, it's appended to the list of procedures to call. So in the ditem's post array, we'll have proc-post-com.apple.extract-extract twice (or three times in this example) and this function will be the last definition (the previous ones will be forgotten).
The attached patch fixes the bug by appending an index for every pre/post/proc function we already have. In other words, it adds to the ditem's post/pre/proc arrays something like: proc-post-com.apple.extract-extract-0, proc-post-com.apple.extract-extract-1, proc-post-com.apple.extract-extract-2
and defines that many functions.
It fixes the problem for the example shown above.
Do we have any test suite where we could add this example?
Attachments (1)
Change History (3)
Changed 21 years ago by pguyot (Paul Guyot)
Attachment: | portutil.tcl.diff added |
---|
comment:1 Changed 21 years ago by pguyot (Paul Guyot)
blocked: | → 1089 |
---|
comment:2 Changed 21 years ago by jkh@…
Resolution: | → fixed |
---|---|
Status: | new → closed |
Patch for src/port1.0/portutil.tcl that fixes the bug by adding a suffix to hook names.