a8a5f236f1
I made a subtle change at the last minute with the previous PR to use `*` for the glob instead of `.`, because the tmpdir had a `.tmp` file I didn't want. But - this caused us to miss the `.cargo` directory which has the config file. And while I'd been testing builds with no network, of course cargo was really pulling content from `~/.cargo`. When I went to do a scratch build in Koji, that failed obviously. I tested this makes things [work with a SRPM scratch](https://koji.fedoraproject.org/koji/taskinfo?taskID=27490830) and in my dev container under `bwrap --unshare-net` with `mv ~/.cargo{,.orig}`. Closes: #1394 Approved by: jlebon
51 lines
1.2 KiB
Bash
Executable File
51 lines
1.2 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
srcdir=$1
|
|
shift
|
|
PKG_VER=$1
|
|
shift
|
|
GITREV=$1
|
|
shift
|
|
|
|
TARFILE=${PKG_VER}.tar
|
|
TARFILE_TMP=$(pwd)/${TARFILE}.tmp
|
|
|
|
set -x
|
|
set -e
|
|
|
|
test -n "${srcdir}"
|
|
test -n "${PKG_VER}"
|
|
test -n "${GITREV}"
|
|
|
|
TOP=$(git rev-parse --show-toplevel)
|
|
|
|
echo "Archiving ${PKG_VER} at ${GITREV} to ${TARFILE_TMP}"
|
|
(cd ${TOP}; git archive --format=tar --prefix=${PKG_VER}/ ${GITREV}) > ${TARFILE_TMP}
|
|
ls -al ${TARFILE_TMP}
|
|
(cd ${TOP}; git submodule status) | while read line; do
|
|
rev=$(echo ${line} | cut -f 1 -d ' '); path=$(echo ${line} | cut -f 2 -d ' ')
|
|
echo "Archiving ${path} at ${rev}"
|
|
(cd ${srcdir}/${path}; git archive --format=tar --prefix=${PKG_VER}/${path}/ ${rev}) > submodule.tar
|
|
tar -A -f ${TARFILE_TMP} submodule.tar
|
|
rm submodule.tar
|
|
done
|
|
tmpd=${TOP}/.dist-tmp
|
|
trap cleanup EXIT
|
|
function cleanup () {
|
|
if test -f ${tmpd}/.tmp; then
|
|
rm "${tmpd}" -rf
|
|
fi
|
|
}
|
|
# Run it now
|
|
cleanup
|
|
mkdir ${tmpd} && touch ${tmpd}/.tmp
|
|
|
|
(cd ${tmpd}
|
|
mkdir -p .cargo vendor
|
|
cargo vendor -q --sync ${TOP}/rust/Cargo.toml vendor
|
|
cp ${TOP}/rust/Cargo.lock .
|
|
cp ${TOP}/rust/cargo-vendor-config .cargo/config
|
|
tar --transform="s,^,${PKG_VER}/rust/," -rf ${TARFILE_TMP} * .cargo/
|
|
)
|
|
mv ${TARFILE_TMP} ${TARFILE}
|