function gen_forge_package_list (outfile)
  str = evalc ("pkg ('-forge', 'list')");
  strs = strsplit (str, "\n");
  strs(1) = []; % Drop "OctaveForge provides these packages:"
  strs(end) = []; % Drop blank last line
  strs = regexprep (strs, '^\s+', '');
  strs = regexprep (strs, '\s+', ',');
  
  [fid, msg] = fopen (outfile, 'w');
  fprintf (fid, 'Name,CurrentVersion\n');
  for i = 1:numel (strs)
    fprintf (fid, "%s\n", strs{i});
  endfor
  fclose (fid);
endfunction
