svn: /web/php-rmtools/trunk/ include/Storage.php include/Svn.php script/snapshot.php

From: Date: Wed, 13 Jan 2010 14:37:21 +0000
Subject: svn: /web/php-rmtools/trunk/ include/Storage.php include/Svn.php script/snapshot.php
Groups: php.webmaster 
Request: Send a blank email to php-webmaster+get-7014@lists.php.net to get a copy of this message
pajoye Wed, 13 Jan 2010 14:37:21 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=293506 Log: - we don't need secs in filename/snapshot. use svn info to fetch current revision. print out the filename so it can be used by shell script directly. Changed paths: U web/php-rmtools/trunk/include/Storage.php U web/php-rmtools/trunk/include/Svn.php U web/php-rmtools/trunk/script/snapshot.php Modified: web/php-rmtools/trunk/include/Storage.php =================================================================== --- web/php-rmtools/trunk/include/Storage.php 2010-01-13 14:21:08 UTC (rev 293505) +++ web/php-rmtools/trunk/include/Storage.php 2010-01-13 14:37:21 UTC (rev 293506) @@ -107,9 +107,9 @@ if ($filename && !is_dir(dirname($filename))) { throw new \Exception('Invalid filename ' . $filename); } - + $time = time(); if (!$filename) { - $filename = SNAPS_PATH . '/php-' . $this->release['name'] . '-src-' . date("YmdHis") . '.zip'; + $filename = SNAPS_PATH . '/php-' . $this->release['name'] . '-src-' . date("YmdHi", $time) . '.zip'; } if ($this->release['last_revision'] == $this->release['last_snap_revision'] && !$force) { @@ -130,10 +130,11 @@ $snaps_archive_name = $filename; } - $now = date(DATE_RFC822); + $now = date(DATE_RFC822, $time); + $text = " PHP source snapshot generated on $now. The last revision in this snap is -$latest_revision"; + " . $this->release['last_revision']; file_put_contents("SNAPSHOT.txt", $text); $cmd = "zip -r $snaps_archive_name *"; Modified: web/php-rmtools/trunk/include/Svn.php =================================================================== --- web/php-rmtools/trunk/include/Svn.php 2010-01-13 14:21:08 UTC (rev 293505) +++ web/php-rmtools/trunk/include/Svn.php 2010-01-13 14:37:21 UTC (rev 293506) @@ -52,6 +52,24 @@ $revision = (int)str_replace('At revision ', '', $out); fclose($pipes[1]); proc_close($process); + + + $cmd = 'svn info --xml ' . $path; + $process = proc_open($cmd, $descriptorspec, $pipes, $path); + $out = stream_get_contents($pipes[1]); + $revision = (int)str_replace('At revision ', '', $out); + fclose($pipes[1]); + proc_close($process); + + $sx = new \SimpleXMLElement($out); + if (!$sx) { + throw new \Exception('svn log failed ' . $path); + } + + $revision = (int)$sx->entry['revision']; + if (!$revision) { + throw new \Exception('svn log failed ' . $path); + } return $revision; } Modified: web/php-rmtools/trunk/script/snapshot.php =================================================================== --- web/php-rmtools/trunk/script/snapshot.php 2010-01-13 14:21:08 UTC (rev 293505) +++ web/php-rmtools/trunk/script/snapshot.php 2010-01-13 14:37:21 UTC (rev 293506) @@ -22,7 +22,9 @@ try { $svn = new rm\Storage($release); - $svn->createSnapshot($filename); + $filename = $svn->createSnapshot($filename); } catch (Exception $e) { echo 'An error occured: ', $e->getMessage(), "\n"; } + +echo $filename;

« previous php.webmaster (#7014) next »