Compare commits
	
		
			13 Commits
		
	
	
		
			60dfb368e6
			...
			fix/Pacser
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 733689cb5b | |||
| 25004cd83b | |||
| 42fe907ec8 | |||
| 6892191275 | |||
| 58ceb31c1c | |||
| 15220e7135 | |||
| 590b06fc86 | |||
|  | 65b15f657d | ||
|  | 82a854dd8b | ||
|  | 5018856aab | ||
| dc811d7462 | |||
| 07982425e0 | |||
| e609caf892 | 
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -1,3 +1,4 @@ | ||||
| .vscode/ | ||||
| [Oo]bj/ | ||||
| [Bb]in/ | ||||
| .sonarqube/ | ||||
| @@ -4,15 +4,15 @@ namespace Pacserver.Tests; | ||||
|  | ||||
| public class TranserFilesTest { | ||||
|     [Fact] | ||||
|     public void transferPacmanCache_doesNotFail() { | ||||
|     public async void transferPacmanCache_doesNotFail() { | ||||
|         // Arrange | ||||
|         PacserverUtils utils = new PacserverUtils(); | ||||
|  | ||||
|         // Act | ||||
|         utils.readPacmanConfig(); | ||||
|         utils.transferPacmanCache(); | ||||
|         Action act = () => utils.transfer(); | ||||
|  | ||||
|         // Assert | ||||
|         //Assert.NotEmpty(Directory.GetFiles("/home/rene/test/")); | ||||
|         act.Should().NotThrow(); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -7,9 +7,11 @@ public class checkForNewerStuffTest { | ||||
|     public void checkForNewerPackages_throwsExceptionIfNoFilesExist() { | ||||
|         // Arrange | ||||
|         PacserverUtils utils = new PacserverUtils(); | ||||
|         File.Delete(utils.pacserverDirectory + "packages_before.txt"); | ||||
|         File.Delete(utils.pacserverDirectory + "packages_after.txt"); | ||||
|  | ||||
|         // Act | ||||
|         Action act = () => utils.diff("/tmp/before_update.txt", "/tmp/after_update.txt"); | ||||
|         Action act = () => utils.diff(utils.pacserverDirectory + "packages_before.txt", utils.pacserverDirectory + "packages_after.txt"); | ||||
|  | ||||
|         // Assert | ||||
|         act.Should().Throw<FileNotFoundException>().WithMessage("Necessary files could not be found"); | ||||
| @@ -19,42 +21,42 @@ public class checkForNewerStuffTest { | ||||
|     public void getEveryPackageNameAndVersionViaFolderName_createsFiles() { | ||||
|         // Arrange | ||||
|         PacserverUtils utils = new PacserverUtils(); | ||||
|         utils.readPacmanConfig(); | ||||
|         Directory.CreateDirectory("/tmp/pacserverTest/"); | ||||
|         utils.pacmanCacheDirectory = "/tmp/pacserverTest/"; | ||||
|  | ||||
|         // Act | ||||
|         utils.getEveryPackageNameAndVersionViaFolderName("/tmp/before_update.txt"); | ||||
|         utils.getEveryPackageNameAndVersionViaFolderName("/tmp/after_update.txt"); | ||||
|         utils.getEveryPackageNameAndVersion("before", utils.pacserverDirectory + "packages_before.txt"); | ||||
|         utils.getEveryPackageNameAndVersion("after", utils.pacserverDirectory + "packages_after.txt"); | ||||
|  | ||||
|         // Assert | ||||
|         File.Exists("/tmp/before_update.txt").Should().BeTrue(); | ||||
|         File.Exists("/tmp/after_update.txt").Should().BeTrue(); | ||||
|         File.Exists(utils.pacserverDirectory + "packages_before.txt").Should().BeTrue(); | ||||
|         File.Exists(utils.pacserverDirectory + "packages_before.txt").Should().BeTrue(); | ||||
|     } | ||||
|  | ||||
|     [Fact] | ||||
|     public void packageNamesAndVersion_notEmpty() { | ||||
|     public void packageNamesAndVersion_isEmpty() { | ||||
|         // Arrange | ||||
|         PacserverUtils utils = new PacserverUtils(); | ||||
|         utils.readPacmanConfig(); | ||||
|         utils.getEveryPackageNameAndVersionViaFolderName("/tmp/before_update.txt"); | ||||
|         Directory.CreateDirectory("/tmp/pacserverTest/"); | ||||
|         utils.pacmanCacheDirectory = "/tmp/pacserverTest/"; | ||||
|         utils.getEveryPackageNameAndVersion("before", utils.pacserverDirectory + "packages_before.txt"); | ||||
|  | ||||
|         // Act | ||||
|         List<String> packageList = utils.packageNamesAndVersion; | ||||
|         var packageList = utils.packageNamesAndVersion; | ||||
|  | ||||
|         // Assert | ||||
|         packageList.Should().NotBeNullOrEmpty(); | ||||
|         packageList.Should().BeEmpty(); | ||||
|     } | ||||
|  | ||||
|     [Fact] | ||||
|     public void getEveryPackageNameAndVersionViaFolderName_throwsExceptionIfListIsEmpty() { | ||||
|     public void getEveryPackageNameAndVersionViaFolderName_throwsExceptionIfModeIsNotValid() { | ||||
|         // Arrange | ||||
|         PacserverUtils utils = new PacserverUtils(); | ||||
|         Directory.CreateDirectory("/tmp/local"); | ||||
|         utils.pacmanDatabaseDirectory = "/tmp/"; | ||||
|  | ||||
|         // Act | ||||
|         Action act = () => utils.getEveryPackageNameAndVersionViaFolderName("/tmp/before_update.txt"); | ||||
|         Action act = () => utils.getEveryPackageNameAndVersion("test", utils.pacserverDirectory + "test.txt"); | ||||
|  | ||||
|         // Assert | ||||
|         act.Should().Throw<Exception>().WithMessage("How did you execute this without any packages?"); | ||||
|         act.Should().Throw<ArgumentException>().WithMessage("No valid mode was given. Valid modes are before and after"); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										22
									
								
								src/Pacserver.Tests/getEverySigFileTest.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								src/Pacserver.Tests/getEverySigFileTest.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,22 @@ | ||||
| using Pacserver.Utils; | ||||
|  | ||||
| namespace Pacserver.Tests; | ||||
|  | ||||
| public class getEverySigFileTest { | ||||
|     [Fact] | ||||
|     public void getEverySigFile_ListShouldNotBeEmpty() { | ||||
|         // Arrange | ||||
|         PacserverUtils utils = new PacserverUtils(); | ||||
|         Directory.CreateDirectory("/tmp/pacserverTest/"); | ||||
|         utils.pacmanCacheDirectory = "/tmp/pacserverTest/"; | ||||
|         File.Create(utils.pacmanCacheDirectory + "zsh-5.9-3-x86_64.pkg.tar.zst.sig"); | ||||
|  | ||||
|         // Act | ||||
|         utils.getEverySigFile(); | ||||
|         var sigFiles = utils.sigFiles; | ||||
|         Directory.Delete(utils.pacmanCacheDirectory, true); | ||||
|  | ||||
|         // Assert | ||||
|         sigFiles.Should().NotBeEmpty(); | ||||
|     } | ||||
| } | ||||
| @@ -1,52 +1,109 @@ | ||||
| using System.Net.Http.Headers; | ||||
| using System.Collections.Immutable; | ||||
| using System.Text.RegularExpressions; | ||||
|  | ||||
| namespace Pacserver.Utils; | ||||
| public class PacserverUtils { | ||||
|     public string pacmanCacheDirectory = string.Empty; | ||||
|     public string pacmanDatabaseDirectory = string.Empty; | ||||
|     public static List<String> pathsToDetermine = new List<String>() { "CacheDir", "DBPath" }; | ||||
| public partial class PacserverUtils { | ||||
|     public string? pacserverDirectory { get; set; } | ||||
|     public void prerequisites() { | ||||
|         AppDomain.CurrentDomain.SetData("REGEX_DEFAULT_MATCH_TIMEOUT", TimeSpan.FromMilliseconds(100)); | ||||
|  | ||||
|         pacserverDirectory = "/tmp/pacserver/"; | ||||
|         pacmanCacheDirectory = string.Empty; | ||||
|         pacmanDatabaseDirectory = string.Empty; | ||||
|  | ||||
|         if (!Directory.Exists(pacserverDirectory)) { | ||||
|             Directory.CreateDirectory(pacserverDirectory); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public void cleanup() { | ||||
|         if (Directory.Exists(pacserverDirectory)) { | ||||
|             Directory.Delete(pacserverDirectory, true); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public string? pacmanCacheDirectory { get; set; } | ||||
|     public string? pacmanDatabaseDirectory { get; set; } | ||||
|     public readonly ImmutableList<String> pathsToDetermine = ImmutableList.Create("CacheDir", "DBPath"); | ||||
|     [GeneratedRegex(@"\/(?:[\w.-]+\/)*[\w.-]+(?:\.\w+)*\/?$", RegexOptions.NonBacktracking)] // https://regex101.com/r/GwWeui/2 | ||||
|     private static partial Regex CacheDirOrDBPathRegex(); | ||||
|     public void readPacmanConfig() { | ||||
|         using (StreamReader file = new StreamReader("/etc/pacman.conf")) { | ||||
|             Regex regex = new Regex(@"\/(?:[\w.-]+\/)*[\w.-]+(?:\.\w+)*\/?$"); // https://regex101.com/r/GwWeui/2 | ||||
|  | ||||
|             string? line; | ||||
|  | ||||
|             while ((line = file.ReadLine()) is not null) { | ||||
|                 foreach (string path in pathsToDetermine) { | ||||
|                     if (line.Contains(path)) { | ||||
|                         Match match = regex.Match(line); | ||||
|                         if (match.Success) { | ||||
|                             switch (path) { | ||||
|                                 case "CacheDir": | ||||
|                                     pacmanCacheDirectory = match.ToString(); | ||||
|                                     break; | ||||
|                                 case "DBPath": | ||||
|                                     pacmanDatabaseDirectory = match.ToString(); | ||||
|                                     break; | ||||
|                                 default: | ||||
|                                     throw new Exception("Could not deal with " + match.ToString()); | ||||
|                             } | ||||
|                         } else { | ||||
|                             string pathsToDetermineString = string.Join(",", pathsToDetermine); | ||||
|                             throw new Exception("Could not determine the necessary file paths: " + pathsToDetermineString); | ||||
|                         } | ||||
|                     } | ||||
|                 string cachePath = pathsToDetermine[0]; | ||||
|                 string dbPath = pathsToDetermine[1]; | ||||
|  | ||||
|                 if (!line.Contains(cachePath) && !line.Contains(dbPath)) { | ||||
|                     continue; | ||||
|                 } | ||||
|  | ||||
|                 Match match = CacheDirOrDBPathRegex().Match(line); | ||||
|  | ||||
|                 if (!match.Success) { | ||||
|                     string pathsToDetermineString = string.Join(",", pathsToDetermine); | ||||
|                     throw new DirectoryNotFoundException("Could not determine the necessary file paths: " + pathsToDetermineString); | ||||
|                 } | ||||
|  | ||||
|                 if (line.Contains(cachePath)) { | ||||
|                     pacmanCacheDirectory = match.ToString(); | ||||
|                 } else if (line.Contains(dbPath)) { | ||||
|                     pacmanDatabaseDirectory = match.ToString(); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public List<String> packageNamesAndVersion = new List<String>(); | ||||
|     public void getEveryPackageNameAndVersionViaFolderName(string filePath) { | ||||
|         string[] directories = Directory.GetDirectories(pacmanDatabaseDirectory + "local/"); | ||||
|         foreach (string directory in directories) { | ||||
|             packageNamesAndVersion.Add(new DirectoryInfo(directory).Name); | ||||
|     [GeneratedRegex(@".+\.pkg\.tar\.zst$", RegexOptions.NonBacktracking)] | ||||
|     private static partial Regex onlyGetPackages(); | ||||
|     public void getEveryPackageNameAndVersion(string mode, string filePath) { | ||||
|         if (Directory.Exists(pacmanCacheDirectory)) { | ||||
|             if (Directory.GetFiles(pacmanCacheDirectory) is not null) { | ||||
|                 packageNamesAndVersion = Directory.GetFiles(pacmanCacheDirectory).Where(file => onlyGetPackages().IsMatch(file)).ToList(); | ||||
|             } else { | ||||
|                 Console.WriteLine("No packages found in pacman cache"); | ||||
|             } | ||||
|         } else { | ||||
|             Console.WriteLine("No pacman cache directory found"); | ||||
|         } | ||||
|  | ||||
|         if (packageNamesAndVersion.Capacity > 0) { | ||||
|             File.WriteAllLines(filePath, packageNamesAndVersion); | ||||
|         } else { | ||||
|             throw new Exception("How did you execute this without any packages?"); | ||||
|         switch (mode) { | ||||
|             case "before": | ||||
|                 writePackageNamesAndVersionToFile(filePath); | ||||
|                 break; | ||||
|             case "after": | ||||
|                 writePackageNamesAndVersionToFile(filePath); | ||||
|                 break; | ||||
|             default: | ||||
|                 throw new ArgumentException("No valid mode was given. Valid modes are before and after"); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public void writePackageNamesAndVersionToFile(string filePath) { | ||||
|         if (File.Exists(filePath)) { | ||||
|             File.Delete(filePath); | ||||
|         } | ||||
|  | ||||
|         using (File.Open(filePath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite)) { | ||||
|             using (StreamWriter sw = new StreamWriter(filePath)) { | ||||
|                 foreach (string package in packageNamesAndVersion) { | ||||
|                     sw.WriteLine(package); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public List<String> sigFiles = new List<String>(); | ||||
|     [GeneratedRegex(@".+\.pkg\.tar\.zst\.sig$", RegexOptions.NonBacktracking)] | ||||
|     private static partial Regex onlyGetSigFiles(); | ||||
|     public void getEverySigFile() { | ||||
|         if (Directory.Exists(pacmanCacheDirectory)) { | ||||
|             if (Directory.GetFiles(pacmanCacheDirectory) is not null) { | ||||
|                 sigFiles = Directory.GetFiles(pacmanCacheDirectory).Where(file => onlyGetSigFiles().IsMatch(file)).ToList(); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
| @@ -59,34 +116,50 @@ public class PacserverUtils { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public List<String> databases = new List<String>(); | ||||
|     public void checkIfDatabasesWereModified(string mode, string filePath) { | ||||
|         string[] databases = Directory.GetFiles(pacmanDatabaseDirectory + "sync/"); | ||||
|     public void saveDiffToFile(string filePath) { | ||||
|         if (File.Exists(filePath)) { | ||||
|             File.Delete(filePath); | ||||
|         } | ||||
|  | ||||
|         foreach (string database in databases) { | ||||
|             switch (mode) { | ||||
|                 case "before": | ||||
|                     writeDatabaseAccessTimeToFile(filePath, database); | ||||
|                     break; | ||||
|                 case "after": | ||||
|                     writeDatabaseAccessTimeToFile(filePath, database); | ||||
|                     break; | ||||
|                 default: | ||||
|                     throw new ArgumentException("No valid mode was given. Valid modes are before and after"); | ||||
|         using (File.Open(filePath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite)) { | ||||
|             using (StreamWriter sw = new StreamWriter(filePath)) { | ||||
|                 foreach (string packageOrDatabase in diffOfPackagesOrDatabases) { | ||||
|                     sw.WriteLine(packageOrDatabase); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public void writeDatabaseAccessTimeToFile(string filePath, string database) { | ||||
|         if (!File.Exists(filePath)) { | ||||
|             using (File.Open(filePath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite)) { | ||||
|                 using (StreamWriter sw = new StreamWriter(filePath)) { | ||||
|                     sw.WriteLine(database + " " + File.GetLastAccessTime(database)); | ||||
|                 } | ||||
|             } | ||||
|         } else if (File.Exists(filePath)) { | ||||
|             using (File.Open(filePath, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite)) { | ||||
|                 using (var sw = new StreamWriter(filePath, true)) { | ||||
|     public List<String> readDiffFileToList(string filePath) { | ||||
|         using (File.Open(filePath, FileMode.Open, FileAccess.Read, FileShare.Read)) { | ||||
|             return File.ReadAllLines(filePath).ToList(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public List<String> databases = new List<String>(); | ||||
|     public void checkIfDatabasesWereModified(string mode, string filePath) { | ||||
|         databases = Directory.GetFiles(pacmanDatabaseDirectory + "sync/").ToList(); | ||||
|  | ||||
|         switch (mode) { | ||||
|             case "before": | ||||
|                 writeDatabaseAccessTimeToFile(filePath); | ||||
|                 break; | ||||
|             case "after": | ||||
|                 writeDatabaseAccessTimeToFile(filePath); | ||||
|                 break; | ||||
|             default: | ||||
|                 throw new ArgumentException("No valid mode was given. Valid modes are before and after"); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public void writeDatabaseAccessTimeToFile(string filePath) { | ||||
|         if (File.Exists(filePath)) { | ||||
|             File.Delete(filePath); | ||||
|         } | ||||
|  | ||||
|         using (File.Open(filePath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.Read)) { | ||||
|             using (StreamWriter sw = new StreamWriter(filePath)) { | ||||
|                 foreach (string database in databases) { | ||||
|                     sw.WriteLine(database + " " + File.GetLastAccessTime(database)); | ||||
|                 } | ||||
|             } | ||||
| @@ -94,25 +167,22 @@ public class PacserverUtils { | ||||
|     } | ||||
|  | ||||
|     public List<String> databasesToTransfer = new List<String>(); | ||||
|     [GeneratedRegex(@"\/(?:[\w.-]+\/)*[\w.-]+(?:\.\w+)*\/*db", RegexOptions.NonBacktracking)] // https://regex101.com/r/Wm5M0P/1 | ||||
|     private static partial Regex onlyGetDatabaseName(); | ||||
|     public void filterDiffOutputForDatabases() { | ||||
|         foreach (string database in diffOfPackagesOrDatabases) { | ||||
|             databasesToTransfer.Add(getDatabaseFromRegex(database, @"\/(?:[\w.-]+\/)*[\w.-]+(?:\.\w+)*\/*db")); // https://regex101.com/r/Wm5M0P/1 | ||||
|             databasesToTransfer.Add(onlyGetDatabaseName().Match(database).Value); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public string getDatabaseFromRegex(string input, string pattern) { | ||||
|         string match = string.Empty; | ||||
|         MatchCollection matchCollection = Regex.Matches(input, pattern); | ||||
|  | ||||
|         foreach (Match matches in matchCollection) { | ||||
|             match = matches.Value; | ||||
|         } | ||||
|  | ||||
|         return match; | ||||
|     } | ||||
|  | ||||
|     private static List<String> newerPackagesAndDatabases = new List<String>(); | ||||
|     public async void transferPacmanCache() { | ||||
|     public void combinePackagesWithDatabases() { | ||||
|         newerPackagesAndDatabases.AddRange(packageNamesAndVersion); | ||||
|         newerPackagesAndDatabases.AddRange(databasesToTransfer); | ||||
|         newerPackagesAndDatabases.AddRange(sigFiles); | ||||
|     } | ||||
|  | ||||
|     public async Task transfer() { | ||||
|         HttpClient client = new HttpClient(); | ||||
|         HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, "http://192.168.0.69:12000/upload?path=/"); | ||||
|         MultipartFormDataContent content = new MultipartFormDataContent(); | ||||
| @@ -124,8 +194,4 @@ public class PacserverUtils { | ||||
|  | ||||
|         await client.SendAsync(request); | ||||
|     } | ||||
|  | ||||
|     public void transferPacmanDatabases() { | ||||
|  | ||||
|     } | ||||
| } | ||||
| @@ -1,59 +1,51 @@ | ||||
| using Pacserver.Utils; | ||||
|  | ||||
| public class Program { | ||||
|  | ||||
|     protected Program() { | ||||
|     } | ||||
|     static void Main(string[] args) { | ||||
|         if (args.Length == 0) { | ||||
|             Console.ForegroundColor = ConsoleColor.Red; | ||||
|             Console.WriteLine("Please specify an option."); | ||||
|             Console.ResetColor(); | ||||
|             Console.WriteLine("Possible options are: determinePacmanCacheDirectory, packagesBefore, packagesAfter, diffPackages, databasesBefore, databasesAfter, diffDatabases, filter"); | ||||
|             Console.WriteLine("Possible options are: before, after"); | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         PacserverUtils utils = new PacserverUtils(); | ||||
|         utils.prerequisites(); | ||||
|         utils.readPacmanConfig(); | ||||
|  | ||||
|         switch (args[0]) { | ||||
|             case "determinePacmanCacheDirectory": | ||||
|                 utils.readPacmanConfig(); | ||||
|                 Console.WriteLine(utils.pacmanCacheDirectory); | ||||
|             case "before": | ||||
|                 utils.getEveryPackageNameAndVersion("before", utils.pacserverDirectory + "packages_before.txt"); | ||||
|                 utils.checkIfDatabasesWereModified("before", utils.pacserverDirectory + "databases_before.txt"); | ||||
|                 break; | ||||
|             case "packagesBefore": | ||||
|                 utils.readPacmanConfig(); | ||||
|                 utils.getEveryPackageNameAndVersionViaFolderName("/tmp/before_update.txt"); | ||||
|                 break; | ||||
|             case "packagesAfter": | ||||
|                 utils.readPacmanConfig(); | ||||
|                 utils.getEveryPackageNameAndVersionViaFolderName("/tmp/after_update.txt"); | ||||
|                 break; | ||||
|             case "diffPackages": | ||||
|                 utils.diff("/tmp/before_update.txt", "/tmp/after_update.txt"); | ||||
|                 string packages = string.Join("\n", utils.diffOfPackagesOrDatabases); | ||||
|                 Console.WriteLine(packages); | ||||
|                 break; | ||||
|             case "databasesBefore": | ||||
|                 utils.readPacmanConfig(); | ||||
|                 utils.checkIfDatabasesWereModified("before", "/tmp/databases_before.txt"); | ||||
|                 break; | ||||
|             case "databasesAfter": | ||||
|                 utils.readPacmanConfig(); | ||||
|                 utils.checkIfDatabasesWereModified("after", "/tmp/databases_after.txt"); | ||||
|                 break; | ||||
|             case "diffDatabases": | ||||
|                 utils.diff("/tmp/databases_before.txt", "/tmp/databases_after.txt"); | ||||
|                 string databases = string.Join("\n", utils.diffOfPackagesOrDatabases); | ||||
|                 Console.WriteLine(databases); | ||||
|                 break; | ||||
|             case "filter": | ||||
|                 utils.diff("/tmp/databases_before.txt", "/tmp/databases_after.txt"); | ||||
|             case "after": | ||||
|                 utils.getEveryPackageNameAndVersion("after", utils.pacserverDirectory + "packages_after.txt"); | ||||
|                 utils.checkIfDatabasesWereModified("after", utils.pacserverDirectory + "databases_after.txt"); | ||||
|  | ||||
|                 utils.diff(utils.pacserverDirectory + "packages_before.txt", utils.pacserverDirectory + "packages_after.txt"); | ||||
|                 utils.saveDiffToFile(utils.pacserverDirectory + "package_diff.txt"); | ||||
|  | ||||
|                 utils.diff(utils.pacserverDirectory + "databases_before.txt", utils.pacserverDirectory + "databases_after.txt"); | ||||
|                 utils.saveDiffToFile(utils.pacserverDirectory + "database_diff.txt"); | ||||
|                 utils.filterDiffOutputForDatabases(); | ||||
|                 string filteredDatabases = string.Join("\n", utils.databasesToTransfer); | ||||
|                 Console.WriteLine(filteredDatabases); | ||||
|  | ||||
|                 utils.packageNamesAndVersion = utils.readDiffFileToList(utils.pacserverDirectory + "package_diff.txt"); | ||||
|  | ||||
|                 utils.getEverySigFile(); | ||||
|                 utils.combinePackagesWithDatabases(); | ||||
|                 utils.transfer(); | ||||
|  | ||||
|                 utils.cleanup(); | ||||
|                 break; | ||||
|             default: | ||||
|                 Console.ForegroundColor = ConsoleColor.Red; | ||||
|                 Console.WriteLine(args[0] + " is not a recognized option."); | ||||
|                 Console.ResetColor(); | ||||
|                 Console.WriteLine("Possible options are: determinePacmanCacheDirectory, packagesBefore, packagesAfter, diffPackages, databasesBefore, databasesAfter, diffDatabases, filter"); | ||||
|                 Console.WriteLine("Possible options are: before, after"); | ||||
|                 break; | ||||
|         } | ||||
|     } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user