Example #1
0
        public async Task GetAndAddPackage(SpecificVersion package)
        {
            //Somewhere here we will need to specify what we will be doing with the package.
            await GetPackage(package).ConfigureAwait(false);

            Repo.AddPackage(package.GetFullName());
        }
Example #2
0
        public SpecificVersion GetBundle(SpecificVersion bundle)
        {
            lock (Bundles) {
                if (!Bundles.ContainsKey(bundle.Name))
                {
                    return(null);
                }
                var bundles = Bundles[bundle.Name];

                if (!bundles.Any())
                {
                    return(null);
                }

                if ((bundle.Version == null) && (bundle.Branch == null))
                {
                    return(new SpecificVersion(bundle.Name, Dependency.FindLatestPreferNonBranched(bundles)));
                }

                if (bundles.Contains(bundle.VersionData))
                {
                    return(new SpecificVersion(bundle.GetFullName()));
                }

                var m = _dependencyVersionMatcher.MatchesConstraints(bundles, bundle.Version.ToString(), bundle.Branch);
                return(m == null ? null : new SpecificVersion(bundle.Name, m));
            }
        }
Example #3
0
        Task GetBundle(SpecificVersion bundle)
        {
            var bundleName = bundle.GetFullName();
            var remotes    = FindRemotesWithBundle(bundle.Name).ToArray();

            Repository.Log("Fetching bundle: {0} ({1})", bundle.Name, bundleName);
            if (!remotes.Any())
            {
                throw new NoSourceFoundException("No source found with " + bundle.Name);
            }

            return(Repo.DownloadBundle(bundleName, remotes, PackageManager.StatusRepo.CancelToken));
        }
Example #4
0
        Task GetPackage(SpecificVersion package)
        {
            var packageName = package.GetFullName();
            var remotes     = FindRemotesWithPackage(package.Name).ToArray();

            Repository.Log("\nFetching package: {0} ({1})", package.Name, packageName);
            if (!remotes.Any())
            {
                throw new NoSourceFoundException("No source found with " + package.Name);
            }

            return(Repo.DownloadPackage(packageName, remotes, StatusRepo.CancelToken));
        }
Example #5
0
        async Task ResolveDependencies(List <string> list, List <string> list2, List <Package> packages,
                                       SpecificVersion depInfo, List <SpecificVersion> done, bool useFullName = false, bool noCheckout = false)
        {
            if (!noCheckout && list.Contains(depInfo.Name.ToLower()))
            {
                Repository.Log("Conflicting package, not resolving {0}", depInfo);
                return;
            }
            var name = depInfo.GetFullName();

            if (list2.Contains(name))
            {
                Repository.Log("Duplicate package, skipping {0}", name);
                return;
            }
            list2.Add(name);

            if (!done.Contains(depInfo))
            {
                await GetAndAddPackage(depInfo).ConfigureAwait(false);

                done.Add(depInfo);
            }

            var package = Package.Factory.Open(Repo,
                                               WorkDir.GetChildDirectoryWithName(useFullName ? name : depInfo.Name), name);

            list.Add(depInfo.Name);
            packages.Add(package);

            // TODO: Higher level policy can be overwritten by dependencies (e.g specified dependency contraints). We dont want this.
            foreach (var dep in package.MetaData.GetDependencies())
            {
                await
                ResolveDependencies(list, list2, packages, ResolvePackageName(dep.GetFullName()), done, useFullName,
                                    noCheckout).ConfigureAwait(false);
            }

            OrderPackageLast(list, packages, package);
        }
Example #6
0
 IAbsoluteFilePath GetPackageMetadataPath(SpecificVersion arg) {
     return Repo.PackagesPath.GetChildFileWithName(arg.GetFullName() + Repository.PackageFormat);
 }
Example #7
0
 public async Task GetAndAddPackage(SpecificVersion package) {
     //Somewhere here we will need to specify what we will be doing with the package.
     await GetPackage(package).ConfigureAwait(false);
     Repo.AddPackage(package.GetFullName());
 }
Example #8
0
        Task GetPackage(SpecificVersion package) {
            var packageName = package.GetFullName();
            var remotes = FindRemotesWithPackage(package.Name).ToArray();
            Repository.Log("\nFetching package: {0} ({1})", package.Name, packageName);
            if (!remotes.Any())
                throw new NoSourceFoundException("No source found with " + package.Name);

            return Repo.DownloadPackage(packageName, remotes, StatusRepo.CancelToken);
        }
        public SpecificVersion GetBundle(SpecificVersion bundle) {
            lock (Bundles) {
                if (!Bundles.ContainsKey(bundle.Name))
                    return null;
                var bundles = Bundles[bundle.Name];

                if (!bundles.Any())
                    return null;

                if (bundle.Version == null && bundle.Branch == null)
                    return new SpecificVersion(bundle.Name, Dependency.FindLatestPreferNonBranched(bundles));

                if (bundles.Contains(bundle.VersionData))
                    return new SpecificVersion(bundle.GetFullName());

                var m = _dependencyVersionMatcher.MatchesConstraints(bundles, bundle.Version.ToString(), bundle.Branch);
                return m == null ? null : new SpecificVersion(bundle.Name, m);
            }
        }
Example #10
0
 public Bundle GetMetaData(SpecificVersion arg)
 => Bundle.Factory.Open(Repo.BundlesPath.GetChildFileWithName(arg.GetFullName() + Repository.PackageFormat));
Example #11
0
        public async Task GetAndAddBundle(SpecificVersion bundle)
        {
            await GetBundle(bundle).ConfigureAwait(false);

            Repo.AddBundle(bundle.GetFullName());
        }
Example #12
0
 public Bundle GetMetaData(SpecificVersion arg) {
     return
         Bundle.Factory.Open(Repo.BundlesPath.GetChildFileWithName(arg.GetFullName() + Repository.PackageFormat));
 }
Example #13
0
 public async Task GetAndAddBundle(SpecificVersion bundle) {
     await GetBundle(bundle).ConfigureAwait(false);
     Repo.AddBundle(bundle.GetFullName());
 }
Example #14
0
        Task GetBundle(SpecificVersion bundle) {
            var bundleName = bundle.GetFullName();
            var remotes = FindRemotesWithBundle(bundle.Name).ToArray();
            Repository.Log("Fetching bundle: {0} ({1})", bundle.Name, bundleName);
            if (!remotes.Any())
                throw new NoSourceFoundException("No source found with " + bundle.Name);

            return Repo.DownloadBundle(bundleName, remotes, PackageManager.StatusRepo.CancelToken);
        }
        async Task ResolveDependencies(List<string> list, List<string> list2, List<Package> packages,
            SpecificVersion depInfo, List<SpecificVersion> done, bool useFullName = false, bool noCheckout = false) {
            if (!noCheckout && list.Contains(depInfo.Name.ToLower())) {
                Repository.Log("Conflicting package, not resolving {0}", depInfo);
                return;
            }
            var name = depInfo.GetFullName();
            if (list2.Contains(name)) {
                Repository.Log("Duplicate package, skipping {0}", name);
                return;
            }
            list2.Add(name);

            if (!done.Contains(depInfo)) {
                await GetAndAddPackage(depInfo).ConfigureAwait(false);
                done.Add(depInfo);
            }

            var package = Package.Factory.Open(Repo,
                WorkDir.GetChildDirectoryWithName(useFullName ? name : depInfo.Name), name);
            list.Add(depInfo.Name);
            packages.Add(package);

            // TODO: Higher level policy can be overwritten by dependencies (e.g specified dependency contraints). We dont want this.
            foreach (var dep in package.MetaData.GetDependencies())
                await
                    ResolveDependencies(list, list2, packages, ResolvePackageName(dep.GetFullName()), done, useFullName,
                        noCheckout).ConfigureAwait(false);

            OrderPackageLast(list, packages, package);
        }
Example #16
0
 IAbsoluteFilePath GetPackageMetadataPath(SpecificVersion arg)
 => Repo.PackagesPath.GetChildFileWithName(arg.GetFullName() + Repository.PackageFormat);