Index: branches/pap_mops/ippTools/src/pubtool.c
===================================================================
--- branches/pap_mops/ippTools/src/pubtool.c	(revision 24413)
+++ branches/pap_mops/ippTools/src/pubtool.c	(revision 24427)
@@ -36,5 +36,4 @@
 static bool addMode(pxConfig *config);
 static bool revertMode(pxConfig *config);
-static bool advanceMode(pxConfig *config);
 
 # define MODECASE(caseName, func) \
@@ -62,5 +61,4 @@
         MODECASE(PUBTOOL_MODE_ADD, addMode);
         MODECASE(PUBTOOL_MODE_REVERT, revertMode);
-        MODECASE(PUBTOOL_MODE_ADVANCE, advanceMode);
       default:
         psAbort("invalid option (this should not happen)");
@@ -89,12 +87,11 @@
 
     // required
+    PXOPT_LOOKUP_STR(product, config->args, "-product",  true, false);
     PXOPT_LOOKUP_STR(stage, config->args, "-stage", true, false);
-    PXOPT_LOOKUP_STR(destination, config->args, "-destination",  true, false);
 
     // optional
-    PXOPT_LOOKUP_STR(format, config->args, "-format",  false, false);
     PXOPT_LOOKUP_STR(comment, config->args, "-comment",  false, false);
 
-    if (!publishClientInsert(config->dbh, 0, stage, destination, format, comment)) {
+    if (!publishClientInsert(config->dbh, 0, product, stage, comment)) {
         psError(PS_ERR_UNKNOWN, false, "Database error");
         return false;
@@ -109,4 +106,7 @@
 
     psMetadata *where = psMetadataAlloc(); // WHERE conditions
+
+    // required
+    PXOPT_LOOKUP_STR(workdir, config->args, "-workdir",  true, false);
 
     // optional
@@ -141,5 +141,5 @@
         psFree(query);
         psFree(whereClause);
-        if (!psDBTransaction(config->dbh)) {
+        if (!psDBRollback(config->dbh)) {
             psError(PS_ERR_UNKNOWN, false, "Database error");
         }
@@ -152,5 +152,5 @@
     if (!output) {
         psError(PS_ERR_UNKNOWN, false, "Database error");
-        if (!psDBTransaction(config->dbh)) {
+        if (!psDBRollback(config->dbh)) {
             psError(PS_ERR_UNKNOWN, false, "Database error");
         }
@@ -160,5 +160,5 @@
         psTrace("pubtool", PS_LOG_INFO, "No rows found");
         psFree(output);
-        if (!psDBTransaction(config->dbh)) {
+        if (!psDBRollback(config->dbh)) {
             psError(PS_ERR_UNKNOWN, false, "Database error");
         }
@@ -171,8 +171,8 @@
         psS64 stage = psMetadataLookupS64(NULL, row, "stage_id");   // Stage identifier
 
-        if (!publishRunInsert(config->dbh, 0, client, stage, set_label, "new")) {
+        if (!publishRunInsert(config->dbh, 0, client, stage, workdir, set_label, "new")) {
             psError(PS_ERR_UNKNOWN, false, "Unable to add fileset");
             psFree(output);
-            if (!psDBTransaction(config->dbh)) {
+            if (!psDBRollback(config->dbh)) {
                 psError(PS_ERR_UNKNOWN, false, "Database error");
             }
@@ -182,5 +182,5 @@
     psFree(output);
 
-    if (!psDBTransaction(config->dbh)) {
+    if (!psDBCommit(config->dbh)) {
         psError(PS_ERR_UNKNOWN, false, "Database error");
         return false;
@@ -259,11 +259,34 @@
     // required
     PXOPT_LOOKUP_S64(pub_id, config->args, "-pub_id", true, false);
-    PXOPT_LOOKUP_STR(component, config->args, "-component", true, false);
+    PXOPT_LOOKUP_STR(path_base, config->args, "-path_base",  true, false);
 
     // optional
     PXOPT_LOOKUP_S32(fault, config->args, "-fault", false, false);
 
-    if (!publishFileInsert(config->dbh, pub_id, component, fault)) {
+    if (!psDBTransaction(config->dbh)) {
+        psError(PS_ERR_UNKNOWN, false, "Database error");
+        return false;
+    }
+
+    if (!publishDoneInsert(config->dbh, pub_id, path_base, fault)) {
         psError(PS_ERR_UNKNOWN, false, "Unable to add file");
+        if (!psDBRollback(config->dbh)) {
+            psError(PS_ERR_UNKNOWN, false, "Database error");
+        }
+        return false;
+    }
+
+    if (!p_psDBRunQueryF(config->dbh,
+                         "UPDATE publishRun SET state = 'full' WHERE pub_id = %" PRId64,
+                         pub_id)) {
+        psError(PS_ERR_UNKNOWN, false, "Database error");
+        if (!psDBRollback(config->dbh)) {
+            psError(PS_ERR_UNKNOWN, false, "Database error");
+        }
+        return false;
+    }
+
+    if (!psDBCommit(config->dbh)) {
+        psError(PS_ERR_UNKNOWN, false, "Database error");
         return false;
     }
@@ -283,5 +306,4 @@
     PXOPT_COPY_S32(config->args, where, "-fault", "fault", "==");
     PXOPT_COPY_STR(config->args, where, "-client_id", "client_id", "==");
-    PXOPT_COPY_STR(config->args, where, "-component", "component", "==");
     PXOPT_COPY_STR(config->args, where, "-comment", "comment", "LIKE");
     PXOPT_COPY_STR(config->args, where, "-label", "label", "==");
@@ -310,21 +332,3 @@
     return true;
 }
-static bool advanceMode(pxConfig *config)
-{
-    PS_ASSERT_PTR_NON_NULL(config, false);
-
-    psString query = pxDataGet("pubtool_advance.sql");
-    if (!query) {
-        psError(PXTOOLS_ERR_DATA, false, "Failed to retreive SQL statement");
-        return false;
-    }
-
-    if (!p_psDBRunQuery(config->dbh, query)) {
-        psError(PS_ERR_UNKNOWN, false, "Database error");
-        psFree(query);
-        return false;
-    }
-    psFree(query);
-
-    return true;
-}
+
Index: branches/pap_mops/ippTools/src/pubtool.h
===================================================================
--- branches/pap_mops/ippTools/src/pubtool.h	(revision 24413)
+++ branches/pap_mops/ippTools/src/pubtool.h	(revision 24427)
@@ -30,5 +30,4 @@
     PUBTOOL_MODE_ADD,
     PUBTOOL_MODE_REVERT,
-    PUBTOOL_MODE_ADVANCE,
 } pubtoolMode;
 
Index: branches/pap_mops/ippTools/src/pubtoolConfig.c
===================================================================
--- branches/pap_mops/ippTools/src/pubtoolConfig.c	(revision 24413)
+++ branches/pap_mops/ippTools/src/pubtoolConfig.c	(revision 24427)
@@ -46,10 +46,10 @@
     psMetadata *defineclientArgs = psMetadataAlloc();
     psMetadataAddStr(defineclientArgs, PS_LIST_TAIL, "-stage", 0, "define stage (required)", NULL);
-    psMetadataAddStr(defineclientArgs, PS_LIST_TAIL, "-destination", 0, "define destination (required)", NULL);
-    psMetadataAddStr(defineclientArgs, PS_LIST_TAIL, "-format", 0, "define format", NULL);
+    psMetadataAddStr(defineclientArgs, PS_LIST_TAIL, "-product", 0, "define product (required)", NULL);
     psMetadataAddStr(defineclientArgs, PS_LIST_TAIL, "-comment", 0, "define comment", NULL);
 
     // -definerun
     psMetadata *definerunArgs = psMetadataAlloc();
+    psMetadataAddStr(definerunArgs, PS_LIST_TAIL, "-workdir", 0, "define workdir (required)", NULL);
     psMetadataAddS64(definerunArgs, PS_LIST_TAIL, "-set_label", 0, "define label", 0);
     psMetadataAddS64(definerunArgs, PS_LIST_TAIL, "-client_id", 0, "search by client_id", 0);
@@ -68,5 +68,4 @@
     psMetadata *addArgs = psMetadataAlloc();
     psMetadataAddS64(addArgs, PS_LIST_TAIL, "-pub_id", 0, "define pub_id (required)", 0);
-    psMetadataAddStr(addArgs, PS_LIST_TAIL, "-component", 0, "define component (required)", NULL);
     psMetadataAddS32(addArgs, PS_LIST_TAIL, "-fault", 0, "define fault code", 0);
 
@@ -74,5 +73,4 @@
     psMetadata *revertArgs = psMetadataAlloc();
     psMetadataAddS64(revertArgs, PS_LIST_TAIL, "-pub_id", 0, "search on pub_id", 0);
-    psMetadataAddStr(revertArgs, PS_LIST_TAIL, "-component", 0, "search on component", NULL);
     psMetadataAddS32(revertArgs, PS_LIST_TAIL, "-fault", 0, "search on fault code", 0);
     psMetadataAddStr(revertArgs, PS_LIST_TAIL, "-client_id", 0, "search on client_id", NULL);
@@ -80,6 +78,4 @@
     psMetadataAddStr(revertArgs, PS_LIST_TAIL, "-label", 0, "search on label", NULL);
 
-    // -advance
-    psMetadata *advanceArgs = psMetadataAlloc();
 
     psMetadata *argSets = psMetadataAlloc();
@@ -91,5 +87,4 @@
     PXOPT_ADD_MODE("-add", "", PUBTOOL_MODE_ADD, addArgs);
     PXOPT_ADD_MODE("-revert", "", PUBTOOL_MODE_REVERT, revertArgs);
-    PXOPT_ADD_MODE("-advance", "", PUBTOOL_MODE_ADVANCE, advanceArgs);
 
     if (!pxGetOptions(stderr, argc, argv, config, modes, argSets)) {
