Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Esteban Blanc
proview
Commits
eab989b1
Commit
eab989b1
authored
Jul 08, 2004
by
claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set owner root of plc, and improved error handling
parent
fe1b0cb4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
24 deletions
+50
-24
wb/lib/wb/src/wb_pkg.cpp
wb/lib/wb/src/wb_pkg.cpp
+50
-24
No files found.
wb/lib/wb/src/wb_pkg.cpp
View file @
eab989b1
...
...
@@ -318,27 +318,32 @@ void pkg_node::fetchFiles( bool distribute)
// Put all files in a single list
for
(
int
i
=
0
;
i
<
(
int
)
m_pattern
.
size
();
i
++
)
{
for
(
int
j
=
0
;
j
<
(
int
)
m_pattern
[
i
].
m_filelist
.
size
();
j
++
)
{
pkg_file
f
=
m_pattern
[
i
].
m_filelist
[
j
];
dcli_parse_filename
(
f
.
m_source
,
dev
,
dir
,
file
,
type
,
&
version
);
strcpy
(
f
.
m_arname
,
file
);
strcat
(
f
.
m_arname
,
type
);
// Check that this name is unic
for
(;;)
{
bool
new_name
=
false
;
for
(
int
k
=
0
;
k
<
(
int
)
m_filelist
.
size
();
k
++
)
{
if
(
strcmp
(
m_filelist
[
k
].
m_arname
,
f
.
m_arname
)
==
0
)
{
strcat
(
f
.
m_arname
,
"x"
);
new_name
=
true
;
break
;
try
{
pkg_file
f
=
m_pattern
[
i
].
m_filelist
[
j
];
dcli_parse_filename
(
f
.
m_source
,
dev
,
dir
,
file
,
type
,
&
version
);
strcpy
(
f
.
m_arname
,
file
);
strcat
(
f
.
m_arname
,
type
);
// Check that this name is unic
for
(;;)
{
bool
new_name
=
false
;
for
(
int
k
=
0
;
k
<
(
int
)
m_filelist
.
size
();
k
++
)
{
if
(
strcmp
(
m_filelist
[
k
].
m_arname
,
f
.
m_arname
)
==
0
)
{
strcat
(
f
.
m_arname
,
"x"
);
new_name
=
true
;
break
;
}
}
if
(
!
new_name
)
break
;
}
if
(
!
new_name
)
break
;
}
m_filelist
.
push_back
(
f
);
m_filelist
.
push_back
(
f
);
}
catch
(
wb_error
&
e
)
{
MsgWindow
::
message
(
'W'
,
e
.
what
().
c_str
(),
msgw_ePop_No
);
m_warnings
++
;
}
}
}
...
...
@@ -426,6 +431,16 @@ void pkg_node::fetchFiles( bool distribute)
"mv pwr_pkg.dat $pwrp_load"
<<
endl
<<
"rm -r /tmp/pkg_build"
<<
endl
;
// Change owner to root of plc, to make modification of thread prio possible
ofu
<<
"nname=`eval uname -n`"
<<
endl
<<
"tst=`eval sudo -l | grep
\"
ALL
\"
`"
<<
endl
<<
"if [
\"
$tst
\"
!=
\"\"
]; then"
<<
endl
<<
" sudo chown root $pwrp_exe/plc_$nname_*"
<<
endl
<<
" sudo chmod g+w $pwrp_exe/plc_$nname_*"
<<
endl
<<
" sudo chmod u+s $pwrp_exe/plc_$nname_*"
<<
endl
<<
"fi"
<<
endl
;
ofu
.
close
();
// Create a data file with description and all installed files
...
...
@@ -546,8 +561,12 @@ void pkg_pattern::fetchFiles()
strcat
(
file_target
,
file
);
strcat
(
file_target
,
type
);
}
pkg_file
file
(
found_file
,
file_target
);
m_filelist
.
push_back
(
file
);
try
{
pkg_file
file
(
found_file
,
file_target
);
m_filelist
.
push_back
(
file
);
}
catch
(
wb_error
&
e
)
{
MsgWindow
::
message
(
'W'
,
e
.
what
().
c_str
(),
msgw_ePop_Yes
);
}
break
;
}
}
...
...
@@ -572,8 +591,12 @@ void pkg_pattern::fetchFiles()
strcat
(
file_target
,
file
);
strcat
(
file_target
,
type
);
}
pkg_file
file
(
found_file
,
file_target
);
m_filelist
.
push_back
(
file
);
try
{
pkg_file
file
(
found_file
,
file_target
);
m_filelist
.
push_back
(
file
);
}
catch
(
wb_error
&
e
)
{
MsgWindow
::
message
(
'W'
,
e
.
what
().
c_str
(),
msgw_ePop_Yes
);
}
sts
=
dcli_search_file
(
m_source
,
found_file
,
DCLI_DIR_SEARCH_NEXT
);
}
...
...
@@ -598,8 +621,11 @@ pkg_file::pkg_file( char *source, char *target)
struct
stat
info
;
int
sts
=
stat
(
source
,
&
info
);
if
(
sts
==
-
1
)
throw
wb_error_str
(
"Source file doesn't exist"
);
if
(
sts
==
-
1
)
{
char
msg
[
256
];
sprintf
(
msg
,
"Source file doesn't exist: %s"
,
source
);
throw
wb_error_str
(
msg
);
}
m_date
.
tv_sec
=
info
.
st_ctime
;
m_date
.
tv_nsec
=
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment