From e2de7f209ecdd0eea9f4df4ad60458ce30db6ad4 Mon Sep 17 00:00:00 2001 From: Laura Hausmann Date: Fri, 26 Jun 2020 00:16:53 +0200 Subject: [PATCH] update, fix --- Pages/Index.cshtml | 2 +- Pages/Log.cshtml | 2 +- RepoMgr.cs | 12 ++++++++---- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Pages/Index.cshtml b/Pages/Index.cshtml index 64c369b..9ab41cc 100644 --- a/Pages/Index.cshtml +++ b/Pages/Index.cshtml @@ -39,7 +39,7 @@ { Build failing } - @if (System.IO.File.Exists(System.IO.Path.Combine(Program.Repo._pkgpath, p.Name, "buildlog.txt"))) + @if (System.IO.File.Exists(System.IO.Path.Combine(Program.Repo._logpath, $"{p.Name}.log"))) { View Build log } diff --git a/Pages/Log.cshtml b/Pages/Log.cshtml index 4c382b5..22f49fe 100644 --- a/Pages/Log.cshtml +++ b/Pages/Log.cshtml @@ -6,7 +6,7 @@ Response.Headers["Content-Type"] = "text/plain"; if (Program.Repo._repo.Packages.Any(p => p.Name.Equals(Request.Query["package"]))) { - var logfile = System.IO.Path.Combine(Program.Repo._pkgpath, Request.Query["package"], "buildlog.txt"); + var logfile = System.IO.Path.Combine(Program.Repo._logpath, $"{Request.Query["package"]}.log"); if (System.IO.File.Exists(logfile)) { @Html.Raw(System.IO.File.ReadAllText(logfile)) diff --git a/RepoMgr.cs b/RepoMgr.cs index 3e482a2..3a891e3 100644 --- a/RepoMgr.cs +++ b/RepoMgr.cs @@ -10,17 +10,21 @@ namespace repomgr { public class RepoMgr { public RepoMgr(string buildpath) { _buildpath = Path.GetFullPath(buildpath); - _pkgpath = Path.Combine(_buildpath, "pkg"); + _pkgpath = Path.Combine(_buildpath, "pkg"); + _logpath = Path.Combine(_buildpath, "log"); } public readonly string _buildpath; - public readonly string _pkgpath; + public readonly string _pkgpath; + public readonly string _logpath; public Repository _repo; public void Init(string repopath, string reponame) { _repo = new Repository(repopath, reponame); if (!Directory.Exists(repopath)) Directory.CreateDirectory(repopath); + if (!Directory.Exists(_logpath)) + Directory.CreateDirectory(repopath); WriteIndex(); Console.WriteLine("Initialized."); } @@ -70,9 +74,9 @@ namespace repomgr { package.CurrentVersion = Shell.ExecR("source PKGBUILD; echo \"$pkgver-$pkgrel\"", Path.Combine(_pkgpath, package.Name)); WriteIndex(); if (force) - Shell.Exec("makepkg -Ccsf --sign --noconfirm 2>&1| tee buildlog.txt", Path.Combine(_pkgpath, package.Name)); + Shell.Exec($"makepkg -Ccsf --sign --noconfirm 2>&1| tee ../log/{package.Name}.log", Path.Combine(_pkgpath, package.Name)); else if (package.CurrentVersion != package.RepoVersion) - Shell.Exec("makepkg -Ccs --sign --noconfirm 2>&1| tee buildlog.txt", Path.Combine(_pkgpath, package.Name)); + Shell.Exec($"makepkg -Ccs --sign --noconfirm 2>&1| tee ../log/{package.Name}.log", Path.Combine(_pkgpath, package.Name)); else return;