pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Start work on Go packaging automation.



Module Name:	pkgsrc-wip
Committed By:	Benny Siegert <bsiegert%gmail.com@localhost>
Pushed By:	bsiegert
Date:		Tue Apr 4 22:57:30 2017 +0200
Changeset:	77423d003e4e1cc76e4485b5c06935bb6e9e72f1

Added Files:
	gopkgdep/files/gopkgdep.sh

Log Message:
Start work on Go packaging automation.

For now, this prints the (recursive) list of dependent packages
of a given Go source path. Example: ./gopkgdep.sh golang.org/x/crypto

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=77423d003e4e1cc76e4485b5c06935bb6e9e72f1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 gopkgdep/files/gopkgdep.sh | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diffs:
diff --git a/gopkgdep/files/gopkgdep.sh b/gopkgdep/files/gopkgdep.sh
new file mode 100755
index 0000000000..7cf78afab1
--- /dev/null
+++ b/gopkgdep/files/gopkgdep.sh
@@ -0,0 +1,24 @@
+#!/bin/sh
+#
+# output dependencies for a given Go package. Input is the GO_SRCPATH.
+
+ME=$(basename $0)
+
+if [ -z "$1" ]; then
+	echo "Usage: $0 srcpath" >&2
+	exit 1
+fi
+
+
+GOPATH=$(mktemp -d -t ${ME}) || exit 2
+export GOPATH
+
+echo "=> Downloading code for $1"
+go get "$1/..."
+
+echo "=> Recursive dependencies (excluding stdlib)"
+go list -f '{{range .Deps}}{{.}}
+{{end}}' "$1/..." \
+	| sort -u \
+	| xargs go list -e -f '{{if not .Standard}}{{.ImportPath}}{{end}}' \
+	| grep -v "^$1"
\ No newline at end of file


Home | Main Index | Thread Index | Old Index