Skip to content

Commit

Permalink
Merge branch 'bundle-pdbs'
Browse files Browse the repository at this point in the history
With this change, we will release .zip archives containing the .pdb
files of some of Git for Windows' components together with every new
version.

Signed-off-by: Johannes Schindelin <[email protected]>
  • Loading branch information
dscho committed Feb 7, 2018
2 parents 924dcb1 + afc314d commit 0af1701
Showing 1 changed file with 101 additions and 2 deletions.
103 changes: 101 additions & 2 deletions please.sh
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ set_package () {
busybox|mingw-w64-busybox)
package=mingw-w64-busybox
type=MINGW
extra_packages="mingw-w64-busybox-pdb"
pkgpath=/usr/src/MINGW-packages/mingw-w64-busybox
;;
msys2-runtime)
Expand Down Expand Up @@ -3282,6 +3283,92 @@ sign_files () {
fi
}

bundle_pdbs () { # [--directory=<artifacts-directory] [<package-versions>]
packages="mingw-w64-git-pdb mingw-w64-curl-pdb mingw-w64-openssl-pdb
msys2-runtime-devel bash-devel"

case "$1" in
--directory=*)
artifactsdir="$(cygpath -am "${1#*=}")" || exit
shift
test -d "$artifactsdir" ||
mkdir "$artifactsdir" ||
die "Could not create artifacts directory: %s\n" "$artifactsdir"
;;
*)
artifactsdir="$(cygpath -am "$HOME")" || exit
;;
esac

versions="$(case $# in 0) pacman -Q;; 1) cat "$1";; esac |
sed 's/^\(mingw-w64\)\(-[^-]*\)/\1/')"
test -n "$versions" ||
die 'Could not obtain package versions\n'

git_version="$(echo "$versions" | sed -n 's/^mingw-w64-git //p')"

dir=cached-source-packages
unpack=$dir/.unpack
url=https://wingit.blob.core.windows.net

for arch in i686 x86_64
do
test i686 = $arch &&
bitness=32-bit ||
bitness=64-bit

echo "Unpacking .pdb files for $bitness..." >&2

test x86_64 = $arch &&
oarch=x86-64 ||
oarch=$arch

test ! -d $unpack ||
rm -rf $unpack ||
die 'Could not remove %s\n' "$unpack"

mkdir -p $unpack

for package in $packages
do
name=${package%-*}
version=$(echo "$versions" | sed -n "s/^$name //p")
case "$package" in
mingw-w64-*)
tar=mingw-w64-$arch-${package#mingw-w64-}-$version-any.pkg.tar.xz
dir2="$sdk64/usr/src/MINGW-packages/$name"
;;
*)
tar=$package-$version-$arch.pkg.tar.xz
test i686 = $arch &&
dir2="$sdk32/usr/src/MSYS2-packages/$name" ||
dir2="$sdk64/usr/src/MSYS2-packages/$name"
;;
esac

test -f "$dir/$tar" ||
if test -f "$dir2/$tar"
then
cp "$dir2/$tar" "$dir/$tar"
else
echo "Retrieving $tar..." >&2
curl -sfo "$dir/$tar" $url/$oarch/$tar
fi ||
die 'Could not retrieve %s\n' "$tar"

(cd "$unpack" &&
tar --wildcards -xf ../"$tar" \*.pdb) ||
die 'Could not unpack .pdb files from %s\n' "$tar"
done

zip=pdbs-for-git-$bitness-$git_version.zip &&
echo "Bundling .pdb files for $bitness..." >&2
(cd "$unpack" && zip -9qr "$artifactsdir/$zip" *) &&
echo "Created $artifactsdir/$zip" >&2 ||
die 'Could not create %s for %s\n' "$zip" "$arch"
done
}

release () { # [--directory=<artifacts-directory>]
artifactsdir=
while case "$1" in
Expand Down Expand Up @@ -3392,6 +3479,11 @@ release () { # [--directory=<artifacts-directory>]
Git-Windows-Minimal.$ver.nupkg \
"$artifactsdir/") ||
die "Could not copy artifacts to '%s'\n" "$artifactsdir"

(cd "$sdk64/usr/src/build-extra" &&
bundle_pdbs --directory="$artifactsdir" \
installer/package-versions.txt) ||
die 'Could not generate .pdb bundles\n'
fi
}

Expand All @@ -3415,6 +3507,9 @@ virus_check () { #
publish () { #
set_version_from_sdks_git

git_pkgver="$("$sdk64/git-cmd.exe" --command=usr\\bin\\sh.exe -l -c \
'pacman -Q mingw-w64-x86_64-git | sed "s/.* //"')"

needs_upload_permissions || exit

grep -q '<apikeys>' "$HOME"/AppData/Roaming/NuGet/NuGet.Config ||
Expand Down Expand Up @@ -3466,7 +3561,9 @@ publish () { #
MinGit-"$ver"-busybox-64-bit.zip \
MinGit-"$ver"-busybox-32-bit.zip \
Git-"$ver"-64-bit.tar.bz2 \
Git-"$ver"-32-bit.tar.bz2) |
Git-"$ver"-32-bit.tar.bz2 \
pdbs-for-git-32-bit-$git_pkgver.zip \
pdbs-for-git-64-bit-$git_pkgver.zip) |
sed -n 's/\([^ ]*\) \*\(.*\)/\2 | \1/p')"
body="$(printf "%s\n\n%s" "$text" "$checksums")"
quoted="$(echo "$body" |
Expand All @@ -3483,7 +3580,9 @@ publish () { #
"$HOME"/MinGit-"$ver"-busybox-64-bit.zip \
"$HOME"/MinGit-"$ver"-busybox-32-bit.zip \
"$HOME"/Git-"$ver"-64-bit.tar.bz2 \
"$HOME"/Git-"$ver"-32-bit.tar.bz2 ||
"$HOME"/Git-"$ver"-32-bit.tar.bz2 \
"$HOME"/pdbs-for-git-32-bit-$git_pkgver.zip \
"$HOME"/pdbs-for-git-64-bit-$git_pkgver.zip ||
die "Could not upload files\n"

for nupkg in GitForWindows Git-Windows-Minimal
Expand Down

0 comments on commit 0af1701

Please sign in to comment.