commit:     744d388a0c92404d80bb0f125394a2c6cc624f2f
Author:     Horodniceanu Andrei <a.horodniceanu <AT> proton <DOT> me>
AuthorDate: Fri Jan 12 18:29:53 2024 +0000
Commit:     Horodniceanu Andrei <a.horodniceanu <AT> proton <DOT> me>
CommitDate: Sun Jan 14 20:43:48 2024 +0000
URL:        https://gitweb.gentoo.org/repo/user/dlang.git/commit/?id=744d388a

dev-util/dub: add and enable tests for 1.35.1-r1

Signed-off-by: Horodniceanu Andrei <a.horodniceanu <AT> proton.me>

 dev-util/dub/Manifest             |   3 +
 dev-util/dub/dub-1.35.1-r1.ebuild | 148 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 151 insertions(+)

diff --git a/dev-util/dub/Manifest b/dev-util/dub/Manifest
index 9a9d96c..b6c5eda 100644
--- a/dev-util/dub/Manifest
+++ b/dev-util/dub/Manifest
@@ -1,2 +1,5 @@
 DIST dub-1.33.0.tar.gz 1488522 BLAKE2B 
f3171c4c85dca2bdae133c1f9f8f4ef79726a882ace9242ee825716c2f38ade16171eb1f0395856117d2b7ed592dd19e8e223ddff78ba900716832b346162f7e
 SHA512 
027c77ac6179cb0cf26618a04604c15bbe4ae668901b54a0029b63ce4585cd1017c463cd9b6bc58f2eabafab85fb58935feb2866714e69d281d1d5cbe0a3f806
 DIST dub-1.35.1.tar.gz 1494965 BLAKE2B 
400e210584660f7ac67732006ca6d88156adbbf2bf221aa244e317bf7c2772a6a01d9e141252fbf0cfde4c07302ee533593f3a2f418f9e120edc7359a83180cf
 SHA512 
a371a7ec7003a4a4fb642a3567fce0685c99f4940a02de94d026bdc6fe4e84512b16e4bb57673da4d3b8e25177cc3df329da41862086cecc7b98aec1ebf9e4e7
+DIST gitcompatibledubpackage-1.0.1.zip 1354 BLAKE2B 
60c3ff78c9cc0ca16f36bfdb4d91f6ec7e8d1bc7fb2fae9488e3f24b33fc3b578157f3c2fd9f892743b1fba7ec473267d9027febd3c27ac2af52733e146c341d
 SHA512 
0adb8a97cce0aaac1dbaea978aacf801071457c06413e618b0feb1adaf4169c7a1acbfac2d9c192fada4f2f8bd44e1ea3b9fce8c7cb3fb8bf364eba75f559122
+DIST gitcompatibledubpackage-1.0.4.zip 2041 BLAKE2B 
595080956881fd86753b17cdbb12108ab03161806ca51c748017f29251dd47a95a0aebde4442db1783602cfa67a9593014ebb6ca591dcfec2b08eef3d737e2cc
 SHA512 
12057117be99bb4d2351af74cfd36c050734383bfc44b185cf5f9737d982e9fd6840f6968a3246b625d4ec90e9d30f5e394f8fa1febb85464429d771bc8062d0
+DIST urld-2.1.1.zip 15062 BLAKE2B 
fe123fbef20167e07c81d0f7700a59c48dca28311329f9717283f3e7c88cc2430a1ffc26632c8c1512145b9d6fa6e432cee1677e99be3bd555247f02f7f42b67
 SHA512 
c4c8d349a8bbac9f234166ed9452ab221f8928e822c6ab95716b05948dbb21ae4309face4158909559698f23aa750c9faef5b2294feef7e601ccbc9a41c3b6bb

diff --git a/dev-util/dub/dub-1.35.1-r1.ebuild 
b/dev-util/dub/dub-1.35.1-r1.ebuild
new file mode 100644
index 0000000..45e6d75
--- /dev/null
+++ b/dev-util/dub/dub-1.35.1-r1.ebuild
@@ -0,0 +1,148 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+DESCRIPTION="Package and build management system for D"
+HOMEPAGE="https://code.dlang.org/";
+LICENSE="MIT"
+
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="debug test"
+RESTRICT="!test? ( test )"
+
+DUB_TEST_DEPS=(
+       [email protected]
+       [email protected]
+       [email protected]
+)
+generate_dub_dependencies() {
+       local dep
+       for dep in "${DUB_TEST_DEPS[@]}"; do
+               local depName depVersion
+               depName="${dep%@*}"
+               depVersion="${dep#*@}"
+               echo 
"https://code.dlang.org/packages/${depName}/${depVersion}.zip -> 
${depName}-${depVersion}.zip"
+       done
+}
+
+GITHUB_URI="https://codeload.github.com/dlang";
+SRC_URI="
+${GITHUB_URI}/${PN}/tar.gz/v${PV} -> ${PN}-${PV}.tar.gz
+test? (
+       $(generate_dub_dependencies)
+)
+"
+
+# Upstream recommends the latest version available
+DLANG_VERSION_RANGE="2.100-2.106"
+DLANG_PACKAGE_TYPE="single"
+
+inherit dlang
+
+src_unpack() {
+       unpack "${PN}-${PV}.tar.gz"
+
+       if use test; then
+               # Copy the archives locally. Some tests do need to perform an
+               # actual fetch operation so make all of them available as
+               # archives and let dub figure out the rest.
+               local dep
+               for dep in "${DUB_TEST_DEPS[@]}"; do
+                       local depName depVersion
+                       depName="${dep%@*}"
+                       depVersion="${dep#*@}"
+
+                       cp "${DISTDIR}/${depName}-${depVersion}.zip" "${T}" || 
die
+               done
+
+               # Generate a dub.settings.json file that points to the 
directory with all the deps
+               cat <<EOF > "${T}/dub.settings.json"
+{
+       "registryUrls": [
+               "file://${T}"
+       ],
+       "skipRegistry": "all"
+}
+EOF
+       fi
+}
+
+d_src_compile() {
+       local imports=source versions="DubApplication DubUseCurl"
+       dlang_compile_bin bin/dub $(<build-files.txt)
+
+       ## Currently broken with gdc
+       # Generate man pages
+       #bin/dub scripts/man/gen_man.d || die "Could not generate man pages."
+}
+
+d_src_test() {
+       # Ideally don't export $DUB to not mess up the scripts (if any) in 
src_install.
+       local DUB="${S}/bin/dub"
+       # Note, disabling tests is possible yet very hard. You have to create a 
bash variable containing a
+       # regex (to be used in =~) that matches all the tests that you want 
*to* run. It's probably easier to
+       # delete the subdirectory under ${S}/test.
+
+       # Tries to connect to github.com and fails due to the network sandbox
+       rm -rf "${S}/test/git-dependency" || die
+       # Doesn't work on non amd64/x86
+       if [[ ${ARCH} != amd64 ]] && [[ ${ARCH} != x86 ]]; then
+               rm -rf test/issue1447-build-settings-vars
+       fi
+
+       if [[ ${DLANG_VENDOR} == GNU ]]; then
+               # Doesn't work with gdc. It doesn't like gdc being in the form 
${CHOST}-gdc.
+               # In the source the test is skipped for dmd and gdc.
+               rm -rf test/depen-build-settings || die
+
+               # Some tests fail because gdc enables dip1000 by default which
+               # adds a bunch of deprecations. Since deprecations are warnings
+               # for gdc and dub adds -Werror by default we have to turn it
+               # off. Since we can't turn it off yet we have to delete the
+               # test.  See: https://github.com/dlang/dub/pull/2796
+               rm -rf test/dub-as-a-library-cwd || die
+       fi
+
+       local dropImportCTest
+       # We have an importC test and not all compilers pass it properly.
+       # gdc-13 doesn't support #include's in its importC implementation yet.
+       [[ ${DLANG_VENDOR} == GNU ]] && [[ ${DC_VERSION} -ge 13 ]] && 
dropImportCTest=1
+       # Nor does <=ldc2-1.32.
+       [[ ${DLANG_VENDOR} == LDC ]] && $(ver_test ${DC_VERSION} -le 1.32) && 
dropImportCTest=1
+       # dmd can do #include's but there are some other errors about 
__float128 in <=dmd-2.102 for non amd64.
+       [[ ${DLANG_VENDOR} == DigitalMars ]] && $(ver_test ${DC_VERSION} -le 
2.102) \
+               && [[ ${ARCH} != amd64 ]] && dropImportCTest=1
+       if [[ -n ${dropImportCTest} ]]; then
+               rm -rf "${S}/test/use-c-sources" || die
+       fi
+
+       # Put the configuration file relative to the dub binary:
+       # <dub-bin-dir>/../etc/dub/settings.json as per
+       # https://dub.pm/dub-reference/settings so that it's picked up
+       # automatically.
+       mkdir -p "${S}/bin/../etc/dub" || die
+       cp "${T}/dub.settings.json" "${S}/bin/../etc/dub/settings.json" \
+               || die "Could not copy dub configuration file"
+
+       # See https://bugs.gentoo.org/921581 we have to remove -op (preserve 
source path for output files)
+       # from the flags lest the sandbox trips us up.
+       local filteredDflags="${DCFLAGS//--op/}"
+       filteredDflags="${filteredDflags//-op/}"
+
+       # There's no easy way to make dub verbose here, the path has to be an 
actual binary for a few tests.
+       DUB="${DUB}" DFLAGS="${filteredDflags}" FRONTEND="${DLANG_VERSION}" 
test/run-unittest.sh  \
+               || die "Tests failed"
+}
+
+d_src_install() {
+       dobin bin/dub
+       dodoc README.md
+
+       ## Currently broken with gdc
+       # All the files in the directory below, with the exception of gen_man.d 
and README, are man pages.
+       # To keep the ebuild simple, we will just glob on the files that end in 
.1 since there are currently
+       # no man pages in a different section.
+       #doman scripts/man/*.1
+}

Reply via email to