Opened 12 years ago

Closed 7 months ago

#38555 closed enhancement (wontfix)

RFE: Move "rec_glob" proc from nodejs portfile into base

Reported by: cooljeanius (Eric Gallager) Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: base Version: 2.1.3
Keywords: Cc: ci42
Port:

Description

I was looking through the nodejs portfile and came across this recursive glob function:

proc rec_glob {basedir pattern} {
    set files [glob -directory $basedir -nocomplain -type f $pattern]
    foreach dir [glob -directory $basedir -nocomplain -type d *] {
        eval lappend files [rec_glob $dir $pattern]
    }
    return $files
}

It would be useful to have this proc available in base so I wouldn't have to copy it from the nodejs portfile if I ever want to use it myself.

Change History (10)

comment:1 Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

Isn't this kind of thing what fs-traverse is for?

comment:2 in reply to:  1 ; Changed 12 years ago by cooljeanius (Eric Gallager)

Replying to ryandesign@…:

Isn't this kind of thing what fs-traverse is for?

I wouldn't know, fs-traverse isn't documented in the guide and I don't know where it's located in the code, so I can't tell if they work the same way. '

Version 0, edited 12 years ago by cooljeanius (Eric Gallager) (next)

comment:3 in reply to:  description ; Changed 12 years ago by larryv (Lawrence Velázquez)

Replying to egall@…:

It would be useful to have this proc available in base so I wouldn't have to copy it from the nodejs portfile if I ever want to use it myself.

I wasn’t aware that MacPorts base was your personal code snippet repository.

comment:4 in reply to:  2 ; Changed 12 years ago by larryv (Lawrence Velázquez)

Replying to egall@…:

I wouldn't know, fs-traverse isn't documented in the guide and I don't know where it's located in the code, so I can't tell if they work the same way.

$ man portfile

comment:5 in reply to:  3 ; Changed 12 years ago by cooljeanius (Eric Gallager)

Replying to larryv@…:

Replying to egall@…:

It would be useful to have this proc available in base so I wouldn't have to copy it from the nodejs portfile if I ever want to use it myself.

I wasn’t aware that MacPorts base was your personal code snippet repository.

Well I didn't mean just me personally; I thought it could be useful as a library function generally. I'm just speaking as an example here.

Last edited 12 years ago by cooljeanius (Eric Gallager) (previous) (diff)

comment:6 in reply to:  5 Changed 12 years ago by larryv (Lawrence Velázquez)

Replying to egall@…:

Well I didn't mean just me personally; I thought it could be useful as a library function generally.

fs-traverse is a more general function than this rec_glob; it executes a body of code for every file or directory in the given directory hierarchy. Of course, a port maintainer is free to define and use any procs they wish.

comment:7 Changed 12 years ago by cooljeanius (Eric Gallager)

So apparently fs-traverse is a pextlib function... in that case the issue for documenting it in the guide is #15623.

comment:8 in reply to:  4 ; Changed 11 years ago by cooljeanius (Eric Gallager)

Replying to larryv@…:

Replying to egall@…:

I wouldn't know, fs-traverse isn't documented in the guide and I don't know where it's located in the code, so I can't tell if they work the same way.

$ man portfile

Thanks, I will just use that in the meantime. However, in the longer term, it would make more sense for there to be a specific manpage for the proc itself that shared a name with it, so I could just do

$ man n fs-traverse

instead of having to remember that it was in the Portfile manpage, and then having to scroll down forever until I reach it.

Last edited 11 years ago by cooljeanius (Eric Gallager) (previous) (diff)

comment:9 in reply to:  8 Changed 10 years ago by larryv (Lawrence Velázquez)

Replying to egall@…:

Thanks, I will just use that in the meantime. However, in the longer term, it would make more sense for there to be a specific manpage for the proc itself that shared a name with it, so I could just do

$ man n fs-traverse

instead of having to remember that it was in the Portfile manpage, and then having to scroll down forever until I reach it.

The presence of such a manpage would imply that fs-traverse was a general Tcl proc intended for use outside of MacPorts, which it isn’t.

comment:10 Changed 7 months ago by jmroot (Joshua Root)

Resolution: wontfix
Status: newclosed
Note: See TracTickets for help on using tickets.