Source-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/lang/rust rust: Use subst framework instead of manual ...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/6cb1e7a77b58
branches:  trunk
changeset: 434000:6cb1e7a77b58
user:      jperkin <jperkin%pkgsrc.org@localhost>
date:      Tue Jun 09 15:08:24 2020 +0000

description:
rust: Use subst framework instead of manual sed.

This was getting unwieldly and didn't support changing multiple checksums in
the same file (required for illumos support in 1.44.0).  It was also hiding
potential bugs, with entries for vendor/rand which do not exist.

It's likely this should be in vendor/rand_os as that's what we're actually
patching, but perhaps that crate is no longer used as it appears we've never
had a checksum fix for it.

diffstat:

 lang/rust/Makefile |  66 ++++++++++++++++++++++++++++++-----------------------
 1 files changed, 37 insertions(+), 29 deletions(-)

diffs (87 lines):

diff -r a80c39924689 -r 6cb1e7a77b58 lang/rust/Makefile
--- a/lang/rust/Makefile        Tue Jun 09 15:01:14 2020 +0000
+++ b/lang/rust/Makefile        Tue Jun 09 15:08:24 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.173 2020/06/08 11:19:33 he Exp $
+# $NetBSD: Makefile,v 1.174 2020/06/09 15:08:24 jperkin Exp $
 
 DISTNAME=      rustc-1.43.1-src
 PKGNAME=       ${DISTNAME:S/rustc/rust/:S/-src//}
@@ -299,6 +299,42 @@
 SUBST_FILES.rpath+=    src/bootstrap/builder.rs
 SUBST_VARS.rpath=      PREFIX
 
+#
+# Generate list of subst entries for various .cargo-checksum.json files.  These
+# are all handled together in one big substitution to simplify things rather
+# than one substitution entry per file, but are kept separate below to ease
+# updating and verification.
+#
+CKSUM_CRATES+= vendor/backtrace-sys
+CKSUMS+=       59763fc255248b54fba5d0761d61093a73d51fa4cb400b0df1b5f339b9c2f48a
+CKSUMS+=       ba66d192421fd536ceddb50616c4c4aea06f4e39450eb0bc2bbbaed0b1e684c1
+
+CKSUM_CRATES+= vendor/libc
+CKSUMS+=       cd266cee38f25fe9ed896ba88ddd3530eca352c4d260671fb63d315890bc49e6
+CKSUMS+=       109a8e5a1638b09c4297e8e7ff95f35b4d16a3c0b42c8791b5fdd3f550612f8c
+
+CKSUM_CRATES+= vendor/libssh2-sys
+CKSUMS+=       0d80edbdffcf36a165578b3cffe9bc4e9eab3b3ae94a170ec8bc18764159cabb
+CKSUMS+=       fd601d3ea2ff745c3d73a546cc553f656924f3e985b87bc4db025c5c51ed3db5
+
+CKSUM_CRATES+= vendor/lzma-sys
+CKSUMS+=       51a9ca7a4576822dc4fa01b31bc4bbed21817777abb304f605ef5951f68c3ed2
+CKSUMS+=       807c3aa4b5a62a70ba790df151e9ecf19f4bb562f2858575d690908751262db3
+
+# Contain identical checksums
+CKSUM_CRATES+= vendor/rand-0.6.1
+CKSUMS+=       1e732c2e3b4bd1561f11e0979bf9d20669a96eae7afe0deff9dfbb980ee47bf1
+CKSUMS+=       bc03f2345d7cfa7000f9da817120b6afa073359789c21a9a790ebd8676c50cca
+
+SUBST_CLASSES+=                cksum
+SUBST_STAGE.cksum=     pre-configure
+.for crate in ${CKSUM_CRATES}
+SUBST_FILES.cksum+=    ${crate}/.cargo-checksum.json
+.endfor
+.for from to in ${CKSUMS}
+SUBST_SED.cksum+=      -e 's,${from},${to},g'
+.endfor
+
 post-extract:
        set -e;                                                                 \
        if ${TEST} -e ${WRKDIR}/rust-${RUST_STAGE0_VER}-${RUST_ARCH}/install.sh \
@@ -308,34 +344,6 @@
                cd ${WRKDIR}/rust-std-${RUST_STAGE0_VER}-${RUST_ARCH};          \
                ${TOOLS_BASH} ./install.sh --prefix=${RUST_BOOTSTRAP_PATH};     \
        fi
-# patch(1) in NetBSD does not handle .cargo-checksum.json like long width file.
-       set -e; ${ECHO}                                                         \
-         vendor/libssh2-sys                                                    \
-         0d80edbdffcf36a165578b3cffe9bc4e9eab3b3ae94a170ec8bc18764159cabb      \
-         fd601d3ea2ff745c3d73a546cc553f656924f3e985b87bc4db025c5c51ed3db5      \
-         vendor/rand                                                           \
-         1e732c2e3b4bd1561f11e0979bf9d20669a96eae7afe0deff9dfbb980ee47bf1      \
-         bc03f2345d7cfa7000f9da817120b6afa073359789c21a9a790ebd8676c50cca      \
-         vendor/rand-0.6.1                                                     \
-         1e732c2e3b4bd1561f11e0979bf9d20669a96eae7afe0deff9dfbb980ee47bf1      \
-         bc03f2345d7cfa7000f9da817120b6afa073359789c21a9a790ebd8676c50cca      \
-         vendor/libc                                                           \
-         cd266cee38f25fe9ed896ba88ddd3530eca352c4d260671fb63d315890bc49e6      \
-         109a8e5a1638b09c4297e8e7ff95f35b4d16a3c0b42c8791b5fdd3f550612f8c      \
-         vendor/backtrace-sys                                                  \
-         59763fc255248b54fba5d0761d61093a73d51fa4cb400b0df1b5f339b9c2f48a      \
-         ba66d192421fd536ceddb50616c4c4aea06f4e39450eb0bc2bbbaed0b1e684c1      \
-         vendor/lzma-sys                                                       \
-         51a9ca7a4576822dc4fa01b31bc4bbed21817777abb304f605ef5951f68c3ed2      \
-         807c3aa4b5a62a70ba790df151e9ecf19f4bb562f2858575d690908751262db3      \
-       | ${XARGS} -n 1 ${ECHO} | while read crate; do                          \
-               read orig_cksum;                                                \
-               read cksum;                                                     \
-               f="${WRKSRC}/$$crate/.cargo-checksum.json";                     \
-               of="$$f.orig";                                                  \
-               ${CP} "$$f" "$$of";                                             \
-               ${SED} -e "s/$$orig_cksum/$$cksum/g" < "$$of" > "$$f";          \
-       done
 .if ${OPSYS} == "NetBSD"
        SDIR=${WRKDIR}/scripts; \
        ${MKDIR} $${SDIR}; \



Home | Main Index | Thread Index | Old Index