Opened 4 months ago

Closed 4 months ago

#61426 closed defect (invalid)

port -D flag does not seem to do what it says it does

Reported by: rnkn (Paul W. Rankin) Owned by:
Priority: Normal Milestone:
Component: base Version: 2.6.3
Keywords: Cc:


Calling any subcommand from port -D does not seem to have the effect that its documentation suggests...


-D portdir|portname

Specify a directory to which the port command should change to before processing any actions. If the specified value does not contain any slashes, the value is used to look up a port and the current working directory is set to the corresponding port directory.

Steps to reproduce

  1. clone the macports-ports repo
  2. edit a Portfile
  3. call port -D ./ [info|install|sync|etc.] from edited Portfile directory
  4. call port -D <port> [info|install|sync|etc.] from edited Portfile directory for <port>

Expected results

MacPorts should use edited Portfile.

Actual results

MacPorts ignores edited Portfile.

Change History (3)

comment:1 Changed 4 months ago by ryandesign (Ryan Schmidt)

I must admit I was not aware of the -D flag, but it seems to work for me, if I'm understanding how it's meant to be used. For example, this works:

$ port -D zlib info --name --version
name: zlib
version: 1.2.11

I also tried editing a portfile in a non-default port tree and then running port -D ./ info while in that directory and it reflected my edits.

Can you show a specific command that is not working for you?

Usually when you are editing a portfile and you want to use that portfile, you just use the port command without specifying a port name, e.g. just run port info or sudo port install while in that directory.

The sync command doesn't accept a port name.

comment:2 Changed 4 months ago by rnkn (Paul W. Rankin)

Okay I fundamentally misunderstood how to install a custom Portfile. I did not realise you could just call port <command> from the directory of the Portfile and I was specifying extra arguments.

comment:3 Changed 4 months ago by jmroot (Joshua Root)

Resolution: invalid
Status: newclosed

OK. Let us know if there's a way the documentation could be made more clear.

Note: See TracTickets for help on using tickets.