patchupdate.py: Improvement of category dependency handling.

This commit is contained in:
Sebastian Lackner 2015-06-07 04:41:40 +02:00
parent 6b78b26763
commit 0ccd396056
3 changed files with 24 additions and 3 deletions

View File

@ -76,6 +76,7 @@ warning()
# Default settings
patch_enable_all 0
category_enable_all 0
enable_patchlist=1
enable_autoconf=1
patchlist="/dev/null"

View File

@ -69,6 +69,7 @@ class PatchUpdaterError(RuntimeError):
class PatchSet(object):
def __init__(self, name, directory):
self.name = name
self.is_category = False
self.variable = None
self.directory = directory
self.fixes = []
@ -340,6 +341,7 @@ def read_patchset(revision = None):
# Add virtual targets for all the categories
for category, indices in categories.iteritems():
patch = PatchSet(category, directory)
patch.is_category = True
patch.depends = indices
i = next(unique_id)
@ -622,11 +624,23 @@ def generate_script(all_patches):
lines.append("patch_enable_all ()\n")
lines.append("{\n")
for i, patch in sorted([(i, all_patches[i]) for i in resolved], key=lambda x:x[1].name):
if patch.is_category: continue
patch.variable = "enable_%s" % patch.name.replace("-","_").replace(".","_")
lines.append("\t%s=\"$1\"\n" % patch.variable)
lines.append("}\n")
lines.append("\n")
lines.append("# Enable or disable a specific patchset\n")
lines.append("# Enable or disable all categories\n")
lines.append("category_enable_all ()\n")
lines.append("{\n")
for i, patch in sorted([(i, all_patches[i]) for i in resolved], key=lambda x:x[1].name):
if not patch.is_category: continue
patch.variable = "enable_%s" % patch.name.replace("-","_").replace(".","_")
lines.append("\t%s=\"$1\"\n" % patch.variable)
lines.append("}\n")
lines.append("\n")
lines.append("# Enable or disable a specific patchset/category\n")
lines.append("patch_enable ()\n")
lines.append("{\n")
lines.append("\tcase \"$1\" in\n")

View File

@ -83,7 +83,6 @@ patch_enable_all ()
enable_advapi32_LsaLookupSids="$1"
enable_browseui_ACLShell_IEnumString="$1"
enable_browseui_Progress_Dialog="$1"
enable_category_stable="$1"
enable_combase_String="$1"
enable_comctl32_LoadIconMetric="$1"
enable_configure_Absolute_RPATH="$1"
@ -297,7 +296,13 @@ patch_enable_all ()
enable_wtsapi32_EnumerateProcesses="$1"
}
# Enable or disable a specific patchset
# Enable or disable all categories
category_enable_all ()
{
enable_category_stable="$1"
}
# Enable or disable a specific patchset/category
patch_enable ()
{
case "$1" in
@ -970,6 +975,7 @@ patch_enable ()
# Default settings
patch_enable_all 0
category_enable_all 0
enable_patchlist=1
enable_autoconf=1
patchlist="/dev/null"