summaryrefslogtreecommitdiff
path: root/devel/jq
diff options
context:
space:
mode:
authorfhajny <fhajny@pkgsrc.org>2014-04-17 09:08:34 +0000
committerfhajny <fhajny@pkgsrc.org>2014-04-17 09:08:34 +0000
commit4d2f0eb6e8c19ef6bb3a9fa143bed429814219f6 (patch)
tree4cac569576d1b3d3ba4d5147f31e2628f6381400 /devel/jq
parent2fd54f3f101c28d75e3eb1d6c3f8ad2ff096048e (diff)
downloadpkgsrc-4d2f0eb6e8c19ef6bb3a9fa143bed429814219f6.tar.gz
Update jq to 1.3.
Changelog not provided, see commits made since 1.2: https://github.com/stedolan/jq/compare/jq-1.2...jq-1.3
Diffstat (limited to 'devel/jq')
-rw-r--r--devel/jq/Makefile16
-rw-r--r--devel/jq/PLIST6
-rw-r--r--devel/jq/distinfo13
-rw-r--r--devel/jq/patches/patch-Makefile31
-rw-r--r--devel/jq/patches/patch-configure.ac23
-rw-r--r--devel/jq/patches/patch-jq.1362
-rw-r--r--devel/jq/patches/patch-jv__utf8__tables.gen.h42
7 files changed, 378 insertions, 115 deletions
diff --git a/devel/jq/Makefile b/devel/jq/Makefile
index d3356755069..eaa15731190 100644
--- a/devel/jq/Makefile
+++ b/devel/jq/Makefile
@@ -1,21 +1,25 @@
-# $NetBSD: Makefile,v 1.3 2014/01/27 18:41:11 wiz Exp $
+# $NetBSD: Makefile,v 1.4 2014/04/17 09:08:34 fhajny Exp $
-DISTNAME= jq-1.2
+DISTNAME= jq-1.3
CATEGORIES= devel
-MASTER_SITES= -https://github.com/stedolan/jq/tarball/${DISTNAME}/
+MASTER_SITES= https://github.com/stedolan/jq/archive/
MAINTAINER= jperkin@joyent.com
HOMEPAGE= http://github.com/stedolan/jq/
COMMENT= Command-line JSON processor
LICENSE= mit
-WRKSRC= ${WRKDIR}/stedolan-jq-1e8c524
+WRKSRC= ${WRKDIR}/jq-${DISTNAME}
USE_LANGUAGES= c99
-USE_TOOLS+= bison flex gmake
+USE_LIBTOOL= yes
+USE_TOOLS+= autoconf automake autoreconf bison flex gmake
-NO_CONFIGURE= yes
+GNU_CONFIGURE= yes
CFLAGS.SunOS+= -D_XPG6
+pre-configure:
+ cd ${WRKSRC} && autoreconf -i
+
.include "../../mk/bsd.pkg.mk"
diff --git a/devel/jq/PLIST b/devel/jq/PLIST
index 02238710a5a..73bea81776b 100644
--- a/devel/jq/PLIST
+++ b/devel/jq/PLIST
@@ -1,3 +1,7 @@
-@comment $NetBSD: PLIST,v 1.2 2013/04/26 10:20:34 jperkin Exp $
+@comment $NetBSD: PLIST,v 1.3 2014/04/17 09:08:34 fhajny Exp $
bin/jq
man/man1/jq.1
+share/doc/jq/AUTHORS
+share/doc/jq/COPYING
+share/doc/jq/README
+share/doc/jq/README.md
diff --git a/devel/jq/distinfo b/devel/jq/distinfo
index 51ea4b5c7f5..198240db7e4 100644
--- a/devel/jq/distinfo
+++ b/devel/jq/distinfo
@@ -1,8 +1,7 @@
-$NetBSD: distinfo,v 1.2 2013/04/26 10:20:34 jperkin Exp $
+$NetBSD: distinfo,v 1.3 2014/04/17 09:08:34 fhajny Exp $
-SHA1 (jq-1.2.tar.gz) = 30bd7861acdfa9e1bb13d87b563eeb218c97e3a3
-RMD160 (jq-1.2.tar.gz) = 44df3e85f538a28d47aaa8b9bd9fd9cb2d1f558e
-Size (jq-1.2.tar.gz) = 180303 bytes
-SHA1 (patch-Makefile) = 6d828402c996ded50c2b76778356635293e0ef46
-SHA1 (patch-jq.1) = 3c93df8d998ad81cf244a9e9a08f83665d94c12a
-SHA1 (patch-jv__utf8__tables.gen.h) = c854e81aaa83aff8e9741690109f5e8c4c25bfbe
+SHA1 (jq-1.3.tar.gz) = 0d70d913e1df5cdbe09bccd3139ef0cb40c6fd49
+RMD160 (jq-1.3.tar.gz) = 8341cced3136448671e634f6f1d2d37791220f64
+Size (jq-1.3.tar.gz) = 213770 bytes
+SHA1 (patch-configure.ac) = 86ca50edaddb108ac9f337c394eda126adfac701
+SHA1 (patch-jq.1) = 9eba00837c7da427739fd0f9bcbe9aa653a4df69
diff --git a/devel/jq/patches/patch-Makefile b/devel/jq/patches/patch-Makefile
deleted file mode 100644
index e56454c3d68..00000000000
--- a/devel/jq/patches/patch-Makefile
+++ /dev/null
@@ -1,31 +0,0 @@
-$NetBSD: patch-Makefile,v 1.2 2013/04/26 10:20:34 jperkin Exp $
-
-pkgsrc-ify.
-
---- Makefile.orig 2012-12-20 12:26:15.000000000 +0000
-+++ Makefile
-@@ -1,5 +1,5 @@
--CC=gcc
--CFLAGS=-Wextra -Wall -Wno-missing-field-initializers -Wno-unused-parameter -std=gnu99 -ggdb -Wno-unused-function $(EXTRA_CFLAGS)
-+#CC=gcc
-+#CFLAGS=-Wextra -Wall -Wno-missing-field-initializers -Wno-unused-parameter -std=gnu99 -ggdb -Wno-unused-function $(EXTRA_CFLAGS)
-
- prefix=/usr/local
- mandir=$(prefix)/share/man
-@@ -80,11 +80,11 @@ tarball: docs/content/2.download/source/
- jq.1: docs/content/3.manual/manual.yml
- ( cd docs; rake manpage; ) > $@
-
--install: jq jq.1
-- install -d -m 0755 $(prefix)/bin
-- install -m 0755 jq $(prefix)/bin
-- install -d -m 0755 $(mandir)/man1
-- install -m 0755 jq.1 $(mandir)/man1
-+install: jq
-+ ${BSD_INSTALL_PROGRAM_DIR} $(DESTDIR)$(PREFIX)/bin
-+ ${BSD_INSTALL_PROGRAM} jq $(DESTDIR)$(PREFIX)/bin
-+ ${BSD_INSTALL_MAN_DIR} $(DESTDIR)$(PREFIX)/$(PKGMANDIR)/man1
-+ ${BSD_INSTALL_MAN} jq.1 $(DESTDIR)$(PREFIX)/$(PKGMANDIR)/man1
-
- uninstall:
- rm -vf $(prefix)/bin/jq
diff --git a/devel/jq/patches/patch-configure.ac b/devel/jq/patches/patch-configure.ac
new file mode 100644
index 00000000000..4af3a5ca613
--- /dev/null
+++ b/devel/jq/patches/patch-configure.ac
@@ -0,0 +1,23 @@
+$NetBSD: patch-configure.ac,v 1.1 2014/04/17 09:08:34 fhajny Exp $
+
+Fix automake macro as per https://github.com/stedolan/jq/pull/175.
+
+--- configure.ac.orig 2013-05-19 10:48:18.000000000 +0000
++++ configure.ac
+@@ -4,7 +4,7 @@ AC_INIT([jq], [1.3], [mu@netsoc.tcd.ie],
+ dnl Created autoconf implementation thompson@dtosolutions, 26NOV12
+ AC_PREREQ([2.61])
+ AC_CONFIG_AUX_DIR([config])
+-AM_INIT_AUTOMAKE([parallel-tests foreign])
++AM_INIT_AUTOMAKE([parallel-tests foreign -Wall])
+ AM_SILENT_RULES([yes])
+ AC_PROG_CC
+ AC_PROG_CC_STDC
+@@ -59,7 +59,6 @@ AC_SUBST([BUNDLER], ["$bundle_cmd"])
+
+ dnl AC_CONFIG_MACRO_DIR([m4])
+ AC_CONFIG_HEADERS(config.h)
+-AM_INIT_AUTOMAKE([-Wall])
+ AC_CONFIG_FILES([Makefile])
+ AC_OUTPUT
+
diff --git a/devel/jq/patches/patch-jq.1 b/devel/jq/patches/patch-jq.1
index 7a9a9bd01c8..ab88420a68c 100644
--- a/devel/jq/patches/patch-jq.1
+++ b/devel/jq/patches/patch-jq.1
@@ -1,14 +1,14 @@
-$NetBSD: patch-jq.1,v 1.1 2013/04/26 10:20:34 jperkin Exp $
+$NetBSD: patch-jq.1,v 1.2 2014/04/17 09:08:34 fhajny Exp $
Pre-generate manual page to avoid Ruby dependencies.
---- /dev/null 2013-04-25 17:04:21.000000000 +0000
+--- /dev/null 2014-04-17 08:53:13.478890431 +0000
+++ jq.1
-@@ -0,0 +1,1137 @@
+@@ -0,0 +1,1443 @@
+.\" generated with Ronn/v0.7.3
+.\" http://github.com/rtomayko/ronn/tree/0.7.3
+.
-+.TH "JQ" "1" "April 2013" "" ""
++.TH "JQ" "1" "April 2014" "" ""
+.
+.SH "NAME"
+\fBjq\fR \- Command\-line JSON processor
@@ -88,8 +88,13 @@ Pre-generate manual page to avoid Ruby dependencies.
+.IP
+With this option, if the filter\'s result is a string then it will be written directly to standard output rather than being formatted as a JSON string with quotes\. This can be useful for making jq filters talk to non\-JSON\-based systems\.
+.
++.TP
++\fB\-\-arg name value\fR:
++.
++.IP
++This option passes a value to the jq program as a predefined variable\. If you run jq with \fB\-\-arg foo bar\fR, then \fB$foo\fR is available in the program and has the value \fB"bar"\fR\.
++.
+.SH "BASIC FILTERS"
-+nil
+.
+.SS "\."
+The absolute simplest (and least interesting) filter is \fB\.\fR\. This is a filter that takes its input and produces it unchanged as output\.
@@ -110,7 +115,7 @@ Pre-generate manual page to avoid Ruby dependencies.
+.IP "" 0
+.
+.SS "\.foo"
-+The simplest \fIuseful\fR filter is \.foo\. When given a JSON object (aka dictionary or hash) as input, it produces the value at the key "foo", or null if there\e\'s none present\.
++The simplest \fIuseful\fR filter is \.foo\. When given a JSON object (aka dictionary or hash) as input, it produces the value at the key "foo", or null if there\'s none present\.
+.
+.IP "" 4
+.
@@ -128,8 +133,11 @@ Pre-generate manual page to avoid Ruby dependencies.
+.
+.IP "" 0
+.
-+.SS "\.[foo]"
-+You can also look up fields of an object using syntax like \fB\.["foo"]\fR (\.foo above is a shorthand version of this)\. This one works for arrays as well, if the key is an integer\. Arrays are zero\-based (like javascript), so \.[2] returns the third element of the array\.
++.SS "\.[foo], \.[2], \.[10:15]"
++You can also look up fields of an object using syntax like \fB\.["foo"]\fR (\.foo above is a shorthand version of this)\. This one works for arrays as well, if the key is an integer\. Arrays are zero\-based (like javascript), so \fB\.[2]\fR returns the third element of the array\.
++.
++.P
++The \fB\.[10:15]\fR syntax can be used to return a subarray of an array\. The array returned by \fB\.[10:15]\fR will be of length 5, containing the elements from index 10 (inclusive) to index 15 (exclusive)\. Either index may be negative (in which case it counts backwards from the end of the array), or omitted (in which case it refers to the start or end of the array)\.
+.
+.IP "" 4
+.
@@ -142,13 +150,28 @@ Pre-generate manual page to avoid Ruby dependencies.
+jq \'\.[2]\'
+ [{"name":"JSON", "good":true}, {"name":"XML", "good":false}]
+=> null
++
++jq \'\.[2:4]\'
++ ["a","b","c","d","e"]
++=> ["c", "d"]
++
++jq \'\.[:3]\'
++ ["a","b","c","d","e"]
++=> ["a", "b", "c"]
++
++jq \'\.[\-2:]\'
++ ["a","b","c","d","e"]
++=> ["d", "e"]
+.
+.fi
+.
+.IP "" 0
+.
+.SS "\.[]"
-+If you use the \fB\.[foo]\fR syntax, but omit the index entirely, it will return \fIall\fR of the elements of an array\. Running \fB\.[]\fR with the input \fB[1,2,3]\fR will produce the numbers as three seperate results, rather than as a single array\.
++If you use the \fB\.[foo]\fR syntax, but omit the index entirely, it will return \fIall\fR of the elements of an array\. Running \fB\.[]\fR with the input \fB[1,2,3]\fR will produce the numbers as three separate results, rather than as a single array\.
++.
++.P
++You can also use this on an object, and it will return all the values of the object\.
+.
+.IP "" 4
+.
@@ -161,6 +184,10 @@ Pre-generate manual page to avoid Ruby dependencies.
+jq \'\.[]\'
+ []
+=>
++
++jq \'\.[]\'
++ {"a": 1, "b": 1}
++=> 1, 1
+.
+.fi
+.
@@ -190,7 +217,7 @@ Pre-generate manual page to avoid Ruby dependencies.
+.IP "" 0
+.
+.SS "|"
-+The | operator combines two filters by feeding the output(s) of the one on the left into the input of the one on the right\. It\e\'s pretty much the same as the Unix shell\e\'s pipe, if you\e\'re used to that\.
++The | operator combines two filters by feeding the output(s) of the one on the left into the input of the one on the right\. It\'s pretty much the same as the Unix shell\'s pipe, if you\'re used to that\.
+.
+.P
+If the one on the left produces multiple results, the one on the right will be run for each of those results\. So, the expression \fB\.[] | \.foo\fR retrieves the "foo" field of each element of the input array\.
@@ -217,7 +244,7 @@ Pre-generate manual page to avoid Ruby dependencies.
+As in JSON, \fB[]\fR is used to construct arrays, as in \fB[1,2,3]\fR\. The elements of the arrays can be any jq expression\. All of the results produced by all of the expressions are collected into one big array\. You can use it to construct an array out of a known quantity of values (as in \fB[\.foo, \.bar, \.baz]\fR) or to "collect" all the results of a filter into an array (as in \fB[\.items[]\.name]\fR)
+.
+.P
-+Once you understand the "," operator, you can look at jq\e\'s array syntax in a different light: the expression [1,2,3] is not using a built\-in syntax for comma\-separated arrays, but is instead applying the \fB[]\fR operator (collect results) to the expression 1,2,3 (which produces three different results)\.
++Once you understand the "," operator, you can look at jq\'s array syntax in a different light: the expression \fB[1,2,3]\fR is not using a built\-in syntax for comma\-separated arrays, but is instead applying the \fB[]\fR operator (collect results) to the expression 1,2,3 (which produces three different results)\.
+.
+.P
+If you have a filter \fBX\fR that produces four results, then the expression \fB[X]\fR will produce a single result, an array of four elements\.
@@ -238,7 +265,7 @@ Pre-generate manual page to avoid Ruby dependencies.
+Like JSON, \fB{}\fR is for constructing objects (aka dictionaries or hashes), as in: \fB{"a": 42, "b": 17}\fR\.
+.
+.P
-+If the keys are "sensible" (all alphabetic characters), then the quotes can be left off\. The value can be any expression (although you may need to wrap it in parentheses if it\e\'s a complicated one), which gets applied to the {} expression\e\'s input (remember, all filters have an input and an output)\.
++If the keys are "sensible" (all alphabetic characters), then the quotes can be left off\. The value can be any expression (although you may need to wrap it in parentheses if it\'s a complicated one), which gets applied to the {} expression\'s input (remember, all filters have an input and an output)\.
+.
+.IP "" 4
+.
@@ -264,10 +291,10 @@ Pre-generate manual page to avoid Ruby dependencies.
+.IP "" 0
+.
+.P
-+Because that\e\'s so common, there\e\'s a shortcut syntax: \fB{user, title}\fR\.
++Because that\'s so common, there\'s a shortcut syntax: \fB{user, title}\fR\.
+.
+.P
-+If one of the expressions produces multiple results, multiple dictionaries will be produced\. If the input\e\'s
++If one of the expressions produces multiple results, multiple dictionaries will be produced\. If the input\'s
+.
+.IP "" 4
+.
@@ -358,14 +385,36 @@ Pre-generate manual page to avoid Ruby dependencies.
+.IP "\(bu" 4
+\fBObjects\fR are added by merging, that is, inserting all the key\-value pairs from both objects into a single combined object\. If both objects contain a value for the same key, the object on the right of the \fB+\fR wins\.
+.
-+.IP
-+jq \'\.a + 1\' {"a": 7} => 8
++.IP "" 0
+.
-+.IP
-+jq \'\.a + \.b\' {"a": [1,2], "b": [3,4]} => [1,2,3,4]
++.P
++\fBnull\fR can be added to any value, and returns the other value unchanged\.
+.
-+.IP
-+jq \'{a: 1} + {b: 2} + {c: 3} + {a: 42}\' null => {"a": 42, "b": 2, "c": 3}
++.IP "" 4
++.
++.nf
++
++jq \'\.a + 1\'
++ {"a": 7}
++=> 8
++
++jq \'\.a + \.b\'
++ {"a": [1,2], "b": [3,4]}
++=> [1,2,3,4]
++
++jq \'\.a + null\'
++ {"a": 1}
++=> 1
++
++jq \'\.a + 1\'
++ {}
++=> 1
++
++jq \'{a: 1} + {b: 2} + {c: 3} + {a: 42}\'
++ null
++=> {"a": 42, "b": 2, "c": 3}
++.
++.fi
+.
+.IP "" 0
+.
@@ -448,6 +497,54 @@ Pre-generate manual page to avoid Ruby dependencies.
+.
+.IP "" 0
+.
++.SS "has"
++The builtin function \fBhas\fR returns whether the input object has the given key, or the input array has an element at the given index\.
++.
++.P
++\fBhas($key)\fR has the same effect as checking whether \fB$key\fR is a member of the array returned by \fBkeys\fR, although \fBhas\fR will be faster\.
++.
++.IP "" 4
++.
++.nf
++
++jq \'map(has("foo"))\'
++ [{"foo": 42}, {}]
++=> [true, false]
++
++jq \'map(has(2))\'
++ [[0,1], ["a","b","c"]]
++=> [false, true]
++.
++.fi
++.
++.IP "" 0
++.
++.SS "to_entries, from_entries, with_entries"
++These functions convert between an object and an array of key\-value pairs\. If \fBto_entries\fR is passed an object, then for each \fBk: v\fR entry in the input, the output array includes \fB{"key": k, "value": v}\fR\.
++.
++.P
++\fBfrom_entries\fR does the opposite conversion, and \fBwith_entries(foo)\fR is a shorthand for \fBto_entries | map(foo) | from_entries\fR, useful for doing some operation to all keys and values of an object\.
++.
++.IP "" 4
++.
++.nf
++
++jq \'to_entries\'
++ {"a": 1, "b": 2}
++=> [{"key":"a", "value":1}, {"key":"b", "value":2}]
++
++jq \'from_entries\'
++ [{"key":"a", "value":1}, {"key":"b", "value":2}]
++=> {"a": 1, "b": 2}
++
++jq \'with_entries(\.key |= "KEY_" + \.)\'
++ {"a": 1, "b": 2}
++=> {"KEY_a": 1, "KEY_b": 2}
++.
++.fi
++.
++.IP "" 0
++.
+.SS "select"
+The function \fBselect(foo)\fR produces its input unchanged if \fBfoo\fR returns true for that input, and produces no output otherwise\.
+.
@@ -532,6 +629,25 @@ Pre-generate manual page to avoid Ruby dependencies.
+.
+.IP "" 0
+.
++.SS "range"
++The \fBrange\fR function produces a range of numbers\. \fBrange(4;10)\fR produces 6 numbers, from 4 (inclusive) to 10 (exclusive)\. The numbers are produced as separate outputs\. Use \fB[range(4;10)]\fR to get a range as an array\.
++.
++.IP "" 4
++.
++.nf
++
++jq \'range(2;4)\'
++ null
++=> 2, 3
++
++jq \'[range(2;4)]\'
++ null
++=> [2,3]
++.
++.fi
++.
++.IP "" 0
++.
+.SS "tonumber"
+The \fBtonumber\fR function parses its input as a number\. It will convert correctly\-formatted strings to their numeric equivalent, leave numbers alone, and give an error on all other input\.
+.
@@ -562,6 +678,21 @@ Pre-generate manual page to avoid Ruby dependencies.
+.
+.IP "" 0
+.
++.SS "type"
++The \fBtype\fR function returns the type of its argument as a string, which is one of null, boolean, number, string, array or object\.
++.
++.IP "" 4
++.
++.nf
++
++jq \'map(type)\'
++ [0, false, [], {}, null, "hello"]
++=> ["number", "boolean", "array", "object", "null", "string"]
++.
++.fi
++.
++.IP "" 0
++.
+.SS "sort, sort_by"
+The \fBsort\fR functions sorts its input, which must be an array\. Values are sorted in the following order:
+.
@@ -662,6 +793,21 @@ Pre-generate manual page to avoid Ruby dependencies.
+.
+.IP "" 0
+.
++.SS "reverse"
++This function reverses an array\.
++.
++.IP "" 4
++.
++.nf
++
++jq \'reverse\'
++ [1,2,3,4]
++=> [4,3,2,1]
++.
++.fi
++.
++.IP "" 0
++.
+.SS "contains"
+The filter \fBcontains(b)\fR will produce true if b is completely contained within the input\. A string B is contained in a string A if B is a substring of A\. An array B is contained in an array A is all elements in B are contained in any element in A\. An object B is contained in object A if all of the values in B are contained in the value in A with the same key\. All other types are assumed to be contained in each other if they are equal\.
+.
@@ -693,6 +839,42 @@ Pre-generate manual page to avoid Ruby dependencies.
+.
+.IP "" 0
+.
++.SS "recurse"
++The \fBrecurse\fR function allows you to search through a recursive structure, and extract interesting data from all levels\. Suppose your input represents a filesystem:
++.
++.IP "" 4
++.
++.nf
++
++{"name": "/", "children": [
++ {"name": "/bin", "children": [
++ {"name": "/bin/ls", "children": []},
++ {"name": "/bin/sh", "children": []}]},
++ {"name": "/home", "children": [
++ {"name": "/home/stephen", "children": [
++ {"name": "/home/stephen/jq", "children": []}]}]}]}
++.
++.fi
++.
++.IP "" 0
++.
++.P
++Now suppose you want to extract all of the filenames present\. You need to retrieve \fB\.name\fR, \fB\.children[]\.name\fR, \fB\.children[]\.children[]\.name\fR, and so on\. You can do this with:
++.
++.IP "" 4
++.
++.nf
++
++recurse(\.children[]) | \.name
++
++jq \'recurse(\.foo[])\'
++ {"foo":[{"foo": []}, {"foo":[{"foo":[]}]}]}
++=> {"foo":[{"foo":[]},{"foo":[{"foo":[]}]}]}, {"foo":[]}, {"foo":[{"foo":[]}]}, {"foo":[]}
++.
++.fi
++.
++.IP "" 0
++.
+.SS "String interpolation \- \e(foo)"
+Inside a string, you can put an expression inside parens after a backslash\. Whatever the expression returns will be interpolated into the string\.
+.
@@ -708,8 +890,97 @@ Pre-generate manual page to avoid Ruby dependencies.
+.
+.IP "" 0
+.
++.SS "Format strings and escaping"
++The \fB@foo\fR syntax is used to format and escape strings, which is useful for building URLs, documents in a language like HTML or XML, and so forth\. \fB@foo\fR can be used as a filter on its own, the possible escapings are:
++.
++.TP
++\fB@text\fR:
++.
++.IP
++Calls \fBtostring\fR, see that function for details\.
++.
++.TP
++\fB@json\fR:
++.
++.IP
++Serialises the input as JSON\.
++.
++.TP
++\fB@html\fR:
++.
++.IP
++Applies HTML/XML escaping, by mapping the characters \fB<>&\'"\fR to their entity equivalents \fB&lt;\fR, \fB&gt;\fR, \fB&amp;\fR, \fB&apos;\fR, \fB&quot;\fR\.
++.
++.TP
++\fB@uri\fR:
++.
++.IP
++Applies percent\-encoding, by mapping all reserved URI characters to a \fB%xx\fR sequence\.
++.
++.TP
++\fB@csv\fR:
++.
++.IP
++The input must be an array, and it is rendered as CSV with double quotes for strings, and quotes escaped by repetition\.
++.
++.TP
++\fB@sh\fR:
++.
++.IP
++The input is escaped suitable for use in a command\-line for a POSIX shell\. If the input is an array, the output will be a series of space\-separated strings\.
++.
++.TP
++\fB@base64\fR:
++.
++.IP
++The input is converted to base64 as specified by RFC 4648\.
++.
++.P
++This syntax can be combined with string interpolation in a useful way\. You can follow a \fB@foo\fR token with a string literal\. The contents of the string literal will \fInot\fR be escaped\. However, all interpolations made inside that string literal will be escaped\. For instance,
++.
++.IP "" 4
++.
++.nf
++
++@uri "http://www\.google\.com/search?q=\e(\.search)"
++.
++.fi
++.
++.IP "" 0
++.
++.P
++will produce the following output for the input \fB{"search":"jq!"}\fR:
++.
++.IP "" 4
++.
++.nf
++
++http://www\.google\.com/search?q=jq%21
++.
++.fi
++.
++.IP "" 0
++.
++.P
++Note that the slashes, question mark, etc\. in the URL are not escaped, as they were part of the string literal\.
++.
++.IP "" 4
++.
++.nf
++
++jq \'@html\'
++ "This works if x < y"
++=> "This works if x &lt; y"
++
++jq \'@sh "echo \e(\.)"\'
++ "O\'Hara\'s Ale"
++=> "echo \'O\'\e\e\'\'Hara\'\e\e\'\'s Ale\'"
++.
++.fi
++.
++.IP "" 0
++.
+.SH "CONDITIONALS AND COMPARISONS"
-+nil
+.
+.SS "==, !="
+The expression \'a == b\' will produce \'true\' if the result of a and b are equal (that is, if they represent equivalent JSON documents) and \'false\' otherwise\. In particular, strings are never considered equal to numbers\. If you\'re coming from Javascript, jq\'s == is like Javascript\'s === \- considering values equal only when they have the same type as well as the same value\.
@@ -733,7 +1004,7 @@ Pre-generate manual page to avoid Ruby dependencies.
+\fBif A then B else C end\fR will act the same as \fBB\fR if \fBA\fR produces a value other than false or null, but act the same as \fBC\fR otherwise\.
+.
+.P
-+Checking for false or null is a simpler notion of "truthiness" than is found in Javascript or Python, but it means that you\'ll sometimes have to be more explicit about the condition you want: you can\'t test whether, e\.g\. a string is empty using \fBif \.name then A else B end\fR, you\'ll need something more like \'if (\.name | count) > 0 then A else B end\' instead\.
++Checking for false or null is a simpler notion of "truthiness" than is found in Javascript or Python, but it means that you\'ll sometimes have to be more explicit about the condition you want: you can\'t test whether, e\.g\. a string is empty using \fBif \.name then A else B end\fR, you\'ll need something more like \fBif (\.name | count) > 0 then A else B end\fR instead\.
+.
+.P
+If the condition A produces multiple results, it is considered "true" if any of those results is not false or null\. If it produces zero results, it\'s considered false\.
@@ -807,9 +1078,9 @@ Pre-generate manual page to avoid Ruby dependencies.
+ null
+=> true, false
+
-+jq \'(true, false) and (true, false)\'
++jq \'(true, true) and (true, false)\'
+ null
-+=> true, false, false, false
++=> true, false, true, false
+
+jq \'[true, false | not]\'
+ null
@@ -841,7 +1112,7 @@ Pre-generate manual page to avoid Ruby dependencies.
+.
+.IP "" 0
+.
-+.SH "VARIABLES AND FUNCTIONS"
++.SH "ADVANCED FEATURES"
+Variables are an absolute necessity in most programming languages, but they\'re relegated to an "advanced feature" in jq\.
+.
+.P
@@ -850,11 +1121,14 @@ Pre-generate manual page to avoid Ruby dependencies.
+.P
+It is also possible to define functions in jq, although this is is a feature whose biggest use is defining jq\'s standard library (many jq functions such as \fBmap\fR and \fBfind\fR are in fact written in jq)\.
+.
++.P
++Finally, jq has a \fBreduce\fR operation, which is very powerful but a bit tricky\. Again, it\'s mostly used internally, to define some useful bits of jq\'s standard library\.
++.
+.SS "Variables"
+In jq, all filters have an input and an output, so manual plumbing is not necessary to pass a value from one part of a program to the next\. Many expressions, for instance \fBa + b\fR, pass their input to two distinct subexpressions (here \fBa\fR and \fBb\fR are both passed the same input), so variables aren\'t usually necessary in order to use a value twice\.
+.
+.P
-+For instance, calculating the average value of an array of numbers requires a few variables in most languages \- at least one to hold the array, perhaps one for each element or for a loop counter\. In jq, it\'s simply \fBadd / length\fR \- the \fBsum\fR expression is given the array and produces its sum, and the \fBcount\fR expression is given the array and produces its length\.
++For instance, calculating the average value of an array of numbers requires a few variables in most languages \- at least one to hold the array, perhaps one for each element or for a loop counter\. In jq, it\'s simply \fBadd / length\fR \- the \fBadd\fR expression is given the array and produces its sum, and the \fBlength\fR expression is given the array and produces its length\.
+.
+.P
+So, there\'s generally a cleaner way to solve most problems in jq that defining variables\. Still, sometimes they do make things easier, so jq lets you define variables using \fBexpression as $variable\fR\. All variable names start with \fB$\fR\. Here\'s a slightly uglier version of the array\-averaging example:
@@ -916,7 +1190,7 @@ Pre-generate manual page to avoid Ruby dependencies.
+.IP "" 0
+.
+.P
-+The expression "foo as $x" runs foo, puts the result in $x, and returns the original input\. Apart from the side\-effect of binding the variable, it has the same effect as "\."\.
++The expression \fBexp as $x | \.\.\.\fR means: for each value of expression \fBexp\fR, run the rest of the pipeline with the entire original input, and with \fB$x\fR set to that value\. Thus \fBas\fR functions as something of a foreach loop\.
+.
+.P
+Variables are scoped over the rest of the expression that defines them, so
@@ -995,7 +1269,7 @@ Pre-generate manual page to avoid Ruby dependencies.
+.
+.nf
+
-+def addvalue(f): f as $value | map(, + $value);
++def addvalue(f): f as $value | map(\. + $value);
+.
+.fi
+.
@@ -1020,6 +1294,38 @@ Pre-generate manual page to avoid Ruby dependencies.
+.
+.IP "" 0
+.
++.SS "Reduce"
++The \fBreduce\fR syntax in jq allows you to combine all of the results of an expression by accumulating them into a single answer\. As an example, we\'ll pass \fB[3,2,1]\fR to this expression:
++.
++.IP "" 4
++.
++.nf
++
++reduce \.[] as $item (0; \. + $item)
++.
++.fi
++.
++.IP "" 0
++.
++.P
++For each result that \fB\.[]\fR produces, \fB\. + $item\fR is run to accumulate a running total, starting from 0\. In this example, \fB\.[]\fR produces the results 3, 2, and 1, so the effect is similar to running something like this:
++.
++.IP "" 4
++.
++.nf
++
++0 | (3 as $item | \. + $item) |
++ (2 as $item | \. + $item) |
++ (1 as $item | \. + $item)
++
++jq \'reduce \.[] as $item (0; \. + $item)\'
++ [10,2,5,3]
++=> 20
++.
++.fi
++.
++.IP "" 0
++.
+.SH "ASSIGNMENT"
+Assignment works a little differently in jq than in most programming languages\. jq doesn\'t distinguish between references to and copies of something \- two objects or arrays are either equal or not equal, without any further notion of being "the same object" or "not the same object"\.
+.
diff --git a/devel/jq/patches/patch-jv__utf8__tables.gen.h b/devel/jq/patches/patch-jv__utf8__tables.gen.h
deleted file mode 100644
index 9115017946e..00000000000
--- a/devel/jq/patches/patch-jv__utf8__tables.gen.h
+++ /dev/null
@@ -1,42 +0,0 @@
-$NetBSD: patch-jv__utf8__tables.gen.h,v 1.1 2013/04/26 10:20:34 jperkin Exp $
-
-Pre-generate file to avoid Python dependency.
-
---- /dev/null 2013-04-25 16:10:18.000000000 +0000
-+++ jv_utf8_tables.gen.h
-@@ -0,0 +1,35 @@
-+#define UTF8_CONTINUATION_BYTE ((unsigned char)255)
-+static const unsigned char utf8_coding_length[] =
-+ {0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
-+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
-+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
-+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
-+ 0x00, 0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
-+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
-+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
-+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
-+static const unsigned char utf8_coding_bits[] =
-+ {0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f,
-+ 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f,
-+ 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f,
-+ 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f,
-+ 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f,
-+ 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f,
-+ 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f,
-+ 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f,
-+ 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f,
-+ 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f,
-+ 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f,
-+ 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f,
-+ 0x00, 0x00, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f,
-+ 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f,
-+ 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f,
-+ 0x07, 0x07, 0x07, 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};