53 require_once(
"FIXMETOBERELATIVE/pathinclude.php");
54 require_once(
"$LIBDIR/lib_projxml.h.php");
57 Usage: diffm [-h] -f <file1> <file2> [-o <dir-path>]
58 Where <file1> path to an uncompressed top1000 Freshmeat rdf XML file
59 <file2> path to an uncompressed top1000 Freshmeat rdf XML file
61 For the differences to be found as expected file1 should be the newer
62 file. E.g. f1.2008-1-14 f2.2008-1-13.
64 <dir-path> fully qualified path where output files will be placed.
65 If no -o option given, the cwd is used
for the output files.
67 Output files are: FM-projects2update and Update.fm.rdf
69 See
mktop1k to create a top1000 Freshmeat file from the master rdf file.
73 for ($i = 1; $i < $argc; $i++) {
78 if ((isset($argv[$i])) and (isset($argv[$i+1]))){
79 $in_file1 = $argv[$i];
81 $in_file2 = $argv[$i];
85 echo(
"ERROR: Must specify 2 uncompressed filenames after -f");
91 if(eregi(
'^-+', $in_file2)) {
92 echo(
"ERROR: Must specify 2 uncompressed filenames after -f");
99 if (isset($argv[$i])) {
100 $dir_path = $argv[$i];
103 die(
"ERROR: Must specify fully qualified directory path after -o");
111 die(
"ERROR: Unknown argument: $argv[$i]\n$usage");
118 echo
"ERROR: -f is a required parameter\n";
123 if (
false == file_exists($in_file1)) {
124 echo
"Error: $in_file1 does not exist\n";
128 if (
false == file_exists($in_file2)) {
129 echo
"Error: $in_file2 does not exist\n";
134 if (0 == $size = filesize($in_file1)){
135 echo
"Error, file $in_file1 is empty\n";
138 if (0 == $size = filesize($in_file2)){
139 echo
"Error, file $in_file2 is empty\n";
144 $F1 = fopen($in_file1,
'r') or die("Can't open: $in_file1 $php_errormsg\n");
145 $F2 = fopen($in_file2, 'r') or die("Can't open: $in_file2 $php_errormsg\n");
147 echo "Comparing the following files:\n$in_file1\n$in_file2\n\n";
151 $dstamp = date('Y-m-d');
152 $projs2update = $dir_path . 'FM-projects2update.' . $dstamp;
153 $xml_changes = $dir_path . 'Update.fm.rdf.' . $dstamp;
155 $P2up = fopen($projs2update, 'w') or die("Can't open: $php_errormsg\n");
156 $Cxml = fopen($xml_changes, 'w') or die("Can't open: $php_errormsg\n");
166 $list1 = mklists($in_file1);
167 $list2 = mklists($in_file2);
172 $adiffs = array_diff_assoc($list1, $list2);
176 $diffs_found = count($adiffs);
177 if ($diffs_found == 0){
178 echo
"NOTE: No differences were found. \n";
179 $junk = exec(
"rm -f $projs2update $xml_changes", $dummy, $rtn);
181 echo
"cound not remove files $projs2update\nand\n$xml_changes\n";
182 echo
"Please remove them manually";
189 while(
false != ($f1_line = fgets($F1, 1024))) {
192 if (preg_match(
'/<project>/', $f1_line)) {
194 $proj1 = get_entry($F1, $m1);
202 $proj_name = xtract($proj1[4]);
203 foreach($adiffs as $name => $version){
204 if ($proj_name == $name){
206 $Yupdate =
"$name " .
"has a new version:" .
" $version\n";
207 save_Yupdated($P2up, $Yupdate);
209 write_pxml($Cxml, $proj1);
219 if($diffs_found > 0){
221 "$diffs_found differences were found. Please consult the following files:\n";
222 echo
"$projs2update and $xml_changes\n";
236 function mklists($xml_file){
239 $pdoc1= simplexml_load_file(
"$xml_file");
241 $projects = $pdoc1->xpath(
'/project-listing/project');
243 foreach($projects as $proj){
244 list($pname_short) = $proj->xpath(
'projectname_short');
246 list($lrv) = $proj->xpath(
'latest_release/latest_release_version');
247 $p[
"$pname_short"] =
"$lrv";
Usage()
Print Usage statement.
if(!preg_match("/\s$projectGroup\s/", $groups) &&(posix_getgid() !=$gInfo[ 'gid']))
get monk license list of one specified uploadtree_id
list_t type structure used to keep various lists. (e.g. there are multiple lists).