IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 24565


Ignore:
Timestamp:
Jun 25, 2009, 3:08:22 PM (17 years ago)
Author:
eugene
Message:

importing changes from head

Location:
branches/eam_branches/20090522
Files:
21 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/20090522

  • branches/eam_branches/20090522/Nebulous-Server

  • branches/eam_branches/20090522/Nebulous-Server/Changes

    r24557 r24565  
    2929    - infinitely try to get a db handle if the connection fails
    3030    - add --mountpoint param to neb-voladd
     31    - change Nebulous::Server->find_objects() to return dirs and to sort it's
     32      output
    3133     
    32340.16
  • branches/eam_branches/20090522/Nebulous-Server/lib/Nebulous/Server.pm

    r24557 r24565  
    14491449    }
    14501450
    1451     eval {
    1452         $log->debug("trying for a directory match under dir: $dir_id");
     1451    # find dirs under dir
     1452    my @dir_keys;
     1453    eval {
     1454        $log->debug("looking for directories under dir: $dir_id");
     1455        my $query = $db->prepare_cached( $sql->find_dir_by_parent_id);
     1456        $query->execute( $dir_id );
     1457
     1458        while ( my $row = $query->fetchrow_hashref ) {
     1459            next if $row->{'dir_id'} == 1;
     1460            my $dir = $row->{'dirname'};
     1461            if ($dir_id == 1) {
     1462                push @dir_keys, $dir . '/' if $dir;
     1463            } else {
     1464                push @dir_keys, $key->path . '/' . $dir . '/' if $dir;
     1465            }
     1466            $log->debug( "matched $dir" ) if $dir;
     1467        }
     1468    };
     1469    $log->logdie("database error: $@") if $@;
     1470
     1471    # find files under dir
     1472    eval {
     1473        $log->debug("looking for objects under dir: $dir_id");
    14531474        my $query = $db->prepare_cached( $sql->find_object_by_dir_id );
    14541475        $query->execute( $dir_id );
     
    14631484
    14641485    $log->debug( "leaving" );
    1465 
    1466     return \@keys;
     1486   
     1487    return [sort(@dir_keys), sort(@keys)];
    14671488}
    14681489
  • branches/eam_branches/20090522/Nebulous-Server/lib/Nebulous/Server/SQL.pm

    r24557 r24565  
    317317        FROM storage_object
    318318        WHERE dir_id = ?
     319    },
     320    find_dir_by_parent_id => qq{
     321        SELECT dir_id, dirname
     322        FROM directory
     323        WHERE parent_id = ?
    319324    },
    320325    rename_object => qq{
  • branches/eam_branches/20090522/Nebulous-Server/t/13_server_find_objects.t

    r24557 r24565  
    88use warnings FATAL => qw( all );
    99
    10 use Test::More tests => 28;
     10use Test::More tests => 36;
    1111
    1212use lib qw( ./t ./lib );
     
    100100    my $keys = $neb->find_objects("a");
    101101
    102     is(scalar @$keys, 1, 'number of keys found');
    103     is($keys->[0], "a/foo", "key name");
     102    is(scalar @$keys, 2, 'number of keys found');
     103    is($keys->[0], "a/b/", "key name");
     104    is($keys->[1], "a/foo", "key name");
    104105}
    105106
     
    113114
    114115    is(scalar @$keys, 2, 'number of keys found');
    115     is($keys->[0], "a/foo", "key name");
    116     is($keys->[1], "a/bar", "key name");
     116    is($keys->[0], "a/bar", "key name");
     117    is($keys->[1], "a/foo", "key name");
    117118}
    118119
     
    138139    my $keys = $neb->find_objects("/");
    139140
    140     is(scalar @$keys, 2, 'number of keys found');
    141     is($keys->[0], "foo", "key name");
     141    is(scalar @$keys, 3, 'number of keys found');
     142    is($keys->[0], "a/", "key name");
    142143    is($keys->[1], "bar", "key name");
     144    is($keys->[2], "foo", "key name");
    143145}
    144146
     
    152154    my $keys = $neb->find_objects(".");
    153155
    154     is(scalar @$keys, 2, 'number of keys found');
    155     is($keys->[0], "foo", "key name");
     156    is(scalar @$keys, 3, 'number of keys found');
     157    is($keys->[0], "a/", "key name");
    156158    is($keys->[1], "bar", "key name");
     159    is($keys->[2], "foo", "key name");
    157160}
    158161
     
    166169    my $keys = $neb->find_objects("..");
    167170
    168     is(scalar @$keys, 2, 'number of keys found');
    169     is($keys->[0], "foo", "key name");
     171    is(scalar @$keys, 3, 'number of keys found');
     172    is($keys->[0], "a/", "key name");
    170173    is($keys->[1], "bar", "key name");
     174    is($keys->[2], "foo", "key name");
     175}
     176
     177Test::Nebulous->setup;
     178
     179{
     180    $neb->create_object("a/bar");
     181    $neb->create_object("b/foo");
     182    $neb->create_object("foo");
     183
     184    my $keys = $neb->find_objects("/");
     185
     186    is(scalar @$keys, 3, 'number of keys found');
     187    is($keys->[0], "a/", "key name");
     188    is($keys->[1], "b/", "key name");
     189    is($keys->[2], "foo", "key name");
    171190}
    172191
  • branches/eam_branches/20090522/Nebulous/bin

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/20090522/Nebulous/t/70_neb-ls.t

    r24557 r24565  
    8383
    8484    is($? >> 8, 0, "exit code");
    85     like($test->stdout, qr/^foo\nbar$/,  "stdout");
     85    like($test->stdout, qr/^bar\nfoo$/,  "stdout");
    8686    like($test->stderr, qr/^$/,         "stderr");
    8787}
     
    9999
    100100    is($? >> 8, 0, "exit code");
    101     like($test->stdout, qr/^foo\nbar\n$/,   "stdout");
     101    like($test->stdout, qr/^bar\nfoo\n$/,   "stdout");
    102102    like($test->stderr, qr/^$/,             "stderr");
    103103}
     
    115115
    116116    is($? >> 8, 0, "exit code");
    117     like($test->stdout, qr/^foo\nbar\n$/,   "stdout");
     117    like($test->stdout, qr/^bar\nfoo\n$/,   "stdout");
    118118    like($test->stderr, qr/^$/,             "stderr");
    119119}
     
    161161
    162162    is($? >> 8, 0, "exit code");
    163     like($test->stdout, qr|^a/foo\na/bar$|,  "stdout");
     163    like($test->stdout, qr|^a/bar\na/foo$|,  "stdout");
    164164    like($test->stderr, qr/^$/,             "stderr");
    165165}
     
    193193
    194194    is($? >> 8, 0, "exit code");
    195     like($test->stdout, qr|^a/foo$|,        "stdout");
     195    like($test->stdout, qr|^a/b/\na/foo$|,        "stdout");
    196196    like($test->stderr, qr/^$/,             "stderr");
    197197}
  • branches/eam_branches/20090522/ippTools/share/chiptool_export_imfile.sql

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/20090522/ippTools/share/chiptool_export_processed_imfile.sql

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/20090522/ippTools/share/warptool_revertoverlap.sql

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/20090522/ippTools/src/camtool.c

    r24182 r24565  
    766766    pxcamGetSearchArgs (config, where);
    767767    PXOPT_COPY_S64(config->args, where, "-cam_id",    "camRun.cam_id",         "==");
    768     PXOPT_COPY_STR(config->args, where, "-label",     "camRun.label",          "==");
     768    pxAddLabelSearchArgs (config, where, "-label",    "camRun.label",     "==");
    769769    PXOPT_COPY_STR(config->args, where, "-reduction", "camRun.reduction",      "==");
    770770    PXOPT_COPY_S16(config->args, where, "-fault", "camProcessedExp.fault", "==");
  • branches/eam_branches/20090522/ippTools/src/camtoolConfig.c

    r23920 r24565  
    187187    pxcamSetSearchArgs(revertprocessedexpArgs);
    188188    psMetadataAddS64(revertprocessedexpArgs, PS_LIST_TAIL, "-cam_id",   0,            "search by cam_id", 0);
    189     psMetadataAddStr(revertprocessedexpArgs, PS_LIST_TAIL, "-label",    0,            "search by camRun label", NULL);
     189    psMetadataAddStr(revertprocessedexpArgs, PS_LIST_TAIL, "-label",    PS_META_DUPLICATE_OK, "search by camRun label", NULL);
    190190    psMetadataAddStr(revertprocessedexpArgs, PS_LIST_TAIL, "-reduction",0,            "search by camRun reduction class", NULL);
    191191    psMetadataAddS16(revertprocessedexpArgs, PS_LIST_TAIL, "-code",     0,            "search by fault code", 0);
  • branches/eam_branches/20090522/ippTools/src/chiptool.c

    r24557 r24565  
    676676    PXOPT_COPY_S64(config->args, where, "-chip_id", "chipRun.chip_id", "==");
    677677    PXOPT_COPY_STR(config->args, where, "-class_id", "chipProcessedImfile.class_id", "==");
    678     // require a single label
    679     PXOPT_COPY_STR(config->args, where, "-label", "chipRun.label", "==");
     678    pxAddLabelSearchArgs (config, where, "-label", "chipRun.label", "==");
    680679    PXOPT_COPY_STR(config->args, where, "-reduction", "chipRun.reduction", "==");
    681680    PXOPT_COPY_S16(config->args, where, "-fault", "chipProcessedImfile.fault", "==");
  • branches/eam_branches/20090522/ippTools/src/chiptoolConfig.c

    r23919 r24565  
    169169    psMetadataAddStr(revertprocessedimfileArgs,  PS_LIST_TAIL, "-class_id",           0, "search by class ID", NULL);
    170170    psMetadataAddStr(revertprocessedimfileArgs,  PS_LIST_TAIL, "-reduction",          0, "search by reduction class", NULL);
    171     psMetadataAddStr(revertprocessedimfileArgs,  PS_LIST_TAIL, "-label",              0, "search by chipRun label (LIKE comparison)", NULL);
     171    psMetadataAddStr(revertprocessedimfileArgs,  PS_LIST_TAIL, "-label",              PS_META_DUPLICATE_OK, "search by chipRun label (LIKE comparison)", NULL);
    172172    pxchipSetSearchArgs(revertprocessedimfileArgs);
    173173    psMetadataAddBool(revertprocessedimfileArgs, PS_LIST_TAIL, "-all",  0,            "allow everything to be queued without search terms", false);
  • branches/eam_branches/20090522/ippTools/src/faketool.c

    r24557 r24565  
    632632
    633633    psMetadata *where = psMetadataAlloc();
     634    pxAddLabelSearchArgs (config, where, "-label", "fakeRun.label", "==");
    634635    PXOPT_COPY_S64(config->args, where, "-fake_id", "fake_id", "==");
    635     PXOPT_COPY_STR(config->args, where, "-label", "fakeRun.label", "==");
    636636    PXOPT_COPY_S64(config->args, where, "-exp_id", "exp_id", "==");
    637637    PXOPT_COPY_STR(config->args, where, "-exp_name", "exp_name", "==");
  • branches/eam_branches/20090522/ippTools/src/faketoolConfig.c

    r23921 r24565  
    198198    psMetadata *revertprocessedimfileArgs = psMetadataAlloc();
    199199    psMetadataAddS64(revertprocessedimfileArgs, PS_LIST_TAIL, "-fake_id", 0,            "search by fake ID", 0);
    200     psMetadataAddStr(revertprocessedimfileArgs, PS_LIST_TAIL, "-label", 0, "search by label", NULL);
     200    psMetadataAddStr(revertprocessedimfileArgs, PS_LIST_TAIL, "-label", PS_META_DUPLICATE_OK, "search by label", NULL);
    201201    psMetadataAddS64(revertprocessedimfileArgs, PS_LIST_TAIL, "-exp_id",  0,            "search by exp_id", 0);
    202202    psMetadataAddStr(revertprocessedimfileArgs, PS_LIST_TAIL, "-exp_name",  0,            "search by exp_name", NULL);
  • branches/eam_branches/20090522/ippTools/src/warptool.c

    r24557 r24565  
    680680    PXOPT_COPY_STR(config->args, where, "-skycell_id", "warpSkyCellMap.skycell_id", "==");
    681681    PXOPT_COPY_STR(config->args, where, "-tess_id",    "warpSkyCellMap.tess_id", "==");
    682     PXOPT_COPY_STR(config->args, where, "-label",      "warpRun.label", "==");
     682    // PXOPT_COPY_STR(config->args, where, "-label",      "warpRun.label", "==");
     683    pxAddLabelSearchArgs (config, where, "-label",     "warpRun.label", "==");
    683684    PXOPT_COPY_S16(config->args, where, "-fault",      "warpSkyCellMap.fault", "==");
    684685
     
    12691270    PXOPT_COPY_STR(config->args, where, "-tess_id",    "warpSkyfile.tess_id", "==");
    12701271    PXOPT_COPY_STR(config->args, where, "-reduction",  "rawExp.reduction", "==");
    1271     PXOPT_COPY_STR(config->args, where, "-label",      "warpRun.label", "==");
     1272    // PXOPT_COPY_STR(config->args, where, "-label",      "warpRun.label", "==");
     1273    pxAddLabelSearchArgs (config, where, "-label",     "warpRun.label", "==");
    12721274    PXOPT_COPY_S16(config->args, where, "-fault",       "warpSkyfile.fault", "==");
    12731275
  • branches/eam_branches/20090522/ippTools/src/warptoolConfig.c

    r24557 r24565  
    164164    psMetadataAddStr(revertoverlapArgs, PS_LIST_TAIL, "-skycell_id",  0,            "search by skycell ID", NULL);
    165165    psMetadataAddStr(revertoverlapArgs, PS_LIST_TAIL, "-tess_id",  0,            "search by tessellation ID", NULL);
    166     psMetadataAddStr(revertoverlapArgs, PS_LIST_TAIL, "-label",  0,            "search by warpRun label", NULL);
     166    psMetadataAddStr(revertoverlapArgs, PS_LIST_TAIL, "-label",  PS_META_DUPLICATE_OK, "search by warpRun label", NULL);
    167167    psMetadataAddS16(revertoverlapArgs, PS_LIST_TAIL, "-fault",  0,            "search by fault code", 0);
    168168    psMetadataAddBool(revertoverlapArgs, PS_LIST_TAIL, "-all",  0,            "allow everything to be queued without search terms", false);
     
    227227    psMetadataAddStr(revertwarpedArgs, PS_LIST_TAIL, "-tess_id",  0,            "search by tessellation ID", NULL);
    228228    psMetadataAddStr(revertwarpedArgs, PS_LIST_TAIL, "-reduction",  0,            "search by warpRun reduction class", NULL);
    229     psMetadataAddStr(revertwarpedArgs, PS_LIST_TAIL, "-label",  0,            "search by warpRun label", NULL);
     229    psMetadataAddStr(revertwarpedArgs, PS_LIST_TAIL, "-label",  PS_META_DUPLICATE_OK, "search by warpRun label", NULL);
    230230    psMetadataAddS16(revertwarpedArgs, PS_LIST_TAIL, "-fault",  0,            "search by fault code", 0);
    231231    psMetadataAddBool(revertwarpedArgs, PS_LIST_TAIL, "-all",  0,            "allow everything to be queued without search terms", false);
  • branches/eam_branches/20090522/ppImage/src/ppImageReplaceBackground.c

    r23825 r24565  
    144144    for (int y = 0; y < numRows; y++) {
    145145        for (int x = 0; x < numCols; x++) {
    146             float value = backData[y][x];
    147             if (!isfinite(value)) {
    148                 image->data.F32[y][x] = NAN;
    149                 mask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] |= options->lowMask;
     146            if (mask && mask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] & maskVal) {
     147                image->data.F32[y][x] = 0.0;
    150148            } else {
    151                 image->data.F32[y][x] -= value;
    152             }
     149                float value = backData[y][x];
     150                if (!isfinite(value)) {
     151                    image->data.F32[y][x] = NAN;
     152                    mask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] |= options->lowMask;
     153                } else {
     154                    image->data.F32[y][x] -= value;
     155                }
     156            }
    153157        }
    154158    }
  • branches/eam_branches/20090522/psLib/src/mathtypes/psVector.c

    r21183 r24565  
    7777    // Create vector data array
    7878    vector->data.U8 = psAlloc(nalloc * elementSize);
     79    memset (vector->data.U8, 0, nalloc * elementSize);
    7980
    8081    return vector;
     
    119120                _("psVectorRealloc must a given a non-NULL psVector to resize.  Desired datatype unknown."));
    120121        return NULL;
    121     } else if (vector->nalloc != nalloc) {     // No need to realloc to same size
    122         elemType = vector->type.type;
    123         elementSize = PSELEMTYPE_SIZEOF(elemType);
    124         if (nalloc < vector->n) {
    125             vector->n = nalloc;
    126         }
    127         // Realloc after decrementation to avoid accessing freed array elements
    128         vector->data.U8 = psRealloc(vector->data.U8, nalloc * elementSize);
    129         P_PSVECTOR_SET_NALLOC(vector,nalloc);
     122    }
     123
     124   
     125    if (vector->nalloc == nalloc) {     
     126        // No need to realloc to same size
     127        return vector;
     128    }
     129     
     130    elemType = vector->type.type;
     131    elementSize = PSELEMTYPE_SIZEOF(elemType);
     132
     133    long nstart = vector->n;
     134    if (nalloc < vector->n) {
     135        vector->n = nalloc;
     136    }
     137    // Realloc after decrementation to avoid accessing freed array elements
     138    vector->data.U8 = psRealloc(vector->data.U8, nalloc * elementSize);
     139    P_PSVECTOR_SET_NALLOC(vector,nalloc);
     140
     141    // fill newly allocated range with zeros:
     142    if (nstart < nalloc) {
     143        long nNew = nalloc - nstart;
     144        memset (&vector->data.U8[nstart*elementSize], 0, nNew*elementSize);
    130145    }
    131146
     
    165180    vector->type.type = type;
    166181    vector->n = nalloc;
     182
     183    // zero the vector
     184    memset (vector->data.U8, 0, byteSize);
     185
    167186    return vector;
    168187}
Note: See TracChangeset for help on using the changeset viewer.