8000 GitHub - dmgk/portgrep: Parallel port search utility · GitHub
[go: up one dir, main page]

Skip to content
{"props":{"color_mode":"dark","logged_in":false,"marketing_page":false,"home_path":"/","login_path":"/login?return_to=https%3A%2F%2FGitHub.com%2Fdmgk%2Fportgrep","signup_path":"/signup?ref_cta=Sign+up\u0026ref_loc=header+logged+out\u0026ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E\u0026source=header-repo\u0026source_repo=dmgk%2Fportgrep","signup_enabled":true,"is_signup_controller":false,"show_search_and_nav":true,"hide_search":false,"private_mode_enabled":false,"should_use_dotcom_links":true,"auth_hydro_click":"{\"event_type\":\"authentication.click\",\"payload\":{\"location_in_page\":\"site header menu\",\"repository_id\":null,\"auth_type\":\"SIGN_UP\",\"originating_url\":\"https://GitHub.com/dmgk/portgrep\",\"user_id\":null}}","auth_hydro_click_hmac":"74da1a52969348e696cb31441e023234498e1ddc3c56b914673d19bc198fbb95"}}
dmgkPublic

About

Parallel port search utility

Resources

Stars

2 stars

Watchers

1 watching

Forks

Latest commit

 

History

40 Commits

Folders and files

Repository files navigation

portgrep

portgrep is a fast parallel ports tree search utility.

Tests

Installation

go install github.com/dmgk/portgrep@latest

Usage

usage: portgrep [options] [query ...]

General options:
  -h          show help and exit
  -V          show version and exit
  -R path     ports tree root (default: )
  -M mode     colorized output mode: [auto|never|always] (default: auto)
  -G colors   set colors (default: "BCDA")
              the order is query,match,path,separator; see ls(1) for color codes

Search options:
  -c name,... limit search to only these categories
  -O          multiple searches are OR-ed (default: AND-ed)
  -F          interpret query as a plain text, not regular expression
  -j jobs     number of parallel jobs (default: 8)

Formatting options:
  -1          output origins in a single line (implies -o)
  -A count    show count lines of context after match
  -B count    show count lines of context before match
  -C count    show count lines of context around match
  -o          output origins only
  -s          sort results by origin
  -T          do not indent results

Predefined searches:
  -n query    search by PORTNAME
  -m query    search by MAINTAINER
  -d query    search by *_DEPENDS
  -b query    search by BUILD_DEPENDS
  -l query    search by LIB_DEPENDS
  -r query    search by RUN_DEPENDS
  -t query    search by TEST_DEPENDS
  -a query    search by ONLY_FOR_ARCHS
  -u query    search by USES
  -p query    search by PLIST_FILES
  -X          search only ports marked BROKEN

Examples:

Find broken USES=go ports:

$ portgrep -X -u go
databases/cayley:
        BROKEN_i386=    gopkg.in/mgo.v2/bson/json.go:320:7: constant 9007199254740992 overflows int
        --------
        USES=           go:modules
databases/litestream:
        BROKEN_i386=    Build error: constant 9223372036854775807 overflows int
        --------
        USES=           go:modules
databases/mongodb36-tools:
        BROKEN_SSL=     openssl libressl libressl-devel
        --------
        USES=   go localbase

Find ports depending on libcjson, with 2 lines of context:

$ portgrep -d libcjson -C2
audio/ocp:

        BUILD_DEPENDS=  xa65:devel/xa65
        LIB_DEPENDS=    libcjson.so:devel/libcjson \
                        libdiscid.so:audio/libdiscid \
                        libid3tag.so:audio/libid3tag \
                        libmad.so:audio/libmad \
                        libogg.so:audio/libogg \
                        libvorbis.so:audio/libvorbis

        USES=           compiler:c11 dos2unix gmake gnome iconv localbase:ldflags \
                        makeinfo ncurses pkgconfig tar:bz2
multimedia/librist:
        LICENSE_FILE=   ${WRKSRC}/COPYING

        LIB_DEPENDS=    libcjson.so:devel/libcjson \
                        libmbedcrypto.so:security/mbedtls

        USES=           localbase:ldflags meson pkgconfig

Search by an arbitrary regex:

$ portgrep 'REINPLACE_CMD.*\s-i'
www/yarn:

                @${REINPLACE_CMD} -i '' \
                        -e 's|"installationMethod": "tar"|"installationMethod": "pkg"|g' \
                        ${WRKSRC}/package.json

devel/py-os-brick:

                @${GREP} -Rl -Ee '${MY_REGEX}' --null \
                        ${WRKSRC}/etc ${WRKSRC}/os_brick | \
                                ${XARGS} -0 ${REINPLACE_CMD} -i '' -Ee \
                                        "s,${MY_REGEX},${PREFIX}\1,g"

devel/sfml1:

                @${FIND} ${STAGEDIR}${PREFIX}/include/SFML -name "*.hpp" -exec ${REINPLACE_CMD} -i '' -e '/#include/ s|SFML|&1|' {} \;

Performance

$ time (find /usr/ports -name Makefile | xargs grep "MAINTAINER=.*ports@" >/dev/null)

real    0m1.045s
user    0m0.237s
sys     0m1.076s
$ time (./portgrep -m ports@ >/dev/null)

real    0m0.395s
user    0m2.238s
sys     0m0.796s

About

Parallel port search utility

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages

0