* $Id$
*
* Written by Keith Marshall <keithmarshall@users.sourceforge.net>
- * Copyright (C) 2011, 2012, MinGW Project
+ * Copyright (C) 2011-2013, MinGW.org Project
*
*
* Implementation of the primary package removal methods.
#include "pkgkeys.h"
#include "pkgproc.h"
#include "pkgtask.h"
+#include "pkgstat.h"
#include "mkpath.h"
* a reference to any sysroot which claims it, returning
* a pointer to the first such reference found.
*/
- if( (this != NULL) && (manifest != NULL) && (key != NULL) )
+ if( (manifest != NULL) && (key != NULL) )
{
/* We appear to have a valid manifest, and a valid sysroot
* key to match; locate this manifest's first, (and nominally
char filepath[ mkpath( NULL, sysroot, pathname, NULL ) ];
mkpath( filepath, sysroot, pathname, NULL );
+ pkgSpinWait::Report( "Deleting %s", pathname );
DEBUG_INVOKE_IF( DEBUG_REQUEST( DEBUG_TRACE_TRANSACTIONS ),
dmh_printf( " %s: unlink file\n", filepath )
);
EXTERN_C void pkgRemove( pkgActionItem *current )
{
- /* Common handler for all package removal tasks...
+ /* Common handler for all package removal tasks; note that we
+ * initially assert failure, pending reversion on success...
*/
pkgXmlNode *pkg;
+ current->Assert( ACTION_REMOVE_FAILED );
if( ((pkg = current->Selection( to_remove )) != NULL)
&& (current->HasAttribute( ACTION_DOWNLOAD_OK ) == ACTION_REMOVE_OK) )
{
* have no associated archive file, no installed footprint on disk,
* and no associated content manifest to process; thus...
*/
- if( ! match_if_explicit( pkg->ArchiveName(), value_none ) )
+ if( match_if_explicit( pkg->ArchiveName(), value_none ) )
{
- /* ...only in the case of packages identified as "real", (which
+ /* ...we may simply assert the removal action as successful...
+ */
+ current->Assert( 0UL, ~ACTION_REMOVE_FAILED );
+ }
+ else
+ { /* ...but, in the case of packages identified as "real", (which
* we expect to be in a substantial majority), do we need to refer
* to any installation manifest, to identify actual disk files to
* be removed.
"%s: unreferenced in %s\n", sysname, id_lookup( manifest, value_unknown )
);
}
+ else
+ /* Removal should be successful: revert our original
+ * assertion of failure...
+ */
+ current->Assert( 0UL, ~ACTION_REMOVE_FAILED );
+
/* Now, we've validated the manifest, and confirmed that it
* correctly records its association with the current sysroot,
* (or we've reported the inconsistency; we may proceed with
sysroot->SetAttribute( modified_key, value_yes );
}
}
+ /* Update the internal record of installed state; although no
+ * running CLI instance will return to any point where it needs
+ * this, we may have been called from the GUI, and it requires
+ * consistency here, if the user revisits this package within
+ * any single active session.
+ */
+ pkg->SetAttribute( installed_key, value_no );
+
/* After package removal has been completed, we invoke any
* post-remove script which may be associated with the package.
*/