2
0
mirror of https://github.com/boostorg/website.git synced 2026-01-30 08:22:18 +00:00

Merge branch 'feature/metadata'

This commit is contained in:
Daniel James
2014-07-13 11:31:58 +01:00
6 changed files with 141 additions and 37 deletions

View File

@@ -151,9 +151,7 @@ class boost_libraries
$import = json_decode($json, true);
if (!$import) {
// TODO: Proper error handling.
echo "Error decoding json: $json\n";
exit(0);
throw new library_decode_exception("Error decoding json.", $json);
}
if ($json[0] == '{') {
@@ -687,5 +685,17 @@ class boost_libraries
}
class boost_libraries_exception extends RuntimeException {}
class library_decode_exception extends boost_libraries_exception {
private $content = '';
function __construct($message, $content) {
parent::__construct($message);
$this->content = $content;
}
public function content() {
return $this->content;
}
}
?>

View File

@@ -182,6 +182,12 @@ class BoostVersion {
($this->is_beta() ? '_beta'. $this->beta : '');
}
/** Return the git tag/branch for the version */
function git_ref() {
return $this->version['stage'] ? $this->stage_name() :
'boost-'.implode('.', $this->version_numbers());
}
/** Return the version numbers from the verion array */
private function version_numbers() {
$numbers = $this->version;

View File

@@ -252,6 +252,33 @@
<category>Domain</category>
<category>System</category>
</library>
<library>
<key>chrono</key>
<module>chrono</module>
<boost-version>1.47.0</boost-version>
<update-version>master</update-version>
<name>Chrono</name>
<authors>Howard Hinnant</authors>
<authors>Beman Dawes</authors>
<authors>Vicente J. Botet Escriba</authors>
<maintainers>Vicente J. Botet Escriba &lt;vicente.botet -at- wanadoo.fr&gt;</maintainers>
<description>Useful time utilities. C++11.</description>
<documentation>libs/chrono/</documentation>
<std>proposal</std>
<category>Domain</category>
<category>System</category>
</library>
<library>
<key>chrono/stopwatch</key>
<module>chrono</module>
<update-version>master</update-version>
<name>Chrono.Stopwatch</name>
<authors>Vicente J. Botet Escriba</authors>
<maintainers>Vicente J. Botet Escriba &lt;vicente.botet -at- wanadoo.fr&gt;</maintainers>
<description>Useful stopclocks and stopwatches utilities.</description>
<documentation>libs/chrono/stopwatches/</documentation>
<category>Domain</category>
</library>
<library>
<key>circular_buffer</key>
<module>circular_buffer</module>
@@ -332,7 +359,7 @@
<key>conversion</key>
<module>conversion</module>
<boost-version>1.20.0</boost-version>
<update-version>develop</update-version>
<update-version>master</update-version>
<name>Conversion</name>
<authors>Dave Abrahams</authors>
<authors>Kevlin Henney</authors>
@@ -751,7 +778,7 @@
<key>lexical_cast</key>
<module>lexical_cast</module>
<boost-version>1.20.0</boost-version>
<update-version>develop</update-version>
<update-version>master</update-version>
<name>Lexical Cast</name>
<authors>Kevlin Henney</authors>
<maintainers>Antony Polukhin &lt;antoshkka -at- gmail.com&gt;</maintainers>
@@ -760,6 +787,19 @@
<category>Miscellaneous</category>
<category>String</category>
</library>
<library>
<key>lexical_cast</key>
<module>lexical_cast</module>
<boost-version>1.20.0</boost-version>
<update-version>develop</update-version>
<name>Lexical Cast</name>
<authors>Kevlin Henney</authors>
<maintainers>Antony Polukhin &lt;antoshkka -at- gmail.com&gt;</maintainers>
<description>General literal text conversions, such as an int represented a string, or vice-versa.</description>
<documentation>libs/lexical_cast/lexical_cast.htm</documentation>
<category>Miscellaneous</category>
<category>String</category>
</library>
<library>
<key>local_function</key>
<module>local_function</module>
@@ -1009,7 +1049,7 @@
</library>
<library>
<key>numeric/conversion</key>
<module>numeric/conversion</module>
<module>numeric_conversion</module>
<boost-version>1.32.0</boost-version>
<name>Numeric Conversion</name>
<authors>Fernando Cacciola</authors>
@@ -1020,7 +1060,7 @@
</library>
<library>
<key>numeric/interval</key>
<module>numeric/interval</module>
<module>interval</module>
<boost-version>1.30.0</boost-version>
<name>Interval</name>
<authors>Guillaume Melquiond</authors>
@@ -1032,7 +1072,7 @@
</library>
<library>
<key>numeric/odeint</key>
<module>numeric/odeint</module>
<module>odeint</module>
<boost-version>1.53.0</boost-version>
<name>Odeint</name>
<authors>Karsten Ahnert</authors>
@@ -1043,7 +1083,7 @@
</library>
<library>
<key>numeric/ublas</key>
<module>numeric/ublas</module>
<module>ublas</module>
<boost-version>1.29.0</boost-version>
<name>uBLAS</name>
<authors>Joerg Walter</authors>
@@ -1238,6 +1278,21 @@
<documentation>libs/ratio/</documentation>
<category>Math</category>
</library>
<library>
<key>ratio</key>
<module>ratio</module>
<boost-version>1.47.0</boost-version>
<update-version>develop</update-version>
<name>Ratio</name>
<authors>Howard Hinnant</authors>
<authors>Beman Dawes</authors>
<authors>Vicente J. Botet Escriba</authors>
<maintainers>Vicente J. Botet Escriba &lt;vicente.botet -at- wanadoo.fr&gt;</maintainers>
<description>Compile time rational arithmetic. C++11.</description>
<documentation>libs/ratio/</documentation>
<std>proposal</std>
<category>Math</category>
</library>
<library>
<key>rational</key>
<module>rational</module>
@@ -1409,6 +1464,22 @@
<category>Concurrent</category>
<category>System</category>
</library>
<library>
<key>thread</key>
<module>thread</module>
<boost-version>1.25.0</boost-version>
<update-version>master</update-version>
<name>Thread</name>
<authors>Anthony Williams</authors>
<authors>Vicente J. Botet Escriba</authors>
<maintainers>Vicente J. Botet Escriba &lt;vicente.botet -at- wanadoo.fr&gt;</maintainers>
<maintainers>Niall Douglas &lt;niall -at- nedprod.com&gt;</maintainers>
<description>Portable C++ multi-threading. C++11, C++14.</description>
<documentation>libs/thread/</documentation>
<std>proposal</std>
<category>Concurrent</category>
<category>System</category>
</library>
<library>
<key>throw_exception</key>
<module>throw_exception</module>

Binary file not shown.

View File

@@ -1,6 +1,7 @@
<?php
require_once(__DIR__ . '/../common/code/boost_libraries.php');
require_once(__DIR__ . '/boost_super_project.php');
function main() {
$args = $_SERVER['argv'];
@@ -13,8 +14,11 @@ function main() {
exit(1);
}
$libs = boost_libraries::from_xml_file(__DIR__ . '/../doc/libraries.xml');
$library_details = $libs->get_for_version(BoostVersion::develop());
$library_details =
boost_libraries::from_xml_file(__DIR__ . '/../doc/libraries.xml')
->get_for_version(BoostVersion::develop());
$git_submodules = (new BoostSuperProject($boost_root))->get_modules();
// Get the library data, so that it can be updated with maintainers.
// In case you're wondering why the result from get_for_version doesn't
@@ -64,9 +68,14 @@ function main() {
foreach ($library_details as $library) {
$module = $library['module'];
if (!isset($git_submodules[$module])) {
echo "Unknown module: {$module}\n";
continue;
}
if (isset($library['documentation'])) {
$doc_url = $library['documentation'];
$module_base = "libs/$module";
$module_base = $git_submodules[$module]['path'];
if ($doc_url == $module_base) {
$doc_url = '';
@@ -93,12 +102,12 @@ function main() {
foreach ($libraries_by_module as $module => $libraries) {
$module_libraries = boost_libraries::from_array($libraries);
$module_dir = "$boost_root/libs/$module";
$module_dir = "{$boost_root}/{$git_submodules[$module]['path']}";
$meta_dir = "$module_dir/meta";
$meta_file = "$module_dir/meta/libraries.json";
if (!is_dir($module_dir)) {
echo "Module doesn't exist: $module\n";
echo "Module '$module' doesn't exist at '$module_dir'\n";
continue;
}

View File

@@ -17,22 +17,25 @@ function main() {
exit(1);
}
// TODO: Support releases.
if ($version && !in_array($version, ['master', 'develop', 'latest'])) {
echo "Invalid version: $version\n";
exit(1);
if ($version) {
// BoostVersion dies if version is invalid.
$version = BoostVersion::from($version);
}
$libs = boost_libraries::from_xml_file(dirname(__FILE__) . '/../doc/libraries.xml');
if ($location) {
$location = realpath($location);
$real_location = realpath($location);
if (is_file($location))
if ($real_location && !is_dir($real_location))
{
update_from_file($libs, $location, $version);
echo "Not a directory: {$location}\n";
exit(1);
}
else if (get_bool_from_array(run_process(
$location = $real_location;
if (get_bool_from_array(run_process(
"cd '${location}' && git rev-parse --is-bare-repository")))
{
if ($version) {
@@ -68,13 +71,13 @@ function main() {
*
* @param \boost_libraries $libs The libraries to update.
* @param string $location The location of the super project in the mirror.
* @param string $branch The branch to update from.
* @param BoostVersion|string $version The version to update from.
* @throws RuntimeException
*/
function update_from_git($libs, $location, $branch) {
function update_from_git($libs, $location, $version) {
$branch = BoostVersion::from($version)->git_ref();
echo "Updating from {$branch}\n";
$git_command = "cd '${location}' && git";
$super_project = new BoostSuperProject($location, $branch);
$modules = $super_project->get_modules();
@@ -104,12 +107,17 @@ function update_from_git($libs, $location, $branch) {
foreach(run_process("{$module_command} ls-tree {$module['hash']} "
."meta/libraries.xml meta/libraries.json") as $entry)
{
$entry = trim($entry);
if (preg_match("@^100644 blob ([a-zA-Z0-9]+)\t(.*)$@", $entry, $matches)) {
$hash = $matches[1];
$filename = $matches[2];
$text = implode("\n", (run_process("{$module_command} show {$hash}")));
$libs->update(load_from_text($text, $filename, $branch), $name);
try {
$entry = trim($entry);
if (preg_match("@^100644 blob ([a-zA-Z0-9]+)\t(.*)$@", $entry, $matches)) {
$hash = $matches[1];
$filename = $matches[2];
$text = implode("\n", (run_process("{$module_command} show {$hash}")));
$libs->update(load_from_text($text, $filename, $branch), $name);
}
}
catch (library_decode_exception $e) {
echo "Error decoding metadata for module {$name}:\n{$e->content()}\n";
}
}
}
@@ -130,16 +138,16 @@ function update_from_local_copy($libs, $location, $branch = 'latest') {
foreach (
glob("{$location}/{$module_details['path']}/meta/libraries.*")
as $path) {
$libs->update(load_from_file($path, $branch), $name);
try {
$libs->update(load_from_file($path, $branch), $name);
}
catch (library_decode_exception $e) {
echo "Error decoding metadata for module {$name}:\n{$e->content()}\n";
}
}
}
}
function update_from_file($libs, $location, $version) {
echo "Updated from local file\n";
$libs->update(load_from_file($location, $version));
}
function load_from_file($path, $branch) {
return load_from_text(file_get_contents($path), $path, $branch);
}