summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Moennich <adrian@planetcoding.net>2020-09-06 00:21:37 +0200
committerPatrice Clement <monsieurp@gentoo.org>2020-11-12 22:28:42 +0100
commitd428c50a040b5ae00ec1d0fc38769565108c5d24 (patch)
tree19175e0a9949584bf6c1bb021d2d42de231d0152 /dev-util
parentnet-misc/qtm: update SRC_URI. (diff)
downloadgentoo-d428c50a040b5ae00ec1d0fc38769565108c5d24.tar.gz
gentoo-d428c50a040b5ae00ec1d0fc38769565108c5d24.tar.bz2
gentoo-d428c50a040b5ae00ec1d0fc38769565108c5d24.zip
dev-util/watchman: new package.
Watchman is a file watching service. Signed-off-by: Adrian Moennich <adrian@planetcoding.net> Package-Manager: Portage-3.0.4, Repoman-3.0.1 Closes: https://github.com/gentoo/gentoo/pull/17433 Signed-off-by: Patrice Clement <monsieurp@gentoo.org>
Diffstat (limited to 'dev-util')
-rw-r--r--dev-util/watchman/Manifest1
-rw-r--r--dev-util/watchman/files/4.9.0-changes.patch80
-rw-r--r--dev-util/watchman/files/4.9.0-python3.patch65
-rw-r--r--dev-util/watchman/metadata.xml22
-rw-r--r--dev-util/watchman/watchman-4.9.0.ebuild61
5 files changed, 229 insertions, 0 deletions
diff --git a/dev-util/watchman/Manifest b/dev-util/watchman/Manifest
new file mode 100644
index 000000000000..8faca46f3e03
--- /dev/null
+++ b/dev-util/watchman/Manifest
@@ -0,0 +1 @@
+DIST watchman-4.9.0.tar.gz 3508045 BLAKE2B 413b779f02736442c371af1d9e18e5c84f05f9e9465c114dc4bdf79cbc1d823f1ad3167abef22818652a924ca2cb563c54d18f7599b987f579655d8a2b82162a SHA512 3c1222ba41383b26c2c427415e75abdb4bef5a95001438c3debe7cf3ca654944ecf08e432c5ad0aefa2a6554ae73ff0f6995e7f4ee61cdb2cde80f8378d3a704
diff --git a/dev-util/watchman/files/4.9.0-changes.patch b/dev-util/watchman/files/4.9.0-changes.patch
new file mode 100644
index 000000000000..4625bc815539
--- /dev/null
+++ b/dev-util/watchman/files/4.9.0-changes.patch
@@ -0,0 +1,80 @@
+diff -ru old/python/bin/watchman-make new/python/bin/watchman-make
+--- old/python/bin/watchman-make 2020-09-06 11:36:12.202435809 +0200
++++ new/python/bin/watchman-make 2020-09-06 11:36:14.105482419 +0200
+@@ -55,7 +55,14 @@
+ data = client.getSubscription(self.name)
+ if data is None:
+ return
+- self.triggered = True
++ for item in data:
++ # We only want to trigger if files matched;
++ # updates without a files list are metadata
++ # such as state-enter/leave notices so we skip them
++ if 'files' in item:
++ self.triggered = True
++ if 'canceled' in item:
++ raise RuntimeError('Watch was cancelled')
+
+ def execute(self):
+ if not self.triggered:
+@@ -165,6 +172,11 @@
+ parser.add_argument('-r', '--run', type=str, help="""
+ The script that should be run when changes are detected
+ """)
++parser.add_argument('--connect-timeout', type=float, default=600, help="""
++Initial watchman client connection timeout. It should be sufficiently large to
++prevent timeouts when watchman is busy (eg. performing a crawl). The default
++value is 600 seconds.
++""")
+ args = parser.parse_args()
+
+ if args.target is None and args.run is None:
+@@ -187,7 +199,7 @@
+ sys.exit(1)
+
+ targets = {}
+-client = pywatchman.client(timeout=600)
++client = pywatchman.client(timeout=args.connect_timeout)
+ try:
+ client.capabilityCheck(
+ required=['cmd-watch-project', 'wildmatch'])
+diff -ru old/python/bin/watchman-wait new/python/bin/watchman-wait
+--- old/python/bin/watchman-wait 2020-09-06 11:36:12.202435809 +0200
++++ new/python/bin/watchman-wait 2020-09-06 11:36:14.106482444 +0200
+@@ -76,6 +76,11 @@
+ Exit if no events trigger within the specified timeout. If timeout is
+ zero (the default) then keep running indefinitely.
+ """)
++parser.add_argument('--connect-timeout', type=float, default=100, help="""
++Initial watchman client connection timeout. It should be sufficiently large to
++prevent timeouts when watchman is busy (eg. performing a crawl). The default
++value is 100 seconds.
++""")
+ args = parser.parse_args()
+
+
+@@ -141,7 +146,7 @@
+ def formatField(self, fname, val):
+ if fname == 'name':
+ # Respect the --relative path printing option
+- return os.path.relpath(val, args.relative)
++ return os.path.relpath(os.path.join(self.name, val), args.relative)
+ # otherwise just make sure it's a string so that we can join it
+ return str(val)
+
+@@ -173,12 +178,13 @@
+ for path in args.path:
+ sub = Subscription(path)
+
++# and start up the client + subscriptions
++client = pywatchman.client(timeout=args.connect_timeout)
++
+ deadline = None
+ if args.timeout > 0:
+ deadline = time.time() + args.timeout
+
+-# and start up the client + subscriptions
+-client = pywatchman.client()
+ try:
+ client.capabilityCheck(
+ required=['term-dirname', 'cmd-watch-project', 'wildmatch'])
diff --git a/dev-util/watchman/files/4.9.0-python3.patch b/dev-util/watchman/files/4.9.0-python3.patch
new file mode 100644
index 000000000000..5b416f24ae46
--- /dev/null
+++ b/dev-util/watchman/files/4.9.0-python3.patch
@@ -0,0 +1,65 @@
+diff -ru backup/old/python/bin/watchman-make old/python/bin/watchman-make
+--- backup/old/python/bin/watchman-make 2020-09-06 11:33:34.449582111 +0200
++++ old/python/bin/watchman-make 2020-09-06 11:33:43.473801969 +0200
+@@ -100,7 +100,7 @@
+ targets = []
+ setattr(namespace, self.dest, targets)
+
+- if isinstance(values, basestring):
++ if isinstance(values, (str, bytes)):
+ values = [values]
+
+ if namespace.pattern is None or len(namespace.pattern) == 0:
+@@ -209,7 +209,7 @@
+ client.setTimeout(600)
+
+ result = client.receive()
+- for _, t in targets.iteritems():
++ for _, t in targets.items():
+ t.consumeEvents(client)
+
+ # Now we wait for events to settle
+@@ -218,7 +218,7 @@
+ while not settled:
+ try:
+ result = client.receive()
+- for _, t in targets.iteritems():
++ for _, t in targets.items():
+ t.consumeEvents(client)
+ except pywatchman.SocketTimeout as ex:
+ # Our short settle timeout hit, so we're now settled
+@@ -226,7 +226,7 @@
+ break
+
+ # Now we can work on executing the targets
+- for _, t in targets.iteritems():
++ for _, t in targets.items():
+ t.execute()
+
+ # Print this at the bottom of the loop rather than the top
+@@ -249,4 +249,3 @@
+ except KeyboardInterrupt:
+ # suppress ugly stack trace when they Ctrl-C
+ break
+-
+diff -ru backup/old/python/bin/watchman-wait old/python/bin/watchman-wait
+--- backup/old/python/bin/watchman-wait 2020-09-06 11:33:34.449582111 +0200
++++ old/python/bin/watchman-wait 2020-09-06 11:33:43.473801969 +0200
+@@ -182,7 +182,7 @@
+ try:
+ client.capabilityCheck(
+ required=['term-dirname', 'cmd-watch-project', 'wildmatch'])
+- for _, sub in subscriptions.iteritems():
++ for _, sub in subscriptions.items():
+ sub.start(client)
+
+ except pywatchman.CommandError as ex:
+@@ -200,7 +200,7 @@
+ # the client object will accumulate all subscription results
+ # over time, so we ask it to remove and return those values
+ # for each of the subscriptions
+- for _, sub in subscriptions.iteritems():
++ for _, sub in subscriptions.items():
+ sub.emit(client)
+
+ except pywatchman.SocketTimeout as ex:
diff --git a/dev-util/watchman/metadata.xml b/dev-util/watchman/metadata.xml
new file mode 100644
index 000000000000..57a0732b555f
--- /dev/null
+++ b/dev-util/watchman/metadata.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM 'http://www.gentoo.org/dtd/metadata.dtd'>
+<pkgmetadata>
+ <maintainer type="person">
+ <email>monsieurp@gentoo.org</email>
+ <name>Patrice Clement</name>
+ </maintainer>
+ <maintainer type="person">
+ <email>adrian@planetcoding.net</email>
+ <name>Adrian Moennich</name>
+ </maintainer>
+ <maintainer type="project">
+ <email>proxy-maint@gentoo.org</email>
+ <name>Proxy Maintainers</name>
+ </maintainer>
+ <upstream>
+ <remote-id type="github">facebook/watchman</remote-id>
+ </upstream>
+ <use>
+ <flag name="python">Install pywatchman bindings and the watchman-{wait,make} utils</flag>
+ </use>
+</pkgmetadata>
diff --git a/dev-util/watchman/watchman-4.9.0.ebuild b/dev-util/watchman/watchman-4.9.0.ebuild
new file mode 100644
index 000000000000..ca3006fbc0c6
--- /dev/null
+++ b/dev-util/watchman/watchman-4.9.0.ebuild
@@ -0,0 +1,61 @@
+# Copyright 2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+PYTHON_COMPAT=( python3_{6,7,8} )
+inherit autotools distutils-r1
+
+COMMIT="8e0ba724d85de2c89f48161807e878667b9ed089" # v4.9.0 tag
+DESCRIPTION="A file watching service"
+HOMEPAGE="https://facebook.github.io/watchman/"
+SRC_URI="https://github.com/facebook/watchman/archive/${COMMIT}.tar.gz -> ${P}.tar.gz"
+S="${WORKDIR}/${PN}-${COMMIT}"
+
+LICENSE="Apache-2.0"
+SLOT="0"
+KEYWORDS="~amd64"
+IUSE="pcre python"
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
+
+RDEPEND="pcre? ( dev-libs/libpcre )
+ python? ( ${PYTHON_DEPS} )"
+DEPEND="${RDEPEND}"
+
+PATCHES=(
+ "${FILESDIR}/${PV}-python3.patch"
+ "${FILESDIR}/${PV}-changes.patch"
+)
+
+src_prepare() {
+ default
+
+ eautoreconf
+}
+
+src_configure() {
+ econf \
+ --enable-lenient \
+ --disable-statedir \
+ --without-python \
+ $(use_with pcre)
+}
+
+src_compile() {
+ default
+
+ if use python; then
+ pushd python >/dev/null || die
+ distutils-r1_src_compile
+ popd >/dev/null || die
+ fi
+}
+
+src_install() {
+ default
+
+ if use python; then
+ pushd python >/dev/null || die
+ distutils-r1_src_install
+ popd >/dev/null || die
+ fi
+}