From: Keith M. <no...@so...> - 2013-07-25 21:55:02
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Repository: mingw-get". The branch, master has been updated via 162f37bd962f36011251a3c23966f1d47a344e0e (commit) via fbc3eaa39e32067578a43138a2a15ba6a0e00d30 (commit) from 68841d602208bf7bf73bdd38173a2aa10444d385 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://sf.net/p/mingw/mingw-get/ci/162f37bd962f36011251a3c23966f1d47a344e0e/ commit 162f37bd962f36011251a3c23966f1d47a344e0e Author: Keith Marshall <kei...@us...> Date: Thu Jul 25 21:48:45 2013 +0100 Implement setup tool installer "plugin". diff --git a/ChangeLog b/ChangeLog index 9cfbaa8..f094054 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,35 @@ 2013-07-25 Keith Marshall <kei...@us...> + Implement setup tool installer "plugin". + + * src/setup.h (SETUP_HOOK_RUN_INSTALLER): Define request code. + + * src/dllhook.cpp (run_basic_system_installer): Implement handler... + (setup_hook) [SETUP_HOOK_RUN_INSTALLER]: ...and invoke it. + (setup_hook) [default]: Collect diagnostics in common message digest. + (AppWindowMaker::SetupHookInvoked): Define and initialise it; in this + context, which does not conflict with prior definition in guimain.exe, + it must always remain true. + + * src/setup.cpp (SetupTool) [constructor]: Invoke... + (SetupTool::DispatchSetupHookRequest): ...this, on user's request... + (SETUP_HOOK_RUN_INSTALLER): ...with this action code; this replaces... + (SetupTool::RunInstalledProgram): ...one reference instance for this + external program fork, leaving only one such reference remaining; + declare it to be "inline". + + * Makefile.in (GUIMAIN_LIB_OBJECTS): New macro; define it. It + abstracts a subset of the object modules originally enumerated... + (GUIMAIN_OBJECTS): ...here, whence use it; also incorporate into... + (SETUP_DLL_OBJECTS): ...this. + (SETUP_DLL_LIBS): Make it equivalent to... + (GUIMAIN_LIBS): ...this. + (mingw-get-setup-0.dll): Use... + (GUI_LDFLAGS): ...this, to specify linking options, rather than... + (LDFLAGS): ...this. + +2013-07-25 Keith Marshall <kei...@us...> + Add "Basic Setup" as a built-in standard package group. * src/guimain.h (AppWindowMaker::SetupToolInvoked): New private diff --git a/Makefile.in b/Makefile.in index 9abc7af..7717e56 100644 --- a/Makefile.in +++ b/Makefile.in @@ -173,17 +173,22 @@ CLI_EXE_OBJECTS = \ clistub.$(OBJEXT) version.$(OBJEXT) approot.$(OBJEXT) getopt.$(OBJEXT) GUIMAIN_OBJECTS = \ - guimain.$(OBJEXT) guiexec.$(OBJEXT) dmhguix.$(OBJEXT) \ - approot.$(OBJEXT) pkgview.$(OBJEXT) pkgtree.$(OBJEXT) pkglist.$(OBJEXT) \ - pkgdata.$(OBJEXT) pkgnget.$(OBJEXT) guimain.res.$(OBJEXT) + guimain.$(OBJEXT) dmhguix.$(OBJEXT) $(GUIMAIN_LIB_OBJECTS) \ + approot.$(OBJEXT) guimain.res.$(OBJEXT) + +GUIMAIN_LIB_OBJECTS = \ + guiexec.$(OBJEXT) pkgview.$(OBJEXT) pkgtree.$(OBJEXT) pkglist.$(OBJEXT) \ + pkgdata.$(OBJEXT) pkgnget.$(OBJEXT) GUIMAIN_LIBS = -lwtklite -lcomctl32 SETUP_TOOL_OBJECTS = setup.$(OBJEXT) setup.res.$(OBJEXT) apihook.$(OBJEXT) SETUP_TOOL_LIBS = -lwtklite -lwininet -lcomctl32 -lole32 -Wl,-Bstatic -llzma -SETUP_DLL_OBJECTS = dllhook.$(OBJEXT) -SETUP_DLL_LIBS = +SETUP_DLL_OBJECTS = \ + dllhook.$(OBJEXT) $(GUIMAIN_LIB_OBJECTS) guimain.res.$(OBJEXT) + +SETUP_DLL_LIBS = $(GUIMAIN_LIBS) script_srcdir = ${srcdir}/scripts/libexec @@ -225,7 +230,7 @@ mingw-get-0.dll: $(CORE_DLL_OBJECTS) $(CXX) -shared -o $@ $(CXXFLAGS) $(LDFLAGS) $+ $(LIBS) mingw-get-setup-0.dll: $(SETUP_DLL_OBJECTS) mingw-get-0.dll - $(CXX) -shared -o $@ $(CXXFLAGS) $(LDFLAGS) $+ $(SETUP_DLL_LIBS) + $(CXX) -shared -o $@ $(CXXFLAGS) $(GUI_LDFLAGS) $+ $(SETUP_DLL_LIBS) # The following recursive invocation hook provides a mechanism for # accessing make's facility for reporting what it is doing, even when diff --git a/src/dllhook.cpp b/src/dllhook.cpp index 06394f9..3d117e3 100644 --- a/src/dllhook.cpp +++ b/src/dllhook.cpp @@ -48,6 +48,13 @@ static const char *setup_key = "setup"; #include <sys/stat.h> #include <fcntl.h> +/* This file implements the plugin variant of the mingw-get + * GUI installer, for use by the setup tool; in this context + * this AppWindowMaker static attribute must be initialised + * to indicate this mode of use. + */ +bool AppWindowMaker::SetupToolInvoked = true; + static const char *internal_error = "internal error"; #define MSG_INTERNAL_ERROR(MSG) "%s: "MSG_##MSG"\n", internal_error @@ -204,6 +211,59 @@ void update_catalogue( HWND owner ) free( (void *)(dfile) ); } +static inline +int run_basic_system_installer( const wchar_t *dll_name ) +{ + /* Hook to emulate a subset of the mingw-get GUI installer + * capabilities, via an embedded subset of its functions. + */ + try + { /* Identify the DLL module, whence we may retrieve resources + * similar to those of the free-standing GUI application, and + * create a clone of that application's main window. + */ + HINSTANCE instance; + AppWindowMaker MainWindow( instance = GetModuleHandleW( dll_name ) ); + MainWindow.Create( WTK::StringResource( instance, ID_MAIN_WINDOW_CLASS ), + WTK::StringResource( instance, ID_MAIN_WINDOW_CAPTION ) + ); + + /* Show this window, and paint its initial content... + */ + MainWindow.Show( SW_SHOW ); + MainWindow.Update(); + + /* ...then invoke its message loop, ultimately returning the + * status code which prevails, when the user closes it. + */ + return MainWindow.Invoked(); + } + catch( dmh_exception &e ) + { + /* Here, we handle any fatal exception which has been raised + * and identified by the diagnostic message handler... + */ + MessageBox( NULL, e.what(), "WinMain", MB_ICONERROR ); + return EXIT_FAILURE; + } + catch( WTK::runtime_error &e ) + { + /* ...while here, we diagnose any other error which was captured + * during the creation of the application's window hierarchy, or + * processing of its message loop... + */ + MessageBox( NULL, e.what(), "WinMain", MB_ICONERROR ); + return EXIT_FAILURE; + } + catch(...) + { /* ...and here, we diagnose any other error which we weren't + * able to explicitly identify. + */ + MessageBox( NULL, "Unknown exception", "WinMain", MB_ICONERROR ); + return EXIT_FAILURE; + } +} + EXTERN_C __declspec(dllexport) void setup_hook( unsigned int request, va_list argv ) { @@ -230,12 +290,21 @@ void setup_hook( unsigned int request, va_list argv ) update_catalogue( va_arg( argv, HWND ) ); break; + case SETUP_HOOK_RUN_INSTALLER: + /* This hook invokes the mingw-get GUI, in setup tool mode, to + * facilitate installation of a user configured basic system. + */ + run_basic_system_installer( va_arg( argv, const wchar_t * ) ); + break; + default: /* We should never get to here; it's a programming error in * the setup tool, if we do. */ + dmh_control( DMH_BEGIN_DIGEST ); dmh_notify( DMH_ERROR, MSG_INTERNAL_ERROR( INVALID_REQUEST ) ); dmh_notify( DMH_ERROR, MSG_INTERNAL_ERROR( NOTIFY_MAINTAINER ) ); + dmh_control( DMH_END_DIGEST ); } } diff --git a/src/setup.cpp b/src/setup.cpp index 4616be8..e9597d9 100644 --- a/src/setup.cpp +++ b/src/setup.cpp @@ -188,7 +188,7 @@ class SetupTool ( HWND, unsigned, WPARAM, LPARAM ); static const wchar_t *gui_program; - int RunInstalledProgram( const wchar_t * ); + inline int RunInstalledProgram( const wchar_t * ); inline wchar_t *setup_dll( void ) { /* Helper function to ensure that the static "approot_path" buffer @@ -1051,6 +1051,17 @@ base_dll( NULL ), hook_dll( NULL ) MAKEINTRESOURCE( IDD_SETUP_BEGIN ), NULL, OpeningDialogue ); + /* When the user has requested progression to package installation... + */ + if( Status == EXIT_CONTINUE ) + { + /* ...then delegate that to the embedded mingw-get plugin, before + * reasserting successful completion status for the setup tool. + */ + DispatchSetupHookRequest( SETUP_HOOK_RUN_INSTALLER, setup_dll() ); + Status = EXIT_SUCCESS; + } + /* If the mingw-get-0.dll and mingw-get-setup-0.dll libraries * were successfully loaded, to complete the installation process, * then we must now unload them; we also have no further use for @@ -1062,17 +1073,6 @@ base_dll( NULL ), hook_dll( NULL ) /* We're done with the COM subsystem; release it. */ CoUninitialize(); - - /* When the user has requested progression to advanced installation... - */ - if( Status == EXIT_CONTINUE ) - { - /* ...the delegate that to mingw-get itself, before reasserting - * the successful completion status for the setup tool. - */ - RunInstalledProgram( gui_program ); - Status = EXIT_SUCCESS; - } } } @@ -1285,7 +1285,7 @@ inline HMODULE SetupTool::HaveWorkingInstallation( void ) */ const wchar_t *SetupTool::gui_program = L"libexec\\mingw-get\\guimain.exe"; -int SetupTool::RunInstalledProgram( const wchar_t *program ) +inline int SetupTool::RunInstalledProgram( const wchar_t *program ) { /* Helper method to spawn an external process, into which a * specified program image is loaded; (typically this will be diff --git a/src/setup.h b/src/setup.h index 155be28..9463c0c 100644 --- a/src/setup.h +++ b/src/setup.h @@ -86,7 +86,8 @@ enum * serviced by mingw-get-setup-0.dll */ SETUP_HOOK_DMH_BIND = 0, - SETUP_HOOK_POST_INSTALL + SETUP_HOOK_POST_INSTALL, + SETUP_HOOK_RUN_INSTALLER }; class pkgSetupAction https://sf.net/p/mingw/mingw-get/ci/fbc3eaa39e32067578a43138a2a15ba6a0e00d30/ commit fbc3eaa39e32067578a43138a2a15ba6a0e00d30 Author: Keith Marshall <kei...@us...> Date: Thu Jul 25 12:15:52 2013 +0100 Add "Basic Setup" as a built-in standard package group. diff --git a/ChangeLog b/ChangeLog index b5423b0..9cfbaa8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,25 @@ +2013-07-25 Keith Marshall <kei...@us...> + + Add "Basic Setup" as a built-in standard package group. + + * src/guimain.h (AppWindowMaker::SetupToolInvoked): New private + static member variable; declare it. + + * src/guimain.cpp (AppWindowMaker::SetupToolInvoked): Define and + initialise it; this instance is specific to guimain.exe, where it + must always remain false. + + * src/pkgtree.cpp (PKG_AFFILIATE_ALL): New constant; define it. + (load_package_group_hierarchy): Use it to specify those groups which + have all packages as affiliates, rather than just first root group. + (group_attributes): New static inline function; implement it, then... + (is_affiliated) [PKG_AFFILIATE_ALL]: ...use it to identify groups + which are specified as having all packages as affiliates. + (AppWindowMaker::InitPackageTreeView): Construct a temporary XML + specification for the "Basic Setup" package group, thence add it to + the package tree view; mark it as default group selection when... + [AppWindowMaker::SetupToolInvoked]: ...this is true. + 2013-07-14 Keith Marshall <kei...@us...> Implement GUI filtering of package list by group selection. diff --git a/src/guimain.cpp b/src/guimain.cpp index e4c89d7..2b0e11a 100644 --- a/src/guimain.cpp +++ b/src/guimain.cpp @@ -29,6 +29,12 @@ #include "pkglock.h" #include "dmh.h" +/* This is the main program source for the full, free-standing + * mingw-get GUI installer; initialise this static AppWindowMaker + * attribute, indicating that this is not a setup tool plugin. + */ +bool AppWindowMaker::SetupToolInvoked = false; + using WTK::StringResource; using WTK::WindowClassMaker; using WTK::MainWindowMaker; diff --git a/src/guimain.h b/src/guimain.h index 0677e6b..383727f 100644 --- a/src/guimain.h +++ b/src/guimain.h @@ -212,6 +212,7 @@ class AppWindowMaker: public WTK::MainWindowMaker HFONT DefaultFont; static HWND PackageTreeView; + static bool SetupToolInvoked; void InitPackageTreeView( void ); HWND PackageListView; diff --git a/src/pkgtree.cpp b/src/pkgtree.cpp index 4cfdc52..62ac2ee 100644 --- a/src/pkgtree.cpp +++ b/src/pkgtree.cpp @@ -32,6 +32,8 @@ #include "pkgbase.h" #include "pkgkeys.h" +#define PKG_AFFILIATE_ALL 1 + static const char *package_group_key = "package-group"; static const char *package_group_all = "All Packages"; @@ -148,12 +150,15 @@ load_package_group_hierarchy( HWND display, HTREEITEM parent, pkgXmlNode *group * database representation, into a Windows tree view control. */ TVINSERTSTRUCT ref; + static long root_affiliate = PKG_AFFILIATE_ALL; /* Establish initial state for the tree view item insertion control. */ ref.hParent = parent; - ref.item.mask = TVIF_TEXT | TVIF_CHILDREN; ref.hInsertAfter = TVI_FIRST; + ref.item.mask = TVIF_TEXT | TVIF_PARAM | TVIF_CHILDREN; + ref.item.lParam = root_affiliate; + root_affiliate = 0; do { /* For each package group specified at the current level in the * package group hierarchy, retrieve its name from the XML record... @@ -168,6 +173,7 @@ load_package_group_hierarchy( HWND display, HTREEITEM parent, pkgXmlNode *group * ...and add a corresponding entry to the tree view. */ ref.hInsertAfter = TreeView_InsertItem( display, &ref ); + ref.item.lParam = 0; /* Check if the current group is to be made the initial selection, * when the tree view is first displayed; the last entry so marked @@ -274,12 +280,36 @@ void AppWindowMaker::InitPackageTreeView() TreeView_InsertItem( PackageTreeView, &entry ); } else - /* The package group hierarchy has been incorporated into + { /* The package group hierarchy has been incorporated into * the in-core image of the XML database; create a windows * "tree view", into which we load a representation of the * structure of this hierarchy. */ load_package_group_hierarchy( PackageTreeView, TVI_ROOT, tree ); + + /* Augment this "All Packages" hierarchy... + */ + if( (tree = new pkgXmlNode( package_group_key )) != NULL ) + { + /* ...by the addition of a further "Basic Setup" + * category at root level... + */ + tree->SetAttribute( name_key, "Basic Setup" ); + if( SetupToolInvoked ) + /* + * ...which becomes the default group selection when + * running the installer from within the setup tool. + */ + tree->SetAttribute( select_key, value_true ); + load_package_group_hierarchy( PackageTreeView, TVI_ROOT, tree ); + + /* The XML node, from which we created the "Basic Setup" + * group entry, has not been attached to the in-core image + * of the XML database; we have no need to keep it. + */ + delete tree; + } + } } static bool is_child_affiliate( HWND tree, TVITEM *ref, const char *name ) @@ -322,6 +352,16 @@ static bool is_child_affiliate( HWND tree, TVITEM *ref, const char *name ) return false; } +static inline long group_attributes( HWND tree, TVITEM *ref ) +{ + /* Helper to retrieve the application specific attributes + * which are associated with a package group tree item. + */ + ref->mask = TVIF_PARAM; + TreeView_GetItem( tree, ref ); + return ref->lParam; +} + static inline bool is_affiliated( HWND tree, const char *name ) { /* Helper to initiate a determination if a specified package @@ -331,11 +371,11 @@ static inline bool is_affiliated( HWND tree, const char *name ) */ TVITEM ref; if( ((ref.hItem = TreeView_GetSelection( tree )) == NULL) - || (ref.hItem == TreeView_GetRoot( tree )) ) + || ((group_attributes( tree, &ref ) & PKG_AFFILIATE_ALL) != 0) ) /* * Before proceeding further, we may note that ANY group name - * is considered to be IMPLICITLY matched, at the root of the - * package group tree. + * is considered to be IMPLICITLY matched, for specified groups + * (nominally at the root) within the package group tree. */ return true; ----------------------------------------------------------------------- Summary of changes: ChangeLog | 52 +++++++++++++++++++++++++++++++++++++++++ Makefile.in | 17 ++++++++---- src/dllhook.cpp | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/guimain.cpp | 6 ++++ src/guimain.h | 1 + src/pkgtree.cpp | 50 +++++++++++++++++++++++++++++++++++---- src/setup.cpp | 26 ++++++++++---------- src/setup.h | 3 +- 8 files changed, 199 insertions(+), 25 deletions(-) hooks/post-receive -- Repository: mingw-get |