@ -114,15 +114,37 @@ stdenv.mkDerivation (filteredArgs // {
EOF
export RUST_LOG = $ { logLevel }
'' + s t d e n v . l i b . o p t i o n a l S t r i n g v a l i d a t e C a r g o D e p s ''
if ! diff source/Cargo.lock $ cargoDepsCopy/Cargo.lock ; then
'' + ( a r g s . p o s t U n p a c k o r " " ) ;
# After unpacking and applying patches, check that the Cargo.lock matches our
# src package. Note that we do this after the patchPhase, because the
# patchPhase may create the Cargo.lock if upstream has not shipped one.
postPatch = ( args . postPatch or " " ) + stdenv . lib . optionalString validateCargoDeps ''
cargoDepsLockfile = $ NIX_BUILD_TOP / $ cargoDepsCopy/Cargo.lock
srcLockfile = $ NIX_BUILD_TOP / $ sourceRoot/Cargo.lock
echo " V a l i d a t i n g c o n s i s t e n c y b e t w e e n $ s r c L o c k f i l e a n d $ c a r g o D e p s L o c k f i l e "
if ! diff $ srcLockfile $ cargoDepsLockfile ; then
# If the diff failed, first double-check that the file exists, so we can
# give a friendlier error msg.
if ! [ - e $ srcLockfile ] ; then
echo " E R R O R : M i s s i n g C a r g o . l o c k f r o m s r c . E x p e c t e d t o f i n d i t a t : $ s r c L o c k f i l e "
exit 1
fi
if ! [ - e $ cargoDepsLockfile ] ; then
echo " E R R O R : M i s s i n g l o c k f i l e f r o m c a r g o v e n d o r . E x p e c t e d t o f i n d i t a t : $ c a r g o D e p s L o c k f i l e "
exit 1
fi
echo
echo " E R R O R : c a r g o S h a 2 5 6 i s o u t o f d a t e "
echo
echo " C a r g o . l o c k i s n o t t h e s a m e i n $ c a r g o D e p s C o p y "
echo
echo " T o f i x t h e i s s u e : "
echo ' 1 . Use " 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 " as the cargoSha256 value'
echo ' 1 . Use " 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 " as the cargoSha256 value'
echo " 2 . B u i l d t h e d e r i v a t i o n a n d w a i t i t t o f a i l w i t h a h a s h m i s m a t c h "
echo " 3 . C o p y t h e ' g o t : s h a 2 5 6 : ' v a l u e b a c k i n t o t h e c a r g o S h a 2 5 6 f i e l d "
echo
@ -131,7 +153,7 @@ stdenv.mkDerivation (filteredArgs // {
fi
'' + ''
unset cargoDepsCopy
'' + ( a r g s . p o s t U n p a c k o r " " ) ;
'' ;
configurePhase = args . configurePhase or ''
runHook preConfigure