From 6742790952fcd85959f5ca9b02fca8ed68a4d1fc Mon Sep 17 00:00:00 2001 From: Daniel James Date: Thu, 27 Feb 2014 08:00:52 +0000 Subject: [PATCH] Set maintainers in create-module-metadata. --- site-tools/create-module-metadata.php | 38 +++++++++++++++++++++- site-tools/update-doc-list.php | 45 --------------------------- 2 files changed, 37 insertions(+), 46 deletions(-) diff --git a/site-tools/create-module-metadata.php b/site-tools/create-module-metadata.php index 08a393a1..0b2cbfc4 100644 --- a/site-tools/create-module-metadata.php +++ b/site-tools/create-module-metadata.php @@ -14,9 +14,43 @@ function main() { } $libs = boost_libraries::from_xml_file(__DIR__ . '/../doc/libraries.xml'); - $library_details = $libs->get_for_version(BoostVersion::develop()); + // 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 + // use 'key' as its key, it's for historical reasons I think, might be + // fixable. + + $libs_index = array(); + foreach ($library_details as $index => $details) { + $libs_index[$details['key']] = $index; + } + + foreach (file("$boost_root/libs/maintainers.txt") as $line) + { + $line = trim($line); + if (!$line || $line[0] == '#') { + continue; + } + + $matches = null; + if (!preg_match('@^([^\s]+)\s*(.*)$@', $line, $matches)) { + echo "Unable to parse line: {$line}\n"; + exit(1); + } + + if (isset($libs_index[$matches[1]])) { + $index = $libs_index[$matches[1]]; + $library_details[$index]['maintainers'] = array_map('trim', + explode(',', $matches[2])); + } + else { + echo "Unable to find library: {$matches[1]}\n"; + } + } + + // Split the libraries up into modules. + $libraries_by_module = array(); foreach ($library_details as $library) { @@ -47,6 +81,8 @@ function main() { $libraries_by_module[$module][] = $library; } + // Write the module metadata + foreach ($libraries_by_module as $module => $libraries) { $module_libraries = boost_libraries::from_array($libraries); $module_dir = "$boost_root/libs/$module"; diff --git a/site-tools/update-doc-list.php b/site-tools/update-doc-list.php index c00bbb31..7227591f 100644 --- a/site-tools/update-doc-list.php +++ b/site-tools/update-doc-list.php @@ -102,51 +102,6 @@ function update_from_git($libs, $location, $branch) { } } } - - // 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 - // use 'key' as its key, it's for historical reasons I think, might be - // fixable. - $libs_copy = $libs->get_for_version($branch); - - $libs_index = array(); - foreach ($libs_copy as $index => $details) { - $libs_index[$details['key']] = $index; - } - - // Grab the maintainers... - foreach(run_process("{$git_command} ls-tree {$branch} " - ."libs/maintainers.txt") as $entry) - { - $entry = trim($entry); - if (preg_match("@^100644 blob ([a-zA-Z0-9]+)\t(.*)$@", $entry, $matches)) { - $hash = $matches[1]; - $filename = $matches[2]; - foreach (run_process("{$git_command} show {$hash}") as $line) { - $line = trim($line); - if (!$line || $line[0] == '#') { - continue; - } - - $matches = null; - if (!preg_match('@^([^\s]+)\s*(.*)$@', $line, $matches)) { - echo "Unable to parse line: {$line}\n"; - exit(1); - } - - if (isset($libs_index[$matches[1]])) { - $index = $libs_index[$matches[1]]; - $libs_copy[$index]['maintainers'] = array_map('trim', - explode(',', $matches[2])); - } - else { - echo "Unable to find library: {$matches[1]}\n"; - } - } - } - } - - $libs->update(boost_libraries::from_array($libs_copy), $branch); } function git_config_from_repo($git_command, $branch, $path) {