Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(215)

Side by Side Diff: third_party/scons/scons-local/SCons/Tool/rpm.py

Issue 17024: Update to SCons 1.2.0. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 """SCons.Tool.rpm 1 """SCons.Tool.rpm
2 2
3 Tool-specific initialization for rpm. 3 Tool-specific initialization for rpm.
4 4
5 There normally shouldn't be any need to import this module directly. 5 There normally shouldn't be any need to import this module directly.
6 It will usually be imported through the generic SCons.Tool.Tool() 6 It will usually be imported through the generic SCons.Tool.Tool()
7 selection method. 7 selection method.
8 8
9 The rpm tool calls the rpmbuild command. The first and only argument should a 9 The rpm tool calls the rpmbuild command. The first and only argument should a
10 tar.gz consisting of the source file and a specfile. 10 tar.gz consisting of the source file and a specfile.
(...skipping 15 matching lines...) Expand all
26 # 26 #
27 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY 27 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
28 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 28 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
29 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 29 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
30 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 30 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
31 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 31 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
32 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 32 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
33 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 33 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
34 # 34 #
35 35
36 __revision__ = "src/engine/SCons/Tool/rpm.py 3603 2008/10/10 05:46:45 scons" 36 __revision__ = "src/engine/SCons/Tool/rpm.py 3842 2008/12/20 22:59:52 scons"
37 37
38 import os 38 import os
39 import re 39 import re
40 import shutil 40 import shutil
41 import popen2 41 import subprocess
42 42
43 import SCons.Builder 43 import SCons.Builder
44 import SCons.Node.FS 44 import SCons.Node.FS
45 import SCons.Util 45 import SCons.Util
46 import SCons.Action 46 import SCons.Action
47 import SCons.Defaults 47 import SCons.Defaults
48 48
49 def get_cmd(source, env): 49 def get_cmd(source, env):
50 tar_file_with_included_specfile = source 50 tar_file_with_included_specfile = source
51 if SCons.Util.is_List(source): 51 if SCons.Util.is_List(source):
52 tar_file_with_included_specfile = source[0] 52 tar_file_with_included_specfile = source[0]
53 return "%s %s %s"%(env['RPM'], env['RPMFLAGS'], 53 return "%s %s %s"%(env['RPM'], env['RPMFLAGS'],
54 tar_file_with_included_specfile.abspath ) 54 tar_file_with_included_specfile.abspath )
55 55
56 def build_rpm(target, source, env): 56 def build_rpm(target, source, env):
57 # create a temporary rpm build root. 57 # create a temporary rpm build root.
58 tmpdir = os.path.join( os.path.dirname( target[0].abspath ), 'rpmtemp' ) 58 tmpdir = os.path.join( os.path.dirname( target[0].abspath ), 'rpmtemp' )
59 if os.path.exists(tmpdir): 59 if os.path.exists(tmpdir):
60 shutil.rmtree(tmpdir) 60 shutil.rmtree(tmpdir)
61 61
62 # now create the mandatory rpm directory structure. 62 # now create the mandatory rpm directory structure.
63 for d in ['RPMS', 'SRPMS', 'SPECS', 'BUILD']: 63 for d in ['RPMS', 'SRPMS', 'SPECS', 'BUILD']:
64 os.makedirs( os.path.join( tmpdir, d ) ) 64 os.makedirs( os.path.join( tmpdir, d ) )
65 65
66 # set the topdir as an rpmflag. 66 # set the topdir as an rpmflag.
67 env.Prepend( RPMFLAGS = '--define \'_topdir %s\'' % tmpdir ) 67 env.Prepend( RPMFLAGS = '--define \'_topdir %s\'' % tmpdir )
68 68
69 # now call rpmbuild to create the rpm package. 69 # now call rpmbuild to create the rpm package.
70 handle = popen2.Popen3( get_cmd(source, env), capturestderr=1 ) 70 handle = subprocess.Popen(get_cmd(source, env),
71 output = handle.fromchild.read() 71 stdout=subprocess.PIPE,
72 #output += handle.childerr.read() 72 stderr=subprocess.STDOUT,
73 output = output + handle.childerr.read() 73 shell=True)
74 status = handle.wait() 74 output = handle.stdout.read()
75 status = handle.wait()
75 76
76 if status: 77 if status:
77 raise SCons.Errors.BuildError( node=target[0], 78 raise SCons.Errors.BuildError( node=target[0],
78 errstr=output, 79 errstr=output,
79 filename=str(target[0]) ) 80 filename=str(target[0]) )
80 else: 81 else:
81 # XXX: assume that LC_ALL=c is set while running rpmbuild 82 # XXX: assume that LC_ALL=c is set while running rpmbuild
82 output_files = re.compile( 'Wrote: (.*)' ).findall( output ) 83 output_files = re.compile( 'Wrote: (.*)' ).findall( output )
83 84
84 for output, input in zip( output_files, target ): 85 for output, input in zip( output_files, target ):
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 bld = RpmBuilder 117 bld = RpmBuilder
117 env['BUILDERS']['Rpm'] = bld 118 env['BUILDERS']['Rpm'] = bld
118 119
119 env.SetDefault(RPM = 'LC_ALL=c rpmbuild') 120 env.SetDefault(RPM = 'LC_ALL=c rpmbuild')
120 env.SetDefault(RPMFLAGS = SCons.Util.CLVar('-ta')) 121 env.SetDefault(RPMFLAGS = SCons.Util.CLVar('-ta'))
121 env.SetDefault(RPMCOM = rpmAction) 122 env.SetDefault(RPMCOM = rpmAction)
122 env.SetDefault(RPMSUFFIX = '.rpm') 123 env.SetDefault(RPMSUFFIX = '.rpm')
123 124
124 def exists(env): 125 def exists(env):
125 return env.Detect('rpmbuild') 126 return env.Detect('rpmbuild')
OLDNEW
« no previous file with comments | « third_party/scons/scons-local/SCons/Tool/rpcgen.py ('k') | third_party/scons/scons-local/SCons/Tool/sgiar.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698