/// <summary> /// Write package meta/xml data file(either if it not exist, you can use a get meta before to generate it, this is the way used to create a new package). /// </summary> /// <param name="PkgName"> /// Package name to create or edit. /// </param> /// <param name="XmlFs"> /// The file path and name who contain the XML meta data. /// </param> /// <returns> /// A <see cref="StringBuilder"/>The status of the operation in XML format. /// </returns> /// <example> This sample shows how to call the PutProjectPkgMeta method. /// <code> /// using System; /// using MonoOBSFramework.Functions.Sources /// class TestClass /// { /// static int Main() /// { /// if(!VarGlobal.LessVerbose)Console.WriteLine(PutProjectPkgMeta.PutSourceProjectPkgMeta("MonoOSC","home/user/tmp/TmpMeta.xml").ToString()); /// } /// } /// </code> /// </example> public static StringBuilder PutProjectPkgMeta(string PkgName, string XmlFs) { if (Environment.OSVersion.Platform == PlatformID.Unix) { return(PUT.UploadFileCore("source/" + VarGlobal.PrefixUserName + "/" + PkgName + "/_meta", VarGlobal.User, VarGlobal.Password, XmlFs)); } else { return(PUT.Putit("source/" + VarGlobal.PrefixUserName + "/" + PkgName + "/_meta", VarGlobal.User, VarGlobal.Password, XmlFs)); } }
/// <summary> /// Write user data. /// </summary> /// <param name="XmlFs">The file path and name who contain the XML meta data, use get person to have an existing one or a new.</param> /// <returns> /// A <see cref="StringBuilder"/>The status of the operation in XML format. /// </returns> /// <example> This sample shows how to call the PutPersonData method. /// <code> /// using System; /// using MonoOBSFramework.Functions.User.Data /// class TestClass /// { /// static int Main() /// { /// if(!VarGlobal.LessVerbose)Console.WriteLine(PutPerson.PutPersonData("home/user/tmp/TmpMeta.xml").ToString()); /// } /// } /// </code> /// </example> public static StringBuilder PutPersonData(string XmlFs) { //return PUT.Putit("person/" + UserName + "?" + ArgName + "=" + ArgValue, VarGlobal.User, VarGlobal.Password); if (Environment.OSVersion.Platform == PlatformID.Unix) { return(PUT.UploadFileCore("person/", VarGlobal.User, VarGlobal.Password, XmlFs)); } else { return(PUT.Putit("person/", VarGlobal.User, VarGlobal.Password, XmlFs)); } }
// https://api.opensuse.org/build/home:surfzoid/Fedora_9/i586/MonoOSC/MonoOSC-1.0.0.0-2.2.i386.rpm /// <summary> /// Upload a file in the package build area of the server. /// </summary> /// <param name="Repository">repository</param> /// <param name="Arch">Arch (i586, x86_64 ...)</param> /// <param name="PkgName">Package name</param> /// <param name="FileName">File in the package to download.</param> /// <param name="Dest">Where to store the downloaded file, example "/home/user/tmp"</param> /// <param name="BlockSize">The size of each block during download, example 1024</param> /// <returns> /// A <see cref="StringBuilder"/>The status of the operation in XML format. /// </returns> /// <example> This sample shows how to call the PutFile method. /// <code> /// using System; /// using MonoOBSFramework.Functions.Sources /// class TestClass /// { /// static int Main() /// { /// PutSourceProjectPackageFile.PutFile("mono","i586","MonoOSC","MonoOSC-1.0.0.0-2.2.i386.rpm","/home/user/tmp",1024); /// } /// } /// </code> /// </example> public static void PutFile(string Repository, string Arch, string PkgName, string FileName, string Dest, int BlockSize) { System.IO.FileInfo FsInf = new System.IO.FileInfo(FileName); PUT.Putit("source/" + VarGlobal.PrefixUserName + "/" + Repository + "/" + Arch + "/" + PkgName + "/" + FsInf.Name + "?rev=upload", VarGlobal.User, VarGlobal.Password, FileName); }
/// <summary> /// /// </summary> /// <param name="UserName"></param> /// <param name="PkgName"></param> /// <param name="FileName"></param> /// <returns></returns> public static StringBuilder CreatePackage(string UserName, string PkgName) { StringBuilder Result = PUT.Putit("source/" + VarGlobal.PrefixUserName + UserName + "/" + PkgName + "/_meta", VarGlobal.User, VarGlobal.Password); return(Result); }