New Ticket     Wiki     Browse Source     Timeline     Roadmap     Ticket Reports     Search

Ticket #421 (closed enhancement: fixed)

Opened 9 years ago

Last modified 3 years ago

Feature request: bug and user_notes keywords

Reported by: gwright@… Owned by: perry@…
Priority: Normal Milestone: MacPorts 1.8.0
Component: base Version:
Keywords: Cc: waqar@…, raimue@…
Port:

Description (last modified by jmpp@…) (diff)

In my portfiles I use two keywords to give the maintainer and user some useful information. For now, I comment them out. The keywords are 'bugs' and 'user_notes'.

'bugs' is intended to tell the maintainer about infelicities in the port. This might include delicate hacks needed to get it running or unsupported features.

'user_notes' is usually a reminder that the user has to do something to get the expected behavior, like set an enviroment variable. It can also warn of pitfalls for the unwary.

The 'user_notes' variable could be displayed at the end of installation from the command line, or in a text window from the GUI version. Maintainers (and other knowledgable users) can be expected to grep for 'bugs', but it might be nice if the GUI supported display of the 'bugs' value for advanced users.

These seem to be both useful and unlikely to break anything. Could they be added to the port system?

Attachments

patch-portactivate.tcl.diff Download (1.6 KB) - added by perry@… 3 years ago.
Portfile Download (1.1 KB) - added by perry@… 3 years ago.

Change History

  Changed 9 years ago by kevin@…

  • owner changed from kevin@… to darwinports-bugs@…

  Changed 8 years ago by waqar@…

  • cc waqar@… added

  Changed 7 years ago by toby@…

  • component changed from dports to base

  Changed 5 years ago by markd@…

  • type changed from defect to enhancement

  Changed 5 years ago by pipping@…

  • milestone set to MacPorts 1.5

  Changed 5 years ago by nox@…

  • priority changed from Expected to Normal
  • cc waqar@… added; waqar@… removed
  • version 1.0 deleted

  Changed 4 years ago by jmpp@…

  • description modified (diff)
  • milestone changed from MacPorts 1.5 to MacPorts base enhancements

  Changed 3 years ago by jmr@…

  • milestone changed from MacPorts base enhancements to MacPorts 1.8.0

  Changed 3 years ago by perry@…

Looks like this ticket has been opened for awhile ;) -- I'll go ahead and take a stab at it.

On top of what has already been described, it might be useful to add a new port command (i.e., port notes foo) that displays any notes associated with a port. That way users can see the user notes before installing a port and/or in case the user misses the message displayed at the end of installation.

Before I go ahead and implement the described behavior for user_notes (display it at the end of installation) and add the two commands bugs and notes, should I wait for further discussion or bring this ticket up on the dev mailing list?

follow-up: ↓ 11   Changed 3 years ago by raimue@…

  • cc raimue@… added

The user notes seem useful to me.

But I don't understand what bugs should contain. Port bugs should be filed in Trac with a correct 'Port' field. Other stuff can be added as comments. If you want to improve/update the Portfile you have to look at it anyway.

in reply to: ↑ 10   Changed 3 years ago by perry@…

Replying to raimue@…:

But I don't understand what bugs should contain. Port bugs should be filed in Trac with a correct 'Port' field. Other stuff can be added as comments. If you want to improve/update the Portfile you have to look at it anyway.

That makes sense to me -- should the bugs portion of this ticket be removed then?

For now, I've implemented the following (r45686):

  • I added a new field (notes) to PortInfo in portutil.tcl.
  • I added a new action (action_notes) in port.tcl that displays notes set in the Portfile (not PortIndex, though an option that reads notes from the index can be added -- much like in action_info).
  • At the end of activate_main in portactivate.tcl, notes are displayed. Note that action_activate does not call this procedure (it uses portimage::activate instead). This means that notes are only displayed when port install or port upgrade is called -- not during port activate.

To test the implementation, I created an example Portfile (foo) that contains the following lines in particular:

notes This message is stored in notes. It is displayed at\
      \nthe end of the activation phase and when action_notes\
      \nis invoked.

When port install foo or port upgrade foo is called:

--->  Installing foo @0.2.1_0+darwin_9
--->  Activating foo @0.2.1_0+darwin_9

This message is stored in notes. It is displayed at 
the end of the activation phase and when action_notes 
is invoked.

--->  Cleaning foo

When port notes elinks foo git-core is called:

elinks has no notes.
foo has the following notes:
    This message is stored in notes. It is displayed at 
    the end of the activation phase and when action_notes 
    is invoked.
git-core has no notes.

  Changed 3 years ago by perry@…

Unless there are any reasons not to do so, in a couple of days I'll go ahead and merge the existing code into trunk so more people can test/use the keyword.

  Changed 3 years ago by perry@…

Merged into trunk in r46061.

  Changed 3 years ago by jmr@…

  • owner changed from macports-tickets@… to perry@…

I don't see any value in storing the notes in the index and thus making it even bigger. Is anyone really going to want to search on the notes field?

  Changed 3 years ago by perry@…

That's a good point; I'll go ahead and remove the field from PortInfo.

  Changed 3 years ago by perry@…

The notes field was removed in r46632.

  Changed 3 years ago by perry@…

I've attached a patch that wraps the notes output (in portactivate.tcl) to the terminal's width. It uses the same logic as the wrap* procs in port/port.tcl. Is there a better way to share the code than duplicating the logic in portactivate.tcl?

I've also attached the Portfile that I've been using to test the functionality.

Changed 3 years ago by perry@…

Changed 3 years ago by perry@…

  Changed 3 years ago by perry@…

In r49104, I reverted to storing notes in PortInfo now that PortInfo keys are limited to those that are searchable (r47874).

  Changed 3 years ago by perry@…

For the time being, I've committed the patch to trunk so notes output is a tad prettier (r49606).

  Changed 3 years ago by jmr@…

  • status changed from new to closed
  • resolution set to fixed

The feature is added. Sure it's not perfect, but that can be worked on in future.

Note: See TracTickets for help on using tickets.