示例#1
0
        private static int RunInstallPackage(PackageOptions options)
        {
            console.Write("Downloading catalogs...");

            var availablePackages = new List <PackageReference>();

            foreach (var packageSource in PackageSources.Instance.Sources)
            {
                RepositoryOld repo = null;

                var awaiter = packageSource.DownloadCatalog();

                awaiter.Wait();

                repo = awaiter.Result;

                console.WriteLine("Done");

                console.WriteLine("Enumerating Packages...");

                if (repo != null)
                {
                    foreach (var packageReference in repo.Packages)
                    {
                        availablePackages.Add(packageReference);
                        console.WriteLine(packageReference.Name);
                    }
                }
            }

            var package = availablePackages.FirstOrDefault(p => p.Name == options.Package);

            if (package != null)
            {
                var task = package.DownloadInfoAsync();
                task.Wait();

                var repo = task.Result;

                var downloadTask = repo.Synchronize(options.Tag, console);
                downloadTask.Wait();

                return(1);
            }
            console.WriteLine("Unable to find package " + options.Package);
            return(-1);
        }
示例#2
0
		private static int RunInstallPackage(PackageOptions options)
		{
			console.Write("Downloading catalogs...");

			var availablePackages = new List<PackageReference>();

			foreach (var packageSource in PackageSources.Instance.Sources)
			{
				Repository repo = null;

				repo = packageSource.DownloadCatalog();
				console.WriteLine("Done");

				console.WriteLine("Enumerating Packages...");

				if (repo != null)
				{
					foreach (var packageReference in repo.Packages)
					{
						availablePackages.Add(packageReference);
						console.WriteLine(packageReference.Name);
					}
				}
			}

			var package = availablePackages.FirstOrDefault(p => p.Name == options.Package);

			if (package != null)
			{
				var task = package.DownloadInfoAsync();
				task.Wait();

				var repo = task.Result;

				var dlTask = repo.Synchronize(options.Tag, console);
				dlTask.Wait();

				return 1;
			}
			console.WriteLine("Unable to find package " + options.Package);
			return -1;
		}
示例#3
0
        private static int RunPackage(PackageOptions options)
        {
            var arguments = $"cvf package.tar {options.SourceDirectory}";

            if (options.SourceDirectory == ".")
            {
                arguments += " --exclude=package.tar";
            }

            if (!File.Exists(Path.Combine(options.SourceDirectory, "package.manifest")))
            {
                console.WriteLine("File: package.manifest was not found.");
                return(2);
            }

            try
            {
                var manifest = PackageManifest.Load(Path.Combine(options.SourceDirectory, "package.manifest"), "test");
            }
            catch (Exception)
            {
                console.WriteLine("Manifest was not valid.");
                return(2);
            }

            var process = Process.Start("tar", arguments);

            process.WaitForExit();

            process = Process.Start("7z", "a package.7z -mx9 -mmt -md29 -ms=on -myx=9 -mfb=273 package.tar");

            process.WaitForExit();

            File.Delete(Path.Combine(options.SourceDirectory, "package.tar"));

            File.Move(Path.Combine(options.SourceDirectory, "package.7z"), Path.Combine(options.SourceDirectory, "package.avpkg"));

            return(1);
        }