Ignore:
Timestamp:
2012-09-13T10:12:59+12:00 (12 years ago)
Author:
ak19
Message:

Committing changes Dr Bainbridge and I made to the g2f-import and g2f-building long ago. Note g2f-import runs both import and export.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/bin/script/g2f-import.pl

    r22338 r26183  
    212212    # readdir
    213213    if (opendir(DIR, $export_dir)) {
    214 
     214        my @xml_files = grep { $_ =~ m/^greenstone-http.*\.xml$/ } readdir(DIR);
    215215        closedir DIR;
     216
     217        # purge all the (URL,hashID) metadata files that we inserted
     218        # into fedora at the end of g2f-buildcol.pl
     219        # convert the filenames into fedora-pids
     220        # filename = greenstone-http=tmpcol-http-__test1-html.xml -> fpid = greenstone-http:tmpcol-http-__test1.html
     221        foreach my $file (@xml_files) {
     222        my $fedora_pid = $file;
     223        $fedora_pid =~ s/\.xml$//;
     224        $fedora_pid =~ s/\=/:/;
     225        $fedora_pid =~ s/(.*)-(.*)$/$1.$2/;
     226       
     227        print STDERR "#### fedora_pid: $fedora_pid\n";
     228        &g2futil::run_purge($fedora_pid,$options); # displays error message if first time (nothing to purge)
     229        }
     230
    216231        my @hash_dirs = &g2futil::get_all_hash_dirs($export_dir,$maxdocs);
    217232
     
    246261    print "***\n";
    247262
    248     my $gs_export_opts = "-saveas FedoraMETS -fedora_namespace $pid_namespace -verbosity $verbosity";
    249 
    250     $gs_export_opts .= " -gli" if ($gli);
    251 
    252     $gs_export_opts .= " -language $language" if ($language);
    253     $gs_export_opts .= " -collectdir \"$collectdir\"" if ($collectdir);
    254     $gs_export_opts .= " -removeold" if ($removeold);
    255     $gs_export_opts .= " -maxdocs $maxdocs" if ($maxdocs);
    256 
    257     $gs_export_opts .= " -exportdir \"$export_dir\"";
     263    my $gs_export_opts = "-saveas FedoraMETS -fedora_namespace $pid_namespace";
     264
     265    my $gs_opts = " -verbosity $verbosity";
     266    $gs_opts .= " -gli" if ($gli);
     267
     268    $gs_opts .= " -language $language" if ($language);
     269    $gs_opts .= " -collectdir \"$collectdir\"" if ($collectdir);
     270    $gs_opts .= " -removeold" if ($removeold);
     271    $gs_opts .= " -maxdocs $maxdocs" if ($maxdocs);
     272
     273    $gs_export_opts .= " $gs_opts -exportdir \"$export_dir\"";
    258274
    259275    my $gs_export_arguments = "$gs_export_opts $gs_col";
    260276
    261277    &g2futil::run_cmd("export.pl", $gs_export_arguments, $options);
     278
     279    print STDERR "**** Just for now, also run Greenstone's import.pl\n";
     280# if we have the FedoraMETSPlugIN then we wouldn't have to run import anymore
     281    my $gs_import_arguments = "$gs_opts $gs_col";
     282
     283    &g2futil::run_cmd("import.pl", $gs_import_arguments, $options);
    262284}
    263285
Note: See TracChangeset for help on using the changeset viewer.