Commit 2df1e3ad authored by Claes Sjofors's avatar Claes Sjofors

Build sequence for copying files from improved

parent f3577204
...@@ -117,7 +117,11 @@ void dcli_save_file_versions( char *fname); ...@@ -117,7 +117,11 @@ void dcli_save_file_versions( char *fname);
#define DCLI_DIR_SEARCH_END 2 #define DCLI_DIR_SEARCH_END 2
int dcli_search_file( const char *file_name , int dcli_search_file( const char *file_name,
char *found_file,
int new_search);
int dcli_search_directory( const char *file_name,
char *found_file, char *found_file,
int new_search); int new_search);
...@@ -133,6 +137,9 @@ int dcli_parse_filename( const char *filename, ...@@ -133,6 +137,9 @@ int dcli_parse_filename( const char *filename,
char *type, char *type,
int *version); int *version);
int dcli_create_directory( char *path);
int dcli_delete_directory( char *path, int force);
/* Functions i module co_dcli_struct */ /* Functions i module co_dcli_struct */
typedef struct s_element { typedef struct s_element {
......
...@@ -71,6 +71,10 @@ ...@@ -71,6 +71,10 @@
# include <ctype.h> # include <ctype.h>
# include <string.h> # include <string.h>
# include <dirent.h> # include <dirent.h>
# include <sys/stat.h>
# include <sys/types.h>
# include <unistd.h>
# include <errno.h>
#endif #endif
#include "pwr.h" #include "pwr.h"
...@@ -87,31 +91,18 @@ ...@@ -87,31 +91,18 @@
#define ODD(a) (((int)(a) & 1) != 0) #define ODD(a) (((int)(a) & 1) != 0)
#define EVEN(a) (((int)(a) & 1) == 0) #define EVEN(a) (((int)(a) & 1) == 0)
/* Search for one or several files.
/************************************************************************* * The file name can contain wildcard, *.
* * Should be called for the first time with new = DCLI_DIR_SEARCH_INIT.
* Name: dcli_search_file * If more then one file is searched for, the next files are found with
* * calls where new = DCLI_DIR_SEARCH_NEXT. When the search is finished,
* Typ int * one call with DCLI_DIR_SEARCH_END should be made.
* * Two parallell searches are not allowed as data is stored internally.
* Typ Parameter IOGF Beskrivning
* *
* Beskrivning: * file_name File name, can contain wildcard.
* Sker efter en fil. * found_file Found file.
* Filnamnet kan innehlla wildcard. * new DCLI_DIR_SEARCH_INIT, DCLI_DIR_SEARCH_NEXT or DCLI_DIR_SEARCH_END.
* Vid skning av flera filer mha wildcard anropas */
* rutinen frsta gngen med new=1 och sedan med new=0.
* Tv skningar med wildcard kan ej pg parallellt efter
* som skvillkor lagras i interna variabler.
*
* Parametrar
* file_name *char I Namn p fil, kan innehlla wildcard.
* found_file *char O Hittad fil.
* new int I 1 vid ej wildcard skning och vid frsta
* wildcardskningsanropet. 0 vid skning
* efter fler filer med samma wildcard.
*
**************************************************************************/
int dcli_search_file( const char *name , int dcli_search_file( const char *name ,
char *found_file, char *found_file,
...@@ -291,6 +282,119 @@ int dcli_search_file( const char *name , ...@@ -291,6 +282,119 @@ int dcli_search_file( const char *name ,
return DCLI__SUCCESS; return DCLI__SUCCESS;
} }
/* Search for one or several directories.
* The file name can contain wildcard, *.
* Should be called for the first time with new = DCLI_DIR_SEARCH_INIT.
* If more then one file is searched for, the next files are found with
* calls where new = DCLI_DIR_SEARCH_NEXT. When the search is finished,
* one call with DCLI_DIR_SEARCH_END should be made.
* Two parallell searches are not allowed as data is stored internally.
*
* file_name File name, can contain wildcard.
* found_file Found file.
* new DCLI_DIR_SEARCH_INIT, DCLI_DIR_SEARCH_NEXT or DCLI_DIR_SEARCH_END.
*/
int dcli_search_directory( const char *name ,
char *found_file,
int new)
{
#if defined OS_POSIX
static DIR *directory;
static char pattern[200];
static char dir[200];
char dev[2], dir2[200], file[80], type[80];
char cwd[200];
int version;
int found;
static int wildcard;
struct dirent *dir_entry;
if ( new == DCLI_DIR_SEARCH_INIT)
{
dcli_parse_filename( name, dev, dir, file, type, &version);
dcli_replace_env( dir, dir2);
if ( dir2[0] != '/')
{
/* Add cwd to the path */
if ( getcwd( cwd, sizeof(cwd)) == NULL)
return DCLI__NOFILE;
strcpy( dir, cwd);
if ( dir[strlen(dir)-1] != '/')
strcat( dir, "/");
strcat( dir, dir2);
}
else
strcpy( dir, dir2);
directory = opendir( dir);
if ( directory == NULL)
return DCLI__NOFILE;
strcpy( pattern, file);
strcat( pattern, type);
if ( strchr( pattern, '*') != 0)
wildcard = 1;
else
wildcard = 0;
// if ( wildcard)
// dcli_toupper( pattern, pattern);
}
if ( new == DCLI_DIR_SEARCH_INIT || new == DCLI_DIR_SEARCH_NEXT)
{
found = 0;
while ( (dir_entry = readdir( directory)) != NULL)
{
struct stat st;
if ( strcmp( dir_entry->d_name, ".") == 0 ||
strcmp( dir_entry->d_name, "..") == 0)
continue;
if ( fstatat( dirfd(directory), dir_entry->d_name, &st, 0) < 0)
continue;
if ( !S_ISDIR(st.st_mode))
continue;
if ( wildcard) {
if ( dcli_wildcard( pattern, dir_entry->d_name) == 0) {
strcpy( found_file, dir);
strcat( found_file, dir_entry->d_name);
found = 1;
}
}
else {
if ( strcmp( pattern, dir_entry->d_name) == 0) {
strcpy( found_file, dir);
strcat( found_file, dir_entry->d_name);
found = 1;
}
}
if ( found)
break;
}
if ( !found)
return DCLI__NOFILE;
else
return DCLI__SUCCESS;
}
if ( new == DCLI_DIR_SEARCH_END) {
if ( directory)
closedir( directory);
}
return DCLI__SUCCESS;
#else
return 0;
#endif
return DCLI__SUCCESS;
}
/************************************************************************* /*************************************************************************
* *
...@@ -541,3 +645,31 @@ int dcli_parse_filename( const char *filename, ...@@ -541,3 +645,31 @@ int dcli_parse_filename( const char *filename,
#endif #endif
} }
int dcli_create_directory( char *path)
{
pwr_tFileName fname;
dcli_translate_filename( fname, path);
if ( mkdir( fname, 0777) != 0)
return 0;
return 1;
}
int dcli_delete_directory( char *path, int force)
{
pwr_tFileName fname;
dcli_translate_filename( fname, path);
if ( rmdir( fname) != 0) {
if ( !force)
return 0;
if ( force && errno == ENOTEMPTY) {
pwr_tCmd cmd;
sprintf( cmd, "rm -r %s", path);
system( cmd);
}
}
return 1;
}
...@@ -1949,6 +1949,7 @@ void WttGtk::update_options_form() ...@@ -1949,6 +1949,7 @@ void WttGtk::update_options_form()
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(build_debug_w), build_debug ? TRUE : FALSE); gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(build_debug_w), build_debug ? TRUE : FALSE);
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(build_crossref_w), build_crossref ? TRUE : FALSE); gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(build_crossref_w), build_crossref ? TRUE : FALSE);
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(build_manual_w), build_manual ? TRUE : FALSE); gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(build_manual_w), build_manual ? TRUE : FALSE);
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(build_nocopy_w), build_nocopy ? TRUE : FALSE);
} }
...@@ -1972,15 +1973,16 @@ void WttGtk::set_options() ...@@ -1972,15 +1973,16 @@ void WttGtk::set_options()
build_debug = (int) gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(build_debug_w)); build_debug = (int) gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(build_debug_w));
build_crossref = (int) gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(build_crossref_w)); build_crossref = (int) gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(build_crossref_w));
build_manual = (int) gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(build_manual_w)); build_manual = (int) gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(build_manual_w));
build_nocopy = (int) gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(build_nocopy_w));
wnav->set_options( enable_comment, show_class, show_alias, wnav->set_options( enable_comment, show_class, show_alias,
show_descrip, show_objref, show_objxref, show_descrip, show_objref, show_objxref,
show_attrref, show_attrxref, build_force, build_debug, show_attrref, show_attrxref, build_force, build_debug,
build_crossref, build_manual); build_crossref, build_manual, build_nocopy);
wnavnode->set_options( enable_comment, show_class, show_alias, wnavnode->set_options( enable_comment, show_class, show_alias,
show_descrip, show_objref, show_objxref, show_descrip, show_objref, show_objxref,
show_attrref, show_attrxref, build_force, build_debug, show_attrref, show_attrxref, build_force, build_debug,
build_crossref, build_manual); build_crossref, build_manual, build_nocopy);
} }
// Callbacks from the options form // Callbacks from the options form
...@@ -3011,9 +3013,9 @@ WttGtk::WttGtk( ...@@ -3011,9 +3013,9 @@ WttGtk::WttGtk(
gtk_paned_set_position( GTK_PANED(wnav_paned), window_width / 2); gtk_paned_set_position( GTK_PANED(wnav_paned), window_width / 2);
wnav->get_options( &enable_comment, &show_class, &show_alias, wnav->get_options( &enable_comment, &show_class, &show_alias,
&show_descrip, &show_objref, &show_objxref, &show_descrip, &show_objref, &show_objxref,
&show_attrref, &show_attrxref, &build_force, &build_debug, &show_attrref, &show_attrxref, &build_force, &build_debug,
&build_crossref, &build_manual); &build_crossref, &build_manual, &build_nocopy);
if ( wbctx && volid) { if ( wbctx && volid) {
wnav->volume_attached( wbctx, ldhses, 0); wnav->volume_attached( wbctx, ldhses, 0);
...@@ -3140,6 +3142,7 @@ void WttGtk::create_options_dialog() ...@@ -3140,6 +3142,7 @@ void WttGtk::create_options_dialog()
build_debug_w = gtk_check_button_new_with_label( "Debug"); build_debug_w = gtk_check_button_new_with_label( "Debug");
build_crossref_w = gtk_check_button_new_with_label( "Crossreference"); build_crossref_w = gtk_check_button_new_with_label( "Crossreference");
build_manual_w = gtk_check_button_new_with_label( "Manual"); build_manual_w = gtk_check_button_new_with_label( "Manual");
build_nocopy_w = gtk_check_button_new_with_label( "Disable Copy");
GtkWidget *build_vbox = gtk_vbox_new( FALSE, 0); GtkWidget *build_vbox = gtk_vbox_new( FALSE, 0);
gtk_box_pack_start( GTK_BOX(build_vbox), build_label, FALSE, FALSE, 15); gtk_box_pack_start( GTK_BOX(build_vbox), build_label, FALSE, FALSE, 15);
...@@ -3147,6 +3150,7 @@ void WttGtk::create_options_dialog() ...@@ -3147,6 +3150,7 @@ void WttGtk::create_options_dialog()
gtk_box_pack_start( GTK_BOX(build_vbox), build_debug_w, FALSE, FALSE, 7); gtk_box_pack_start( GTK_BOX(build_vbox), build_debug_w, FALSE, FALSE, 7);
gtk_box_pack_start( GTK_BOX(build_vbox), build_crossref_w, FALSE, FALSE, 7); gtk_box_pack_start( GTK_BOX(build_vbox), build_crossref_w, FALSE, FALSE, 7);
gtk_box_pack_start( GTK_BOX(build_vbox), build_manual_w, FALSE, FALSE, 7); gtk_box_pack_start( GTK_BOX(build_vbox), build_manual_w, FALSE, FALSE, 7);
gtk_box_pack_start( GTK_BOX(build_vbox), build_nocopy_w, FALSE, FALSE, 7);
GtkWidget *hbox = gtk_hbox_new( FALSE, 0); GtkWidget *hbox = gtk_hbox_new( FALSE, 0);
gtk_box_pack_start( GTK_BOX(hbox), hier_vbox, FALSE, FALSE, 50); gtk_box_pack_start( GTK_BOX(hbox), hier_vbox, FALSE, FALSE, 50);
......
...@@ -99,6 +99,7 @@ class WttGtk : public Wtt { ...@@ -99,6 +99,7 @@ class WttGtk : public Wtt {
GtkWidget *build_debug_w; GtkWidget *build_debug_w;
GtkWidget *build_crossref_w; GtkWidget *build_crossref_w;
GtkWidget *build_manual_w; GtkWidget *build_manual_w;
GtkWidget *build_nocopy_w;
GtkWidget *menu_save_w; GtkWidget *menu_save_w;
GtkWidget *menu_revert_w; GtkWidget *menu_revert_w;
GtkWidget *menu_cut_w; GtkWidget *menu_cut_w;
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
**/ **/
#include <vector>
#include "pwr.h" #include "pwr.h"
#include "pwr_baseclasses.h" #include "pwr_baseclasses.h"
#include "cow_msgwindow.h" #include "cow_msgwindow.h"
...@@ -60,6 +61,18 @@ ...@@ -60,6 +61,18 @@
#include "ge_graph.h" #include "ge_graph.h"
#include "ge.h" #include "ge.h"
class build_dir
{
public:
build_dir() {}
build_dir( const build_dir& x) {
strcpy( src_dir, x.src_dir);
strcpy( dest_dir, x.dest_dir);
}
pwr_tFileName src_dir;
pwr_tFileName dest_dir;
};
void wb_build::classlist( pwr_tCid cid) void wb_build::classlist( pwr_tCid cid)
{ {
pwr_tStatus sumsts; pwr_tStatus sumsts;
...@@ -228,103 +241,157 @@ void wb_build::node( char *nodename, void *volumelist, int volumecnt) ...@@ -228,103 +241,157 @@ void wb_build::node( char *nodename, void *volumelist, int volumecnt)
// if ( cdh_NoCaseStrcmp( node, currentnode) == 0) // if ( cdh_NoCaseStrcmp( node, currentnode) == 0)
{ {
pwr_tFileName src_fname, dest_fname; pwr_tFileName src_fname, dest_fname;
pwr_tCmd cmd;
pwr_tTime dest_time, src_time;
// Copy xtt_help.dat from $pwrp_cnf to $pwrp_load // Copy node directories from $pwrp_cnf to $pwrp_load
sprintf( src_fname, "$pwrp_cnf/%s/xtt_help.dat", node); vector<build_dir> users_dirv;
dcli_translate_filename( src_fname, src_fname); build_dir node_dir;
m_sts = dcli_file_time( src_fname, &src_time);
if ( evenSts()) { pwr_tFileName src_dir, dest_dir, found_src_dir, found_dest_dir;
strcpy( src_fname, "$pwrp_cnf/xtt_help.dat"); pwr_tStatus src_sts, dest_sts;
dcli_translate_filename( src_fname, src_fname);
m_sts = dcli_file_time( src_fname, &src_time); sprintf( node_dir.src_dir, "$pwrp_cnf/%s", node);
if ( evenSts()) { src_sts = dcli_search_directory( node_dir.src_dir, found_src_dir, DCLI_DIR_SEARCH_INIT);
char msg[200]; dcli_search_directory( node_dir.src_dir, found_src_dir, DCLI_DIR_SEARCH_END);
sprintf( msg, "File is missing $pwrp_cnf/xtt_help.dat");
MsgWindow::message('E', msg, msgw_ePop_Yes); sprintf( node_dir.dest_dir, "$pwrp_load/%s", node);
} dest_sts = dcli_search_directory( node_dir.dest_dir, found_dest_dir, DCLI_DIR_SEARCH_INIT);
dcli_search_directory( node_dir.dest_dir, found_dest_dir, DCLI_DIR_SEARCH_END);
if ( ODD(src_sts) && EVEN(dest_sts))
// Create destination directory
dcli_create_directory( node_dir.dest_dir);
else if ( EVEN(src_sts) && ODD(dest_sts))
// Delete destination directory
dcli_delete_directory( node_dir.dest_dir, 1);
sprintf( src_dir, "%s/*", node_dir.src_dir);
for ( src_sts = dcli_search_directory( src_dir, found_src_dir, DCLI_DIR_SEARCH_INIT);
ODD(src_sts);
src_sts = dcli_search_directory( src_dir, found_src_dir, DCLI_DIR_SEARCH_NEXT)) {
build_dir dir;
char *s = strrchr( found_src_dir, '/');
if ( !s) continue;
sprintf( dest_dir, "%s/%s", node_dir.dest_dir, s+1);
strcpy( dir.src_dir, found_src_dir);
strcpy( dir.dest_dir, dest_dir);
users_dirv.push_back(dir);
} }
dcli_search_directory( src_dir, found_src_dir, DCLI_DIR_SEARCH_END);
if ( oddSts()) { // Files on $pwrp_cnf
strcpy( dest_fname, "$pwrp_load/xtt_help.dat");
dcli_translate_filename( dest_fname, dest_fname); // Update $pwrp_cnf/xtt_help.dat
m_sts = dcli_file_time( dest_fname, &dest_time); strcpy( src_fname, "$pwrp_cnf/xtt_help.dat");
if ( opt.force || evenSts() || src_time.tv_sec > dest_time.tv_sec) { strcpy( dest_fname, "$pwrp_load/xtt_help.dat");
sprintf( cmd, "cp %s %s", src_fname, dest_fname); update_file( dest_fname, src_fname);
system( cmd);
sprintf( cmd, "Build: Copy %s -> $pwrp_exe", src_fname);
MsgWindow::message( 'I', cmd, msgw_ePop_No);
m_sts = PWRB__SUCCESS;
}
else
m_sts = PWRB__NOBUILT;
}
if ( sumsts == PWRB__NOBUILT && m_sts != PWRB__NOBUILT) if ( sumsts == PWRB__NOBUILT && m_sts != PWRB__NOBUILT)
sumsts = m_sts; sumsts = m_sts;
// Copy pwrp_alias.dat from $pwrp_cnf to $pwrp_load // Update $pwrp_cnf/xtt_setup.rtt_com
sprintf( src_fname, "$pwrp_cnf/%s/pwrp_alias.dat", node); strcpy( src_fname, "$pwrp_cnf/xtt_setup.rtt_com");
dcli_translate_filename( src_fname, src_fname); strcpy( dest_fname, "$pwrp_load/xtt_setup.rtt_com");
m_sts = dcli_file_time( src_fname, &src_time); update_file( dest_fname, src_fname);
if ( evenSts()) { if ( sumsts == PWRB__NOBUILT && m_sts != PWRB__NOBUILT)
strcpy( src_fname, "$pwrp_cnf/pwrp_alias.dat"); sumsts = m_sts;
dcli_translate_filename( src_fname, src_fname);
m_sts = dcli_file_time( src_fname, &src_time);
}
if ( oddSts()) {
strcpy( dest_fname, "$pwrp_load/pwrp_alias.dat");
dcli_translate_filename( dest_fname, dest_fname);
m_sts = dcli_file_time( dest_fname, &dest_time);
if ( opt.force || evenSts() || src_time.tv_sec > dest_time.tv_sec) {
sprintf( cmd, "cp %s %s", src_fname, dest_fname);
system( cmd);
sprintf( cmd, "Build: Copy %s -> $pwrp_load", src_fname);
MsgWindow::message( 'I', cmd, msgw_ePop_No);
m_sts = PWRB__SUCCESS;
}
else
m_sts = PWRB__NOBUILT;
}
else
m_sts = PWRB__NOBUILT;
// Update $pwrp_cnf/Rt_xtt
strcpy( src_fname, "$pwrp_cnf/Rt_xtt");
strcpy( dest_fname, "$pwrp_load/Rt_xtt");
update_file( dest_fname, src_fname);
if ( sumsts == PWRB__NOBUILT && m_sts != PWRB__NOBUILT) if ( sumsts == PWRB__NOBUILT && m_sts != PWRB__NOBUILT)
sumsts = m_sts; sumsts = m_sts;
// Copy ld_appl_...txt from $pwrp_cnf to $pwrp_load // Update $pwrp_cnf/pwrp_stop.sh
sprintf( src_fname, pwr_cNameAppl, "$pwrp_cnf", cdh_Low(node), bussid); strcpy( src_fname, "$pwrp_cnf/pwrp_stop.sh");
dcli_translate_filename( src_fname, src_fname); strcpy( dest_fname, "$pwrp_load/pwrp_stop.sh");
m_sts = dcli_file_time( src_fname, &src_time); update_file( dest_fname, src_fname);
if ( evenSts()) { if ( sumsts == PWRB__NOBUILT && m_sts != PWRB__NOBUILT)
char dir[80]; sumsts = m_sts;
strcpy( dir, "$pwrp_cnf/");
sprintf( src_fname, pwr_cNameAppl, dir, cdh_Low(node), bussid);
dcli_translate_filename( src_fname, src_fname);
m_sts = dcli_file_time( src_fname, &src_time);
}
if ( oddSts()) { // Files on $pwrp_cnf/node
sprintf( dest_fname, pwr_cNameAppl, "$pwrp_load/", cdh_Low(node), bussid);
dcli_translate_filename( dest_fname, dest_fname); // Update $pwrp_cnf/node/xtt_help.dat
m_sts = dcli_file_time( dest_fname, &dest_time); sprintf( src_fname, "%s/xtt_help.dat", node_dir.src_dir);
if ( opt.force || evenSts() || src_time.tv_sec > dest_time.tv_sec) { sprintf( dest_fname, "%s/xtt_help.dat", node_dir.dest_dir);
sprintf( cmd, "cp %s %s", src_fname, dest_fname); update_file( dest_fname, src_fname);
system( cmd); if ( sumsts == PWRB__NOBUILT && m_sts != PWRB__NOBUILT)
sprintf( cmd, "Build: %s -> $pwrp_load", src_fname); sumsts = m_sts;
MsgWindow::message( 'I', cmd, msgw_ePop_No);
m_sts = PWRB__SUCCESS; // Update $pwrp_cnf/node/xtt_setup.rtt_com
} sprintf( src_fname, "%s/xtt_setup.rtt_com", node_dir.src_dir);
else sprintf( dest_fname, "%s/xtt_setup.rtt_com", node_dir.dest_dir);
m_sts = PWRB__NOBUILT; update_file( dest_fname, src_fname);
if ( sumsts == PWRB__NOBUILT && m_sts != PWRB__NOBUILT)
sumsts = m_sts;
// Update $pwrp_cnf/node/'node'_xtthelp.dat
sprintf( src_fname, "%s/%s_xtthelp.dat", node_dir.src_dir, node);
sprintf( dest_fname, "%s/%s_xtthelp.dat", node_dir.dest_dir, node);
update_file( dest_fname, src_fname);
if ( sumsts == PWRB__NOBUILT && m_sts != PWRB__NOBUILT)
sumsts = m_sts;
// Update $pwrp_cnf/node/Rt_xtt
sprintf( src_fname, "%s/Rt_xtt", node_dir.src_dir);
sprintf( dest_fname, "%s/Rt_xtt", node_dir.dest_dir);
update_file( dest_fname, src_fname);
if ( sumsts == PWRB__NOBUILT && m_sts != PWRB__NOBUILT)
sumsts = m_sts;
// Update $pwrp_cnf/node/pwrp_stop.sh
sprintf( src_fname, "%s/pwrp_stop.sh", node_dir.src_dir);
sprintf( dest_fname, "%s/pwrp_stop.sh", node_dir.dest_dir);
update_file( dest_fname, src_fname);
if ( sumsts == PWRB__NOBUILT && m_sts != PWRB__NOBUILT)
sumsts = m_sts;
for ( unsigned int i = 0; i < users_dirv.size(); i++) {
dest_sts = dcli_search_directory( users_dirv[i].dest_dir, found_dest_dir, DCLI_DIR_SEARCH_INIT);
dcli_search_directory( users_dirv[i].dest_dir, found_dest_dir, DCLI_DIR_SEARCH_END);
if ( EVEN(dest_sts))
// Create destination directory
dcli_create_directory( users_dirv[i].dest_dir);
// Update $pwrp_cnf/node/user/xtt_help.dat
sprintf( src_fname, "%s/%s", users_dirv[i].src_dir, "xtt_help.dat");
sprintf( dest_fname, "%s/%s", users_dirv[i].dest_dir, "xtt_help.dat");
update_file( dest_fname, src_fname);
if ( sumsts == PWRB__NOBUILT && m_sts != PWRB__NOBUILT)
sumsts = m_sts;
// Update $pwrp_cnf/node/user/xtt_setup.rtt_com
sprintf( src_fname, "%s/%s", users_dirv[i].src_dir, "xtt_setup.rtt_com");
sprintf( dest_fname, "%s/%s", users_dirv[i].dest_dir, "xtt_setup.rtt_com");
update_file( dest_fname, src_fname);
if ( sumsts == PWRB__NOBUILT && m_sts != PWRB__NOBUILT)
sumsts = m_sts;
// Update $pwrp_cnf/node/user/Rt_xtt
sprintf( src_fname, "%s/%s", users_dirv[i].src_dir, "Rt_xtt");
sprintf( dest_fname, "%s/%s", users_dirv[i].dest_dir, "Rt_xtt");
update_file( dest_fname, src_fname);
if ( sumsts == PWRB__NOBUILT && m_sts != PWRB__NOBUILT)
sumsts = m_sts;
} }
else
m_sts = PWRB__NOBUILT;
// Copy pwrp_alias.dat from $pwrp_cnf to $pwrp_load
strcpy( src_fname, "$pwrp_cnf/pwrp_alias.dat");
strcpy( dest_fname, "$pwrp_load/pwrp_alias.dat");
update_file( dest_fname, src_fname);
if ( sumsts == PWRB__NOBUILT && m_sts != PWRB__NOBUILT)
sumsts = m_sts;
// Copy ld_appl_...txt from $pwrp_cnf to $pwrp_load
sprintf( src_fname, pwr_cNameAppl, "$pwrp_cnf/", cdh_Low(node), bussid);
sprintf( dest_fname, pwr_cNameAppl, "$pwrp_load/", cdh_Low(node), bussid);
update_file( dest_fname, src_fname);
if ( sumsts == PWRB__NOBUILT && m_sts != PWRB__NOBUILT) if ( sumsts == PWRB__NOBUILT && m_sts != PWRB__NOBUILT)
sumsts = m_sts; sumsts = m_sts;
} }
export_files( bld_ePass_AfterNode); export_files( bld_ePass_AfterNode);
...@@ -765,7 +832,7 @@ void wb_build::xttgraph( pwr_tOid oid) ...@@ -765,7 +832,7 @@ void wb_build::xttgraph( pwr_tOid oid)
strcat( dest_fname, action); strcat( dest_fname, action);
dcli_translate_filename( dest_fname, dest_fname); dcli_translate_filename( dest_fname, dest_fname);
m_sts = dcli_file_time( dest_fname, &dest_time); m_sts = dcli_file_time( dest_fname, &dest_time);
if ( opt.force || evenSts() || src_time.tv_sec > dest_time.tv_sec) { if ( !opt.nocopy && (opt.force || evenSts() || src_time.tv_sec > dest_time.tv_sec)) {
sprintf( cmd, "cp %s %s", src_fname, dest_fname); sprintf( cmd, "cp %s %s", src_fname, dest_fname);
system( cmd); system( cmd);
sprintf( cmd, "Build: XttGraph copy $pwrp_pop/%s -> $pwrp_exe", action); sprintf( cmd, "Build: XttGraph copy $pwrp_pop/%s -> $pwrp_exe", action);
...@@ -1020,7 +1087,7 @@ void wb_build::webgraph( pwr_tOid oid) ...@@ -1020,7 +1087,7 @@ void wb_build::webgraph( pwr_tOid oid)
dcli_translate_filename( dest_fname, dest_fname); dcli_translate_filename( dest_fname, dest_fname);
m_sts = dcli_file_time( dest_fname, &dest_time); m_sts = dcli_file_time( dest_fname, &dest_time);
if ( opt.force || evenSts() || src_time.tv_sec > dest_time.tv_sec) { if ( !opt.nocopy && (opt.force || evenSts() || src_time.tv_sec > dest_time.tv_sec)) {
sprintf( cmd, "cp %s %s", src_fname, dest_fname); sprintf( cmd, "cp %s %s", src_fname, dest_fname);
system( cmd); system( cmd);
sprintf( cmd, "Build: WebGraph copy $pwrp_pop/%s -> $pwrp_web", graph_name); sprintf( cmd, "Build: WebGraph copy $pwrp_pop/%s -> $pwrp_web", graph_name);
...@@ -1050,6 +1117,9 @@ void wb_build::appgraph( pwr_tOid oid) ...@@ -1050,6 +1117,9 @@ void wb_build::appgraph( pwr_tOid oid)
int hierarchy_found = 0; int hierarchy_found = 0;
char *s; char *s;
if ( opt.nocopy)
return;
wb_object o = m_session.object(oid); wb_object o = m_session.object(oid);
if ( !o) { if ( !o) {
m_sts = o.sts(); m_sts = o.sts();
...@@ -1107,7 +1177,7 @@ void wb_build::appgraph( pwr_tOid oid) ...@@ -1107,7 +1177,7 @@ void wb_build::appgraph( pwr_tOid oid)
dcli_translate_filename( dest_fname, dest_fname); dcli_translate_filename( dest_fname, dest_fname);
m_sts = dcli_file_time( dest_fname, &dest_time); m_sts = dcli_file_time( dest_fname, &dest_time);
if ( opt.force || evenSts() || src_time.tv_sec > dest_time.tv_sec) { if ( !opt.nocopy && (opt.force || evenSts() || src_time.tv_sec > dest_time.tv_sec)) {
sprintf( cmd, "cp %s %s", src_fname, dest_fname); sprintf( cmd, "cp %s %s", src_fname, dest_fname);
system( cmd); system( cmd);
sprintf( cmd, "Build: AppGraph copy $pwrp_pop/%s -> $pwrp_exe", graph_name); sprintf( cmd, "Build: AppGraph copy $pwrp_pop/%s -> $pwrp_exe", graph_name);
...@@ -1447,7 +1517,7 @@ void wb_build::classdef( pwr_tOid oid) ...@@ -1447,7 +1517,7 @@ void wb_build::classdef( pwr_tOid oid)
strcat( dest_fname, action); strcat( dest_fname, action);
dcli_translate_filename( dest_fname, dest_fname); dcli_translate_filename( dest_fname, dest_fname);
m_sts = dcli_file_time( dest_fname, &dest_time); m_sts = dcli_file_time( dest_fname, &dest_time);
if ( opt.force || evenSts() || src_time.tv_sec > dest_time.tv_sec) { if ( !opt.nocopy && (opt.force || evenSts() || src_time.tv_sec > dest_time.tv_sec)) {
sprintf( cmd, "cp %s %s", src_fname, dest_fname); sprintf( cmd, "cp %s %s", src_fname, dest_fname);
system( cmd); system( cmd);
sprintf( cmd, "Build: ClassDef copy $pwrp_pop/%s -> $pwrp_exe", action); sprintf( cmd, "Build: ClassDef copy $pwrp_pop/%s -> $pwrp_exe", action);
...@@ -1730,3 +1800,35 @@ void wb_build::export_import_files( int type, bld_ePass pass) ...@@ -1730,3 +1800,35 @@ void wb_build::export_import_files( int type, bld_ePass pass)
is.close(); is.close();
} }
// Copy source file to target if needed
void wb_build::update_file( char *dest, char *src)
{
pwr_tFileName src_fname, dest_fname;
pwr_tTime dest_time, src_time;
if ( opt.nocopy) {
m_sts = PWRB__NOBUILT;
return;
}
dcli_translate_filename( src_fname, src);
m_sts = dcli_file_time( src_fname, &src_time);
if ( oddSts()) {
dcli_translate_filename( dest_fname, dest);
m_sts = dcli_file_time( dest_fname, &dest_time);
if ( opt.force || evenSts() || src_time.tv_sec > dest_time.tv_sec) {
pwr_tCmd cmd;
sprintf( cmd, "cp -a %s %s", src_fname, dest_fname);
system( cmd);
sprintf( cmd, "Build: Copy %s -> %s", src, dest);
MsgWindow::message( 'I', cmd, msgw_ePop_No);
m_sts = PWRB__SUCCESS;
}
else
m_sts = PWRB__NOBUILT;
}
else
m_sts = PWRB__NOBUILT;
}
...@@ -82,6 +82,7 @@ class wb_build : public wb_status ...@@ -82,6 +82,7 @@ class wb_build : public wb_status
void export_import_files( int type, bld_ePass pass); void export_import_files( int type, bld_ePass pass);
void export_files( bld_ePass pass) { export_import_files(bld_eType_Export, pass);} void export_files( bld_ePass pass) { export_import_files(bld_eType_Export, pass);}
void import_files( bld_ePass pass) { export_import_files(bld_eType_Import, pass);} void import_files( bld_ePass pass) { export_import_files(bld_eType_Import, pass);}
void update_file( char *dest, char *src);
wb_build_opt opt; wb_build_opt opt;
wb_session m_session; wb_session m_session;
......
...@@ -40,11 +40,12 @@ ...@@ -40,11 +40,12 @@
class wb_build_opt class wb_build_opt
{ {
public: public:
wb_build_opt() : force(0), debug(0), crossref(0), manual(0) {} wb_build_opt() : force(0), debug(0), crossref(0), manual(0), nocopy(0) {}
int force; int force;
int debug; int debug;
int crossref; int crossref;
int manual; int manual;
int nocopy;
}; };
#endif #endif
...@@ -2273,23 +2273,32 @@ pwr_tStatus lfu_SaveDirectoryVolume( ...@@ -2273,23 +2273,32 @@ pwr_tStatus lfu_SaveDirectoryVolume(
fprintf( file, "appl %s W "pwr_cNameAppl" $pwrp_load/\n", fprintf( file, "appl %s W "pwr_cNameAppl" $pwrp_load/\n",
nodename_ptr, "$pwrp_cnf/", nodename_ptr, *bus_number_ptr); nodename_ptr, "$pwrp_cnf/", nodename_ptr, *bus_number_ptr);
if ( *components_ptr & pwr_mDistrComponentMask_PwrpAliasFile) if ( *components_ptr & pwr_mDistrComponentMask_PwrpAliasFile)
fprintf( file, "appl %s W $pwrp_cnf/%s/pwrp_alias.dat:$pwrp_cnf/pwrp_alias.dat $pwrp_load/pwrp_alias.dat\n", fprintf( file, "appl %s W $pwrp_load/pwrp_alias.dat $pwrp_load/pwrp_alias.dat\n",
nodename_ptr, nodename_ptr); nodename_ptr);
if ( *components_ptr & pwr_mDistrComponentMask_IncludeFiles) if ( *components_ptr & pwr_mDistrComponentMask_IncludeFiles)
fprintf( file, "appl %s W $pwrp_inc/*.h\n", nodename_ptr); fprintf( file, "appl %s W $pwrp_inc/*.h\n", nodename_ptr);
if ( *components_ptr & pwr_mDistrComponentMask_GraphFiles) if ( *components_ptr & pwr_mDistrComponentMask_GraphFiles)
fprintf( file, "appl %s W $pwrp_exe/*.pwg\n", nodename_ptr); fprintf( file, "appl %s W $pwrp_exe/*.pwg\n", nodename_ptr);
if ( *components_ptr & pwr_mDistrComponentMask_XMLFiles) if ( *components_ptr & pwr_mDistrComponentMask_XMLFiles)
fprintf( file, "appl %s W $pwrp_load/*.xml\n", nodename_ptr); fprintf( file, "appl %s W $pwrp_load/*.xml\n", nodename_ptr);
if ( *components_ptr & pwr_mDistrComponentMask_XttHelpFile) if ( *components_ptr & pwr_mDistrComponentMask_XttHelpFile) {
fprintf( file, "appl %s W $pwrp_cnf/%s/xtt_help.dat:$pwrp_cnf/xtt_help.dat $pwrp_load/xtt_help.dat\n", fprintf( file, "appl %s W $pwrp_cnf/%s/xtt_help.dat:$pwrp_cnf/xtt_help.dat $pwrp_load/xtt_help.dat\n",
nodename_ptr, nodename_ptr); nodename_ptr, nodename_ptr);
if ( *components_ptr & pwr_mDistrComponentMask_XttResourceFile) fprintf( file, "appl %s S $pwrp_cnf/%s/%s_xtthelp.dat $pwrp_load/%s/%s__xtthelp.dat\n",
fprintf( file, "appl %s W $pwrp_cnf/%s/b55/Rt_xtt:$pwrp_cnf/%s/Rt_xtt:$pwrp_cnf/Rt_xtt /home/b55/Rt_xtt\n", nodename_ptr, nodename_ptr, nodename_ptr, nodename_ptr, nodename_ptr);
}
if ( *components_ptr & pwr_mDistrComponentMask_XttResourceFile) {
fprintf( file, "appl %s W $pwrp_load/%s/b55/Rt_xtt:$pwrp_load/%s/Rt_xtt:$pwrp_load/Rt_xtt /home/b55/Rt_xtt\n",
nodename_ptr, nodename_ptr, nodename_ptr); nodename_ptr, nodename_ptr, nodename_ptr);
if ( *components_ptr & pwr_mDistrComponentMask_XttSetupFile) fprintf( file, "appl %s S $pwrp_load/%s/pwrp/Rt_xtt /home/pwrp/Rt_xtt\n",
fprintf( file, "appl %s W $pwrp_cnf/%s/b55/xtt_setup.rtt_com:$pwrp_cnf/%s/xtt_setup.rtt_com:$pwrp_cnf/xtt_setup.rtt_com /home/b55/xtt_setup.rtt_com\n", nodename_ptr, nodename_ptr);
}
if ( *components_ptr & pwr_mDistrComponentMask_XttSetupFile) {
fprintf( file, "appl %s W $pwrp_load/%s/b55/xtt_setup.rtt_com:$pwrp_load/%s/xtt_setup.rtt_com:$pwrp_load/xtt_setup.rtt_com /home/b55/xtt_setup.rtt_com\n",
nodename_ptr, nodename_ptr, nodename_ptr); nodename_ptr, nodename_ptr, nodename_ptr);
fprintf( file, "appl %s S $pwrp_load/%s/pwrp/xtt_setup.rtt_com /home/pwrp/xtt_setup.rtt_com\n",
nodename_ptr, nodename_ptr);
}
if ( *components_ptr & pwr_mDistrComponentMask_FlowFiles) if ( *components_ptr & pwr_mDistrComponentMask_FlowFiles)
fprintf( file, "appl %s W $pwrp_load/*.flw\n", nodename_ptr); fprintf( file, "appl %s W $pwrp_load/*.flw\n", nodename_ptr);
if ( *components_ptr & pwr_mDistrComponentMask_RHostsFile) if ( *components_ptr & pwr_mDistrComponentMask_RHostsFile)
...@@ -2307,7 +2316,7 @@ pwr_tStatus lfu_SaveDirectoryVolume( ...@@ -2307,7 +2316,7 @@ pwr_tStatus lfu_SaveDirectoryVolume(
fprintf( file, "appl %s S $pwrp_web/*.pdf\n", nodename_ptr); fprintf( file, "appl %s S $pwrp_web/*.pdf\n", nodename_ptr);
} }
if ( *components_ptr & pwr_mDistrComponentMask_PwrpStop) if ( *components_ptr & pwr_mDistrComponentMask_PwrpStop)
fprintf( file, "appl %s W $pwrp_cnf/%s/pwrp_stop.sh:$pwrp_exe/pwrp_stop.sh $pwrp_exe/pwrp_stop.sh\n", fprintf( file, "appl %s W $pwrp_load/%s/pwrp_stop.sh:$pwrp_load/pwrp_stop.sh $pwrp_exe/pwrp_stop.sh\n",
nodename_ptr, nodename_ptr); nodename_ptr, nodename_ptr);
......
...@@ -2263,6 +2263,9 @@ int WNav::setup() ...@@ -2263,6 +2263,9 @@ int WNav::setup()
new WItemLocal( this, "Build.Manual", "setup_build_manual", new WItemLocal( this, "Build.Manual", "setup_build_manual",
pwr_eType_Int32, sizeof( gbl.build.manual), 0, 1, pwr_eType_Int32, sizeof( gbl.build.manual), 0, 1,
(void *) &gbl.build.manual, NULL, flow_eDest_IntoLast); (void *) &gbl.build.manual, NULL, flow_eDest_IntoLast);
new WItemLocal( this, "Build.NoCopy", "setup_build_nocopy",
pwr_eType_Int32, sizeof( gbl.build.nocopy), 0, 1,
(void *) &gbl.build.nocopy, NULL, flow_eDest_IntoLast);
brow_ResetNodraw( brow->ctx); brow_ResetNodraw( brow->ctx);
brow_Redraw( brow->ctx, 0); brow_Redraw( brow->ctx, 0);
...@@ -2290,8 +2293,8 @@ int WNavGbl::symbolfile_exec( void *wnav) ...@@ -2290,8 +2293,8 @@ int WNavGbl::symbolfile_exec( void *wnav)
} }
void WNav::set_options( int ena_comment, int sh_class, int sh_alias, int sh_descrip, void WNav::set_options( int ena_comment, int sh_class, int sh_alias, int sh_descrip,
int sh_objref, int sh_objxref, int sh_attrref, int sh_attrxref, int sh_objref, int sh_objxref, int sh_attrref, int sh_attrxref,
int bu_force, int bu_debug, int bu_crossref, int bu_manual) int bu_force, int bu_debug, int bu_crossref, int bu_manual, int bu_nocopy)
{ {
gbl.enable_comment = ena_comment; gbl.enable_comment = ena_comment;
gbl.show_class = sh_class; gbl.show_class = sh_class;
...@@ -2305,12 +2308,13 @@ void WNav::set_options( int ena_comment, int sh_class, int sh_alias, int sh_desc ...@@ -2305,12 +2308,13 @@ void WNav::set_options( int ena_comment, int sh_class, int sh_alias, int sh_desc
gbl.build.debug = bu_debug; gbl.build.debug = bu_debug;
gbl.build.crossref = bu_crossref; gbl.build.crossref = bu_crossref;
gbl.build.manual = bu_manual; gbl.build.manual = bu_manual;
gbl.build.nocopy = bu_nocopy;
ldh_refresh( pwr_cNObjid); ldh_refresh( pwr_cNObjid);
} }
void WNav::get_options( int *ena_comment, int *sh_class, int *sh_alias, int *sh_descrip, void WNav::get_options( int *ena_comment, int *sh_class, int *sh_alias, int *sh_descrip,
int *sh_objref, int *sh_objxref, int *sh_attrref, int *sh_attrxref, int *sh_objref, int *sh_objxref, int *sh_attrref, int *sh_attrxref,
int *bu_force, int *bu_debug, int *bu_crossref, int *bu_manual) int *bu_force, int *bu_debug, int *bu_crossref, int *bu_manual, int *bu_nocopy)
{ {
*ena_comment = gbl.enable_comment; *ena_comment = gbl.enable_comment;
*sh_class = gbl.show_class; *sh_class = gbl.show_class;
...@@ -2324,6 +2328,7 @@ void WNav::get_options( int *ena_comment, int *sh_class, int *sh_alias, int *sh_ ...@@ -2324,6 +2328,7 @@ void WNav::get_options( int *ena_comment, int *sh_class, int *sh_alias, int *sh_
*bu_debug = gbl.build.debug; *bu_debug = gbl.build.debug;
*bu_crossref = gbl.build.crossref; *bu_crossref = gbl.build.crossref;
*bu_manual = gbl.build.manual; *bu_manual = gbl.build.manual;
*bu_nocopy = gbl.build.nocopy;
} }
int WNav::save_settnings( ofstream& fp) int WNav::save_settnings( ofstream& fp)
...@@ -2396,6 +2401,11 @@ int WNav::save_settnings( ofstream& fp) ...@@ -2396,6 +2401,11 @@ int WNav::save_settnings( ofstream& fp)
else else
fp << " set nobuildmanual /local" << endl; fp << " set nobuildmanual /local" << endl;
if ( gbl.build.nocopy)
fp << " set buildnocopy /local" << endl;
else
fp << " set nobuildnocopy /local" << endl;
if ( window_type == wnav_eWindowType_W1) if ( window_type == wnav_eWindowType_W1)
fp << "endif" << endl; fp << "endif" << endl;
else if ( window_type == wnav_eWindowType_W2) else if ( window_type == wnav_eWindowType_W2)
......
...@@ -404,11 +404,11 @@ class WNav : public WUtility{ ...@@ -404,11 +404,11 @@ class WNav : public WUtility{
void refresh(); void refresh();
void collapse(); void collapse();
void set_options( int ena_comment, int sh_class, int sh_alias, int sh_descrip, void set_options( int ena_comment, int sh_class, int sh_alias, int sh_descrip,
int sh_objref, int sh_objxref, int sh_attrref, int sh_attrxref, int sh_objref, int sh_objxref, int sh_attrref, int sh_attrxref,
int bu_force, int bu_debug, int bu_crossref, int bu_manual); int bu_force, int bu_debug, int bu_crossref, int bu_manual, int bu_nocopy);
void get_options( int *ena_comment, int *sh_class, int *sh_alias, int *sh_descrip, void get_options( int *ena_comment, int *sh_class, int *sh_alias, int *sh_descrip,
int *sh_objref, int *sh_objxref, int *sh_attrref, int *sh_attrxref, int *sh_objref, int *sh_objxref, int *sh_attrref, int *sh_attrxref,
int *bu_force, int *bu_debug, int *bu_crossref, int *bu_manual); int *bu_force, int *bu_debug, int *bu_crossref, int *bu_manual, int *bu_nocopy);
int save_settnings( ofstream& fp); int save_settnings( ofstream& fp);
int node_to_objid( brow_tNode node, pwr_tObjid *objid); int node_to_objid( brow_tNode node, pwr_tObjid *objid);
int unselect_objid( pwr_tObjid objid); int unselect_objid( pwr_tObjid objid);
......
...@@ -1309,6 +1309,20 @@ static int wnav_set_func( void *client_data, ...@@ -1309,6 +1309,20 @@ static int wnav_set_func( void *client_data,
else else
wnav->gbl.build.manual = 0; wnav->gbl.build.manual = 0;
} }
else if ( cdh_NoCaseStrncmp( arg1_str, "BUILDNOCOPY", strlen( arg1_str)) == 0)
{
if ( EVEN( dcli_get_qualifier( "/LOCAL", 0, 0)))
(wnav->gbl_command_cb)( wnav->parent_ctx, "SET BUILDNOCOPY");
else
wnav->gbl.build.nocopy = 1;
}
else if ( cdh_NoCaseStrncmp( arg1_str, "NOBUILDNOCOPY", strlen( arg1_str)) == 0)
{
if ( EVEN( dcli_get_qualifier( "/LOCAL", 0, 0)))
(wnav->gbl_command_cb)( wnav->parent_ctx, "SET NOBUILDNOCOPY");
else
wnav->gbl.build.nocopy = 0;
}
else if ( cdh_NoCaseStrncmp( arg1_str, "ENABLECOMMENT", strlen( arg1_str)) == 0) else if ( cdh_NoCaseStrncmp( arg1_str, "ENABLECOMMENT", strlen( arg1_str)) == 0)
{ {
if ( EVEN( dcli_get_qualifier( "/LOCAL", 0, 0))) if ( EVEN( dcli_get_qualifier( "/LOCAL", 0, 0)))
......
...@@ -186,6 +186,7 @@ class Wtt : public WUtility { ...@@ -186,6 +186,7 @@ class Wtt : public WUtility {
int build_debug; int build_debug;
int build_crossref; int build_crossref;
int build_manual; int build_manual;
int build_nocopy;
int wnav_mapped; int wnav_mapped;
int wnavnode_mapped; int wnavnode_mapped;
WUted *utedctx; WUted *utedctx;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment