public static void HandlerItem(bool dev, PublishDirInfo item) { var rpmPath = GetPackPath(dev, item, FileEx.RPM); //var cpioPath = GetPackPath(item, FileEx.CPIO); using var targetStream = File.Open(rpmPath, FileMode.Create, FileAccess.ReadWrite, FileShare.None); //using var cpioStream = File.Open(cpioPath, FileMode.Create, FileAccess.ReadWrite, FileShare.None); using var cpioStream = new MemoryStream(); ArchiveBuilder2 archiveBuilder2 = new() { Log = TaskLoggingHelper.Instance, }; ArchiveBuilder archiveBuilder = archiveBuilder2; var archiveEntries = archiveBuilder.FromDirectory( item.Path, Constants.HARDCODED_APP_NAME, LinuxPackConstants.Prefix, Array.Empty <ITaskItem>()); LinuxPackConstants.AddFileNameDesktop(archiveBuilder2, archiveEntries); //archiveEntries.AddRange(archiveBuilder.FromLinuxFolders(this.LinuxFolders)); archiveEntries = archiveEntries .OrderBy(e => e.TargetPathWithFinalSlash, StringComparer.Ordinal) .ToList(); CpioFileCreator cpioCreator = new CpioFileCreator(); cpioCreator.FromArchiveEntries( archiveEntries, cpioStream); cpioStream.Position = 0; // Prepare the list of dependencies List <PackageDependency> dependencies = new List <PackageDependency>(); if (item.DeploymentMode == DeploymentMode.FDE) { dependencies.Add(new PackageDependency { Name = LinuxPackConstants.aspnetcore_runtime_6_0 }); } //if (this.RpmDotNetDependencies != null) //{ // dependencies.AddRange( // this.RpmDotNetDependencies.Select( // d => GetPackageDependency(d))); //} //if (this.RpmDependencies != null) //{ // dependencies.AddRange( // this.RpmDependencies.Select( // d => GetPackageDependency(d))); //} RpmPackageCreator rpmCreator = new RpmPackageCreator(); rpmCreator.CreatePackage( archiveEntries, cpioStream, LinuxPackConstants.PackageName, Utils.GetVersion(dev), RpmTask.GetPackageArchitecture(item.Name), LinuxPackConstants.Release, LinuxPackConstants.CreateUser, LinuxPackConstants.UserName, LinuxPackConstants.InstallService, LinuxPackConstants.ServiceName, LinuxPackConstants.RpmVendor, LinuxPackConstants.Description, LinuxPackConstants.Url, LinuxPackConstants.Prefix, LinuxPackConstants.PreInstallScript, LinuxPackConstants.PostInstallScript, LinuxPackConstants.PreRemoveScript, LinuxPackConstants.PostRemoveScript, dependencies, null !, privateKey !, targetStream); }
public void GetPackageArchitectureTest(string runtimeIdentifier, string packageAchitecture) { Assert.Equal(packageAchitecture, RpmTask.GetPackageArchitecture(runtimeIdentifier)); }