67.11. hurl-8.0.1
Runs HTTP requests and their assertions from a plain-text file
| Version | 8.0.1, release 1 |
| Shelf | devtools — Debuggers, tracers, profilers, analysers, linters, language servers and developer utilities |
| Phase | 40_lang (Languages), 19 of 186 in build order |
| Licence | Apache-2.0 |
| Homepage | https://hurl.dev/ |
| Build time | 4.3 SBU |
| Installed size | 7.3 MiB in 5 files |
| Recipe | ports/core/devtools/hurl/kpkgbuild |
About
Hurl runs HTTP requests described in a plain-text .hurl file and checks each response against the assertions written under it: status, headers, and the body queried by JSONPath, XPath or regular expression. hurlfmt formats and converts such files. A test of an HTTP service is then a file that can be kept beside the service and compared in a diff.
Hurl makes its requests through the system’s curl, so it speaks the protocols and uses the CA store the rest of the machine does, and evaluates XPath with libxml2; the built hurl links both shared libraries.
Why it is in KDOS
The comment above it in script/phases/40_lang/packages.d/devtools.txt:
xh explores and hurl asserts: a request plus what the answer must contain, in a file that diffs. On a machine with no CI, that file IS the CI.
Sources
hurl-8.0.1.tar.gz(12.5 MiB)
sha256d5ea72ed489b9de319d0306d7b23728c4d284ac505adeb06c297ff5da1cf0de8
upstream: https://github.com/Orange-OpenSource/hurl/archive/refs/tags/8.0.1.tar.gz
archive copy: sources-1/devtools--hurl-8.0.1.tar.gzhurl-vendor-8.0.1.tar.xz(19.0 MiB)
sha256bf3e6fdbdc150202a92373e0dbca4986450c7e61f3b7e7ecde271c0336ad72ad
a vendor bundle: the dependencies upstream’s own tool would download, packed once
archive copy: sources-1/devtools--hurl-vendor-8.0.1.tar.xz
Dependencies
Depends on: rust, clang, pkgconf, curl, libxml2.
Required by: no port names it.
Installation
From the repository root, inside the build container, this is the line kdosbuild runs for the port:
script/chroot/exec.sh bash -c 'source script/phases/40_lang/phase.env && kpkg install hurl'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/devtools/hurl.
1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.
cd /ports/core/devtools/hurl
echo 'd5ea72ed489b9de319d0306d7b23728c4d284ac505adeb06c297ff5da1cf0de8 hurl-8.0.1.tar.gz' | sha256sum -c -
echo 'bf3e6fdbdc150202a92373e0dbca4986450c7e61f3b7e7ecde271c0336ad72ad hurl-vendor-8.0.1.tar.xz' | sha256sum -c -
2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.
SRC_ROOT=/var/cache/kpkg/work/hurl
SRC=$SRC_ROOT/hurl-8.0.1
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf hurl-8.0.1.tar.gz -C "$SRC" --strip-components=1
Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.
3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
tar xf $PORT_SRC/${name}-vendor-${version}.tar.xz
export RUSTFLAGS="-C target-feature=-crt-static"
export LIBCLANG_PATH=/usr/lib
cargo build --release --frozen --offline --bin hurl --bin hurlfmt
install -Dm755 target/release/hurl $PKG/usr/bin/hurl
install -Dm755 target/release/hurlfmt $PKG/usr/bin/hurlfmt
install -Dm644 docs/manual/hurl.1 docs/manual/hurlfmt.1 -t "$PKG/usr/share/man/man1"
The switches, and why each is set:
LIBCLANG_PATH=/usr/lib— Where theclang-syscrate looks forlibclang.so. Thelibxmlcrate generates its binding to libxml2 with bindgen (itsruntimefeature, which loads libclang at build time), so clang is independs.--bin hurl --bin hurlfmt— Build the two programs by name; the workspace’s third member,hurl_core, is a library they both link.
The common switches of each build system are explained in the Flag glossary.
4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/hurl, prunes what the image does not ship, lints the tree and rolls it reproducibly:
tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
--mtime=@$SOURCE_DATE_EPOCH \
--use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
-cf hurl-8.0.1-1.tar.xz -C "$PKG" .
5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/hurl, and runs the triggers its paths call for.
Contents
Installed programs: hurl, hurlfmt.
Installed directories: /usr/share/licenses/hurl.
Short descriptions
hurl |
run and test HTTP requests. |
hurlfmt |
format Hurl files |
Notes
The manual pages are shipped rendered in the source, under docs/manual, and installed as they are.