patchupdate.py: Introduce a new Apply-After definition file variable.

This commit is contained in:
Sebastian Lackner 2015-02-22 20:46:03 +01:00
parent b7777f405b
commit 5261bd8a89
4 changed files with 93 additions and 98 deletions

View File

@ -71,7 +71,7 @@ enable=1
# Find location of patches
patchdir="$(dirname "$(readlink -f "$0")")"
if ! test -f "$patchdir/patchinstall.sh"; then
if test ! -f "$patchdir/patchinstall.sh"; then
if test -f ./patchinstall.sh; then
patchdir="$(pwd)"
else
@ -191,7 +191,8 @@ elif test "$backend" = "epatch"; then
if ! command -v epatch >/dev/null 2>&1 || \
! command -v ebegin >/dev/null 2>&1 || \
! command -v eend >/dev/null 2>&1; then
! command -v eend >/dev/null 2>&1 || \
! command -v die >/dev/null 2>&1; then
abort "Shell functions epatch/ebegin/eend not found. You have to source this script from your ebuild."
fi
@ -294,8 +295,8 @@ if test "$enable_patchlist" -eq 1; then
# Generate a temporary patch containing the patchlist and apply it
patch_data=$(cat "$patchlist" | sort)
patch_lines=$(echo "$patch_data" | wc -l)
if test ! -z "$patch_data"; then
patch_lines=$(echo "$patch_data" | wc -l)
patch_lines=$((${{patch_lines}}+21))
cat > "$patchlist" <<EOF
From: Wine Staging Team <webmaster@fds-team.de>

View File

@ -21,6 +21,7 @@
import binascii
import cPickle as pickle
import fnmatch
import hashlib
import itertools
import math
@ -73,6 +74,7 @@ class PatchSet(object):
self.patches = []
self.modified_files = set()
self.depends = set()
self.auto_depends = set()
self.verify_time = None
@ -188,60 +190,6 @@ def enum_directories(revision, path):
return dirs
def read_definition(revision, filename, name_to_id):
"""Read a definition file and return information as tuple (depends, fixes)."""
filename = os.path.join(filename, "definition")
if revision is None:
with open(filename) as fp:
content = fp.read()
else:
filename = "%s:%s" % (revision, filename)
try:
content = subprocess.check_output(["git", "show", filename], stderr=_devnull)
except subprocess.CalledProcessError:
raise IOError("Failed to load %s" % filename)
depends = set()
fixes = []
disabled = False
ifdefined = None
for line in content.split("\n"):
if line.startswith("#"):
continue
tmp = line.split(":", 1)
if len(tmp) != 2:
continue
key, val = tmp[0].lower(), tmp[1].strip()
if key == "depends":
if name_to_id is not None:
if not name_to_id.has_key(val):
raise PatchUpdaterError("Definition file %s references unknown dependency %s" % (filename, val))
depends.add(name_to_id[val])
elif key == "fixes":
r = re.match("^[0-9]+$", val)
if r:
fixes.append((int(val), None))
continue
r = re.match("^\\[ *([0-9]+) *\\](.*)$", val)
if r:
fixes.append((int(r.group(1)), r.group(2).strip()))
continue
fixes.append((None, val))
elif key == "disabled":
disabled = _parse_int(val)
elif key == "ifdefined":
ifdefined = val
elif revision is None:
print "WARNING: Ignoring unknown command in definition file %s: %s" % (filename, line)
return depends, fixes, disabled, ifdefined
def read_patchset(revision = None):
"""Read information about all patchsets for a specific revision."""
unique_id = itertools.count()
@ -283,10 +231,53 @@ def read_patchset(revision = None):
# Now read the definition files in a second step
for i, patch in all_patches.iteritems():
try:
patch.depends, patch.fixes, patch.disabled, patch.ifdefined = \
read_definition(revision, os.path.join(config.path_patches, patch.name), name_to_id)
except IOError:
patch.depends, patch.fixes, patch.disabled, patch.ifdefined = set(), [], False, None
filename = os.path.join(os.path.join(config.path_patches, patch.name), "definition")
if revision is None:
with open(filename) as fp:
content = fp.read()
else:
filename = "%s:%s" % (revision, filename)
content = subprocess.check_output(["git", "show", filename], stderr=_devnull)
except (IOError, subprocess.CalledProcessError):
continue # Skip this definition file
for line in content.split("\n"):
if line.startswith("#"):
continue
tmp = line.split(":", 1)
if len(tmp) != 2:
continue
key, val = tmp[0].lower(), tmp[1].strip()
if key == "depends":
if not name_to_id.has_key(val):
raise PatchUpdaterError("Definition file %s references unknown dependency %s" % (filename, val))
patch.depends.add(name_to_id[val])
elif key == "apply-after":
for j, other_patch in all_patches.iteritems():
if i != j and any([fnmatch.fnmatch(f, val) for f in other_patch.modified_files]):
patch.auto_depends.add(j)
elif key == "fixes":
r = re.match("^[0-9]+$", val)
if r:
patch.fixes.append((int(val), None))
continue
r = re.match("^\\[ *([0-9]+) *\\](.*)$", val)
if r:
patch.fixes.append((int(r.group(1)), r.group(2).strip()))
continue
patch.fixes.append((None, val))
elif key == "disabled":
patch.disabled = _parse_int(val)
elif key == "ifdefined":
patch.ifdefined = val
elif revision is None:
print "WARNING: Ignoring unknown command in definition file %s: %s" % (filename, line)
return all_patches
@ -375,6 +366,7 @@ def resolve_dependencies(all_patches, index = None, depends = None):
# Recusively resolve dependencies
all_patches[i].verify_resolved = -1
_resolve(all_patches[i].depends)
_resolve(all_patches[i].auto_depends)
all_patches[i].verify_resolved = 1
resolved.append(i)

View File

@ -685,7 +685,7 @@ enable=1
# Find location of patches
patchdir="$(dirname "$(readlink -f "$0")")"
if ! test -f "$patchdir/patchinstall.sh"; then
if test ! -f "$patchdir/patchinstall.sh"; then
if test -f ./patchinstall.sh; then
patchdir="$(pwd)"
else
@ -805,7 +805,8 @@ elif test "$backend" = "epatch"; then
if ! command -v epatch >/dev/null 2>&1 || \
! command -v ebegin >/dev/null 2>&1 || \
! command -v eend >/dev/null 2>&1; then
! command -v eend >/dev/null 2>&1 || \
! command -v die >/dev/null 2>&1; then
abort "Shell functions epatch/ebegin/eend not found. You have to source this script from your ebuild."
fi
@ -1542,6 +1543,40 @@ if test "$enable_wined3d_CSMT_Helper" -eq 1; then
) >> "$patchlist"
fi
# Patchset wined3d-Revert_PixelFormat
# |
# | This patchset fixes the following Wine bugs:
# | * [#35655] Fix wined3d performance drop introduced by pixelformat changes.
# | * [#35718] Fix flickering introduced by pixelformat changes.
# | * [#35950] Fix black screen on startup introduced by pixelformat changes.
# | * [#35975] Fix gray screen on startup introduced by pixelformat changes.
# | * [#36900] Fix missing video introduced by pixelformat changes.
# |
# | Modified files:
# | * dlls/d3d8/tests/device.c, dlls/d3d9/tests/device.c, dlls/ddraw/tests/ddraw1.c, dlls/ddraw/tests/ddraw2.c,
# | dlls/ddraw/tests/ddraw4.c, dlls/ddraw/tests/ddraw7.c, dlls/wined3d/context.c, dlls/wined3d/wined3d_private.h
# |
if test "$enable_wined3d_Revert_PixelFormat" -eq 1; then
patch_apply wined3d-Revert_PixelFormat/0001-Revert-wined3d-Track-if-a-context-s-private-hdc-has-.patch
patch_apply wined3d-Revert_PixelFormat/0002-Revert-wined3d-Track-if-a-context-s-hdc-is-private-s.patch
patch_apply wined3d-Revert_PixelFormat/0003-Revert-wined3d-When-restoring-pixel-format-in-contex.patch
patch_apply wined3d-Revert_PixelFormat/0004-Revert-wined3d-Don-t-call-GetPixelFormat-to-set-a-fl.patch
patch_apply wined3d-Revert_PixelFormat/0005-Revert-wined3d-Restore-the-pixel-format-of-the-windo.patch
patch_apply wined3d-Revert_PixelFormat/0006-d3d8-Mark-tests-which-no-longer-pass-due-to-reverts-.patch
patch_apply wined3d-Revert_PixelFormat/0007-d3d9-Mark-tests-which-no-longer-pass-due-to-reverts-.patch
patch_apply wined3d-Revert_PixelFormat/0008-ddraw-Mark-tests-which-no-longer-pass-due-to-reverts.patch
(
echo '+ { "Ken Thomases", "Revert \"wined3d: Track if a context'\''s private hdc has had its pixel format set, so we don'\''t need to check it.\".", 1 },';
echo '+ { "Ken Thomases", "Revert \"wined3d: Track if a context'\''s hdc is private so we never need to restore its pixel format.\".", 1 },';
echo '+ { "Ken Thomases", "Revert \"wined3d: When restoring pixel format in context_release(), mark the context as needing to be set on the next context_acquire().\".", 1 },';
echo '+ { "Ken Thomases", "Revert \"wined3d: Don'\''t call GetPixelFormat() to set a flag that'\''s already set.\".", 1 },';
echo '+ { "Ken Thomases", "Revert \"wined3d: Restore the pixel format of the window whose pixel format was actually changed.\".", 1 },';
echo '+ { "Ken Thomases", "d3d8: Mark tests which no longer pass due to reverts as todo_wine.", 1 },';
echo '+ { "Ken Thomases", "d3d9: Mark tests which no longer pass due to reverts as todo_wine.", 1 },';
echo '+ { "Ken Thomases", "ddraw: Mark tests which no longer pass due to reverts as todo_wine.", 1 },';
) >> "$patchlist"
fi
# Patchset wined3d-CSMT_Main
# |
# | This patchset fixes the following Wine bugs:
@ -3679,40 +3714,6 @@ if test "$enable_winecfg_Libraries" -eq 1; then
) >> "$patchlist"
fi
# Patchset wined3d-Revert_PixelFormat
# |
# | This patchset fixes the following Wine bugs:
# | * [#35655] Fix wined3d performance drop introduced by pixelformat changes.
# | * [#35718] Fix flickering introduced by pixelformat changes.
# | * [#35950] Fix black screen on startup introduced by pixelformat changes.
# | * [#35975] Fix gray screen on startup introduced by pixelformat changes.
# | * [#36900] Fix missing video introduced by pixelformat changes.
# |
# | Modified files:
# | * dlls/d3d8/tests/device.c, dlls/d3d9/tests/device.c, dlls/ddraw/tests/ddraw1.c, dlls/ddraw/tests/ddraw2.c,
# | dlls/ddraw/tests/ddraw4.c, dlls/ddraw/tests/ddraw7.c, dlls/wined3d/context.c, dlls/wined3d/wined3d_private.h
# |
if test "$enable_wined3d_Revert_PixelFormat" -eq 1; then
patch_apply wined3d-Revert_PixelFormat/0001-Revert-wined3d-Track-if-a-context-s-private-hdc-has-.patch
patch_apply wined3d-Revert_PixelFormat/0002-Revert-wined3d-Track-if-a-context-s-hdc-is-private-s.patch
patch_apply wined3d-Revert_PixelFormat/0003-Revert-wined3d-When-restoring-pixel-format-in-contex.patch
patch_apply wined3d-Revert_PixelFormat/0004-Revert-wined3d-Don-t-call-GetPixelFormat-to-set-a-fl.patch
patch_apply wined3d-Revert_PixelFormat/0005-Revert-wined3d-Restore-the-pixel-format-of-the-windo.patch
patch_apply wined3d-Revert_PixelFormat/0006-d3d8-Mark-tests-which-no-longer-pass-due-to-reverts-.patch
patch_apply wined3d-Revert_PixelFormat/0007-d3d9-Mark-tests-which-no-longer-pass-due-to-reverts-.patch
patch_apply wined3d-Revert_PixelFormat/0008-ddraw-Mark-tests-which-no-longer-pass-due-to-reverts.patch
(
echo '+ { "Ken Thomases", "Revert \"wined3d: Track if a context'\''s private hdc has had its pixel format set, so we don'\''t need to check it.\".", 1 },';
echo '+ { "Ken Thomases", "Revert \"wined3d: Track if a context'\''s hdc is private so we never need to restore its pixel format.\".", 1 },';
echo '+ { "Ken Thomases", "Revert \"wined3d: When restoring pixel format in context_release(), mark the context as needing to be set on the next context_acquire().\".", 1 },';
echo '+ { "Ken Thomases", "Revert \"wined3d: Don'\''t call GetPixelFormat() to set a flag that'\''s already set.\".", 1 },';
echo '+ { "Ken Thomases", "Revert \"wined3d: Restore the pixel format of the window whose pixel format was actually changed.\".", 1 },';
echo '+ { "Ken Thomases", "d3d8: Mark tests which no longer pass due to reverts as todo_wine.", 1 },';
echo '+ { "Ken Thomases", "d3d9: Mark tests which no longer pass due to reverts as todo_wine.", 1 },';
echo '+ { "Ken Thomases", "ddraw: Mark tests which no longer pass due to reverts as todo_wine.", 1 },';
) >> "$patchlist"
fi
# Patchset winedevice-DriverUnload
# |
# | Modified files:
@ -4058,8 +4059,8 @@ if test "$enable_patchlist" -eq 1; then
# Generate a temporary patch containing the patchlist and apply it
patch_data=$(cat "$patchlist" | sort)
patch_lines=$(echo "$patch_data" | wc -l)
if test ! -z "$patch_data"; then
patch_lines=$(echo "$patch_data" | wc -l)
patch_lines=$((${patch_lines}+21))
cat > "$patchlist" <<EOF
From: Wine Staging Team <webmaster@fds-team.de>

View File

@ -1,3 +1,4 @@
Fixes: [11674] Support for CSMT (command stream) to increase graphic performance
Apply-After: dlls/wined3d/*
Depends: wined3d-CSMT_Helper
IfDefined: STAGING_CSMT