+2009-12-17 Keith Marshall <keithmarshall@users.sourceforge.net>
+
+ Add CLI support for "update" action.
+
+ * src/pkgtask.h (ACTION_UPDATE): Define it, derived from...
+ (action_update): ...this new entry in anonymous enumeration.
+
+ * src/pkgexec.cpp (action_name): Add "update" keyword identification.
+
+ * src/pkgbase.h: Typo in comment; s/xwXmlDocument/wxXmlDocument/.
+ (pkgXmlDocument::BindRepositories): Add `force_update' parameter...
+ * src/pkgbind.cpp (pkgXmlDocument::BindRepositories): Use it to...
+ (pkgXmlDocument::SyncRepository): ...invoke this method when passed as
+ a `true' flag, in addition to (as previously) first time reference.
+
+ * src/climain.cpp (climain): Interpret "update" keyword for...
+ [ACTION_UPDATE]: ...passing state as `force_update' parameter to...
+ (pkgXmlDocument::BindRepositories): ...this method, then...
+ [!ACTION_UPDATE]: Follow with normal action processing.
+
2009-12-16 Keith Marshall <keithmarshall@users.sourceforge.net>
Add status checking for Internet URL connections.
/* Merge all package lists, as specified in the "repository"
* section of the "profile", into the XML database tree...
*/
- if( dbase.BindRepositories() == NULL )
+ if( dbase.BindRepositories( action == ACTION_UPDATE ) == NULL )
/*
* ...bailing out, on an invalid profile specification...
*/
dmh_notify( DMH_FATAL, "%s: invalid application profile\n", dbase.Value() );
#if 0
- /* Now schedule the specified action for each additionally
- * specified command line argument, (each of which is assumed
- * to represent a package name...
+ /* If the requested action was "update", then we've already done it,
+ * as a side effect of binding the cached repository catalogues...
*/
- while( --argc )
- dbase.Schedule( (unsigned long)(action), *++argv );
+ if( action != ACTION_UPDATE )
+ {
+ /* ...otherwise, we still need to schedule and execute the action request...
+ *
+ * so, schedule the specified action for each additionally specified command
+ * line argument, (each of which is assumed to represent a package name)...
+ */
+ while( --argc )
+ dbase.Schedule( (unsigned long)(action), *++argv );
- /* ...and finally, execute all scheduled actions...
- */
- dbase.ExecuteActions();
+ /* ...and finally, execute all scheduled actions...
+ */
+ dbase.ExecuteActions();
+ }
#endif
/* If we get this far, then all actions completed successfully;
*/
inline pkgXmlDocument( const char* name )
{
- /* tinyxml has a similar constructor, but unlike xwXmlDocument,
+ /* tinyxml has a similar constructor, but unlike wxXmlDocument,
* it DOES NOT automatically load the document; force it.
*/
LoadFile( name );
/* Method to merge content from repository-specific package lists
* into the central XML package database.
*/
- pkgXmlNode* BindRepositories();
+ pkgXmlNode* BindRepositories( bool );
/* Method to locate the XML database entry for a named package.
*/
#include "dmh.h"
#include "pkgbase.h"
-pkgXmlNode *pkgXmlDocument::BindRepositories()
+pkgXmlNode *pkgXmlDocument::BindRepositories( bool force_update )
{
/* Identify the repositories specified in the application profile,
* and merge their associated package distribution lists into the
{
/* Check for a locally cached copy of the "package-list" file...
*/
- if( access( dfile, F_OK ) != 0 )
+ if( force_update || (access( dfile, F_OK ) != 0) )
/*
- * When no local copy is available...
+ * When performing an "update", or if no local copy is available...
* Force a "sync", to fetch a copy from the public host.
*/
SyncRepository( dname, repository );
"no change", /* unused; zero cannot test true in a bitwise test */
"remove", /* remove a previously installed package */
"install", /* install a new package */
- "upgrade" /* update previously installed packages */
+ "upgrade", /* upgrade previously installed packages */
+
+ "update" /* update local copy of repository catalogues */
};
/* For specified "index", return a pointer to the associated keyword,
enum
{
action_none = 0,
+
action_remove,
action_install,
action_upgrade,
+ action_update,
+
end_of_actions
};
#define ACTION_REMOVE (unsigned long)(action_remove)
#define ACTION_INSTALL (unsigned long)(action_install)
#define ACTION_UPGRADE (unsigned long)(action_upgrade)
+#define ACTION_UPDATE (unsigned long)(action_update)
#define STRICTLY_GT ACTION_MASK + 1
#define STRICTLY_LT STRICTLY_GT << 1