src/modules/publish/dependencies.py
changeset 1908 4bdaf0463bae
parent 1887 757d613561da
child 1933 5193ac03ad9f
--- a/src/modules/publish/dependencies.py	Thu May 20 21:07:51 2010 -0700
+++ b/src/modules/publish/dependencies.py	Thu May 20 21:32:54 2010 -0700
@@ -90,7 +90,7 @@
                         for grp in self.pvars.get_unsatisfied()
                     ]))
 
-def list_implicit_deps(file_path, proto_dir, dyn_tok_conv, kernel_paths,
+def list_implicit_deps(file_path, proto_dirs, dyn_tok_conv, kernel_paths,
     remove_internal_deps=True):
         """Given the manifest provided in file_path, use the known dependency
         generators to produce a list of dependencies the files delivered by
@@ -98,7 +98,7 @@
 
         'file_path' is the path to the manifest for the package.
 
-        'proto_dir' is the path to the proto area which holds the files that
+        'proto_dirs' is a list of paths to proto areas which hold the files that
         will be delivered by the package.
 
         'dyn_tok_conv' is the dictionary which maps the dynamic tokens, like
@@ -107,16 +107,15 @@
         'kernel_paths' contains the run paths which kernel modules should use.
         """
 
-        proto_dir = os.path.abspath(proto_dir)
-        m, missing_manf_files = __make_manifest(file_path, [proto_dir])
+        m, missing_manf_files = __make_manifest(file_path, proto_dirs)
         pkg_vars = m.get_all_variants()
-        deps, elist, missing = list_implicit_deps_for_manifest(m, proto_dir,
+        deps, elist, missing = list_implicit_deps_for_manifest(m, proto_dirs,
             pkg_vars, dyn_tok_conv, kernel_paths)
         if remove_internal_deps:
-                deps = resolve_internal_deps(deps, m, proto_dir, pkg_vars)
+                deps = resolve_internal_deps(deps, m, proto_dirs, pkg_vars)
         return deps, missing_manf_files + elist, missing
 
-def resolve_internal_deps(deps, mfst, proto_dir, pkg_vars):
+def resolve_internal_deps(deps, mfst, proto_dirs, pkg_vars):
         """Given a list of dependencies, remove those which are satisfied by
         others delivered by the same package.
 
@@ -139,7 +138,7 @@
                         pvars = pkg_vars
                 p = a.attrs["path"]
                 delivered.setdefault(p, variants.VariantSets()).merge(pvars)
-                p = os.path.join(proto_dir, p)
+                p = os.path.join(a.attrs[portable.PD_PROTO_DIR], p)
                 np = os.path.normpath(p)
                 rp = os.path.realpath(p)
                 # adding the normalized path
@@ -171,7 +170,7 @@
     portable.UNFOUND: no_such_file
 }
 
-def list_implicit_deps_for_manifest(mfst, proto_dir, pkg_vars, dyn_tok_conv,
+def list_implicit_deps_for_manifest(mfst, proto_dirs, pkg_vars, dyn_tok_conv,
     kernel_paths):
         """For a manifest, produce the list of dependencies generated by the
         files it installs.
@@ -202,7 +201,7 @@
         elist = []
         missing = {}
         act_list = list(mfst.gen_actions_by_type("file"))
-        file_types = portable.get_file_type(act_list, proto_dir)
+        file_types = portable.get_file_type(act_list)
 
         for i, file_type in enumerate(file_types):
                 a = act_list[i]
@@ -210,11 +209,11 @@
                         func = dispatch_dict[file_type]
                 except KeyError:
                         if file_type not in missing:
-                                missing[file_type] = os.path.join(proto_dir,
-                                    a.attrs["path"])
+                                missing[file_type] = \
+                                    a.attrs[portable.PD_LOCAL_PATH]
                 else:
                         try:
-                                ds, errs = func(action=a, proto_dir=proto_dir,
+                                ds, errs = func(action=a,
                                     pkg_vars=pkg_vars,
                                     dyn_tok_conv=dyn_tok_conv,
                                     kernel_paths=kernel_paths)
@@ -223,8 +222,7 @@
                         except base.DependencyAnalysisError, e:
                                 elist.append(e)
         for a in mfst.gen_actions_by_type("hardlink"):
-                deps.extend(hardlink.process_hardlink_deps(a, pkg_vars,
-                    proto_dir))
+                deps.extend(hardlink.process_hardlink_deps(a, pkg_vars))
         return deps, elist, missing
 
 def __make_manifest(fp, basedirs=None, load_data=True):
@@ -246,15 +244,16 @@
                 if not l or l[0] == '#':
                         continue
                 try:
-                        a, local_path = actions.internalizestr(l,
+                        a, local_path, used_bd = actions.internalizestr(l,
                             basedirs=basedirs,
                             load_data=load_data)
                         if local_path:
                                 assert portable.PD_LOCAL_PATH not in a.attrs
                                 a.attrs[portable.PD_LOCAL_PATH] = local_path
+                                a.attrs[portable.PD_PROTO_DIR] = used_bd
                         acts.append(a)
                 except actions.ActionDataError, e:
-                        new_a, local_path = actions.internalizestr(
+                        new_a, local_path, used_bd = actions.internalizestr(
                             l, basedirs=basedirs, load_data=False)
                         if new_a.name == "license":
                                 acts.append(new_a)