commit:     b4952d4067abbdabc92d9c0f7dd388c56766ce64
Author:     Andrei Horodniceanu <a.horodniceanu <AT> proton <DOT> me>
AuthorDate: Thu May  2 14:55:21 2024 +0000
Commit:     Horodniceanu Andrei <a.horodniceanu <AT> proton <DOT> me>
CommitDate: Thu May  2 14:55:35 2024 +0000
URL:        https://gitweb.gentoo.org/repo/user/dlang.git/commit/?id=b4952d40

dev-util/dcd: add 0.16.0_beta2

Additional changes:
- run tests with the newly added --extra switch
- don't fetch the d-test-utils submodule as it is only used in certain
  tests that are not relevant for Gentoo
- reorder variables to please pkgcheck

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

 dev-util/dcd/Manifest                |   2 +
 dev-util/dcd/dcd-0.16.0_beta2.ebuild |  99 ++++++++++++++++++++++++++++++
 dev-util/dcd/files/pr-774.patch      | 115 +++++++++++++++++++++++++++++++++++
 3 files changed, 216 insertions(+)

diff --git a/dev-util/dcd/Manifest b/dev-util/dcd/Manifest
index 4db4ea3..0400a2f 100644
--- a/dev-util/dcd/Manifest
+++ b/dev-util/dcd/Manifest
@@ -1,5 +1,7 @@
 DIST DCD-0.15.2.tar.gz 171345 BLAKE2B 
1d85e2b00a201a3ba762fa0357269a3980eeac4db006cd6b82d4688b624af7ac4938e0cac7cf0d8bc37ac2d08cda2c4c1d5f44dc0451bd44427fef8e98282a8a
 SHA512 
b18a886521843b0e9b91a5c457620337073c0221bfe924c289cd5808f4433ec91078e10e6d1b7ba2f35359b2fe0fed140ca81381246322be3a02ef4e7ffd11ba
+DIST DCD-0.16.0-beta.2.tar.gz 199293 BLAKE2B 
9fee6eb69340e32e1619952854ce883a834f2098a9443c2e210e9d9f6c8224f6a4bd9784ed5801cc66887588881f7e59146a75399b5c695c17ff6151399d5425
 SHA512 
154538ffd68f52a859bf0e736b84e483ea61037a3042f83285c86066cc954c490cf2ef7aa0a4abfef09150794ef67a30f085e43dae96b6ab4553836f00a17316
 DIST containers-116a02872039efbd0289828cd5eeff6f60bdf539.tar.gz 55518 BLAKE2B 
466c2452724b3d377ca2cec8793e27b8599e4388644ef7058de4e535d5f095f6e713e6aaf7e934f944b68726f9a96aed3f093100f993cfe4db1efd5dbd9e6cd4
 SHA512 
e98ecc56b7dac12c347b591f65b33fc213a183e22c455e6bd2727d9797922069db70143240d935d72c38738fc43b579ede33c4a6d8e7ac0e5194001d3b0d773f
 DIST d-test-utils-206a2e6abd97b4462f3a320e4f2d23986fad3cff.tar.gz 3188 BLAKE2B 
2b3b334a63595c5f3b85b3354b1d93035c727f494bcaf3a255db2aeb610aa00cd3639d0e08fb54b5ee2f41033173a7f5062ee30edf95c7279b87aeec32e8f39f
 SHA512 
14e3743400957b0fec4c0799c59719957b19c4cb6cf7727f1901adc4acaa4b89309b84f47798e7af8fc066349662c720e2a0298acb8ed5e36c9a96df41e2d960
 DIST libdparse-592ef39a73a58439afc75a3e6c13a0d87d0b847d.tar.gz 150314 BLAKE2B 
bff8c5bd7d5f8cf542eed17f3f85bbd44f71572023a0153b8de0e9341651b137e22f7c4162a2c31abbd6d4981fd49dc3dafc227ef566687711db8c85572e5423
 SHA512 
7648c891f65cef4c52ff13a633568a6b4ac224300fb74455335efa132108790d62c49fb31034cce65d49128277ac3fdd2033ee6e80077d73a0b18d3c17256b1f
+DIST libdparse-86c9bf44c96e1666eb175c749cc26f62c2008979.tar.gz 158565 BLAKE2B 
ef572f06fa465cafd722290a8daf4cbd718d60c4df43ae46596ab3626d8866a706632bc4fc6dc197a3f33b1e83e456ad0342cfeb474f79f929f6fe6cc365d74c
 SHA512 
f21534c7aaad254e0207fc9ac5ac1e8f12c6848a84e289b37c0a462f9fcf5dd19a2b7f7e1539999e0ca1acaccb97c31238ab97c0003ecd4ddd7a3dfe904aab7f
 DIST msgpack-d-480f3bf9ee80ccf6695ed900cfcc1850ba8da991.tar.gz 143848 BLAKE2B 
44ac6f1efbbdb455af694cc476524535bebe993777a8c47d93a7cff21d825c2b8ce4caaf0d9f072f1e37869a9e50821abbd60e23a38546e0522047809cd0695a
 SHA512 
76f7049c9f9f4128b9e9691e224c2ff5d8ee5400bf0796cc362386f0bc6f2359bb1694606923aec21eab539f65b93b828c2e018dee22358b91713365dd443e4d

diff --git a/dev-util/dcd/dcd-0.16.0_beta2.ebuild 
b/dev-util/dcd/dcd-0.16.0_beta2.ebuild
new file mode 100644
index 0000000..ac6563f
--- /dev/null
+++ b/dev-util/dcd/dcd-0.16.0_beta2.ebuild
@@ -0,0 +1,99 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DESCRIPTION="Auto-complete program for the D programming language"
+HOMEPAGE="https://github.com/dlang-community/DCD";
+
+MY_PV=$(ver_rs 3 - 4 .) # For beta releases 0.16.0_beta2 -> 0.16.0-beta.2
+
+CONTAINERS="116a02872039efbd0289828cd5eeff6f60bdf539"
+LIBDPARSE="86c9bf44c96e1666eb175c749cc26f62c2008979"
+MSGPACK="480f3bf9ee80ccf6695ed900cfcc1850ba8da991"
+SRC_URI="
+       https://github.com/dlang-community/DCD/archive/v${MY_PV}.tar.gz -> 
DCD-${MY_PV}.tar.gz
+       
https://github.com/economicmodeling/containers/archive/${CONTAINERS}.tar.gz -> 
containers-${CONTAINERS}.tar.gz
+       
https://github.com/dlang-community/libdparse/archive/${LIBDPARSE}.tar.gz -> 
libdparse-${LIBDPARSE}.tar.gz
+       https://github.com/msgpack/msgpack-d/archive/${MSGPACK}.tar.gz -> 
msgpack-d-${MSGPACK}.tar.gz
+       "
+S="${WORKDIR}/DCD-${MY_PV}"
+LICENSE="GPL-3"
+
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+
+IUSE="systemd"
+
+PATCHES=(
+       "${FILESDIR}/pr-774.patch"
+)
+
+DLANG_COMPAT=( dmd-2_{106..108} gdc-13 ldc2-1_{35..37} )
+
+inherit dlang-single systemd bash-completion-r1
+
+REQUIRED_USE=${DLANG_REQUIRED_USE}
+DEPEND=${DLANG_DEPS}
+RDEPEND=${DLANG_DEPS}
+BDEPEND=${DLANG_DEPS}
+
+src_prepare() {
+       # Default ebuild unpack function places archives side-by-side ...
+       mv -T ../containers-${CONTAINERS}    containers            || die
+       mv -T ../libdparse-${LIBDPARSE}      libdparse             || die
+       mv -T ../msgpack-d-${MSGPACK}        msgpack-d             || die
+       # Stop the makefile from executing git to write an unused githash.txt
+       mkdir bin || die "Coult not create output directory"
+       echo "v${PV}" > bin/githash.txt || die "Could not generate githash"
+       touch githash || die "Could not generate githash"
+
+       # Apply patches
+       default
+}
+
+src_compile() {
+       # Don't let the makefile overwrite user flags.
+       # The downside is that we have to also pass the include dirs.
+       local flags="${DCFLAGS} ${DLANG_LDFLAGS}"
+       flags+=" -Icontainers/src -Idsymbol/src -Ilibdparse/src -Imsgpack-d/src 
-Isrc -Jbin"
+       # An uppercase name of the compiler. It can be GDC, LDC or DMD
+       local name=${EDC::3}
+       name=${name^^}
+
+       # Build client & server with the requested Dlang compiler.
+       local mymakeargs=(
+               # The path to the correct compiler
+               "${name}=${DC}"
+               # The flags for the client and the server
+               "${name}_CLIENT_FLAGS=${flags} 
$(dlang_get_output_flag)bin/dcd-client"
+               "${name}_SERVER_FLAGS=${flags} 
$(dlang_get_output_flag)bin/dcd-server"
+               # The target to build, the lowercase version of the compiler 
name
+               ${name,,}
+       )
+       emake "${mymakeargs[@]}"
+
+       # Write system include paths of host implementation into dcd.conf
+       dlang_print_system_import_paths > dcd.conf
+}
+
+src_test() {
+       # Note, the makefile compiles the server with -g for tests.
+       cd tests && ./run_tests.sh --extra || die "Tests failed"
+}
+
+src_install() {
+       dobin bin/dcd-server
+       dobin bin/dcd-client
+       use systemd && systemd_douserunit "${FILESDIR}"/dcd-server.service
+       dobashcomp bash-completion/completions/dcd-server
+       dobashcomp bash-completion/completions/dcd-client
+       insinto /etc
+       doins dcd.conf
+       dodoc README.md
+       doman man1/dcd-client.1 man1/dcd-server.1
+}
+
+pkg_postinst() {
+       use systemd && elog "A systemd user service for 'dcd-server' has been 
installed."
+}

diff --git a/dev-util/dcd/files/pr-774.patch b/dev-util/dcd/files/pr-774.patch
new file mode 100644
index 0000000..8a55a62
--- /dev/null
+++ b/dev-util/dcd/files/pr-774.patch
@@ -0,0 +1,115 @@
+From cc77cfa4ebbda25edcb3296edae71ceb49795d61 Mon Sep 17 00:00:00 2001
+From: Andrei Horodniceanu <a.horodnice...@proton.me>
+Date: Tue, 30 Apr 2024 15:43:54 +0300
+Subject: [PATCH] tests/extra/tc_ufcs_all_kinds: support gdc
+
+Remove the usage of `-run` which isn't supported by gdc and only pass
+`-verrors=0` to dmd and ldc2 since gdc doesn't support the flag and,
+by default, all errors are printed.
+
+Change the format in which errors are printed to keep it consistent
+across all the three major compilers (a style that they all support is
+the gnu style) and make the matching code in generate_tests.d more
+readable by using a regex.
+
+Signed-off-by: Andrei Horodniceanu <a.horodnice...@proton.me>
+---
+ .gitignore                                    |  2 ++
+ .../extra/tc_ufcs_all_kinds/generate_tests.d  | 31 +++++++++----------
+ tests/extra/tc_ufcs_all_kinds/run.sh          | 24 +++++++++++++-
+ 3 files changed, 40 insertions(+), 17 deletions(-)
+
+diff --git a/.gitignore b/.gitignore
+index 57869d6a..8273543a 100644
+--- a/.gitignore
++++ b/.gitignore
+@@ -31,6 +31,8 @@ stdout.txt
+ # script-generated expected with absolute file paths
+ tests/tc_locate_ufcs_function/expected.txt
+ tests/tc_recursive_public_import/expected.txt
++# other script-generated files
++tests/extra/tc_ufcs_all_kinds/generate_tests
+ 
+ # Dub files
+ .dub
+diff --git a/tests/extra/tc_ufcs_all_kinds/generate_tests.d 
b/tests/extra/tc_ufcs_all_kinds/generate_tests.d
+index 637b2416..91466e66 100644
+--- a/tests/extra/tc_ufcs_all_kinds/generate_tests.d
++++ b/tests/extra/tc_ufcs_all_kinds/generate_tests.d
+@@ -129,29 +129,28 @@ int main(string[] args)
+ 
+       fs.write("proc_test.d", code);
+ 
+-      auto output = executeShell("$DC -verrors=0 -c proc_test.d").output;
++      // $DC and $ERROR_FLAGS are set up in run.sh
++      auto output = executeShell("$DC $ERROR_FLAGS -c proc_test.d").output;
+ 
+       size_t numErrors = 0;
+ 
+       string[][string] variableIncompatibilities;
+ 
++      // Example of a line we want to match: `proc_test.d:2568:22: error: 
[...]'
++      auto errRegex = regex(`proc_test\.d:([0-9]*):[0-9]*: error`, "i");
+       foreach (err; output.lineSplitter)
+       {
+-              if (!err.startsWith("proc_test.d("))
+-                      continue;
+-              err = err["proc_test.d(".length .. $];
+-              auto lineNo = err.parse!int;
+-              if (!err.startsWith("): Error: "))
+-                      continue;
+-              err = err["): Error: ".length .. $];
+-              string line = lines[lineNo - 1];
+-              enforce(line.endsWith("();"), "Unexpected error in line " ~ 
lineNo.to!string);
+-              line = line[0 .. $ - 3];
+-              string varName = line.findSplit(".")[0];
+-              string funcName = line.findSplit(".")[2];
+-              // writeln("variable type ", varLookup[varName], " can't call 
", funcLookup[funcName]);
+-              variableIncompatibilities[varName] ~= funcName;
+-              numErrors++;
++              if (auto m = matchFirst(err, errRegex)) {
++                      auto lineNo = to!int(m[1]);
++                      string line = lines[lineNo - 1];
++                      enforce(line.endsWith("();"), "Unexpected error in line 
" ~ lineNo.to!string);
++                      line = line[0 .. $ - 3];
++                      string varName = line.findSplit(".")[0];
++                      string funcName = line.findSplit(".")[2];
++                      // writeln("variable type ", varLookup[varName], " 
can't call ", funcLookup[funcName]);
++                      variableIncompatibilities[varName] ~= funcName;
++                      numErrors++;
++              }
+       }
+ 
+       enforce(numErrors > 1_000, "compiler didn't error as expected, need to 
adjust tests!");
+diff --git a/tests/extra/tc_ufcs_all_kinds/run.sh 
b/tests/extra/tc_ufcs_all_kinds/run.sh
+index 2c5e79cb..66ee663b 100755
+--- a/tests/extra/tc_ufcs_all_kinds/run.sh
++++ b/tests/extra/tc_ufcs_all_kinds/run.sh
+@@ -4,4 +4,26 @@ if [ -z "${DC:-}" ]; then
+       DC=dmd
+ fi
+ 
+-DC="$DC" "$DC" -run generate_tests.d "$1"
++DCBASE=$(basename ${DC})
++
++# Set up ERROR_FLAGS to make all compilers output errors in the same
++# format to make matching easier in generate_tests.d. Also make them
++# output all errors.
++if [[ ${DCBASE} == *gdc* ]]; then
++      outputFlag=-o
++      # Not needed as gdc defaults to printing all errors
++      ERROR_FLAGS=
++elif [[ ${DCBASE} == *gdmd* ]]; then
++      outputFlag=-of
++      ERROR_FLAGS=
++elif [[ ${DCBASE} == *ldc* || ${DCBASE} == *dmd* ]]; then
++      outputFlag=-of
++      ERROR_FLAGS='-verrors=0 -verror-style=gnu -vcolumns'
++else
++      echo "Unknown compiler ${DC}"
++      exit 1
++fi
++
++$DC ${outputFlag}generate_tests generate_tests.d
++export DC ERROR_FLAGS
++./generate_tests "${1}"

Reply via email to