mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 19:42:57 +00:00
Publish ISOs via FTP
svn path=/trunk/; revision=19523
This commit is contained in:
parent
125e25d424
commit
5247d48cf1
3 changed files with 1127 additions and 11 deletions
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<configuration>
|
<configuration>
|
||||||
<appSettings>
|
<appSettings>
|
||||||
<add key="publishPath" value="c:\iso" />
|
<add key="publishPath" value="c:\iso" /> <!-- c:\iso or ftp://ftp.server.com/iso -->
|
||||||
<add key="smtpServer" value="localhost" />
|
<add key="smtpServer" value="localhost" />
|
||||||
<add key="errorEmail" value="mailbox@somewhere-on-the-net" />
|
<add key="errorEmail" value="mailbox@somewhere-on-the-net" />
|
||||||
<add key="makeParameters" value="" />
|
<add key="makeParameters" value="" />
|
||||||
|
|
1035
cis/ReactOS.CustomRevisionAction/FtpClient.cs
Normal file
1035
cis/ReactOS.CustomRevisionAction/FtpClient.cs
Normal file
File diff suppressed because it is too large
Load diff
|
@ -13,6 +13,17 @@ namespace ReactOS.CustomRevisionAction
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static string publishPath;
|
private static string publishPath;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether or not to publish ISOs to a remote destination via FTP.
|
||||||
|
/// </summary>
|
||||||
|
private static bool PublishToRemoteFtpLocation
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return publishPath.StartsWith("ftp://");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Run the application.
|
/// Run the application.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -138,8 +149,59 @@ namespace ReactOS.CustomRevisionAction
|
||||||
revision);
|
revision);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void SplitRemotePublishPath(string publishPath,
|
||||||
|
out string server,
|
||||||
|
out string directory)
|
||||||
|
{
|
||||||
|
string searchString = "://";
|
||||||
|
int index = publishPath.IndexOf(searchString);
|
||||||
|
if (index == -1)
|
||||||
|
throw new InvalidOperationException();
|
||||||
|
int endOfProtocolIndex = index + searchString.Length;
|
||||||
|
string withoutProtocol = publishPath.Remove(0, endOfProtocolIndex);
|
||||||
|
index = withoutProtocol.IndexOf("/");
|
||||||
|
if (index == -1)
|
||||||
|
{
|
||||||
|
server = withoutProtocol;
|
||||||
|
directory = "";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
server = withoutProtocol.Substring(0, index);
|
||||||
|
directory = withoutProtocol.Remove(0, index + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Copy ISO to the destination.
|
/// Copy ISO to the (remote) destination.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sourceFilename">Name of source ISO file to copy.</param>
|
||||||
|
/// <param name="branch">Branch.</param>
|
||||||
|
/// <param name="revision">Revision.</param>
|
||||||
|
/// <remarks>
|
||||||
|
/// Structure is ftp://ftp.server.com/whereever/<branch>/ReactOS-<branch>-r<revision>.iso.
|
||||||
|
/// </remarks>
|
||||||
|
private static void CopyISOToRemoteFtpDestination(string sourceFilename,
|
||||||
|
string branch,
|
||||||
|
int revision)
|
||||||
|
{
|
||||||
|
string server;
|
||||||
|
string directory;
|
||||||
|
SplitRemotePublishPath(publishPath, out server, out directory);
|
||||||
|
FtpClient ftpClient = new FtpClient(server, "anonymous", "sin@svn.reactos.com");
|
||||||
|
ftpClient.Login();
|
||||||
|
if (directory != "")
|
||||||
|
ftpClient.ChangeDir(directory);
|
||||||
|
/* Create destination directory if it does not already exist */
|
||||||
|
if (ftpClient.GetFileList(branch).Length < 1)
|
||||||
|
ftpClient.MakeDir(branch);
|
||||||
|
ftpClient.ChangeDir(branch);
|
||||||
|
ftpClient.Upload(sourceFilename);
|
||||||
|
ftpClient.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Copy ISO to the (local) destination.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="sourceFilename">Name of source ISO file to copy.</param>
|
/// <param name="sourceFilename">Name of source ISO file to copy.</param>
|
||||||
/// <param name="branch">Branch.</param>
|
/// <param name="branch">Branch.</param>
|
||||||
|
@ -147,7 +209,7 @@ namespace ReactOS.CustomRevisionAction
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// Structure is <branch>\ReactOS-<branch>-r<revision>.iso.
|
/// Structure is <branch>\ReactOS-<branch>-r<revision>.iso.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
private static void CopyISOToDestination(string sourceFilename,
|
private static void CopyISOToLocalDestination(string sourceFilename,
|
||||||
string branch,
|
string branch,
|
||||||
int revision)
|
int revision)
|
||||||
{
|
{
|
||||||
|
@ -163,6 +225,25 @@ namespace ReactOS.CustomRevisionAction
|
||||||
destinationFilename);
|
destinationFilename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Copy ISO to the destination.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sourceFilename">Name of source ISO file to copy.</param>
|
||||||
|
/// <param name="branch">Branch.</param>
|
||||||
|
/// <param name="revision">Revision.</param>
|
||||||
|
/// <remarks>
|
||||||
|
/// Structure is <branch>\ReactOS-<branch>-r<revision>.iso.
|
||||||
|
/// </remarks>
|
||||||
|
private static void CopyISOToDestination(string sourceFilename,
|
||||||
|
string branch,
|
||||||
|
int revision)
|
||||||
|
{
|
||||||
|
if (PublishToRemoteFtpLocation)
|
||||||
|
CopyISOToRemoteFtpDestination(sourceFilename, branch, revision);
|
||||||
|
else
|
||||||
|
CopyISOToLocalDestination(sourceFilename, branch, revision);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Publish a revision of ReactOS.
|
/// Publish a revision of ReactOS.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue