Updates
This commit is contained in:
parent
e17bf988af
commit
eb87026f32
55
Program.cs
55
Program.cs
|
@ -44,34 +44,44 @@ namespace repomgr {
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "add":
|
case "add":
|
||||||
if (args.Length != 3)
|
if (args.Length < 3)
|
||||||
PrintHelp();
|
PrintHelp();
|
||||||
try {
|
try {
|
||||||
Repo.Add(args[2]);
|
foreach (var package in args[Range.StartAt(2)]) {
|
||||||
|
Repo.Add(package);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
Console.WriteLine("Add failed with error: " + e);
|
Console.WriteLine("Add failed with error: " + e);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "update":
|
case "autoadd":
|
||||||
if (args.Length < 3 || args.Length > 4)
|
if (args.Length < 3)
|
||||||
PrintHelp();
|
PrintHelp();
|
||||||
try {
|
try {
|
||||||
switch (args.Length) {
|
foreach (var package in args[Range.StartAt(2)]) {
|
||||||
case 3:
|
Repo.Add(package);
|
||||||
Repo.Build(args[2]);
|
}
|
||||||
break;
|
foreach (var package in args[Range.StartAt(2)]) {
|
||||||
case 4 when args[3] == "-f":
|
Repo.Build(package);
|
||||||
Repo.Build(args[2], true);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
PrintHelp();
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
Console.WriteLine("Build failed with error: " + e);
|
Console.WriteLine("AutoAdd failed with error: " + e);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case "update":
|
||||||
|
if (args.Length < 3)
|
||||||
|
PrintHelp();
|
||||||
|
try {
|
||||||
|
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("Update failed with error: " + e);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -82,15 +92,17 @@ namespace repomgr {
|
||||||
Repo.BuildAll();
|
Repo.BuildAll();
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
Console.WriteLine("BuildAll failed with error: " + e);
|
Console.WriteLine("UpdateAll failed with error: " + e);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "remove":
|
case "remove":
|
||||||
if (args.Length != 3)
|
if (args.Length < 3)
|
||||||
PrintHelp();
|
PrintHelp();
|
||||||
try {
|
try {
|
||||||
Repo.Remove(args[2]);
|
foreach (var package in args[Range.StartAt(2)]) {
|
||||||
|
Repo.Remove(package);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
Console.WriteLine("Remove failed with error: " + e);
|
Console.WriteLine("Remove failed with error: " + e);
|
||||||
|
@ -122,9 +134,10 @@ namespace repomgr {
|
||||||
Console.WriteLine("Usage:");
|
Console.WriteLine("Usage:");
|
||||||
Console.WriteLine("repomgr <data-path> init <repo-path> <reponame>");
|
Console.WriteLine("repomgr <data-path> init <repo-path> <reponame>");
|
||||||
Console.WriteLine("repomgr <data-path> list");
|
Console.WriteLine("repomgr <data-path> list");
|
||||||
Console.WriteLine("repomgr <data-path> add <package>");
|
Console.WriteLine("repomgr <data-path> add <package> [...]");
|
||||||
Console.WriteLine("repomgr <data-path> remove <package>");
|
Console.WriteLine("repomgr <data-path> autoadd <package> [...]");
|
||||||
Console.WriteLine("repomgr <data-path> update <package> [-f]");
|
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> update-all");
|
||||||
Console.WriteLine("repomgr <data-path> daemon");
|
Console.WriteLine("repomgr <data-path> daemon");
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,10 @@
|
||||||
|
|
||||||
This software allows you to automatically manage any archlinux repo with git repos as source.
|
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:
|
### Usage:
|
||||||
|
|
||||||
First, initialize your repository using `repomgr /path/to/data init /path/to/repo repo`
|
First, initialize your repository using `repomgr /path/to/data init /path/to/repo repo`
|
||||||
|
|
17
RepoMgr.cs
17
RepoMgr.cs
|
@ -66,17 +66,26 @@ namespace repomgr {
|
||||||
WriteIndex();
|
WriteIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Build(Package package, bool force = false) {
|
private void Build(Package package, bool force = false, bool skipchecks = false) {
|
||||||
if (UpdateAvailable(package))
|
if (UpdateAvailable(package))
|
||||||
UpdatePackage(package);
|
UpdatePackage(package);
|
||||||
if (File.ReadAllText(Path.Combine(_pkgpath, package.Name, "PKGBUILD")).Contains("pkgver()"))
|
if (File.ReadAllText(Path.Combine(_pkgpath, package.Name, "PKGBUILD")).Contains("pkgver()"))
|
||||||
Shell.Exec("makepkg -os --noconfirm", Path.Combine(_pkgpath, package.Name));
|
Shell.Exec("makepkg -os --noconfirm", Path.Combine(_pkgpath, package.Name));
|
||||||
package.CurrentVersion = Shell.ExecR("source PKGBUILD; echo \"$pkgver-$pkgrel\"", Path.Combine(_pkgpath, package.Name));
|
package.CurrentVersion = Shell.ExecR("source PKGBUILD; echo \"$pkgver-$pkgrel\"", Path.Combine(_pkgpath, package.Name));
|
||||||
WriteIndex();
|
WriteIndex();
|
||||||
|
|
||||||
|
var makepkgargs = "-Ccs";
|
||||||
|
|
||||||
if (force)
|
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)
|
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
|
else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -198,7 +207,7 @@ namespace repomgr {
|
||||||
return Directory.Exists(Path.Combine(_pkgpath, package, ".git")) && File.Exists(Path.Combine(_pkgpath, package, "PKGBUILD"));
|
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))
|
if (!CheckPackage(package))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue