Changeset 25835 for trunk/ippTools/src/disttool.c
- Timestamp:
- Oct 14, 2009, 11:06:18 AM (17 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/disttool.c (modified) (24 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/disttool.c
r25567 r25835 32 32 33 33 static bool definebyqueryMode(pxConfig *config); 34 static bool definerunMode(pxConfig *config);35 34 static bool updaterunMode(pxConfig *config); 36 35 static bool revertrunMode(pxConfig *config); … … 79 78 switch (config->mode) { 80 79 MODECASE(DISTTOOL_MODE_DEFINEBYQUERY, definebyqueryMode); 81 MODECASE(DISTTOOL_MODE_DEFINERUN, definerunMode);82 80 MODECASE(DISTTOOL_MODE_UPDATERUN, updaterunMode); 83 81 MODECASE(DISTTOOL_MODE_REVERTRUN, revertrunMode); … … 123 121 } 124 122 125 static bool definerunMode(pxConfig *config)126 {127 PS_ASSERT_PTR_NON_NULL(config, false);128 129 // required130 PXOPT_LOOKUP_STR(stage, config->args, "-stage", true, false);131 PXOPT_LOOKUP_S64(stage_id, config->args, "-stage_id", true, false);132 PXOPT_LOOKUP_STR(outroot, config->args, "-outroot", true, false);133 PXOPT_LOOKUP_S64(target_id, config->args, "-target_id", true, false);134 135 // optional136 PXOPT_LOOKUP_BOOL(clean, config->args, "-clean", false);137 PXOPT_LOOKUP_BOOL(no_magic, config->args, "-no_magic", false);138 PXOPT_LOOKUP_STR(set_label, config->args, "-set_label", false, false);139 140 // TODO: check that stage has an expected value141 // XXX: all of the following concerns will be managed properly by definebyquery142 143 // TODO: should we check that stage_id actually exists for stage144 // in magicdstool we queue off of a magic_id so the stage_id, exp_id, and cam_id get looked up145 // when the run is queued146 147 if (!distRunInsert(config->dbh,148 0, // dist_id149 target_id,150 stage,151 stage_id,152 0,153 set_label,154 outroot,155 clean,156 no_magic,157 "new",158 NULL, // time_stamp159 0 // fault160 )) {161 psError(PS_ERR_UNKNOWN, false, "database error");162 return false;163 }164 165 return true;166 }167 123 168 124 static bool definebyqueryMode(pxConfig *config) … … 178 134 PXOPT_LOOKUP_BOOL(no_magic, config->args, "-no_magic", false); 179 135 PXOPT_LOOKUP_STR(set_label, config->args, "-set_label", false, false); 136 PXOPT_LOOKUP_STR(set_note, config->args, "-set_note", false, false); 137 180 138 PXOPT_LOOKUP_S64(limit, config->args, "-limit", false, false); 181 139 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); … … 191 149 192 150 PXOPT_LOOKUP_STR(label, config->args, "-label", false, false); 151 PXOPT_LOOKUP_STR(dist_group, config->args, "-dist_group", false, false); 193 152 194 153 psString query = NULL; … … 209 168 psStringAppend(&query, " AND (chipRun.label = '%s')", label); 210 169 } 170 if (dist_group) { 171 psStringAppend(&query, " AND (chipRun.dist_group = '%s')", dist_group); 172 } 211 173 } else if (!strcmp(stage, "chip")) { 212 174 magicRunType = "chipRun"; … … 222 184 psStringAppend(&query, " AND (chipRun.label = '%s')", label); 223 185 } 186 if (dist_group) { 187 psStringAppend(&query, " AND (chipRun.dist_group = '%s')", dist_group); 188 } 224 189 } else if (!strcmp(stage, "camera")) { 225 190 magicRunType = "camRun"; // This is used below to set the magicked business … … 235 200 psStringAppend(&query, " AND (camRun.label = '%s')", label); 236 201 } 202 if (dist_group) { 203 psStringAppend(&query, " AND (camRun.dist_group = '%s')", dist_group); 204 } 237 205 } else if (!strcmp(stage, "fake")) { 238 206 magicRunType = "fakeRun"; … … 246 214 if (label) { 247 215 psStringAppend(&query, " AND (fakeRun.label = '%s')", label); 216 } 217 if (dist_group) { 218 psStringAppend(&query, " AND (fakeRun.dist_group = '%s')", dist_group); 248 219 } 249 220 // fake stage doesn't require magic … … 262 233 psStringAppend(&query, " AND (warpRun.label = '%s')", label); 263 234 } 235 if (dist_group) { 236 psStringAppend(&query, " AND (warpRun.dist_group = '%s')", dist_group); 237 } 264 238 265 239 } else if (!strcmp(stage, "diff")) { … … 276 250 psStringAppend(&query, " AND (diffRun.label = '%s')", label); 277 251 } 252 if (dist_group) { 253 psStringAppend(&query, " AND (diffRun.dist_group = '%s')", dist_group); 254 } 278 255 279 256 } else if (!strcmp(stage, "stack")) { … … 288 265 if (label) { 289 266 psStringAppend(&query, " AND (stackRun.label = '%s')", label); 267 } 268 if (dist_group) { 269 psStringAppend(&query, " AND (stackRun.dist_group = '%s')", dist_group); 290 270 } 291 271 // stack stage doesn't require magic … … 371 351 psS64 magic_ds_id = psMetadataLookupS64(NULL, md, "magicked"); 372 352 psS64 target_id = psMetadataLookupS64(NULL, md, "target_id"); 373 psString target_label = psMetadataLookupStr(NULL, md, "label");353 psString stage_label = psMetadataLookupStr(NULL, md, "label"); 374 354 bool clean = psMetadataLookupBool(NULL, md, "clean"); 375 355 … … 381 361 new_label = set_label; 382 362 } else { 383 new_label = target_label;363 new_label = stage_label; 384 364 } 385 365 distRunRow *row = distRunRowAlloc( … … 395 375 "new", 396 376 NULL, // time_stamp 397 0 // fault 377 0, // fault 378 set_note // note does not propagate 398 379 ); 399 380 … … 1239 1220 1240 1221 // required 1241 PXOPT_LOOKUP_STR( label, config->args, "-label", true, false);1222 PXOPT_LOOKUP_STR(dist_group, config->args, "-dist_group", true, false); 1242 1223 PXOPT_LOOKUP_STR(filter, config->args, "-filter", true, false); 1243 1224 PXOPT_LOOKUP_STR(stage, config->args, "-stage", true, false); … … 1250 1231 distTargetRow *row = distTargetRowAlloc( 1251 1232 0, // target_id 1252 label,1233 dist_group, 1253 1234 filter, 1254 1235 stage, … … 1287 1268 psMetadata *where = psMetadataAlloc(); 1288 1269 PXOPT_COPY_S64(config->args, where, "-target_id", "target_id", "=="); 1289 PXOPT_COPY_STR(config->args, where, "- label", "label", "==");1270 PXOPT_COPY_STR(config->args, where, "-dist_group", "dist_group", "=="); 1290 1271 PXOPT_COPY_STR(config->args, where, "-filter", "filter", "=="); 1291 1272 PXOPT_COPY_STR(config->args, where, "-stage", "stage", "=="); … … 1323 1304 psMetadata *where = psMetadataAlloc(); 1324 1305 PXOPT_COPY_S64(config->args, where, "-target_id", "target_id", "=="); 1325 PXOPT_COPY_STR(config->args, where, "- label", "label", "==");1306 PXOPT_COPY_STR(config->args, where, "-dist_group", "dist_group", "LIKE"); 1326 1307 PXOPT_COPY_STR(config->args, where, "-filter", "filter", "=="); 1327 1308 PXOPT_COPY_STR(config->args, where, "-stage", "stage", "=="); … … 1518 1499 PXOPT_LOOKUP_S64(target_id, config->args, "-target_id", false, false); 1519 1500 PXOPT_LOOKUP_STR(stage, config->args, "-stage", false, false); 1520 PXOPT_LOOKUP_STR( label, config->args, "-label", false, false);1501 PXOPT_LOOKUP_STR(dist_group, config->args, "-dist_group", false, false); 1521 1502 PXOPT_LOOKUP_STR(filter, config->args, "-filter", false, false); 1522 1503 PXOPT_LOOKUP_BOOL(clean, config->args, "-clean", false); … … 1528 1509 error = true; 1529 1510 } 1530 if (! label) {1531 psError(PS_ERR_UNKNOWN, !error, " labelis required if target_id is not supplied");1511 if (!dist_group) { 1512 psError(PS_ERR_UNKNOWN, !error, "dist_group is required if target_id is not supplied"); 1532 1513 error = true; 1533 1514 } … … 1539 1520 // optional 1540 1521 PXOPT_LOOKUP_S64(limit, config->args, "-limit", false, false); 1541 PXOPT_LOOKUP_STR(state, config->args, "-set_state", false, false);1522 PXOPT_LOOKUP_STR(state, config->args, "-set_state", false, false); 1542 1523 if (state) { 1543 1524 if (strcmp(state, "enabled") && strcmp(state, "disabled")) { … … 1555 1536 PXOPT_COPY_STR(config->args, where, "-dest_name", "rcDestination.name", "=="); 1556 1537 PXOPT_COPY_S64(config->args, where, "-target_id", "target_id", "=="); 1557 PXOPT_COPY_STR(config->args, where, "- label", "label", "LIKE");1538 PXOPT_COPY_STR(config->args, where, "-dist_group", "dist_group", "LIKE"); 1558 1539 PXOPT_COPY_STR(config->args, where, "-filter", "filter", "LIKE"); 1559 1540 PXOPT_COPY_STR(config->args, where, "-stage", "stage", "=="); … … 1658 1639 PXOPT_COPY_S64(config->args, where, "-target_id", "target_id", "=="); 1659 1640 PXOPT_COPY_STR(config->args, where, "-stage", "stage", "=="); 1660 PXOPT_COPY_STR(config->args, where, "- label", "label", "LIKE");1641 PXOPT_COPY_STR(config->args, where, "-dist_group", "dist_group", "LIKE"); 1661 1642 PXOPT_COPY_STR(config->args, where, "-filter", "filter", "LIKE"); 1662 1643 PXOPT_COPY_STR(config->args, where, "-state", "state", "==");
Note:
See TracChangeset
for help on using the changeset viewer.
