Please keep me CC'ed, I’m not subscribed to debian-dak. Please consider merging the following patch which you can find attached to this email or at https://github.com/stapelberg/dak/tree/golang. Thank you!
This query will replace a heuristic in dh-make-golang(1) and help us resolve Go build dependencies into Debian build dependencies accurately. --- dakweb/dakwebserver.py | 1 + dakweb/queries/golang.py | 52 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 dakweb/queries/golang.py diff --git a/dakweb/dakwebserver.py b/dakweb/dakwebserver.py index 0ddc10cf..bd6b62ff 100755 --- a/dakweb/dakwebserver.py +++ b/dakweb/dakwebserver.py @@ -45,6 +45,7 @@ from queries.archive import * from queries.madison import * from queries.source import * from queries.suite import * +from queries.golang import * # Set up our initial database connection d = DBConn() diff --git a/dakweb/queries/golang.py b/dakweb/queries/golang.py new file mode 100644 index 00000000..0c343424 --- /dev/null +++ b/dakweb/queries/golang.py @@ -0,0 +1,52 @@ +"""Golang related queries + +@contact: https://pkg-go.alioth.debian.org/ +@copyright: 2017 Michael Stapelberg <stapelb...@debian.org> +@license: GNU General Public License version 2 or later +""" + +import bottle +import json + +from daklib.dbconn import DBConn, MetadataKey +from dakweb.webregister import QueryRegister + + +@bottle.route('/golang/import_paths') +def import_paths(): + """ + Returns a mapping of Go import path to Debian binary package name and + corresponding Debian source package name. + + @rtype: dictionary + @return: A list of dictionaries of + - binary + - source + - importpath + """ + + s = DBConn().session() + conn = s.connection() + res = conn.execute(""" + SELECT + binaries.package, + source.source, + source_metadata.value AS importpath + FROM + binaries LEFT JOIN + source ON (binaries.source = source.id) LEFT JOIN + source_metadata ON (source.id = source_metadata.src_id) LEFT JOIN + metadata_keys ON (source_metadata.key_id = metadata_keys.key_id) + WHERE + metadata_keys.key = 'Go-Import-Path' + GROUP BY + binaries.package, + source.source, + source_metadata.value; + """) + out = [{'binary': res[0], 'source': res[1], 'importpath': res[2]} for res in res] + s.close() + + return json.dumps(out) + +QueryRegister().register_path('/golang/import_paths', import_paths) -- 2.14.2
From 50470f6ba177058fbc77a6652c5883322f78c4fb Mon Sep 17 00:00:00 2001 From: Michael Stapelberg <stapelb...@debian.org> Date: Sun, 22 Oct 2017 18:32:04 +0200 Subject: [PATCH] dakweb: add /golang/import_paths query This query will replace a heuristic in dh-make-golang(1) and help us resolve Go build dependencies into Debian build dependencies accurately. --- dakweb/dakwebserver.py | 1 + dakweb/queries/golang.py | 52 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 dakweb/queries/golang.py diff --git a/dakweb/dakwebserver.py b/dakweb/dakwebserver.py index 0ddc10cf..bd6b62ff 100755 --- a/dakweb/dakwebserver.py +++ b/dakweb/dakwebserver.py @@ -45,6 +45,7 @@ from queries.archive import * from queries.madison import * from queries.source import * from queries.suite import * +from queries.golang import * # Set up our initial database connection d = DBConn() diff --git a/dakweb/queries/golang.py b/dakweb/queries/golang.py new file mode 100644 index 00000000..0c343424 --- /dev/null +++ b/dakweb/queries/golang.py @@ -0,0 +1,52 @@ +"""Golang related queries + +@contact: https://pkg-go.alioth.debian.org/ +@copyright: 2017 Michael Stapelberg <stapelb...@debian.org> +@license: GNU General Public License version 2 or later +""" + +import bottle +import json + +from daklib.dbconn import DBConn, MetadataKey +from dakweb.webregister import QueryRegister + + +@bottle.route('/golang/import_paths') +def import_paths(): + """ + Returns a mapping of Go import path to Debian binary package name and + corresponding Debian source package name. + + @rtype: dictionary + @return: A list of dictionaries of + - binary + - source + - importpath + """ + + s = DBConn().session() + conn = s.connection() + res = conn.execute(""" + SELECT + binaries.package, + source.source, + source_metadata.value AS importpath + FROM + binaries LEFT JOIN + source ON (binaries.source = source.id) LEFT JOIN + source_metadata ON (source.id = source_metadata.src_id) LEFT JOIN + metadata_keys ON (source_metadata.key_id = metadata_keys.key_id) + WHERE + metadata_keys.key = 'Go-Import-Path' + GROUP BY + binaries.package, + source.source, + source_metadata.value; + """) + out = [{'binary': res[0], 'source': res[1], 'importpath': res[2]} for res in res] + s.close() + + return json.dumps(out) + +QueryRegister().register_path('/golang/import_paths', import_paths) -- 2.14.2
_______________________________________________ Pkg-go-maintainers mailing list Pkg-go-maintainers@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-go-maintainers