Opened 10 years ago

Closed 9 years ago

#26406 closed defect (fixed)

.packlist files contain each line twice

Reported by: ryandesign (Ryan Schmidt) Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version: 1.9.1
Keywords: Cc:
Port: perl5 portgroup

Description

Take for example p5-variable-magic:

$ cat /opt/local/lib/perl5/vendor_perl//5.8.9/darwin-2level/auto/Variable/Magic/.packlist
/opt/local/lib/perl5/vendor_perl/5.8.9/darwin-2level/Variable/Magic.pm
/opt/local/lib/perl5/vendor_perl/5.8.9/darwin-2level/auto/Variable/Magic/Magic.bs
/opt/local/lib/perl5/vendor_perl/5.8.9/darwin-2level/auto/Variable/Magic/Magic.bundle
/opt/local/share/man/man3/Variable::Magic.3pm
/opt/local/lib/perl5/vendor_perl/5.8.9/darwin-2level/Variable/Magic.pm
/opt/local/lib/perl5/vendor_perl/5.8.9/darwin-2level/auto/Variable/Magic/Magic.bs
/opt/local/lib/perl5/vendor_perl/5.8.9/darwin-2level/auto/Variable/Magic/Magic.bundle
/opt/local/share/man/man3/Variable::Magic.3pm

But this affects all ports that install a .packlist, which is probably most or all ports in the perl5 portgroup, and some more.

The problem only occurs if the port is already installed and active and is then rebuilt, for example for an upgrade.

During the initial install, all is well and only the paths to the items in the destroot get added to the .packlist. The perl5 portgroup's post-destroot reinplace removes the path to the destroot from each line and that's what gets installed.

On an upgrade install, I think all the lines from the existing .packlist are copied into the new .packlist, then new lines are appended for the paths in the destroot, then when the perl5 portgroup removes the path to the destroot from those lines, they become the same as the first set of lines, making them duplicates.

I think we need some line de-duplication code there, or a way to tell it not to look at an existing .packlist.

A nice shortcut might be to first delete all lines in the new .packlist that do not contain the destroot path. Then remove the destroot path from the remaining lines. This should be an easy two-statement one-liner with sed; I'm not sure if reinplace alone can handle it.

It might be nice if MacPorts base would take care of this for all ports automatically, rather than having to copy a block of code into each port that has a .packlist.

Attachments (2)

portutil.tcl.diff (943 bytes) - added by ryandesign (Ryan Schmidt) 10 years ago.
implements the -n option in reinplace
perl5-1.0.tcl.diff (553 bytes) - added by ryandesign (Ryan Schmidt) 10 years ago.
uses reinplace -n in perl5 portgroup's post-destroot

Download all attachments as: .zip

Change History (6)

comment:1 in reply to:  description ; Changed 10 years ago by ryandesign (Ryan Schmidt)

Replying to ryandesign@…:

This should be an easy two-statement one-liner with sed; I'm not sure if reinplace alone can handle it.

Make that a one-statement one-liner with sed:

sed -n "s|${destroot}||p" ${file}

That would be within an fs-traverse finding all .packlists.

reinplace doesn't have the -n switch though so we may actually have to call out to sed using system. Or we could enhance reinplace to support the -n switch.

Changed 10 years ago by ryandesign (Ryan Schmidt)

Attachment: portutil.tcl.diff added

implements the -n option in reinplace

Changed 10 years ago by ryandesign (Ryan Schmidt)

Attachment: perl5-1.0.tcl.diff added

uses reinplace -n in perl5 portgroup's post-destroot

comment:2 in reply to:  1 Changed 10 years ago by ryandesign (Ryan Schmidt)

Replying to ryandesign@…:

Or we could enhance reinplace to support the -n switch.

Here is a patch that enhances reinplace to have a -n switch, and a patch to modify the perl5 portgroup to use it. Are there any objections to these changes? Obviously the perl5-1.0.tcl patch could not be applied until a new version of MacPorts is released containing the reinplace -n code.

comment:3 Changed 10 years ago by ryandesign (Ryan Schmidt)

Add the -n switch to reinplace in trunk in r73227 and updated the ChangeLog in r73228.

comment:4 Changed 9 years ago by ryandesign (Ryan Schmidt)

Resolution: fixed
Status: newclosed

Updated perl5-1.0 portgroup in r88287.

Note: See TracTickets for help on using tickets.