Andreas Stieger
a5c8899338
OBS-URL: https://build.opensuse.org/package/show/devel:tools:building/scons?expand=0&rev=68
115 lines
4.6 KiB
Diff
115 lines
4.6 KiB
Diff
--- a/src/engine/SCons/Tool/packaging/rpm.py
|
|
+++ b/src/engine/SCons/Tool/packaging/rpm.py
|
|
@@ -51,10 +51,9 @@ def package(env, target, source, PACKAGE
|
|
if str(target[0])!="%s-%s"%(NAME, VERSION):
|
|
raise UserError( "Setting target is not supported for rpm." )
|
|
else:
|
|
- # This should be overridable from the construction environment,
|
|
- # which it is by using ARCHITECTURE=.
|
|
+ # Deduce the build architecture, but allow it to be overridden
|
|
+ # by setting ARCHITECTURE in the construction env.
|
|
buildarchitecture = SCons.Tool.rpmutils.defaultMachine()
|
|
-
|
|
if 'ARCHITECTURE' in kw:
|
|
buildarchitecture = kw['ARCHITECTURE']
|
|
|
|
@@ -126,20 +125,18 @@ def build_specfile(target, source, env):
|
|
""" Builds a RPM specfile from a dictionary with string metadata and
|
|
by analyzing a tree of nodes.
|
|
"""
|
|
- file = open(target[0].get_abspath(), 'w')
|
|
-
|
|
- try:
|
|
- file.write( build_specfile_header(env) )
|
|
- file.write( build_specfile_sections(env) )
|
|
- file.write( build_specfile_filesection(env, source) )
|
|
- file.close()
|
|
-
|
|
- # call a user specified function
|
|
- if 'CHANGE_SPECFILE' in env:
|
|
- env['CHANGE_SPECFILE'](target, source)
|
|
+ with open(target[0].get_abspath(), 'w') as file:
|
|
+ try:
|
|
+ file.write(build_specfile_header(env))
|
|
+ file.write(build_specfile_sections(env))
|
|
+ file.write(build_specfile_filesection(env, source))
|
|
+
|
|
+ # call a user specified function
|
|
+ if 'CHANGE_SPECFILE' in env:
|
|
+ env['CHANGE_SPECFILE'](target, source)
|
|
|
|
- except KeyError as e:
|
|
- raise SCons.Errors.UserError( '"%s" package field for RPM is missing.' % e.args[0] )
|
|
+ except KeyError as e:
|
|
+ raise SCons.Errors.UserError('"%s" package field for RPM is missing.' % e.args[0])
|
|
|
|
|
|
#
|
|
@@ -201,7 +198,8 @@ def build_specfile_header(spec):
|
|
'PACKAGEVERSION' : '%%define release %s\nRelease: %%{release}\n',
|
|
'X_RPM_GROUP' : 'Group: %s\n',
|
|
'SUMMARY' : 'Summary: %s\n',
|
|
- 'LICENSE' : 'License: %s\n', }
|
|
+ 'LICENSE' : 'License: %s\n',
|
|
+ }
|
|
|
|
str = str + SimpleTagCompiler(mandatory_header_fields).compile( spec )
|
|
|
|
@@ -211,6 +209,7 @@ def build_specfile_header(spec):
|
|
'X_RPM_URL' : 'Url: %s\n',
|
|
'SOURCE_URL' : 'Source: %s\n',
|
|
'SUMMARY_' : 'Summary(%s): %s\n',
|
|
+ 'ARCHITECTURE' : 'BuildArch: %s\n',
|
|
'X_RPM_DISTRIBUTION' : 'Distribution: %s\n',
|
|
'X_RPM_ICON' : 'Icon: %s\n',
|
|
'X_RPM_PACKAGER' : 'Packager: %s\n',
|
|
@@ -229,19 +228,33 @@ def build_specfile_header(spec):
|
|
'X_RPM_PREFIX' : 'Prefix: %s\n',
|
|
|
|
# internal use
|
|
- 'X_RPM_BUILDROOT' : 'BuildRoot: %s\n', }
|
|
+ 'X_RPM_BUILDROOT' : 'BuildRoot: %s\n',
|
|
+ }
|
|
|
|
# fill in default values:
|
|
- # Adding a BuildRequires renders the .rpm unbuildable under System, which
|
|
+ # Adding a BuildRequires renders the .rpm unbuildable under systems which
|
|
# are not managed by rpm, since the database to resolve this dependency is
|
|
# missing (take Gentoo as an example)
|
|
-# if not s.has_key('x_rpm_BuildRequires'):
|
|
-# s['x_rpm_BuildRequires'] = 'scons'
|
|
+ #if 'X_RPM_BUILDREQUIRES' not in spec:
|
|
+ # spec['X_RPM_BUILDREQUIRES'] = 'scons'
|
|
|
|
if 'X_RPM_BUILDROOT' not in spec:
|
|
spec['X_RPM_BUILDROOT'] = '%{_tmppath}/%{name}-%{version}-%{release}'
|
|
|
|
str = str + SimpleTagCompiler(optional_header_fields, mandatory=0).compile( spec )
|
|
+
|
|
+ # Add any extra specfile definitions the user may have supplied.
|
|
+ # These flags get no processing, they are just added.
|
|
+ # github #3164: if we don't turn off debug package generation
|
|
+ # the tests which build packages all fail. If there are no
|
|
+ # extra flags, default to adding this one. If the user wants
|
|
+ # to turn this back on, supply the flag set to None.
|
|
+
|
|
+ if 'X_RPM_EXTRADEFS' not in spec:
|
|
+ spec['X_RPM_EXTRADEFS'] = ['%global debug_package %{nil}']
|
|
+ for extra in spec['X_RPM_EXTRADEFS']:
|
|
+ str += extra + '\n'
|
|
+
|
|
return str
|
|
|
|
#
|
|
--- a/src/engine/SCons/Tool/packaging/tarbz2.py
|
|
+++ b/src/engine/SCons/Tool/packaging/tarbz2.py
|
|
@@ -32,7 +32,7 @@ from SCons.Tool.packaging import stripin
|
|
|
|
def package(env, target, source, PACKAGEROOT, **kw):
|
|
bld = env['BUILDERS']['Tar']
|
|
- bld.set_suffix('.tar.gz')
|
|
+ bld.set_suffix('.tar.bz2')
|
|
target, source = putintopackageroot(target, source, env, PACKAGEROOT)
|
|
target, source = stripinstallbuilder(target, source, env)
|
|
return bld(env, target, source, TARFLAGS='-jc')
|