Bug 243273 - [NEW PORT] textproc/codesearch: Fast indexed grep tool
Summary: [NEW PORT] textproc/codesearch: Fast indexed grep tool
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Dmitri Goutnik
URL: https://github.com/google/codesearch
Keywords: feature, needs-patch, needs-qa
Depends on:
Blocks:
 
Reported: 2020-01-11 17:22 UTC by eborisch+FreeBSD
Modified: 2020-01-17 19:02 UTC (History)
2 users (show)

See Also:
koobs: maintainer-feedback? (eborisch+FreeBSD)


Attachments
Shell archive of new port (2.48 KB, text/plain)
2020-01-11 17:22 UTC, eborisch+FreeBSD
no flags Details
codesearch-1.1.0.patch (2.53 KB, patch)
2020-01-13 13:24 UTC, Dmitri Goutnik
no flags Details | Diff
codesearch-1.1.0.patch (2.53 KB, patch)
2020-01-13 13:37 UTC, Dmitri Goutnik
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description eborisch+FreeBSD 2020-01-11 17:22:33 UTC
Created attachment 210626 [details]
Shell archive of new port

Fast, indexed regexp search over large file trees: https://github.com/google/codesearch and https://swtch.com/~rsc/regexp/regexp4.html
Comment 1 Dmitri Goutnik freebsd_committer freebsd_triage 2020-01-11 17:59:15 UTC
(In reply to eborisch+FreeBSD from comment #0)
Hi,

Thank you for the new port submission, but new go ports shouldn't add a build dependency to lang/go, please switch to USES=go instead [1]. There are many examples of such ports in the ports tree - devel/dep, sysutils/immortal etc.

[1] https://www.freebsd.org/doc/en/books/porters-handbook/book.html#uses-go
Comment 2 eborisch+FreeBSD 2020-01-12 20:05:52 UTC
(In reply to Dmitri Goutnik from comment #1)

I can, but it's an old package, doesn't rely on any external modules and doesn't work cleanly with the build that USES=go, so it ends up looking like this. Let me know which way you would like to go.

Thanks!

==

FreeBSD$

PORTNAME=       codesearch
DISTVERSIONPREFIX=      v
DISTVERSION=    1.1.0
CATEGORIES=     textproc

MAINTAINER=     eborisch@gmail.com
COMMENT=        Fast (indexed) text search tool from Google

LICENSE=        BSD3CLAUSE

USES=           go:no_targets
USE_GITHUB=     yes
GH_ACCOUNT=     google
GH_SUBDIR=      src/github.com/google/codesearch

BIN_FILES=      cgrep csearch cindex

PORTDOCS=       LICENSE README AUTHORS CONTRIBUTORS

OPTIONS_DEFINE= DOCS

do-build:
.for bin in ${BIN_FILES}
        cd ${WRKSRC}/src/github.com/google/codesearch/cmd/${bin}; ${SETENV} ${BUILD_ENV} GOPATH=${WRKSRC} go build
.endfor

do-install:
.for bin in ${BIN_FILES}
        cd ${WRKSRC}/src/github.com/google/codesearch/cmd/${bin}; ${CP} ${bin} ${STAGEDIR}${PREFIX}/bin/${src}
.endfor

post-install-DOCS-on:
        ${MKDIR} ${STAGEDIR}${DOCSDIR}
.for doc in ${PORTDOCS}
        ${CP} ${WRKSRC}/src/github.com/google/codesearch/${doc} ${STAGEDIR}${DOCSDIR}
.endfor

.include <bsd.port.mk>
Comment 3 Dmitri Goutnik freebsd_committer freebsd_triage 2020-01-13 13:24:10 UTC
Created attachment 210695 [details]
codesearch-1.1.0.patch
Comment 4 Dmitri Goutnik freebsd_committer freebsd_triage 2020-01-13 13:25:03 UTC
(In reply to eborisch+FreeBSD from comment #2)
Please see attached patch.
Comment 5 Dmitri Goutnik freebsd_committer freebsd_triage 2020-01-13 13:37:21 UTC
Created attachment 210696 [details]
codesearch-1.1.0.patch

Fix typo in directory name
Comment 6 eborisch+FreeBSD 2020-01-13 14:56:38 UTC
That looks great! Clearly I have much to learn about USES=go (I've never done any go development myself, which likely doesn't help on that front.)
Comment 7 commit-hook freebsd_committer freebsd_triage 2020-01-17 19:00:25 UTC
A commit references this bug:

Author: dmgk
Date: Fri Jan 17 19:00:04 UTC 2020
New revision: 523350
URL: https://svnweb.freebsd.org/changeset/ports/523350

Log:
  New port: textproc/codesearch

  Code Search is a tool for indexing and then performing regular expression
  searches over large bodies of source code. It is a set of command-line programs
  written in Go.

  WWW: https://github.com/google/codesearch

  PR:		243273
  Submitted by:	eborisch+FreeBSD@gmail.com

Changes:
  head/textproc/Makefile
  head/textproc/codesearch/
  head/textproc/codesearch/Makefile
  head/textproc/codesearch/distinfo
  head/textproc/codesearch/pkg-descr
Comment 8 Dmitri Goutnik freebsd_committer freebsd_triage 2020-01-17 19:02:07 UTC
Committed, thanks!