|
From: <ai...@us...> - 2013-07-09 06:03:43
|
Revision: 12407
http://sourceforge.net/p/plplot/code/12407
Author: airwin
Date: 2013-07-09 06:03:41 +0000 (Tue, 09 Jul 2013)
Log Message:
-----------
Initial commit of script to parse jhbuild xml file produced by
gtk_xml_recursive_process.py (which combines included chain of jhbuild
xml files into one file).
Currently the principal function of the script, parse_jhbuild only
has the logic tested where if_dependencies is True (i.e., where dependencies
are being recursively followed), and that test on real jhbuild data showed
a circular dependency which lead to infinite depths in the recursion.
So some method of detecting circular dependencies and erroring out
must be implemented, and the logic for the alternative straight
printout of values without following the dependencies must be extended
a bit as well.
Added Paths:
-----------
trunk/cmake/build_projects/gtk_transform.py
Added: trunk/cmake/build_projects/gtk_transform.py
===================================================================
--- trunk/cmake/build_projects/gtk_transform.py (rev 0)
+++ trunk/cmake/build_projects/gtk_transform.py 2013-07-09 06:03:41 UTC (rev 12407)
@@ -0,0 +1,156 @@
+#!/usr/bin/env python
+
+# Read gtk jhbuild xml module that has been produced by
+# gtk_xml_recursive_process.py from stdin and transform it into data
+# required for build_projects using the ElementTree XML API.
+
+# Copyright (C) 2013 Alan W. Irwin
+
+# This file is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+
+# You should have received a copy of the GNU Lesser General Public
+# License along with this file; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+import sys
+import xml.etree.ElementTree as ET
+
+def parse_jhbuild(root, id, if_dependencies):
+ # find all necessary data to build. If xml is in slightly non-standard
+ # form or if there is any other trouble, then immediately return
+ # with no output to stdout.
+ print("id = %s" % id)
+ package = root.findall(".//*[@id='%s']" % id)
+ if len(package) < 1:
+ # Cannot find this package. Do nothing.
+ return None
+ elif len(package) > 1:
+ raise RuntimeError, "non-unique id found for %s" % id
+ # From here on drop the reference to the first (and only) element
+ # of package for convenience.
+ package = package[0]
+
+ # From now only handle two build types and only a subset of
+ # attributes for both, and only look for
+ # branch and dependencies elements (of various kinds) below
+ # packages.
+ config_type = package.tag
+ if config_type == "autotools":
+ config_arguments = package.get("autogenargs")
+ elif config_type == "cmake":
+ config_arguments = package.get("cmakeargs")
+ else:
+ return None
+
+ # Parse branch element of package
+ branch = package.findall("branch[@hash]")
+ if len(branch) < 1:
+ # Cannot find branch so do nothing.
+ return None
+ elif len(branch) > 1:
+ raise RuntimeError, "non-unique branch element found with hash attribute for %s" % id
+
+ # From here on drop the reference to the first (and only) element
+ # of branch for convenience.
+ branch = branch[0]
+
+ download_hash = branch.get("hash")
+ if len(download_hash) == 0:
+ return None
+ index = download_hash.index(":")
+ download_hash_type = download_hash[0:index].upper()
+ download_hash = download_hash[index+1:]
+
+ download_repo = branch.get("repo")
+ if len(download_repo) == 0:
+ return None
+
+ download_module = branch.get("module")
+ if len(download_module) == 0:
+ return None
+
+ # Parse various kinds of jhbuild dependencies.
+ # Note from
+ # http://stackoverflow.com/questions/9974957/what-is-the-after-element-used-for-in-jhbuild
+ # "dependencies are hard dependencies. Packages that are
+ # required to build a module. suggests are soft
+ # dependencies. Packages might use them if they are installed
+ # (detected at build time) but if they are not present, they
+ # do not present a problem. These dependencies will be built,
+ # but they can be ignored without problems by using the
+ # argument --ignore-suggests. For instance, evolution can be
+ # built with or without nss support. after are not strict
+ # dependencies, but they are needed at runtime to get some
+ # features. For instance, metacity is needed by mutter to have
+ # key binding settings in mutter."
+
+ # Create overall_dependencies dictionary and populate it as needed.
+ overall_dependencies={}
+ # Create dependencies dictionary and populate it as needed.
+ dependencies={}
+ # Add a dependency for pkg-config if there is a subelement named that.
+ if package.find("pkg-config") != None:
+ dependencies["pkg-config"] = None
+ overall_dependencies["pkg-config"] = None
+ for dep_element in package.findall("dependencies/dep"):
+ dependencies[dep_element.get("package")] = None
+ overall_dependencies[dep_element.get("package")] = None
+
+ # Create suggests dictionary and populate it as needed.
+ suggests={}
+ for dep_element in package.findall("suggests/dep"):
+ suggests[dep_element.get("package")] = None
+ overall_dependencies[dep_element.get("package")] = None
+ # Repeat for suggest target name (a mistake for one package
+ # with id=gdm).
+ for dep_element in package.findall("suggest/dep"):
+ suggests[dep_element.get("package")] = None
+ overall_dependencies[dep_element.get("package")] = None
+
+ # Create after dictionary and populate it as needed.
+ after={}
+ for dep_element in package.findall("after/dep"):
+ after[dep_element.get("package")] = None
+ overall_dependencies[dep_element.get("package")] = None
+
+ if not if_dependencies:
+ pass
+ else:
+ dependencies_list = overall_dependencies.keys()
+ bad_dependencies = {}
+ for dep in dependencies_list:
+ extra = parse_jhbuild(root, dep, True)
+ if extra == None:
+ bad_dependencies[dep] = None
+ del overall_dependencies[dep]
+ else:
+ overall_dependencies.update(extra[0])
+ bad_dependencies.update(extra[1])
+
+ return (overall_dependencies, bad_dependencies)
+
+tree = ET.parse(sys.stdin)
+root = tree.getroot()
+
+# Create repository dictionary. Note, there is sometimes more than
+# one definition. Eyeballing the file, it appears those definitions
+# are completely redundant so it is fine to take the last definition
+# (which we do here).
+repository_dict={}
+for repository in root.findall("repository"):
+ repository_dict[repository.get("name")] = repository.get("href")
+
+dependency_dictionary = parse_jhbuild(root, "pango", True)
+if not dependency_dictionary == None:
+ print("good dependencies =")
+ print(dependency_dictionary[0].keys())
+ print("bad dependencies =")
+ print(dependency_dictionary[1].keys())
Property changes on: trunk/cmake/build_projects/gtk_transform.py
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ai...@us...> - 2013-07-11 20:17:41
|
Revision: 12416
http://sourceforge.net/p/plplot/code/12416
Author: airwin
Date: 2013-07-11 20:17:38 +0000 (Thu, 11 Jul 2013)
Log Message:
-----------
Update the initial script so that it
(1) finds all valid direct and indirect dependencies of the
starting_package specified on the command-line by the user according
to a command integer also given on the command line (1 bit ON ==> follow
hard dependencies (jhbuild "dependencies"), 2 bit ON ==> follows soft
dependencies (jhbuild "suggests"), 4 bit ON
==> follow "would be nice" run-time dependencies (jhbuild "after")).
(2) Dump to stdout all relevant build configuration information for the
starting package and all valid dependencies that are found.
This should be the final form of this script or close to it.
Modified Paths:
--------------
trunk/cmake/build_projects/gtk_transform.py
Modified: trunk/cmake/build_projects/gtk_transform.py
===================================================================
--- trunk/cmake/build_projects/gtk_transform.py 2013-07-11 19:59:37 UTC (rev 12415)
+++ trunk/cmake/build_projects/gtk_transform.py 2013-07-11 20:17:38 UTC (rev 12416)
@@ -23,11 +23,14 @@
import sys
import xml.etree.ElementTree as ET
-def parse_jhbuild(root, id, if_dependencies):
+def parse_jhbuild(root, id, depend_track, if_dependencies, called):
# find all necessary data to build. If xml is in slightly non-standard
# form or if there is any other trouble, then immediately return
# with no output to stdout.
- print("id = %s" % id)
+ if called.has_key(id):
+ raise RuntimeError, "parse_jhbuild recursively called with the same id"
+ called[id] = None
+ #sys.stderr.write("id = %s\n" % id)
package = root.findall(".//*[@id='%s']" % id)
if len(package) < 1:
# Cannot find this package. Do nothing.
@@ -44,14 +47,20 @@
# packages.
config_type = package.tag
if config_type == "autotools":
- config_arguments = package.get("autogenargs")
+ config_arguments = package.get("autogenargs")
elif config_type == "cmake":
- config_arguments = package.get("cmakeargs")
+ config_arguments = package.get("cmakeargs")
+ elif config_type == "tarball":
+ config_arguments = ""
else:
return None
-
- # Parse branch element of package
- branch = package.findall("branch[@hash]")
+ if config_arguments == None:
+ config_arguments = ""
+ # Parse branch or source element of package
+ if config_type == "tarball":
+ branch = package.findall("source[@hash]")
+ else:
+ branch = package.findall("branch[@hash]")
if len(branch) < 1:
# Cannot find branch so do nothing.
return None
@@ -65,17 +74,32 @@
download_hash = branch.get("hash")
if len(download_hash) == 0:
return None
- index = download_hash.index(":")
- download_hash_type = download_hash[0:index].upper()
- download_hash = download_hash[index+1:]
+ index = download_hash.find(":")
+ if index <= 0:
+ download_hash_type = "UNKNOWN"
+ else:
+ download_hash_type = download_hash[0:index].upper()
+ if index >= 0:
+ download_hash = download_hash[index+1:]
- download_repo = branch.get("repo")
- if len(download_repo) == 0:
- return None
+ if config_type == "tarball":
+ download_href = branch.get("href")
+ else:
+ download_repo = branch.get("repo")
+ if len(download_repo) == 0:
+ return None
- download_module = branch.get("module")
- if len(download_module) == 0:
- return None
+ download_module = branch.get("module")
+ if len(download_module) == 0:
+ return None
+ if repository_dictionary.has_key(download_repo):
+ download_repo = repository_dictionary[download_repo]
+
+ # Make sure there is a trailing "/" on the repo
+ index = download_repo.rfind("/")
+ if len(download_repo)-1 != index:
+ download_repo = download_rep + "/"
+ download_href = download_repo + download_module
# Parse various kinds of jhbuild dependencies.
# Note from
@@ -92,51 +116,79 @@
# features. For instance, metacity is needed by mutter to have
# key binding settings in mutter."
- # Create overall_dependencies dictionary and populate it as needed.
- overall_dependencies={}
# Create dependencies dictionary and populate it as needed.
dependencies={}
- # Add a dependency for pkg-config if there is a subelement named that.
- if package.find("pkg-config") != None:
- dependencies["pkg-config"] = None
- overall_dependencies["pkg-config"] = None
- for dep_element in package.findall("dependencies/dep"):
- dependencies[dep_element.get("package")] = None
- overall_dependencies[dep_element.get("package")] = None
+ if depend_track&1:
+ # Add a dependency for pkg-config if there is a subelement named that.
+ if package.find("pkg-config") != None:
+ dependencies["pkg-config"] = None
+ for dep_element in package.findall("dependencies/dep"):
+ dependencies[dep_element.get("package")] = None
# Create suggests dictionary and populate it as needed.
suggests={}
- for dep_element in package.findall("suggests/dep"):
- suggests[dep_element.get("package")] = None
- overall_dependencies[dep_element.get("package")] = None
- # Repeat for suggest target name (a mistake for one package
- # with id=gdm).
- for dep_element in package.findall("suggest/dep"):
- suggests[dep_element.get("package")] = None
- overall_dependencies[dep_element.get("package")] = None
+ if depend_track&2:
+ for dep_element in package.findall("suggests/dep"):
+ suggests[dep_element.get("package")] = None
+ # Repeat for suggest target name (a mistake for one package
+ # with id=gdm).
+ for dep_element in package.findall("suggest/dep"):
+ suggests[dep_element.get("package")] = None
# Create after dictionary and populate it as needed.
after={}
- for dep_element in package.findall("after/dep"):
- after[dep_element.get("package")] = None
- overall_dependencies[dep_element.get("package")] = None
+ if depend_track&4:
+ for dep_element in package.findall("after/dep"):
+ after[dep_element.get("package")] = None
- if not if_dependencies:
- pass
- else:
+ if if_dependencies:
+ overall_dependencies = {}
+ overall_dependencies.update(dependencies)
+ overall_dependencies.update(suggests)
+ overall_dependencies.update(after)
+
+ good_packages = {}
+ good_packages[id] = None
+ bad_packages = {}
dependencies_list = overall_dependencies.keys()
- bad_dependencies = {}
for dep in dependencies_list:
- extra = parse_jhbuild(root, dep, True)
+ if called.has_key(dep):
+ # ignore any package that has already been processed
+ # by parse_jhbuild. This avoids calling parse_jhbuild
+ # twice for the case of two dependent packages
+ # depending on a common third package and also ignores
+ # circular dependencies.
+ continue
+ extra = parse_jhbuild(root, dep, depend_track, if_dependencies, called)
if extra == None:
- bad_dependencies[dep] = None
- del overall_dependencies[dep]
+ bad_packages[dep] = None
else:
- overall_dependencies.update(extra[0])
- bad_dependencies.update(extra[1])
+ good_packages.update(extra[0])
+ bad_packages.update(extra[1])
- return (overall_dependencies, bad_dependencies)
+ return (good_packages, bad_packages)
+ else:
+ sys.stdout.write(id + "\n")
+ sys.stdout.write(config_type + "\n")
+ sys.stdout.write(config_arguments + "\n")
+ sys.stdout.write(download_hash_type + "\n")
+ sys.stdout.write(download_hash + "\n")
+ sys.stdout.write(download_href + "\n")
+ # Output dependency lists as sorted colon-separated strings
+ dependencies_list = dependencies.keys()
+ dependencies_list.sort()
+ dependencies_string = ":".join(dependencies_list)
+ sys.stdout.write(dependencies_string + "\n")
+ suggests_list = suggests.keys()
+ suggests_list.sort()
+ suggests_string = ":".join(suggests_list)
+ sys.stdout.write(suggests_string + "\n")
+ after_list = after.keys()
+ after_list.sort()
+ after_string = ":".join(after_list)
+ sys.stdout.write(after_string + "\n")
+
tree = ET.parse(sys.stdin)
root = tree.getroot()
@@ -144,13 +196,34 @@
# one definition. Eyeballing the file, it appears those definitions
# are completely redundant so it is fine to take the last definition
# (which we do here).
-repository_dict={}
+repository_dictionary={}
for repository in root.findall("repository"):
- repository_dict[repository.get("name")] = repository.get("href")
+ repository_dictionary[repository.get("name")] = repository.get("href")
-dependency_dictionary = parse_jhbuild(root, "pango", True)
-if not dependency_dictionary == None:
- print("good dependencies =")
- print(dependency_dictionary[0].keys())
- print("bad dependencies =")
- print(dependency_dictionary[1].keys())
+if len(sys.argv) < 3:
+ raise RuntimeError, "must specify a starting package name as the first argument and dependency tracking flag as the second argument on the command line"
+start_package = sys.argv[1]
+# Important!
+# The least significant bit of depend_track shows whether to pay
+# attention to the dependencies attribute.
+# The next least significant bit of depend_track shows whether to pay
+# attention to the suggests attribute.
+# The next least significant bit of depend_track shows whether to pay
+# attention to the after attribute.
+depend_track = int(sys.argv[2])
+dependency_dictionary = parse_jhbuild(root, start_package, depend_track, True, {})
+if dependency_dictionary == None:
+ sys.stderr.write("some failure for start_package = %s or else no dependencies for that start_package\n" % start_package)
+else:
+ good_packages_list = dependency_dictionary[0].keys()
+ bad_packages_list = dependency_dictionary[1].keys()
+ good_packages_list.sort()
+ bad_packages_list.sort()
+ sys.stderr.write("number of good packages = %s\n" % len(good_packages_list))
+ sys.stderr.write("good packages = " + ":".join(good_packages_list) + "\n")
+ sys.stderr.write("number of bad packages = %s\n" % len(bad_packages_list))
+ sys.stderr.write("bad packages = " + ":".join(bad_packages_list) + "\n")
+
+ # Output on stdout good package results.
+ for id in good_packages_list:
+ parse_jhbuild(root, id, depend_track, False, {})
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ai...@us...> - 2013-07-28 04:22:26
|
Revision: 12439
http://sourceforge.net/p/plplot/code/12439
Author: airwin
Date: 2013-07-28 04:22:21 +0000 (Sun, 28 Jul 2013)
Log Message:
-----------
Drop all gtk-doc dependencies as a temporary? measure.
Modified Paths:
--------------
trunk/cmake/build_projects/gtk_transform.py
Modified: trunk/cmake/build_projects/gtk_transform.py
===================================================================
--- trunk/cmake/build_projects/gtk_transform.py 2013-07-28 04:20:14 UTC (rev 12438)
+++ trunk/cmake/build_projects/gtk_transform.py 2013-07-28 04:22:21 UTC (rev 12439)
@@ -141,6 +141,14 @@
for dep_element in package.findall("after/dep"):
after[dep_element.get("package")] = None
+ # As a temporary? measure drop all references to gtk-doc
+ if dependencies.has_key("gtk-doc"):
+ del dependencies["gtk-doc"]
+ if suggests.has_key("gtk-doc"):
+ del suggests["gtk-doc"]
+ if after.has_key("gtk-doc"):
+ del after["gtk-doc"]
+
if if_dependencies:
overall_dependencies = {}
overall_dependencies.update(dependencies)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ai...@us...> - 2013-07-31 01:45:15
|
Revision: 12443
http://sourceforge.net/p/plplot/code/12443
Author: airwin
Date: 2013-07-31 01:45:12 +0000 (Wed, 31 Jul 2013)
Log Message:
-----------
Do more complete processing of data in the generated
gtk_packages<version>.xml file, and all special processing of
particular dependencies is now dropped, i.e., gtk-doc is now allowed
to be a valid dependency.
(For more on gtk_packages<version>.xml see README.) The additional
processing includes collecting make arguments data, deciding on
whether non-srcdir-builds are allowed, deciding on whether parallel
builds are allowed, and replacing "${version}" if it occurs in the URL
by the value of the version attribute.
Modified Paths:
--------------
trunk/cmake/build_projects/gtk_transform.py
Modified: trunk/cmake/build_projects/gtk_transform.py
===================================================================
--- trunk/cmake/build_projects/gtk_transform.py 2013-07-31 01:31:26 UTC (rev 12442)
+++ trunk/cmake/build_projects/gtk_transform.py 2013-07-31 01:45:12 UTC (rev 12443)
@@ -48,14 +48,42 @@
config_type = package.tag
if config_type == "autotools":
config_arguments = package.get("autogenargs")
+
+ make_arguments = package.get("makeargs")
+ if make_arguments == None:
+ make_arguments = ""
+
+ supports_non_srcdir_builds = package.get("supports-non-srcdir-builds")
+ if supports_non_srcdir_builds == "no":
+ supports_non_srcdir_builds = "OFF"
+ else:
+ supports_non_srcdir_builds = "ON"
+
+ supports_parallel_builds = package.get("supports-parallel-builds")
+ if supports_parallel_builds == "no":
+ supports_parallel_builds = "OFF"
+ else:
+ supports_parallel_builds = "ON"
elif config_type == "cmake":
config_arguments = package.get("cmakeargs")
+ make_arguments = ""
+ # Assume both non-source builds and parallel builds work for
+ # CMake-based build systems.
+ supports_non_srcdir_builds = "ON"
+ supports_parallel_builds = "ON"
elif config_type == "tarball":
config_arguments = ""
+ make_arguments = ""
+ # Assume both non-source builds and parallel builds work for
+ # the tarball config type. This may require review.
+ supports_non_srcdir_builds = "ON"
+ supports_parallel_builds = "ON"
else:
return None
+
if config_arguments == None:
config_arguments = ""
+
# Parse branch or source element of package
if config_type == "tarball":
branch = package.findall("source[@hash]")
@@ -98,9 +126,17 @@
# Make sure there is a trailing "/" on the repo
index = download_repo.rfind("/")
if len(download_repo)-1 != index:
- download_repo = download_rep + "/"
+ download_repo = download_repo + "/"
download_href = download_repo + download_module
+ # Replace ${version} string that is sometimes in download_href
+ index = download_href.find("${version}")
+ if index >=0:
+ version = branch.get("version")
+ if version == None:
+ return None
+ download_href = download_href.replace("${version}", version)
+
# Parse various kinds of jhbuild dependencies.
# Note from
# http://stackoverflow.com/questions/9974957/what-is-the-after-element-used-for-in-jhbuild
@@ -141,14 +177,6 @@
for dep_element in package.findall("after/dep"):
after[dep_element.get("package")] = None
- # As a temporary? measure drop all references to gtk-doc
- if dependencies.has_key("gtk-doc"):
- del dependencies["gtk-doc"]
- if suggests.has_key("gtk-doc"):
- del suggests["gtk-doc"]
- if after.has_key("gtk-doc"):
- del after["gtk-doc"]
-
if if_dependencies:
overall_dependencies = {}
overall_dependencies.update(dependencies)
@@ -178,7 +206,10 @@
else:
sys.stdout.write(id + "\n")
sys.stdout.write(config_type + "\n")
+ sys.stdout.write(supports_non_srcdir_builds + "\n")
+ sys.stdout.write(supports_parallel_builds + "\n")
sys.stdout.write(config_arguments + "\n")
+ sys.stdout.write(make_arguments + "\n")
sys.stdout.write(download_hash_type + "\n")
sys.stdout.write(download_hash + "\n")
sys.stdout.write(download_href + "\n")
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|