Ejemplo n.º 1
0
 public void StoreCustomData(Mono.PkgConfig.PcFile pcfile, PackageInfo pkg)
 {
 }
        protected override void ParsePackageInfo(PcFile file, LibraryPackageInfo pinfo)
        {
            List <string> fullassemblies = null;
            bool          gacPackageSet  = false;

            if (file.Libs != null && file.Libs.IndexOf(".dll") != -1)
            {
                if (file.Libs.IndexOf("-lib:") != -1 || file.Libs.IndexOf("/lib:") != -1)
                {
                    fullassemblies = GetAssembliesWithLibInfo(file.Libs);
                }
                else
                {
                    fullassemblies = GetAssembliesWithoutLibInfo(file.Libs);
                }
            }

            string value = file.GetVariable("Libraries");

            if (!string.IsNullOrEmpty(value))
            {
                fullassemblies = GetAssembliesFromLibrariesVar(value);
            }

            value = file.GetVariable("GacPackage");
            if (value != null)
            {
                value = value.ToLower();
                pinfo.IsGacPackage = value == "yes" || value == "true";
                gacPackageSet      = true;
            }

            if (fullassemblies == null)
            {
                return;
            }

            string pcDir      = Path.GetDirectoryName(file.FilePath);
            string monoPrefix = Path.GetDirectoryName(Path.GetDirectoryName(pcDir));

            monoPrefix = Path.GetFullPath(monoPrefix + Path.DirectorySeparatorChar + "lib" + Path.DirectorySeparatorChar + "mono" + Path.DirectorySeparatorChar);

            List <PackageAssemblyInfo> list = new List <PackageAssemblyInfo> ();

            foreach (string assembly in fullassemblies)
            {
                string asm;
                if (Path.IsPathRooted(assembly))
                {
                    asm = Path.GetFullPath(assembly);
                }
                else
                {
                    if (Path.GetDirectoryName(assembly).Length == 0)
                    {
                        asm = assembly;
                    }
                    else
                    {
                        asm = Path.GetFullPath(Path.Combine(pcDir, assembly));
                    }
                }
                if (File.Exists(asm))
                {
                    PackageAssemblyInfo pi = new PackageAssemblyInfo();
                    pi.File          = asm;
                    pi.ParentPackage = pinfo;
                    pi.UpdateFromFile(pi.File);
                    list.Add(pi);
                    if (!gacPackageSet && !asm.StartsWith(monoPrefix) && Path.IsPathRooted(asm))
                    {
                        // Assembly installed outside $(prefix)/lib/mono. It is most likely not a gac package.
                        gacPackageSet      = true;
                        pinfo.IsGacPackage = false;
                    }
                }
            }
            pinfo.Assemblies = list;
        }