Browse Source

Updates

master
Laura Hausmann 2 years ago
parent
commit
eb87026f32
Signed by: zotan GPG Key ID: 5EC1D38FFC321311
  1. 53
      Program.cs
  2. 4
      README.md
  3. 17
      RepoMgr.cs

53
Program.cs

@ -44,34 +44,44 @@ namespace repomgr {
break;
case "add":
if (args.Length != 3)
if (args.Length < 3)
PrintHelp();
try {
Repo.Add(args[2]);
foreach (var package in args[Range.StartAt(2)]) {
Repo.Add(package);
}
}
catch (Exception e) {
Console.WriteLine("Add failed with error: " + e);
}
break;
case "autoadd":
if (args.Length < 3)
PrintHelp();
try {
foreach (var package in args[Range.StartAt(2)]) {
Repo.Add(package);
}
foreach (var package in args[Range.StartAt(2)]) {
Repo.Build(package);
}
}
catch (Exception e) {
Console.WriteLine("AutoAdd failed with error: " + e);
}
break;
case "update":
if (args.Length < 3 || args.Length > 4)
if (args.Length < 3)
PrintHelp();
try {
switch (args.Length) {
case 3:
Repo.Build(args[2]);
break;
case 4 when args[3] == "-f":
Repo.Build(args[2], true);
break;
default:
PrintHelp();
break;
foreach (var package in args[Range.StartAt(2)].Where(p => p != "-f")) {
Repo.Build(package, args.Contains("-f"), args.Contains("--skip-checks"));
}
}
catch (Exception e) {
Console.WriteLine("Build failed with error: " + e);
Console.WriteLine("Update failed with error: " + e);
}
break;
@ -82,15 +92,17 @@ namespace repomgr {
Repo.BuildAll();
}
catch (Exception e) {
Console.WriteLine("BuildAll failed with error: " + e);
Console.WriteLine("UpdateAll failed with error: " + e);
}
break;
case "remove":
if (args.Length != 3)
if (args.Length < 3)
PrintHelp();
try {
Repo.Remove(args[2]);
foreach (var package in args[Range.StartAt(2)]) {
Repo.Remove(package);
}
}
catch (Exception e) {
Console.WriteLine("Remove failed with error: " + e);
@ -122,9 +134,10 @@ namespace repomgr {
Console.WriteLine("Usage:");
Console.WriteLine("repomgr <data-path> init <repo-path> <reponame>");
Console.WriteLine("repomgr <data-path> list");
Console.WriteLine("repomgr <data-path> add <package>");
Console.WriteLine("repomgr <data-path> remove <package>");
Console.WriteLine("repomgr <data-path> update <package> [-f]");
Console.WriteLine("repomgr <data-path> add <package> [...]");
Console.WriteLine("repomgr <data-path> autoadd <package> [...]");
Console.WriteLine("repomgr <data-path> remove <package> [...]");
Console.WriteLine("repomgr <data-path> update <package> [...] [-f] [--skip-checks]");
Console.WriteLine("repomgr <data-path> update-all");
Console.WriteLine("repomgr <data-path> daemon");
}

4
README.md

@ -2,6 +2,10 @@
This software allows you to automatically manage any archlinux repo with git repos as source.
### Important info:
libgit2 links against openssl1.0, so make sure that is installed.
### Usage:
First, initialize your repository using `repomgr /path/to/data init /path/to/repo repo`

17
RepoMgr.cs

@ -66,17 +66,26 @@ namespace repomgr {
WriteIndex();
}
private void Build(Package package, bool force = false) {
private void Build(Package package, bool force = false, bool skipchecks = false) {
if (UpdateAvailable(package))
UpdatePackage(package);
if (File.ReadAllText(Path.Combine(_pkgpath, package.Name, "PKGBUILD")).Contains("pkgver()"))
Shell.Exec("makepkg -os --noconfirm", Path.Combine(_pkgpath, package.Name));
package.CurrentVersion = Shell.ExecR("source PKGBUILD; echo \"$pkgver-$pkgrel\"", Path.Combine(_pkgpath, package.Name));
WriteIndex();
var makepkgargs = "-Ccs";
if (force)
Shell.Exec($"makepkg -Ccsf --sign --noconfirm 2>&1| tee ../../log/{package.Name}.log", Path.Combine(_pkgpath, package.Name));
makepkgargs += "f";
if (skipchecks)
makepkgargs += " --nocheck";
if (force)
Shell.Exec($"makepkg {makepkgargs} --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 ../../log/{package.Name}.log", Path.Combine(_pkgpath, package.Name));
Shell.Exec($"makepkg {makepkgargs} --sign --noconfirm 2>&1| tee ../../log/{package.Name}.log", Path.Combine(_pkgpath, package.Name));
else
return;
@ -198,7 +207,7 @@ namespace repomgr {
return Directory.Exists(Path.Combine(_pkgpath, package, ".git")) && File.Exists(Path.Combine(_pkgpath, package, "PKGBUILD"));
}
public void Build(string package, bool force = false) {
public void Build(string package, bool force = false, bool skipchecks = false) {
if (!CheckPackage(package))
return;

Loading…
Cancel
Save