Posted: Fri Aug 13, 2010 5:40 pm Post subject: Windows -- Content server help, package does not build
I am having a heck of a time getting the content server to work on a Window Server, running Server 2003 x64
PHP 5.2.14
I run the build-update.bat file and the entire php document is shown in the cmd window, and then it closes. And I don't get any .txt files created.
I am testing all this with Team Fortress 2, which I have updated and put into C:\content\win32\orange-box\tf etc.
The rest of the content server files (the build-update files) are in C:\content
Here is my config file, with the password info removed. I'm hoping some of you notice something right off the bat.
Code:
<?php
// Authentication details needed to update revision information
// Include multiple lines if you need to notify more than one domain
// Example: http://mammoth.au.gamecreate.com/admin/
// http://mammoth.REGION.gamecreate.com/admin/
// login = mydomainlogin, password = mydomainpassword, region = au (us, nz, eu, af...)
$auth[] = array("login" => "*login removed*", "password" => "**********", "region" => "US");
// Content directory relative to build-update.
// Must include a trailing slash if set.
define('CONTENT_ROOT', '/win32');
// Whether backup of revision files (<name>.<revision>.txt) should be created
// when a new revision is made. This allows for easy rollback or revision information.
define('BACKUP_REVISION', false);
?>
Anything missing? Let me know, I'm a n00b when it comes to this stuff!
Ok next, the batch file I use.
Code:
@echo off
echo.
php.exe -q build-update.php %*tf2
I have also tried orange-box as well in place of "tf2"
Essentially what happens when I run the bat file is a lot of text runs through and then it closes.
If I get out the cmd cd over to C:\content, then run
php.exe build-update.php tf2 or orange-box etc. I get this very long code. Apologies for the length, and it looks like part was maybe cut off from the top, but that's all that I can manage to get out of the console.
Code:
foreach($opersystems As $os) {
$r = FindNextRevisionForOSAndPackage($os, $package);
if ($r > $NewRevision)
$NewRevision = $r;
}
return $NewRevision;
}
function FindNextRevisionForOSAndPackage($OS, $package)
{
$lines = @file(CONTENT_ROOT . $OS."/".$package.".txt");
// No revision information - start at Revision 1
if(sizeof($lines) <= 1)
return 1;
// Ignore first line (INSTALLER packagename instructioncount)
array_shift($lines);
if ($OS == "win32")
$values["name"] = strtolower($values["name"]);
if ($parts[0] == "EXECUTABLE")
{
$PreviousOperations[trim($values["name"])] = true;
} else {
if ($values["name"])
$FilesIndex[$values["name"]] = $i;
}
}
}
function GetDirectoryName($package)
{
$contents = @file("packages.txt");
if ($contents == '')
{
echo "Could not find package '$package' - did you add it to pack
ages.txt?\n";
die;
}
foreach ($contents as $line)
{
$parts = explode(" ", trim($line), 2);
if ($parts[0] == $package)
return $parts[1];
}
echo "Could not find package '$package' - did you add it to packages.txt
?\n";
die;
}
function ParsePackagesList($OS, $package, $directory)
{
global $IgnoreDirs, $IgnoreFiles, $OwnedDirs;
$IgnoreDirs = array();
$IgnoreFiles= array();
$OwnedDirs = array();
$contents = file("packages.txt");
for ($i=0,$j=sizeof($contents);$i<$j;$i++)
{
$line = $contents[$i];
function showParamHelp()
{
echo "GameCreate Build-Update Parameter Help
======================================
/approve - Approve the package revision on a successful version.
/a
/restart - Restart affected servers for this update.
/r
/norestart - Do not restart affected servers for this update.
/n
/md5 - Force an md5sum comparison of each file.
By default, md5sum comparisons are only performed when a fil
e on disk
has a different modified time or file size than what is spec
ified
in the previous revision.
This option ignores these checks, and will force an md5sum
comparison regardless of the file modified time or its size.
/dry - Perform a dry run. Changes are displayed but not committed.
/d
/confirm - Automatically confirm the revision changes on success and no
tify GameCreate.
/c No confirmation of the build change log is needed at the end
of the build.
/version - Show the GameCreate Package Builder version information.
/v
/help - This help screen.
";
}
function parseParams(&$params)
{
global $approve, $suspend, $forceMd5, $dryRun, $forceDeploy, $package;
if (sizeof($params) < 2)
return;
for ($i = 1; $i < sizeof($params); $i++)
{
switch ($params[$i])
{
case "/help": case "/?":
showParamHelp();
die;
case "/approve": case "/a":
$approve = true;
break;
case "/norestart": case "/n":
$suspend = false;
break;
case "/restart": case "/r":
$suspend = true;
break;
case "/dry": case "/d":
$dryRun = true;
break;
case "/confirm": case "/c":
$forceDeploy = true;
break;
case "/md5":
echo "Ignoring file time and size values; forcin
g md5sum comparison\n";
$forceMd5 = true;
break;
case "/version": case "/v":
showVersion();
die;
default:
$unknownParam = false;
if ($params[$i][0] == '/') {
$unknownParam = true;
} else {
if ($package == '') {
// Assign package name
$package = $params[$i];
} else {
echo "Package name already speci
fied as '$package'.\n";
$unknownParam = true;
}
}
if ($unknownParam) {
echo "Unknown parameter: " . $params[$i]
. "\n";
echo "Type /help for a list of supported
command arguments.\n";
die;
}
break;
}
}
if (!$approve || $suspend !== null)
return;
while (true)
{
echo "\nShould servers be suspended during this update? (Y/N): "
;
$suspend = readConsole();
if (convertToBoolean($suspend))
break;
}
}
function checkAuth($auth)
{
if (sizeof($auth) == 0)
die("You need to define at least one set of domain login informa
tion to be used in the build-update.config file.");
$args = array('login', 'password', 'region');
foreach ($auth As $domain)
{
foreach ($args As $arg)
if (!isset($domain[$arg]) || $domain[$arg] == '')
die("One or more arguments are undefined for a d
omain in build-update.config");
}
}
function showVersion()
{
echo "GameCreate Package Builder v1.0.2\n";
}
?>
I wouldn't be surprised if I'm not setting parameters correctly, but idk.
I see all sorts of errors for missing packages and what not, the package.txt is in C:\content like all the other files. So I'm not sure what is going on. any help would be greatly appreciated!
I use Linux for our content server, so I may not be of much use here. But I'll see what I can do.
You seem to be having two problems, which may or may not be related:
1. Your script doesn't run properly
2. Your script doesn't detect your packages.
To tackle 1 first: I am not familiar with running php in Windows. The fact that the code is dumped to your console makes me think that perhaps you script doesn't actually run. Or is it dumped because it detects an error? You should make sure it actually runs.
About 2: Your config-file should not include /win32, but should be the path to the directory which contains win32 (and also where your packages.txt shoudl reside). You should try to include the full path, like so:
Code:
define('CONTENT_ROOT', 'c:\gamecreatecontent\');
(Not sure it this is 100% correct syntax for Windows with backslashes and such. You may have to escape \ by typing \\ or use forward-slashes /)
Also, your packages.txt may be out of date and not include the new CSS-game, which is called cssob. Edit packages.txt and place the following two lines in the segment for orange-box, for instance right afther the tf2 entry:
Code:
cssob orange-box
- /orangebox/cstrike
This will ensure that build-update.php recognizes the package when you run 'build-update.php cssob'
Are you able to view the topmost part of the text in your console when the script is dumped? If you can't scroll far enough, simply right-click the title-bar of your console, properties->layout and set Screen Buffer Size Height to a couple of thousand. You may find a helpful error message when you thereafter execute the command and scroll to the top.
Also: I just noticed that the batch-file you are using is incorrect. There should be a space between %* and tf2. Or preferably there should be no tf2 at all.
If it doesn't already exist, create a file called build-update.bat, and paste in the following:
Code:
@echo off
echo.
php.exe -q build-update.php %*
(This assumes that php.exe is in your path, which you can verify by just typing 'php.exe -version' in a console. If it spits out some version information, you're good. It not, you'll need to provide the full path to php.exe on the last line).
This script can be used to (or at least should be able to be used to) update all your packages with any argument, not just tf2:
Code:
build-update.bat tf2
build-update.bat /a /r cssob
etc.
if (!$package)
{
echo "Usage: " . $_SERVER["argv"][0] ." <package-name> [parameters]\n\n"
;
echo "Package name may appear before, between, or after any parameters.\
n\n";
echo "Type /help for more information.\n\n";
die;
}
if ($dryRun) {
showChangeLog();
echo "No revision was written. This was a dry run.\n";
} else {
if ($Changes == 0)
{
echo "NOTE: Not writing a new revision.\n";
echo "No changes were made since the last revision!\n";
} else {
showChangeLog();
if (!$forceDeploy) {
while (true)
{
echo "\nDo you want to continue with this revisi
on? (Y/N): ";
$forceDeploy = readConsole();
if (convertToBoolean($forceDeploy))
break;
}
}
if ($forceDeploy) {
echo "Writing revisions...\n";
WriteInstallFiles($package);
if (!$result) {
echo "Warning: An error occurred in notifying GameCreate
about the new package revision for domain login " . $domain['login'] . "\nIs yo
ur domain login information correct and does the domain package exist?\n";
}
}
}
function getSoapClient($domain)
{
static $client = array();
$id = $domain['region'];
function IgnoreFile($file, $isDirectory)
{
global $IgnoreFiles, $IgnoreDirs, $OwnedDirs;
// If this directory is along the path of one of our package's explicitl
y owned
// directories, then do not ignore this directory as there is content in
side it we need to check
if ($isDirectory) {
foreach($OwnedDirs As $dir) {
$dir = substr($dir, 1, strlen($file));
if ($dir == $file)
return false;
}
}
if (isset($IgnoreFiles[$file]))
return true;
foreach ($IgnoreDirs as $dir)
{
$dir = substr($dir, 1);
if ($file == $dir)
return true;
}
return false;
}
function CheckForOperations($OS, $package)
{
global $PreviousOperations, $Operations, $OperationsIndex, $Files;
global $Revision;
global $Changes;
//Get current file operations
$contents = @file(CONTENT_ROOT . $OS."/".$package.".op.txt");
if (is_array($contents))
{
//Operations are case insensitive in windows
foreach ($contents As $line)
{
$line = trim($line);
if ($line == "")
continue;
if ($OS == "win32")
$line = strtolower($line);
$Operations[] = $line;
if (!isset($PreviousOperations[$line]))
{
//New operation
addChangeLog("Adding new EXECUTABLE operation fo
r $line", 'op', $OS);
$Files[] = "EXECUTABLE name=".urlencode($line)."
$Revision\n";
$Changes++;
}
}
}
foreach ($PreviousOperations As $key => $dummy)
{
if (array_search($key, $Operations) !== false)
continue;
function CheckForUpdates($realDir, $logicalDir, $OS)
{
global $Files, $FilesIndex, $FileExists, $Changes, $forceMd5;
global $Revision;
$handle = @opendir($realDir);
if (!$handle)
return;
while (($file = readdir($handle)) !== FALSE)
{
if ($file == "." || $file == "..") continue;
$logicalFile = $logicalDir.$file;
if ($OS == "linux")
{
//Case sensitivity matters in linux files, FILE is diffe
rent from file.
$compareFile = $logicalFile;
} else {
//Ignore case changes when building updates for other (w
in32) OSs - FILE is the same as file
$compareFile = strtolower($logicalFile);
}
// Check if this file's size or time differs. If so, do
the more intensive md5sum check
if (!$forceMd5 && isset($Files[$index]) && GetTimeFromLi
ne($Files[$index]) == $time && GetSizeFromLine($Files[$index]) == $size)
{
//echo "Ignoring unmodified file $logicalFile (N
o time or size change)\n";
continue;
}
if ($oldmd5 == $md5)
{
// md5 does not differ, however the file time/si
ze was different.
// Update our FILE line with these new values so
we dont check the md5 again next run
if ($OS == "win32")
$values["name"] = strtolower($values["name"]);
if ($parts[0] == "EXECUTABLE")
{
$PreviousOperations[trim($values["name"])] = true;
} else {
if ($values["name"])
$FilesIndex[$values["name"]] = $i;
}
}
}
function GetDirectoryName($package)
{
$contents = @file("packages.txt");
if ($contents == '')
{
echo "Could not find package '$package' - did you add it to pack
ages.txt?\n";
die;
}
foreach ($contents as $line)
{
$parts = explode(" ", trim($line), 2);
if ($parts[0] == $package)
return $parts[1];
}
echo "Could not find package '$package' - did you add it to packages.txt
?\n";
die;
}
function ParsePackagesList($OS, $package, $directory)
{
global $IgnoreDirs, $IgnoreFiles, $OwnedDirs;
$IgnoreDirs = array();
$IgnoreFiles= array();
$OwnedDirs = array();
$contents = file("packages.txt");
for ($i=0,$j=sizeof($contents);$i<$j;$i++)
{
$line = $contents[$i];
function showParamHelp()
{
echo "GameCreate Build-Update Parameter Help
======================================
/approve - Approve the package revision on a successful version.
/a
/restart - Restart affected servers for this update.
/r
/norestart - Do not restart affected servers for this update.
/n
/md5 - Force an md5sum comparison of each file.
By default, md5sum comparisons are only performed when a fil
e on disk
has a different modified time or file size than what is spec
ified
in the previous revision.
This option ignores these checks, and will force an md5sum
comparison regardless of the file modified time or its size.
/dry - Perform a dry run. Changes are displayed but not committed.
/d
/confirm - Automatically confirm the revision changes on success and no
tify GameCreate.
/c No confirmation of the build change log is needed at the end
of the build.
/version - Show the GameCreate Package Builder version information.
/v
/help - This help screen.
";
}
function parseParams(&$params)
{
global $approve, $suspend, $forceMd5, $dryRun, $forceDeploy, $package;
if (sizeof($params) < 2)
return;
for ($i = 1; $i < sizeof($params); $i++)
{
switch ($params[$i])
{
case "/help": case "/?":
showParamHelp();
die;
case "/approve": case "/a":
$approve = true;
break;
case "/norestart": case "/n":
$suspend = false;
break;
case "/restart": case "/r":
$suspend = true;
break;
case "/dry": case "/d":
$dryRun = true;
break;
case "/confirm": case "/c":
$forceDeploy = true;
break;
case "/md5":
echo "Ignoring file time and size values; forcin
g md5sum comparison\n";
$forceMd5 = true;
break;
case "/version": case "/v":
showVersion();
die;
default:
$unknownParam = false;
if ($params[$i][0] == '/') {
$unknownParam = true;
} else {
if ($package == '') {
// Assign package name
$package = $params[$i];
} else {
echo "Package name already speci
fied as '$package'.\n";
$unknownParam = true;
}
}
if ($unknownParam) {
echo "Unknown parameter: " . $params[$i]
. "\n";
echo "Type /help for a list of supported
command arguments.\n";
die;
}
break;
}
}
if (!$approve || $suspend !== null)
return;
while (true)
{
echo "\nShould servers be suspended during this update? (Y/N): "
;
$suspend = readConsole();
if (convertToBoolean($suspend))
break;
}
}
function checkAuth($auth)
{
if (sizeof($auth) == 0)
die("You need to define at least one set of domain login informa
tion to be used in the build-update.config file.");
$args = array('login', 'password', 'region');
foreach ($auth As $domain)
{
foreach ($args As $arg)
if (!isset($domain[$arg]) || $domain[$arg] == '')
die("One or more arguments are undefined for a d
omain in build-update.config");
}
}
function showVersion()
{
echo "GameCreate Package Builder v1.0.2\n";
}
?>
C:\Content>
Thanks for the help kybber, I hope you see something funky
I re-installed php, tried putting it in the Program files folder, then tried moving it. Tried the latest version 5.3.3 i think, as well as 5.2.4
I think a lot of the problems have to do with the fact that this is an x64 machine. Usually when I have problems it's cuz of the 64 bit part
And there isn't an x64 bit version of php. I tried running the command in a 32 bit cmd window, and same thing.
When I un-installed php, I tried running the bat file to see what happens. And it just dumped it into the window again, which happens when PHP is installed. Meaning it can't get to php, or can't run it.
I'm not sure what the deal is, but I believe it could be a compatibility issue with PHP and x64, or a newer version of php not compatibile with this update system.
When I un-installed php, I tried running the bat file to see what happens. And it just dumped it into the window again, which happens when PHP is installed. Meaning it can't get to php, or can't run it.
Now this is interesting, and very stupid behaviour from Windows. I am assuming you don't have the php command added to your path? You can't type "C:\content\php.exe" and expect php.exe to run if it doesn't exist in that directory. You need to either provide the full path to php.exe, e.g. "C:\Program Files(x86)\php/php.exe" or add it to your path: My Computer->Properies->Advanced->Environment Variables->System variables->Path->Edit
You should be able to verify that php.exe is actually being called by using the --version argument (e.g. "C:\Program Files(x86)\php/php.exe --version" or, if added to your path: "php.exe --version"
ryguy222 wrote:
What version of php do you use?
I only have php on Linux-hosts. The version I use happens to be 5.2.9, but that shouldn't make any difference for you.
I first had it installed in the program files directory, then I tried to install it in the content folder, to see if that would do anything. Then I installed the latest 5.3.3 in the program files folder, and still the same issue.
I have been using the full path. I haven't put in an environment variable yet, as that would require a restart. I'll probably restart it later this evening, when the box isn't in use.
Although I'm not sure if that will fix this issue.
... and "php.exe --version", with or without paths, yields nothing?
Edit: I just downloaded "PHP 5.2.14 zip package [10,281Kb] - 22 July 2010" from http://www.php.net/downloads.php and extracted it to my Downloads-folder. Open a cmd, cd to the directory, and it seems to work nicely:
Package name may appear before, between, or after any parameters.
Type /help for more information.
So all seems to be working nicely here, and I can't really say what goes on your end. Perhaps you could try to clone what I did above and go from there? Download the php zip package and the GC content-server files, extract them to you Downloads dir and run the commands I ran and see what happens.
I also have windows 7 x64 so I gave this a try, and I'm getting the same thing, so that means I must have something mis-configured
Here is my current config
Code:
<?php
// Authentication details needed to update revision information
// Include multiple lines if you need to notify more than one domain
// Example: http://mammoth.au.gamecreate.com/admin/
//
http://mammoth.us.gamecreate.com/admin/
// login = mydomainlogin, password = mydomainpassword, region = au (us, nz, eu, af...)
$auth[] = array("login" => "evlgaming", "password" => "*******", "region" => "us");
// Content directory relative to build-update.
// Must include a trailing slash if set.
define('CONTENT_ROOT', '');
// Whether backup of revision files (<name>.<revision>.txt) should be created
// when a new revision is made. This allows for easy rollback or revision information.
define('BACKUP_REVISION', false);
?>
I am using the domain login, and the domain pass, same that the remote program uses correct?
Would you mind posting your config maybe? Just so I can see where everything goes, or how it's all setup.
There is at least one error and one potential problem:
1. See that uncommented line that reads "http://mammoth..."? Remove it.
2. define your content root with a complete path
Your content path is "C:\content\" or possibly "C:/content/"
Can you re-post your current config?
Here's one of my configs:
Code:
<?php
// Authentication details needed to update revision information
// Include multiple lines if you need to notify more than one domain
// Example: http://mammoth.au.gamecreate.com/admin/
// http://mammoth.REGION.gamecreate.com/admin/
// login = mydomainlogin, password = mydomainpassword, region = au (us, nz, eu, af...)
$auth[] = array("login" => "mydomain", "password" => "mypassword", "region" => "eu");
// Content directory relative to build-update.
// Must include a trailing slash if set.
define('CONTENT_ROOT', '/mnt/nfs/files1/gccontent/cn/');
// Whether backup of revision files (<name>.<revision>.txt) should be created
// when a new revision is made. This allows for easy rollback or revision information.
define('BACKUP_REVISION', true);
?>
But please note that running the script from a default installation of the GC content server files (just renamed the default config) yielded proper-looking results for me. You should try to do that. It even that doesn't work, then I don't know what to tell you. As said, it works for me in Win 7 x64 with the procedure I outlined above.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum