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
6dc0ef8e
Commit
6dc0ef8e
authored
Dec 20, 2010
by
Claes Sjofors
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Distributor, package temporary build directory moved from /home/claes/tmp to /tmp
parent
d2bb7069
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
15 deletions
+39
-15
wb/lib/wb/src/wb_pkg.cpp
wb/lib/wb/src/wb_pkg.cpp
+37
-15
wb/lib/wb/src/wb_pkg.h
wb/lib/wb/src/wb_pkg.h
+2
-0
No files found.
wb/lib/wb/src/wb_pkg.cpp
View file @
6dc0ef8e
...
...
@@ -31,6 +31,17 @@
#include "rt_load.h"
#include "wb_log.h"
static
unsigned
int
pkg_random
()
{
pwr_tTime
t
;
time_GetTime
(
&
t
);
int
itime
=
t
.
tv_nsec
+
t
.
tv_sec
%
10000
;
srand
(
itime
);
return
(
unsigned
int
)((
double
)
rand
()
/
((
double
)
RAND_MAX
+
1
)
*
999999
);
}
wb_pkg
::
wb_pkg
(
char
*
nodelist
,
bool
distribute
,
bool
config_only
)
{
if
(
nodelist
)
{
...
...
@@ -372,6 +383,10 @@ void pkg_node::fetchFiles( bool distribute)
char
pack_fname
[
200
];
char
fname
[
200
];
// Get temporary directory
sprintf
(
m_tmpdir
,
"/tmp/pwrpkg%06u"
,
pkg_random
());
sprintf
(
m_blddir
,
"%s/pkg_build"
,
m_tmpdir
);
// Add volumes to pattern
for
(
int
i
=
0
;
i
<
(
int
)
m_volumelist
.
size
();
i
++
)
{
if
(
!
m_volumelist
[
i
].
m_isSystem
)
{
...
...
@@ -447,26 +462,29 @@ void pkg_node::fetchFiles( bool distribute)
char
pkg_name
[
80
];
sprintf
(
pkg_name
,
load_cNamePkg
,
m_name
,
version
);
dcli_translate_filename
(
pack_fname
,
"$pwrp_tmp/pkg_pack.sh"
);
sprintf
(
pack_fname
,
"$pwrp_tmp/pkg_pack_%s.sh"
,
m_name
);
dcli_translate_filename
(
pack_fname
,
pack_fname
);
ofstream
of
(
pack_fname
);
of
<<
"if [
! -e $pwrp_tmp/pkg_build
]; then"
<<
endl
<<
"
mkdir $pwrp_tmp/pkg_build"
<<
endl
<<
"
else
"
<<
endl
<<
"
rm -r $pwrp_tmp/pkg_build/*.flw"
<<
endl
<<
"
rm -r $pwrp_tmp/pkg_build/*"
<<
endl
<<
// " find $pwrp_tmp/pkg_build -name \"*\" | xargs rm -r" << endl <<
"fi"
<<
endl
;
"if [
-e "
<<
m_tmpdir
<<
"
]; then"
<<
endl
<<
"
rm -r "
<<
m_tmpdir
<<
endl
<<
"
fi
"
<<
endl
<<
"
mkdir "
<<
m_tmpdir
<<
endl
<<
"
mkdir "
<<
m_blddir
<<
endl
;
for
(
int
i
=
0
;
i
<
(
int
)
m_filelist
.
size
();
i
++
)
of
<<
"cp "
<<
m_filelist
[
i
].
m_source
<<
"
$pwrp_tmp/pkg_build
/"
<<
m_filelist
[
i
].
m_arname
<<
endl
;
"cp "
<<
m_filelist
[
i
].
m_source
<<
"
"
<<
m_blddir
<<
"
/"
<<
m_filelist
[
i
].
m_arname
<<
endl
;
of
<<
"#mv $pwrp_tmp/pkg_unpack.sh $pwrp_tmp/pkg_build"
<<
endl
<<
"cd $pwrp_tmp"
<<
endl
<<
"tar -czf $pwrp_load/"
<<
pkg_name
<<
" pwr_pkg.dat pkg_unpack.sh pkg_build"
<<
endl
;
"cp $pwrp_tmp/pkg_unpack_"
<<
m_name
<<
".sh "
<<
m_tmpdir
<<
"/pkg_unpack.sh"
<<
endl
<<
"cp $pwrp_tmp/pwr_pkg_"
<<
m_name
<<
".dat "
<<
m_tmpdir
<<
"/pwr_pkg.dat"
<<
endl
<<
"cd "
<<
m_tmpdir
<<
endl
<<
"tar -czf $pwrp_load/"
<<
pkg_name
<<
" pwr_pkg.dat pkg_unpack.sh pkg_build"
<<
endl
<<
"rm -r "
<<
m_tmpdir
<<
endl
;
#if 0
if ( distribute)
...
...
@@ -483,7 +501,8 @@ void pkg_node::fetchFiles( bool distribute)
of
.
close
();
// Create a script that unpackes the archive and moves files to the target directories
dcli_translate_filename
(
fname
,
"$pwrp_tmp/pkg_unpack.sh"
);
sprintf
(
fname
,
"$pwrp_tmp/pkg_unpack_%s.sh"
,
m_name
);
dcli_translate_filename
(
fname
,
fname
);
ofstream
ofu
(
fname
);
if
(
!
ofu
)
throw
wb_error_str
(
"Unable to open file"
);
...
...
@@ -550,7 +569,8 @@ void pkg_node::fetchFiles( bool distribute)
ofu
.
close
();
// Create a data file with description and all installed files
dcli_translate_filename
(
fname
,
"$pwrp_tmp/pwr_pkg.dat"
);
sprintf
(
fname
,
"$pwrp_tmp/pwr_pkg_%s.dat"
,
m_name
);
dcli_translate_filename
(
fname
,
fname
);
ofstream
ofd
(
fname
);
if
(
!
ofd
)
throw
wb_error_str
(
"Unable to open file"
);
...
...
@@ -620,7 +640,9 @@ void pkg_node::copyPackage( char *pkg_name)
}
for
(
int
i
=
0
;
i
<
bootnode_cnt
;
i
++
)
{
dcli_translate_filename
(
pack_fname
,
"$pwrp_tmp/pkg_pack.sh"
);
sprintf
(
pack_fname
,
"$pwrp_tmp/pkg_pack_%s.sh"
,
m_name
);
dcli_translate_filename
(
pack_fname
,
pack_fname
);
ofstream
of
(
pack_fname
);
if
(
m_dstatus
&
lfu_mDistrOpt_RSH
)
{
// Use ftp and rsh
...
...
wb/lib/wb/src/wb_pkg.h
View file @
6dc0ef8e
...
...
@@ -117,6 +117,8 @@ class pkg_node {
int
m_warnings
;
char
m_user
[
80
];
char
m_custom_platform
[
80
];
char
m_tmpdir
[
80
];
char
m_blddir
[
80
];
public:
pkg_node
(
char
*
name
)
:
m_opsys
(
pwr_mOpSys__
),
m_bus
(
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