~ubuntu-branches/ubuntu/vivid/esorex/vivid-proposed

« back to all changes in this revision

Viewing changes to src/er_plugin.c

  • Committer: Package Import Robot
  • Author(s): Ole Streicher
  • Date: 2014-09-27 22:33:01 UTC
  • mfrom: (1.1.4)
  • Revision ID: package-import@ubuntu.com-20140927223301-s3r9kwa8qcyrnlu4
Tags: 3.11-1
* New upstream version
* Build-depend on libcfitsio-dev instead of libcfitsio3-dev. Closes: #761706
* Update uploader e-mail
* Update standards version to 3.9.6. No changes needed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
527
527
 */
528
528
/**********************************************************************/
529
529
 
530
 
int upda_products (cpl_frameset * frameset)
531
 
 
532
 
 
 
530
inline static int
 
531
_upda_products (cpl_frameset *frameset, unsigned int flags)
533
532
{
534
 
cpl_error_code reto;
535
 
 
536
 
 
537
 
 
538
 
ER_TRACE(__func__);
539
 
 
540
 
 
541
 
reto = cpl_dfs_update_product_header(frameset);
542
 
if (reto != CPL_ERROR_NONE)
543
 
   {
544
 
   cpl_msg_error (er_func, "could not update the product header...");
545
 
   }
546
 
 
547
 
return 0;
 
533
    cpl_error_code reto;
 
534
 
 
535
 
 
536
    ER_TRACE(__func__);
 
537
 
 
538
#if 0
 
539
    reto = cpl_dfs_update_product_header(frameset);
 
540
#else
 
541
 
 
542
#if 0
 
543
    unsigned int _flags = CPL_DFS_SIGNATURE_DATAMD5 | CPL_DFS_SIGNATURE_CHECKSUM;
 
544
    reto = cpl_dfs_sign_products(frameset, _flags);
 
545
#else
 
546
    reto = cpl_dfs_sign_products(frameset, flags);
 
547
#endif
 
548
 
 
549
#endif
 
550
 
 
551
    if (reto != CPL_ERROR_NONE)
 
552
    {
 
553
        cpl_msg_error (er_func, "could not update the product header...");
 
554
    }
 
555
 
 
556
    return 0;
548
557
}
549
558
 
550
559
/*
577
586
 */
578
587
/**********************************************************************/
579
588
 
580
 
/* int move_products (char * plugin_name, */
581
 
int move_products (cpl_frameset * frameset,
582
 
                   char * output_directory,
583
 
                   char * output_prefix,
584
 
                   char * link_directory,
585
 
                   int flag_noprefix, int flag_nolink, int flag_readonly)
 
589
inline static int
 
590
_move_products (cpl_frameset * frameset,
 
591
                char * output_directory,
 
592
                char * output_prefix,
 
593
                char * link_directory,
 
594
                unsigned int signature_mask,
 
595
                int flag_noprefix, int flag_nolink, int flag_readonly)
586
596
 
587
597
{
588
598
    cpl_frame *frame = NULL;       /* The current frame being processed */
682
692
 
683
693
    }
684
694
 
685
 
    ii = upda_products(frameset);     /* MD5 errors ignored at the moment... */
 
695
    /* MD5 errors ignored at the moment... */
 
696
    ii = _upda_products(frameset, signature_mask);
686
697
    holdme = frameset;
687
698
 
688
699
 
973
984
    flag_create_config = 0, 
974
985
    flag_params = 0,
975
986
    flag_readonly = 0, 
976
 
    flag_noprefix = 0, 
 
987
    flag_noprefix = 0,
977
988
    f_val_unload_plugin = 1,            /* default is TRUE */
978
989
    flag_nolink = 0;
 
990
 
 
991
unsigned int signature_mask = CPL_DFS_SIGNATURE_DATAMD5 | CPL_DFS_SIGNATURE_CHECKSUM;
 
992
 
979
993
unsigned long  uil;
980
994
 
981
995
double plugin_time_start=0.0, plugin_time_end=0.0;
1415
1429
 
1416
1430
   /* Check if we don't want to cleanup after processing (for debugging) */
1417
1431
 
1418
 
   p = cpl_parameterlist_find (caller_parameters,PACKAGE_RESOURCE ".unload-plugin");
1419
 
   f_val_unload_plugin = cpl_parameter_get_bool (p);
1420
 
   /* printf("f_val_unload_plugin = %d\n",f_val_unload_plugin); */
 
1432
   p = cpl_parameterlist_find(caller_parameters, PACKAGE_RESOURCE ".unload-plugin");
 
1433
   f_val_unload_plugin = cpl_parameter_get_bool(p);
 
1434
 
 
1435
 
 
1436
   /*
 
1437
    *  Set product signature bit mask
 
1438
    */
 
1439
 
 
1440
   p = cpl_parameterlist_find(caller_parameters, PACKAGE_RESOURCE ".no-checksum");
 
1441
 
 
1442
   if (cpl_parameter_get_bool(p) == TRUE) {
 
1443
       signature_mask &= ~CPL_DFS_SIGNATURE_CHECKSUM;
 
1444
   }
 
1445
 
 
1446
   p = cpl_parameterlist_find(caller_parameters, PACKAGE_RESOURCE ".no-datamd5");
 
1447
 
 
1448
   if (cpl_parameter_get_bool(p) == TRUE) {
 
1449
       signature_mask &= ~CPL_DFS_SIGNATURE_DATAMD5;
 
1450
   }
1421
1451
 
1422
1452
 
1423
1453
   /*
1425
1455
    */
1426
1456
 
1427
1457
   if (e_code == 0)
1428
 
      {
1429
 
      plugin_func_exec = cpl_plugin_get_exec ((cpl_plugin *) trecipe);
1430
 
 
1431
 
      if (plugin_func_exec != NULL)
1432
 
         {                      /* We have a pointer, so run the plugin */
1433
 
         const char *recipe_name;
1434
 
 
1435
 
         recipe_name = cpl_plugin_get_name ((cpl_plugin *) trecipe);
1436
 
         cpl_msg_set_domain (recipe_name);
1437
 
         e_code = plugin_func_exec ((cpl_plugin *) trecipe);
1438
 
         cpl_msg_set_domain (PACKAGE);
1439
 
         if (e_code != 0)
1440
 
            {
1441
 
            cpl_msg_error (er_func,"Execution of recipe '%s' failed, status = %d",
1442
 
                           recipe_name,e_code);
1443
 
            }
1444
 
         }
1445
 
      else                      /* NULL-pointer, so we simply set an error */
1446
 
         e_code = CPL_ERROR_INCOMPATIBLE_INPUT;
1447
 
      }
 
1458
   {
 
1459
       plugin_func_exec = cpl_plugin_get_exec ((cpl_plugin *) trecipe);
 
1460
 
 
1461
       if (plugin_func_exec != NULL)
 
1462
       {                        /* We have a pointer, so run the plugin */
 
1463
           const char *recipe_name;
 
1464
 
 
1465
           recipe_name = cpl_plugin_get_name ((cpl_plugin *) trecipe);
 
1466
           cpl_msg_set_domain (recipe_name);
 
1467
           e_code = plugin_func_exec ((cpl_plugin *) trecipe);
 
1468
           cpl_msg_set_domain (PACKAGE);
 
1469
           if (e_code != 0)
 
1470
           {
 
1471
               cpl_msg_error (er_func,"Execution of recipe '%s' failed, status = %d",
 
1472
                              recipe_name,e_code);
 
1473
           }
 
1474
       }
 
1475
       else
 
1476
       {
 
1477
           /* NULL-pointer, so we simply set an error */
 
1478
           e_code = CPL_ERROR_INCOMPATIBLE_INPUT;
 
1479
       }
 
1480
   }
1448
1481
 
1449
1482
   if (e_code == 0)                     /* successful execution of recipe */
1450
1483
      {
1477
1510
 
1478
1511
      /* Move all product files to output directory */
1479
1512
 
1480
 
      e_code = move_products (trecipe->frames, (char *)val_output_dir,
1481
 
                   (char *)val_output_mask,
1482
 
                   (char *)val_link_dir, flag_noprefix, 
1483
 
                   flag_nolink, flag_readonly);
 
1513
      e_code = _move_products(trecipe->frames, (char *)val_output_dir,
 
1514
                             (char *)val_output_mask, (char *)val_link_dir,
 
1515
                             signature_mask,
 
1516
                             flag_noprefix, flag_nolink, flag_readonly);
1484
1517
 
1485
1518
      if (e_code != 0) cpl_msg_error (er_func,
1486
1519
                        "An error occurred while trying to move the output products");
1487
1520
      }
1488
1521
 
1489
1522
   else                 /* recipe failed, only get correct MD5 sum */
1490
 
      {                 /* for all product files created anyway */
1491
 
      if (e_code != -99999) ii = upda_products (trecipe->frames);
1492
 
      }
 
1523
   {                    /* for all product files created anyway */
 
1524
       if (e_code != -99999)
 
1525
       {
 
1526
           ii = _upda_products (trecipe->frames, signature_mask);
 
1527
       }
 
1528
   }
1493
1529
 
1494
1530
   /* Run PAF creation */
1495
1531
   p = cpl_parameterlist_find (caller_parameters,