Skip to content

Commit

Permalink
fix(dev-db/mssql-scripter): rework package, fix #32
Browse files Browse the repository at this point in the history
Signed-off-by: Vladimir Pavljuchenkov (SpiderX) <spiderx@spiderx.dp.ua>
  • Loading branch information
SpiderX committed May 15, 2022
1 parent 0898f11 commit 93051d0
Show file tree
Hide file tree
Showing 3 changed files with 124 additions and 53 deletions.
1 change: 1 addition & 0 deletions dev-db/mssql-scripter/Manifest
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
DIST Microsoft.SqlTools.ServiceLayer-rhel-x64-net6.0.tar.gz 64810161 BLAKE2B ed9a8ae78715273fa6e16d737763adcee00e0078431583c4716f4337536e73661060cd3d7a7d60306e30836194be9b396b620f6c44e570a6983ead012703aeb4 SHA512 c8d78b74eef33dc64c09f6920e1abff27e9ef2033d7368031637781f9928c4071714be428fa2f9f00963874ba9a7df42f9c19596877a408dbbea35d950dddc38
DIST mssql-scripter-1.0.0a23.tar.gz 144409531 BLAKE2B 320c24230176eb61bb474d877e7d658fd88f07c4da9525c220c116878186502bd07e659113913d854798e9171df48397134053457510aaeacad0d2bb719652c4 SHA512 15e9aa34ca279f3bb7dc2c8f6a01d9d94b7b33a6cf36dbb4bffadc3b258a8b2905e2a03481a81a244f2d90efbfeff37141d9998522a5cc81a4b65d1ca3d79a0b
87 changes: 60 additions & 27 deletions dev-db/mssql-scripter/mssql-scripter-1.0.0_alpha23.ebuild
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Copyright 1999-2021 Gentoo Authors
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7
EAPI=8

PYTHON_COMPAT=( python3_{8,9} )
DISTUTILS_USE_PEP517=setuptools
PYTHON_COMPAT=( python3_{8..10} )

inherit distutils-r1

Expand All @@ -12,49 +13,81 @@ MY_P="${PN}-${MY_PV}"

DESCRIPTION="CLI for scripting SQL Server Databases"
HOMEPAGE="https://github.com/microsoft/mssql-scripter"
SRC_URI="https://github.com/microsoft/${PN}/archive/v${MY_PV}.tar.gz -> ${MY_P}.tar.gz"
SRC_URI="https://github.com/microsoft/${PN}/archive/v${MY_PV}.tar.gz -> ${MY_P}.tar.gz
https://github.com/microsoft/sqltoolsservice/releases/download/v3.0.0-release.251/Microsoft.SqlTools.ServiceLayer-rhel-x64-net6.0.tar.gz"

LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~x86"

RDEPEND="dev-python/future[${PYTHON_USEDEP}]
dev-util/lttng-ust:0="
RDEPEND="app-crypt/mit-krb5
dev-python/future[${PYTHON_USEDEP}]
dev-util/lttng-ust:0=
net-misc/curl"

S="${WORKDIR}/${MY_P}"

QA_PREBUILT="usr/lib*/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/System.Native.so
usr/lib*/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/System.Security.Cryptography.Native.OpenSsl.so
usr/lib*/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/System.Net.Http.Native.so
usr/lib*/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/MicrosoftSqlToolsServiceLayer
distutils_enable_tests pytest

QA_PREBUILT="usr/lib/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/createdump
usr/lib/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/libclrjit.so
usr/lib/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/libcoreclr.so
usr/lib/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/libcoreclrtraceptprovider.so
usr/lib/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/libdbgshim.so
usr/lib*/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/libhostfxr.so
usr/lib*/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/System.Net.Security.Native.so
usr/lib*/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/MicrosoftSqlToolsCredentials
usr/lib*/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/libhostpolicy.so
usr/lib/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/libmscordaccore.so
usr/lib/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/libmscordbi.so
usr/lib/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/libsos.so
usr/lib/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/libsosplugin.so
usr/lib*/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/MicrosoftSqlToolsCredentials
usr/lib*/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/MicrosoftSqlToolsServiceLayer
usr/lib*/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/SqlSerializationService
usr/lib*/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/SqlToolsResourceProviderService
usr/lib*/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/System.Native.so
usr/lib/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/System.Globalization.Native.so
usr/lib*/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/System.IO.Compression.Native.so
/usr/lib*/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/SqlSerializationService"
usr/lib*/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/System.Net.Http.Native.so
usr/lib*/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/System.Net.Security.Native.so
usr/lib*/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/System.Security.Cryptography.Native.OpenSsl.so
usr/lib/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/libSystem.Net.Security.Native.so
usr/lib/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/libSystem.Security.Cryptography.Native.OpenSsl.so
usr/lib/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/MicrosoftKustoServiceLayer
usr/lib/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/libSystem.Native.so
usr/lib/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/libSystem.IO.Compression.Native.so
usr/lib/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/libSystem.Globalization.Native.so"

EPYTEST_DESELECT=(
# 'Thread' object has no attribute 'isAlive'
mssqlscripter/jsonrpc/tests/test_jsonrpcclient.py::JsonRpcClientTests::test_normal_shutdown
mssqlscripter/jsonrpc/tests/test_jsonrpcclient.py::JsonRpcClientTests::test_receive_invalid_response_exception
mssqlscripter/jsonrpc/tests/test_jsonrpcclient.py::JsonRpcClientTests::test_response_dequeued
mssqlscripter/jsonrpc/tests/test_jsonrpcclient.py::JsonRpcClientTests::test_response_stream_closed_exception
mssqlscripter/jsonrpc/tests/test_jsonrpcclient.py::JsonRpcClientTests::test_send_multiple_request
mssqlscripter/jsonrpc/tests/test_jsonrpcclient.py::JsonRpcClientTests::test_submit_simple_request
)

src_unpack() {
default
unpack "${MY_P}".tar.gz

mkdir "${S}"/mssqlscripter/mssqltoolsservice/bin || die "mkdir failed"
pushd "${S}"/mssqlscripter/mssqltoolsservice/bin || die "pushd failed"
unpack ../../../sqltoolsservice/manylinux1/Microsoft.SqlTools.ServiceLayer-linux-x64-netcoreapp2.1.tar.gz
unpack Microsoft.SqlTools.ServiceLayer-rhel-x64-net6.0.tar.gz
popd || die "popd failed"
}

python_prepare_all() {
# Don't install bat
sed -i "/mssql-scripter.bat/d" setup.py || die "sed failed for setup.py"

distutils-r1_python_prepare_all
}
src_prepare() {
default

python_test() {
pushd mssqlscripter || die "pushd mssqlscripter failed"
"${PYTHON}" -m unittest discover -v tests || die "tests failed with ${EPYTHON}"
pushd jsonrpc || die "pushd jsonrpc failed"
"${PYTHON}" -m unittest discover -v tests || die "tests failed with ${EPYTHON}"
popd || die "popd failed"
# fix QA
sed -i '/description/s/-/_/' setup.cfg || die "sed failed"
# don't install bat
sed -i "/mssql-scripter.bat/d" setup.py || die "sed failed for setup.py"
# compatibility with recent sqltoolservice
sed -i '/utf/s|8|16|' mssqlscripter/main.py \
|| die "sed failed for main.py"
# don't bloat install with any dir except refs
find mssqlscripter/mssqltoolsservice/bin -mindepth 1 ! -name refs \
-type d -not -path '.' -exec rm -rf {} + \
|| die "find failed"
}
89 changes: 63 additions & 26 deletions dev-db/mssql-scripter/mssql-scripter-9999.ebuild
Original file line number Diff line number Diff line change
@@ -1,56 +1,93 @@
# Copyright 1999-2021 Gentoo Authors
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7
EAPI=8

PYTHON_COMPAT=( python3_{8,9} )
DISTUTILS_USE_PEP517=setuptools
PYTHON_COMPAT=( python3_{8..10} )
EGIT_REPO_URI="https://github.com/microsoft/${PN}.git"

inherit distutils-r1 git-r3

MY_PV="${PV//_alpha/a}"
MY_P="${PN}-${MY_PV}"

DESCRIPTION="CLI for scripting SQL Server Databases"
HOMEPAGE="https://github.com/microsoft/mssql-scripter"
SRC_URI=""
SRC_URI="https://github.com/microsoft/sqltoolsservice/releases/download/v3.0.0-release.251/Microsoft.SqlTools.ServiceLayer-rhel-x64-net6.0.tar.gz"

LICENSE="MIT"
SLOT="0"
KEYWORDS=""

RDEPEND="dev-python/future[${PYTHON_USEDEP}]
dev-util/lttng-ust:0="
RDEPEND="app-crypt/mit-krb5
dev-python/future[${PYTHON_USEDEP}]
dev-util/lttng-ust:0=
net-misc/curl"

QA_PREBUILT="usr/lib*/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/System.Native.so
usr/lib*/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/System.Security.Cryptography.Native.OpenSsl.so
usr/lib*/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/System.Net.Http.Native.so
usr/lib*/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/MicrosoftSqlToolsServiceLayer
S="${WORKDIR}/${MY_P}"

distutils_enable_tests pytest

QA_PREBUILT="usr/lib/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/createdump
usr/lib/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/libclrjit.so
usr/lib/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/libcoreclr.so
usr/lib/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/libcoreclrtraceptprovider.so
usr/lib/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/libdbgshim.so
usr/lib*/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/libhostfxr.so
usr/lib*/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/System.Net.Security.Native.so
usr/lib*/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/MicrosoftSqlToolsCredentials
usr/lib*/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/libhostpolicy.so
usr/lib/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/libmscordaccore.so
usr/lib/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/libmscordbi.so
usr/lib/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/libsos.so
usr/lib/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/libsosplugin.so
usr/lib*/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/MicrosoftSqlToolsCredentials
usr/lib*/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/MicrosoftSqlToolsServiceLayer
usr/lib*/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/SqlSerializationService
usr/lib*/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/SqlToolsResourceProviderService
usr/lib*/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/System.Native.so
usr/lib/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/System.Globalization.Native.so
usr/lib*/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/System.IO.Compression.Native.so
/usr/lib*/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/SqlSerializationService"
usr/lib*/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/System.Net.Http.Native.so
usr/lib*/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/System.Net.Security.Native.so
usr/lib*/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/System.Security.Cryptography.Native.OpenSsl.so
usr/lib/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/libSystem.Net.Security.Native.so
usr/lib/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/libSystem.Security.Cryptography.Native.OpenSsl.so
usr/lib/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/MicrosoftKustoServiceLayer
usr/lib/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/libSystem.Native.so
usr/lib/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/libSystem.IO.Compression.Native.so
usr/lib/python3.*/site-packages/mssqlscripter/mssqltoolsservice/bin/libSystem.Globalization.Native.so"

EPYTEST_DESELECT=(
# 'Thread' object has no attribute 'isAlive'
mssqlscripter/jsonrpc/tests/test_jsonrpcclient.py::JsonRpcClientTests::test_normal_shutdown
mssqlscripter/jsonrpc/tests/test_jsonrpcclient.py::JsonRpcClientTests::test_receive_invalid_response_exception
mssqlscripter/jsonrpc/tests/test_jsonrpcclient.py::JsonRpcClientTests::test_response_dequeued
mssqlscripter/jsonrpc/tests/test_jsonrpcclient.py::JsonRpcClientTests::test_response_stream_closed_exception
mssqlscripter/jsonrpc/tests/test_jsonrpcclient.py::JsonRpcClientTests::test_send_multiple_request
mssqlscripter/jsonrpc/tests/test_jsonrpcclient.py::JsonRpcClientTests::test_submit_simple_request
)

src_unpack() {
git-r3_src_unpack

mkdir "${S}"/mssqlscripter/mssqltoolsservice/bin || die "mkdir failed"
pushd "${S}"/mssqlscripter/mssqltoolsservice/bin || die "pushd failed"
unpack ../../../sqltoolsservice/manylinux1/Microsoft.SqlTools.ServiceLayer-linux-x64-netcoreapp2.1.tar.gz
unpack Microsoft.SqlTools.ServiceLayer-rhel-x64-net6.0.tar.gz
popd || die "popd failed"
}

python_prepare_all() {
# Don't install bat
sed -i "/mssql-scripter.bat/d" setup.py || die "sed failed for setup.py"
src_prepare() {
default

distutils-r1_python_prepare_all
}

python_test() {
pushd mssqlscripter || die "pushd mssqlscripter failed"
"${PYTHON}" -m unittest discover -v tests || die "tests failed with ${EPYTHON}"
pushd jsonrpc || die "pushd jsonrpc failed"
"${PYTHON}" -m unittest discover -v tests || die "tests failed with ${EPYTHON}"
popd || die "popd failed"
# fix QA
sed -i '/description/s/-/_/' setup.cfg || die "sed failed"
# don't install bat
sed -i "/mssql-scripter.bat/d" setup.py || die "sed failed for setup.py"
# compatibility with recent sqltoolservice
sed -i '/utf/s|8|16|' mssqlscripter/main.py \
|| die "sed failed for main.py"
# don't bloat install with any dir except refs
find mssqlscripter/mssqltoolsservice/bin -mindepth 1 ! -name refs \
-type d -not -path '.' -exec rm -rf {} + \
|| die "find failed"
}

0 comments on commit 93051d0

Please sign in to comment.