~alpine/aports

main/samurai: upgrade to 1.2 v1 PROPOSED

Drew DeVault: 1
 main/samurai: upgrade to 1.2

 2 files changed, 4 insertions(+), 92 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.alpinelinux.org/~alpine/aports/patches/3399/mbox | git am -3
Learn more about email & git

[PATCH] main/samurai: upgrade to 1.2 Export this patch

---
 main/samurai/20-query-tool.patch | 86 --------------------------------
 main/samurai/APKBUILD            | 10 ++--
 2 files changed, 4 insertions(+), 92 deletions(-)
 delete mode 100644 main/samurai/20-query-tool.patch
diff --git a/main/samurai/20-query-tool.patch b/main/samurai/20-query-tool.patch
deleted file mode 100644
index 441453fa7b..0000000000
--- a/main/samurai/20-query-tool.patch
@@ -1,86 +0,0 @@
From: Paolo Bonzini <pbonzini@redhat.com>
Subject: [PATCH] Implement "query" tool

The query tool allows to print the incoming and outgoing edges for
a given node.

Upstream commit 0727b7c7d08e857a836b8cc7c630fe7a66385c92.

diff --git a/samu.1 b/samu.1
index 1bcc181..62c4cdb 100644
--- a/samu.1
+++ b/samu.1
@@ -29,6 +29,11 @@
 .Nm
 .Op Fl C Ar dir
 .Op Fl f Ar buildfile
+.Fl t Cm query
+.Op Ar target...
+.Nm
+.Op Fl C Ar dir
+.Op Fl f Ar buildfile
 .Fl t Cm targets
 .Op Cm depth Op Ar maxdepth
 .Nm
@@ -78,6 +83,10 @@ tool is used, a compilation database
 is printed instead.
 .Pp
 If the
+.Cm query
+tool is used, the inputs and outputs of the targets are printed instead.
+.Pp
+If the
 .Cm targets
 tool is used, a list of targets will be displayed, either by rule or by depth.
 The first argument determines how the targets will be displayed:
diff --git a/tool.c b/tool.c
index 1eaabfd..5e777cd 100644
--- a/tool.c
+++ b/tool.c
@@ -298,9 +298,46 @@ targets(int argc, char *argv[])
 	return 0;
 }
 
+static int
+query(int argc, char *argv[])
+{
+	struct node *n;
+	struct edge *e;
+	char *path;
+	int i;
+	size_t j, k;
+
+	if (argc == 1) {
+		fprintf(stderr, "usage: %s ... -t query target...\n", argv0);
+		exit(2);
+	}
+	for (i = 1; i < argc; ++i) {
+		path = argv[i];
+		n = nodeget(path, 0);
+		if (!n)
+			fatal("unknown target '%s'", path);
+		printf("%s:\n", argv[i]);
+		e = n->gen;
+		if (e) {
+			printf("  input: %s\n", e->rule->name);
+			for (j = 0; j < e->nin; ++j)
+				printf("    %s\n", e->in[j]->path->s);
+		}
+		puts("  outputs:");
+		for (j = 0; j < n->nuse; ++j) {
+			e = n->use[j];
+			for (k = 0; k < e->nout; ++k)
+				printf("    %s\n", e->out[k]->path->s);
+		}
+	}
+
+	return 0;
+}
+
 static const struct tool tools[] = {
 	{"clean", clean},
 	{"compdb", compdb},
+	{"query", query},
 	{"targets", targets},
 };
 
diff --git a/main/samurai/APKBUILD b/main/samurai/APKBUILD
index 8c3cf969ac..0162ee16e0 100644
--- a/main/samurai/APKBUILD
+++ b/main/samurai/APKBUILD
@@ -1,16 +1,15 @@
# Contributor: Drew DeVault <sir@cmpwn.com>
# Maintainer: Drew DeVault <sir@cmpwn.com>
pkgname=samurai
pkgver=1.1
pkgrel=1
pkgver=1.2
pkgrel=0
pkgdesc="ninja-compatible build tool written in C"
url="https://github.com/michaelforney/samurai"
arch="all"
license="Apache-2.0"
options="!check"  # No test suite.
subpackages="$pkgname-doc"
source="https://github.com/michaelforney/samurai/releases/download/$pkgver/samurai-$pkgver.tar.gz
	20-query-tool.patch"
source="https://github.com/michaelforney/samurai/releases/download/$pkgver/samurai-$pkgver.tar.gz"
provides="ninja"
replaces="ninja"

@@ -23,5 +22,4 @@ package() {
	ln -s samu "$pkgdir"/usr/bin/ninja
}

sha512sums="b27302c34d736f483909e57c8b162609eaa4c86571c1167b71a5564b521cc3af2861307a16bb6dca55e80952088989e9526b103160d2ea054d15f4ed85b1cedb  samurai-1.1.tar.gz
54f5159ed71e5e0d4bcc3e9c7534411225b1ad8b90ac5ac917114dbae619fed74b74a91dea4d99246304d0e7017f2600a06dd54f899a7b7852a858189e12608d  20-query-tool.patch"
sha512sums="bbe6a582c34b04f1df53b76c1647aa3e03c4698ebf7591a203935f11ffa05971bbcb86dc1a8c06aeb904cdc741abb08918122810fc47216fed0a6d9f87fd1225  samurai-1.2.tar.gz"
-- 
2.29.2