[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: icecream
From: Luboš Luňák <l.lunak () kde ! org>
Date: 2012-07-30 17:49:39
Message-ID: 20120730174939.BDCCCAC7A9 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1308589 by lunakl:
get the environment tarball name directly from icecc-create-env
Instead of listing the native/ directory in order to find it. To
be used when using several native environments at the same time (TODO).
M +4 -0 client/icecc-create-env
M +21 -34 daemon/environment.cpp
--- trunk/icecream/client/icecc-create-env #1308588:1308589
@@ -258,3 +258,7 @@
cd ..
rm -rf $tempdir
rm -f $tmp_ld_so_conf
+
+# Print the tarball name to fd 5 (if it's open, created by whatever has invoked \
this) +( echo $md5.tar.gz >&5 ) 2>/dev/null
+exit 0
--- trunk/icecream/daemon/environment.cpp #1308588:1308589
@@ -103,30 +103,6 @@
return res;
}
-static string list_native_environment( const string &nativedir )
-{
- assert( nativedir.at( nativedir.length() - 1 ) == '/' );
-
- string native_environment;
-
- DIR *tdir = opendir( nativedir.c_str() );
- if ( tdir ) {
- string suff = ".tar.gz";
- do {
- struct dirent *myenv = readdir(tdir);
- if ( !myenv )
- break;
- string versfile = myenv->d_name;
- if ( versfile.size() > suff.size() && versfile.substr( versfile.size() - \
suff.size() ) == suff ) {
- native_environment = nativedir + versfile;
- break;
- }
- } while ( true );
- closedir( tdir );
- }
- return native_environment;
-}
-
static void list_target_dirs( const string ¤t_target, const string &targetdir, \
Environments &envs ) {
DIR *envdir = opendir( targetdir.c_str() );
@@ -287,28 +263,35 @@
}
flush_debug();
+ int pipes[ 2 ];
+ pipe( pipes );
pid_t pid = fork();
if ( pid ) {
+ close( pipes[ 1 ] );
int status = 1;
while ( waitpid( pid, &status, 0 ) < 0 && errno == EINTR )
;
trace() << "waitpid " << status << endl;
if ( !status ) {
- trace() << "opendir " << nativedir << endl;
- native_environment = list_native_environment( nativedir );
- if ( native_environment.empty() )
- status = 1;
+ char buf[ 1024 ];
+ buf[ 0 ] = '\0';
+ while ( read( pipes[ 0 ], buf, 1023 ) < 0 && errno == EINTR )
+ ;
+ if ( char *nl = strchr( buf, '\n' ))
+ *nl = '\0';
+ native_environment = nativedir + buf;
}
+ close( pipes[ 0 ] );
trace() << "native_environment " << native_environment << endl;
- if ( status ) {
+ struct stat st;
+ if ( !status && !native_environment.empty()
+ && stat( native_environment.c_str(), &st ) == 0 ) {
+ save_native_env_timestamp();
+ return st.st_size;
+ }
rmdir( nativedir.c_str() );
return 0;
}
- else {
- save_native_env_timestamp();
- return sumup_dir( nativedir );
- }
- }
// else
if ( setgid( nobody_gid ) < 0) {
@@ -325,6 +308,10 @@
_exit(1);
}
+ close( pipes[ 0 ] );
+ dup2( pipes[ 1 ], 5 ); // icecc-create-env will write the hash there
+ close( pipes[ 1 ] );
+
const char *const argv[] = {
BINDIR "/icecc", "--build-native", NULL
};
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic