Automatically enable fallback method to apply patches when running from inside of a git subdirectory.

This commit is contained in:
Sebastian Lackner 2015-01-15 06:51:54 +01:00
parent d50c673144
commit 603ba80d41
3 changed files with 93 additions and 22 deletions

1
debian/changelog vendored
View File

@ -1,6 +1,7 @@
wine-staging (1.7.35) UNRELEASED; urgency=low
* Add support for patchinstall.sh parameters '--no-patchlist' and '--no-autoconf'.
* Add support for Gentoo epatch backend to patchinstall.sh.
* Automatically enable fallback method to apply patches when running from inside of a git subdirectory.
* Synchronize CSMT patchset with https://github.com/stefand/wine.
* Several improvements to make nvcuvid (CUDA video decoding) better compatible with x86_64.
* Added patch to implement support for DDS file format in D3DXSaveTextureToFileInMemory.

View File

@ -67,6 +67,7 @@ if test "$#" -eq 0; then
abort "No commandline arguments given, don't know what to do."
fi
# Parse commandline arguments
while test "$#" -gt 0; do
if patch_enable "$1" "$enable"; then
shift
@ -124,13 +125,36 @@ if test "$enable" -ne 1; then
abort "Missing argument for -W, expected patchname."
fi
# Determine DESTDIR if not explicitly specified
if test -z "$DESTDIR" -a -f ./tools/make_requests; then
DESTDIR="$(pwd)"
elif test ! -f "$DESTDIR/tools/make_requests"; then
abort "DESTDIR does not point to the Wine source tree."
fi
# Most backends will try to use git, either directly or indirectly.
# Unfortunately this does not work when "$DESTDIR" points to a
# subdirectory of a git tree, which has the effect that no patches
# are applied, but the exitcode is zero. To avoid broken builds we
# will workaround this issue or abort. For more information see
# https://github.com/wine-compholio/wine-staging/issues/7
test ! -d "$DESTDIR/.git" && (cd "$DESTDIR"; git rev-parse --git-dir) &> /dev/null
workaround_git_bug="$?"
# Apply the patches using gitapply.sh, a small wrapper around 'patch'
if test "$backend" = "patch"; then
if test "$workaround_git_bug" -eq 0; then
gitapply_args="--nogit"
else
gitapply_args=""
fi
patch_apply ()
{{
echo "Applying $1"
if ! ../debian/tools/gitapply.sh -d "$DESTDIR" < "$1"; then
if ! ../debian/tools/gitapply.sh $gitapply_args -d "$DESTDIR" < "$1"; then
abort "Failed to apply patch, aborting!"
fi
}}
@ -138,15 +162,21 @@ if test "$backend" = "patch"; then
# 'epatch' backend - used on Gentoo
elif test "$backend" = "epatch"; then
if test "$workaround_git_bug" -eq 0; then
gitapply_args="--nogit"
else
gitapply_args=""
fi
patch_apply ()
{{
if grep -q "^GIT binary patch" "$1"; then
if ! ../debian/tools/gitapply.sh -d "$DESTDIR" < "$1"; then
if ! ../debian/tools/gitapply.sh $gitapply_args -d "$DESTDIR" < "$1"; then
abort "Failed to apply patch, aborting!"
fi
else
local patch="$(readlink -f "$1")"
if ! (cd "$DESTDIR" && epatch "$patch"); then
current_patch="$(readlink -f "$1")"
if ! (cd "$DESTDIR" && epatch "$current_patch"); then
abort "Failed to apply patch, aborting!"
fi
fi
@ -155,6 +185,10 @@ elif test "$backend" = "epatch"; then
# GIT backend - apply patches using 'git am'
elif test "$backend" = "git" -o "$backend" = "git-am"; then
if test "$workaround_git_bug" -eq 0; then
abort "Backend 'git-am' not possible when DESTDIR points to a git subdirectory."
fi
patch_apply ()
{{
echo "Applying $1"
@ -166,6 +200,10 @@ elif test "$backend" = "git" -o "$backend" = "git-am"; then
# Git apply backend
elif test "$backend" = "git-apply"; then
if test "$workaround_git_bug" -eq 0; then
abort "Backend 'git-apply' not possible when DESTDIR points to a git subdirectory."
fi
patch_apply ()
{{
echo "Applying $1"
@ -177,6 +215,10 @@ elif test "$backend" = "git-apply"; then
# Stacked GIT backend - import the patches (mainly for developers)
elif test "$backend" = "stg"; then
if test "$workaround_git_bug" -eq 0; then
abort "Backend 'stg' not possible when DESTDIR points to a git subdirectory."
fi
# Only import the regular patches, no autogenerated ones -
# moreover, don't run autoreconf or ./tools/make_requests.
enable_patchlist=0
@ -198,13 +240,6 @@ fi
{patch_resolver}
if test -z "$DESTDIR" -a -f ./tools/make_requests; then
DESTDIR="$(pwd)"
elif test ! -f "$DESTDIR/tools/make_requests"; then
abort "DESTDIR does not point to the Wine source tree."
fi
# To make sure we find all the patches and tools switch to the patches directory now
script="$(readlink -f "$0")"
curdir="$(dirname "$script")"

View File

@ -613,6 +613,7 @@ if test "$#" -eq 0; then
abort "No commandline arguments given, don't know what to do."
fi
# Parse commandline arguments
while test "$#" -gt 0; do
if patch_enable "$1" "$enable"; then
shift
@ -670,13 +671,36 @@ if test "$enable" -ne 1; then
abort "Missing argument for -W, expected patchname."
fi
# Determine DESTDIR if not explicitly specified
if test -z "$DESTDIR" -a -f ./tools/make_requests; then
DESTDIR="$(pwd)"
elif test ! -f "$DESTDIR/tools/make_requests"; then
abort "DESTDIR does not point to the Wine source tree."
fi
# Most backends will try to use git, either directly or indirectly.
# Unfortunately this does not work when "$DESTDIR" points to a
# subdirectory of a git tree, which has the effect that no patches
# are applied, but the exitcode is zero. To avoid broken builds we
# will workaround this issue or abort. For more information see
# https://github.com/wine-compholio/wine-staging/issues/7
test ! -d "$DESTDIR/.git" && (cd "$DESTDIR"; git rev-parse --git-dir) &> /dev/null
workaround_git_bug="$?"
# Apply the patches using gitapply.sh, a small wrapper around 'patch'
if test "$backend" = "patch"; then
if test "$workaround_git_bug" -eq 0; then
gitapply_args="--nogit"
else
gitapply_args=""
fi
patch_apply ()
{
echo "Applying $1"
if ! ../debian/tools/gitapply.sh -d "$DESTDIR" < "$1"; then
if ! ../debian/tools/gitapply.sh $gitapply_args -d "$DESTDIR" < "$1"; then
abort "Failed to apply patch, aborting!"
fi
}
@ -684,15 +708,21 @@ if test "$backend" = "patch"; then
# 'epatch' backend - used on Gentoo
elif test "$backend" = "epatch"; then
if test "$workaround_git_bug" -eq 0; then
gitapply_args="--nogit"
else
gitapply_args=""
fi
patch_apply ()
{
if grep -q "^GIT binary patch" "$1"; then
if ! ../debian/tools/gitapply.sh -d "$DESTDIR" < "$1"; then
if ! ../debian/tools/gitapply.sh $gitapply_args -d "$DESTDIR" < "$1"; then
abort "Failed to apply patch, aborting!"
fi
else
local patch="$(readlink -f "$1")"
if ! (cd "$DESTDIR" && epatch "$patch"); then
current_patch="$(readlink -f "$1")"
if ! (cd "$DESTDIR" && epatch "$current_patch"); then
abort "Failed to apply patch, aborting!"
fi
fi
@ -701,6 +731,10 @@ elif test "$backend" = "epatch"; then
# GIT backend - apply patches using 'git am'
elif test "$backend" = "git" -o "$backend" = "git-am"; then
if test "$workaround_git_bug" -eq 0; then
abort "Backend 'git-am' not possible when DESTDIR points to a git subdirectory."
fi
patch_apply ()
{
echo "Applying $1"
@ -712,6 +746,10 @@ elif test "$backend" = "git" -o "$backend" = "git-am"; then
# Git apply backend
elif test "$backend" = "git-apply"; then
if test "$workaround_git_bug" -eq 0; then
abort "Backend 'git-apply' not possible when DESTDIR points to a git subdirectory."
fi
patch_apply ()
{
echo "Applying $1"
@ -723,6 +761,10 @@ elif test "$backend" = "git-apply"; then
# Stacked GIT backend - import the patches (mainly for developers)
elif test "$backend" = "stg"; then
if test "$workaround_git_bug" -eq 0; then
abort "Backend 'stg' not possible when DESTDIR points to a git subdirectory."
fi
# Only import the regular patches, no autogenerated ones -
# moreover, don't run autoreconf or ./tools/make_requests.
enable_patchlist=0
@ -845,13 +887,6 @@ if test "$enable_ntdll_WRITECOPY" -eq 1; then
fi
if test -z "$DESTDIR" -a -f ./tools/make_requests; then
DESTDIR="$(pwd)"
elif test ! -f "$DESTDIR/tools/make_requests"; then
abort "DESTDIR does not point to the Wine source tree."
fi
# To make sure we find all the patches and tools switch to the patches directory now
script="$(readlink -f "$0")"
curdir="$(dirname "$script")"