5/llvm: Add LLVM as a package for RTEMS.

- Add '%source download <source>' to only download the source
  and do not unpack and prep. This can used when a package
  internally needs another source package.

- Install the staging root only if it is present. A package
  may internally build another package that is not staged as it
  is not suitable for installing.

Updates #3250
Updatew #3797
This commit is contained in:
Chris Johns 2019-09-12 20:09:13 +10:00
parent b3b5ca9ec3
commit 4b7af07300
14 changed files with 451 additions and 75 deletions

View File

@ -0,0 +1,20 @@
#
# SWIG 4.0.1
#
%if %{release} == %{nil}
%define release 1
%endif
%include %{_configdir}/base.cfg
%define swig_version 4.0.1
%hash sha512 swig-rel-%{swig_version}.tar.gz AeegX9wtAHvY40gxQoEHXIx4RuQG4KpSopReBWwbsmhzfLSz8saStvixkhNgl+ZygHCgGqRFPQdQrArxLLQDSg==
%define pcre_version 8.40
%hash sha512 pcre-%{pcre_version}.tar.bz2 tMJ+r73zO9ehOEZVsZNvS+O8Z0XAcjR+sm6YiJbFJmS9haxCRE2hvni24g9Ftsflkh9fIPWwdBtb09mETlvU4g==
#
# The SWIG build instructions.
#
%include %{_configdir}/swig-4-1.cfg

View File

@ -0,0 +1,19 @@
#
# Build set for SWIG
#
%define release 1
#
# Name of the package.
#
package: swig-%{swig_version}-%{_host}-%{release}
#
# A magic internal path that would break if changes in the defaults.mc
# macro file are made.
#
%define _internal_autotools_path %{_tmppath}/sb-%{_uid}/${SB_PREFIX_CLEAN}
devel/autotools-internal
devel/swig-4.0.1

View File

@ -0,0 +1,21 @@
#
# LLVM for RTEMS 5 Tools Stable
#
%define release 1
%define rtems_arch none
#
# The RTEMS base defines.
#
%include rtems-base.bset
#
# Build and install into a prefix that is away from the staged area or it will
# be installed.
#
%define swig_prefix %{_tmproot}/swig
devel/swig
tools/rtems-llvm-8.0.1

View File

@ -20,9 +20,14 @@ package: rtems-%{rtems_version}-%{_target}-%{_host}-%{release}
# #
# Project custom message # Project custom message
# #
%define rtems_gcc_version %{rtems_version} %define rtems_version_message RTEMS %{rtems_version}, RSB %{_sbgit_id}
%define gcc_version_message RTEMS %{rtems_gcc_version}, RSB %{_sbgit_id}, Newlib %{newlib_version}
%define rtems_gcc_version %{rtems_version}
%define gcc_version_message %{rtems_version_message}, Newlib %{newlib_version}
%define rtems_llvm_version %{rtems_version}
%define llvm_version_message %{rtems_version_message}
%define clang_version_message %{rtems_version_message}
# #
# Pick up the RTEMS URLs. # Pick up the RTEMS URLs.
# #

View File

@ -0,0 +1,21 @@
#
# LLVM
#
%define llvm_version 8.0.1
%hash sha512 llvm-%{llvm_version}.src.tar.xz guEgvlyr39URGuu+popmP+IpyIYdc4AtarCaO/SPYN4zPgfmH4+2G+qhSsK+ok/NdPpvdhrK9iRp9Ta3n8seFg==
%hash sha512 cfe-%{llvm_version}.src.tar.xz Eiey0yBSxwtLSUZZhJAAGI/ORvwxpx8zUrqEV6wLCxfkvHyFiYdMhYbVWqgI7mwfzrffUBqvozWZ+N97/St5HQ==
%hash sha512 clang-tools-extra-%{llvm_version}.src.tar.xz 05liww7p2KFnnYAHAJtI3qLIqusoO+14Gp4ioaV7gYbCz+BY2gRmWIgqzhyEow3fm0y3W86YiJEYnoQjtsanLA==
%hash sha512 compiler-rt-%{llvm_version}.src.tar.xz Er8b2r4lwMOoTMc6cY/hVFc91ynsP/Xgmb1fdMa+ycgFIbh97WRtOyDf25qlHeoCNCgUGMfrgYBeHdXTEH09jg==
%hash sha512 libcxx-%{llvm_version}.src.tar.xz dXSdCLKzQ8b1+a77BL5j5C9tEu/FEQHTZH7W9wx6bQUK+zqy82NurnjLUj9YRN5nuWCnoxRe2JqwxwFd6xSSHg==
%hash sha512 libcxxabi-%{llvm_version}.src.tar.xz V3z8sE67Ke6E017TGqj+yyj8dLB+9/8pjw/i1ED4I973PgkjWcQdjYYA5t8Y9VIk7YlnTUA8WuVqfXlzSHuHNA==
%hash sha512 libunwind-%{llvm_version}.src.tar.xz wRVYLKh54hW5fSTkqoBpZ5Y4PnmFbPJuQLTd1rJV1Zj5+phnsw8P0Wkb53B3mDWsHUuaXkpxQksYSZt56jfQYA==
%hash sha512 lld-%{llvm_version}.src.tar.xz ZGQY1KTOki0aaem/LkcvXXWPJewhuAosZt/l7/xZycMS+xZ89k7i2KLO2YbnR07T0plqOL5m+/Y8V0Ip0o4JAA==
%hash sha512 lldb-%{llvm_version}.src.tar.xz 6wMZha1NCCJuxHqQ/jLB5tBwlIlxylI1/UMc99W36iD11RMSN7+DpkGXc9GMM5WQv5Zy57T4hDBEl+Y8EDCYjw==
%hash sha512 openmp-%{llvm_version}.src.tar.xz ne14XIEp57OnC1TwfE3eUpRW7cyUkErXf8V4z38JbPo/8ieZWdf38dtRVx4RxTN18ztZfH82zm3GtRLETO2AJg==
#
# The llvm build instructions.
#
%include %{_configdir}/llvm-common-1.cfg

View File

@ -0,0 +1,152 @@
#
# LLVM Common Support.
#
# This configuration file configure's, make's and install's LLVM and some of
# it projects.
#
%include %{_configdir}/checks.cfg
#
# The package description.
#
Name: rtems-llvm-%{llvm_version}-%{_host}-%{release}
Summary: LLVM v%{llvm_version} on host %{_host}
Version: %{llvm_version}
Release: %{release}
URL: http://llvm.org/
#
# The LLVM version depends on the type of build we are doing.
#
%if %{rsb_released}
%define rtems_llvm_version %{rsb_version}
%else
%define rtems_llvm_version %{rtems_version}
%endif
#
# LLVM Download URL.
#
%define llvm_url https://github.com/llvm/llvm-project/releases/download/llvmorg-%{llvm_version}
#
# Packages
#
%source set cfe %{llvm_url}/cfe-%{llvm_version}.src.tar.xz
%source set clang-tools-extra %{llvm_url}/clang-tools-extra-%{llvm_version}.src.tar.xz
%source set compiler-rt %{llvm_url}/compiler-rt-%{llvm_version}.src.tar.xz
%source set libcxx %{llvm_url}/libcxx-%{llvm_version}.src.tar.xz
%source set libcxxabi %{llvm_url}/libcxxabi-%{llvm_version}.src.tar.xz
%source set libunwind %{llvm_url}/libunwind-%{llvm_version}.src.tar.xz
%source set lld %{llvm_url}/lld-%{llvm_version}.src.tar.xz
%source set lldb %{llvm_url}/lldb-%{llvm_version}.src.tar.xz
%source set llvm %{llvm_url}/llvm-%{llvm_version}.src.tar.xz
%source set openmp %{llvm_url}/openmp-%{llvm_version}.src.tar.xz
#
# Build LLDB on all hosts except MacOS as it reqires a codesign login key of
# name 'llvm'.
#
%if %{_build_os} != darwin
%define with_llvm_lldb 1
%endif
%if %{defined with_llvm_lldb}
%define lldb_codesign_identity -DLLDB_CODESIGN_IDENTITY=llvm
%else
%define lldb_codesign_identity %{nil}
%endif
#
# Prepare the source code.
#
%prep
# save the build top directory and cd back to it rather than
# using 'cd ..' because some shells change $PWD to a symlink's
# target location and 'cd ..' fails.
build_top=$(pwd)
llvm_source=%{?llvm_external:%{llvm_expand_name}}%{!?llvm_external:"llvm-%{llvm_version}"}
# llvm is a collection of separate packages, download them and then create
# the source tree.
source_dir_llvm=${llvm_source}
%source setup llvm -q
%{__mv} llvm-%{llvm_version}.src ${source_dir_llvm}
%source setup cfe -q
%{__mv} cfe-%{llvm_version}.src ${source_dir_llvm}/tools/clang
%source setup clang-tools-extra -q
%{__mv} clang-tools-extra-%{llvm_version}.src ${source_dir_llvm}/tools/clang/extra
%source setup compiler-rt -q
%{__mv} compiler-rt-%{llvm_version}.src ${source_dir_llvm}/projects/compiler-rt
%source setup libcxx -q
%{__mv} libcxx-%{llvm_version}.src ${source_dir_llvm}/projects/libcxx
%source setup libcxxabi -q
%{__mv} libcxxabi-%{llvm_version}.src ${source_dir_llvm}/projects/libcxxabi
%source setup libunwind -q
%{__mv} libunwind-%{llvm_version}.src ${source_dir_llvm}/projects/libunwind
%source setup lld -q
%{__mv} lld-%{llvm_version}.src ${source_dir_llvm}/tools/lld
%if %{defined with_llvm_lldb}
%source setup lldb -q
%{__mv} lldb-%{llvm_version}.src ${source_dir_llvm}/tools/lldb
%endif
%source setup openmp -q
%{__mv} openmp-%{llvm_version}.src ${source_dir_llvm}/tools/openmp
%patch setup llvm -p1
cd ${build_top}
%build
build_top=$(pwd)
# SWIG will be built and installed into %{swig_prefix} if defined
# so add it as a path.
%if %{defined swig_prefix}
export PATH=%{swig_prefix}/bin:$PATH
%endif
%{build_directory}
mkdir -p ${build_dir}
cd ${build_dir}
%{__cmake} -Wno-dev \
-G "Unix Makefiles" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=%{_prefix} \
-DPACKAGE_VERSION="%{llvm_version} (%{llvm_version_message})" \
%{lldb_codesign_identity} \
../${source_dir_llvm}
version_inc="tools/clang/include/clang/Basic/Version.inc"
%{__cat} ${version_inc} | \
sed -e 's/CLANG_VERSION_STRING "[0-9]*\.[0-9]*\.[0-9]*/& \(%{llvm_version_message}\)/g' \
> ${version_inc}.tmp
%{__mv} ${version_inc}.tmp ${version_inc}
%{__make} %{?_smp_mflags}
cd ${build_top}
%install
build_top=$(pwd)
%{__rmdir} $SB_BUILD_ROOT
cd ${build_dir}
%{__make} DESTDIR=$SB_BUILD_ROOT install
cd ${build_top}

View File

@ -0,0 +1,97 @@
#
# SWIG 4.xx Version 1.
#
# This configuration file configure's, make's and install's m4
#
# Warning: this package is only for bootstrapping within a build.
#
Name: swig-%{swig_version}-%{_host}-%{release}
Summary: SWIG v%{swig_version} for host %{_host}
Version: %{swig_version}
Release: %{release}
URL: http://www.swig.org/
#
# Source
#
%source set swig --rsb-file=swig-rel-%{swig_version}.tar.gz https://github.com/swig/swig/archive/rel-%{swig_version}.tar.gz
%source set pcre https://ftp.pcre.org/pub/pcre/pcre-%{pcre_version}.tar.bz2
#
# See if a special swig prefix is provided
#
%if %{defined swig_prefix}
%define _disable_collecting yes
%define _disable_packaging yes
%define _disable_reporting yes
%define _disable_installing yes
%endif
#
# Prepare the source code.
#
%prep
build_top=$(pwd)
source_dir_swig="swig-rel-%{swig_version}"
%source setup swig -q -n swig-rel-%{swig_version}
%source download pcre
%patch setup swig -p1
# SWIG does not ship from github with it's generated files. We
# need to generate them.
# Add the path to the internal autoconf tools
SWIG_XPATH=$PATH
%if %{defined _internal_autotools_path}
export PATH=%{_internal_autotools_path}/bin:$PATH
%endif
./autogen.sh
export PATH=$SWIG_XPATH
cd ${build_top}
%build
build_top=$(pwd)
%{build_directory}
mkdir -p ${build_dir}
cd ${build_dir}
%{host_build_flags}
# build PCRE using the SWIG script as it is a static link
%{__cp} %{_sourcedir}/pcre-%{pcre_version}.tar.bz2 pcre-%{pcre_version}.tar.bz2
../${source_dir_swig}/Tools/pcre-build.sh
%if %{defined swig_prefix}
prefix=%{swig_prefix}
%else
prefix=%{_prefix}
%endif
../${source_dir_swig}/configure \
--host=%{_host} \
--prefix=${prefix}
%{__make} %{?_smp_mflags}
cd ${build_top}
%install
build_top=$(pwd)
%{__rmdir} ${SB_BUILD_ROOT}
cd ${build_dir}
%if %{!defined swig_prefix}
%define destdir DESTDIR=${SB_BUILD_ROOT}
%else
%define destdir %{nil}
%endif
%{__make} %{destdir} install
cd ${build_top}

View File

@ -157,6 +157,7 @@ __cc: exe, required, 'gcc'
__chgrp: exe, required, '/usr/bin/chgrp' __chgrp: exe, required, '/usr/bin/chgrp'
__chmod: exe, required, '/bin/chmod' __chmod: exe, required, '/bin/chmod'
__chown: exe, required, '/usr/sbin/chown' __chown: exe, required, '/usr/sbin/chown'
__cmake: exe, optional, '/usr/bin/cmake'
__cp: exe, required, '/bin/cp' __cp: exe, required, '/bin/cp'
__cpp: exe, none, '%{__cc} -E' __cpp: exe, none, '%{__cc} -E'
__cvs: exe, optional, '/usr/bin/cvs' __cvs: exe, optional, '/usr/bin/cvs'
@ -205,7 +206,7 @@ ___build_cmd: none, none, '%{?_sudo:%{_sudo} }%{?_remsh:%{_remsh}
___build_post: none, none, 'exit 0' ___build_post: none, none, 'exit 0'
# Prebuild set up script. # Prebuild set up script.
___build_pre: none, none, '''# ___build_pre in as set up in defaults.py ___build_pre: none, none, '''# ___build_pre as set up in defaults.py
# Save the original path away. # Save the original path away.
export SB_ORIG_PATH=${PATH} export SB_ORIG_PATH=${PATH}
# Directories # Directories

View File

@ -203,7 +203,7 @@ class build:
not _disable_installing and \ not _disable_installing and \
not _canadian_cross not _canadian_cross
def source(self, name, strip_components): def source(self, name, strip_components, download_only):
# #
# Return the list of sources. Merge in any macro defined sources as # Return the list of sources. Merge in any macro defined sources as
# these may be overridden by user loaded macros. # these may be overridden by user loaded macros.
@ -238,31 +238,37 @@ class build:
if o.startswith('--rsb-file'): if o.startswith('--rsb-file'):
os_ = o.split('=') os_ = o.split('=')
if len(os_) != 2: if len(os_) != 2:
raise error.general('invalid --rsb-file option: %s' % (' '.join(args))) raise error.general('invalid --rsb-file option: %s' % \
(' '.join(args)))
if os_[0] != '--rsb-file': if os_[0] != '--rsb-file':
raise error.general('invalid --rsb-file option: %s' % (' '.join(args))) raise error.general('invalid --rsb-file option: %s' % \
(' '.join(args)))
file_override = os_[1] file_override = os_[1]
opts = [o for o in opts if not o.startswith('--rsb-')] opts = [o for o in opts if not o.startswith('--rsb-')]
url = self.config.expand(' '.join(url)) url = self.config.expand(' '.join(url))
src = download.parse_url(url, '_sourcedir', self.config, self.opts, file_override) src = download.parse_url(url, '_sourcedir',
self.config, self.opts, file_override)
download.get_file(src['url'], src['local'], self.opts, self.config) download.get_file(src['url'], src['local'], self.opts, self.config)
if strip_components > 0: if not download_only:
tar_extract = '%%{__tar_extract} --strip-components %d' % (strip_components) if strip_components > 0:
else: tar_extract = '%%{__tar_extract} --strip-components %d' % \
tar_extract = '%{__tar_extract}' (strip_components)
if 'symlink' in src: else:
sname = name.replace('-', '_') tar_extract = '%{__tar_extract}'
src['script'] = '%%{__ln_s} %s ${source_dir_%s}' % (src['symlink'], sname) if 'symlink' in src:
elif 'compressed' in src: sname = name.replace('-', '_')
# src['script'] = '%%{__ln_s} %s ${source_dir_%s}' % \
# Zip files unpack as well so do not use tar. (src['symlink'], sname)
# elif 'compressed' in src:
src['script'] = '%s %s' % (src['compressed'], src['local']) #
if src['compressed-type'] != 'zip': # Zip files unpack as well so do not use tar.
src['script'] += ' | %s -f -' % (tar_extract) #
else: src['script'] = '%s %s' % (src['compressed'], src['local'])
src['script'] = '%s -f %s' % (tar_extract, src['local']) if src['compressed-type'] != 'zip':
srcs += [src] src['script'] += ' | %s -f -' % (tar_extract)
else:
src['script'] = '%s -f %s' % (tar_extract, src['local'])
srcs += [src]
return srcs return srcs
def source_setup(self, package, args): def source_setup(self, package, args):
@ -270,7 +276,7 @@ class build:
setup_name = args[1] setup_name = args[1]
args = args[1:] args = args[1:]
try: try:
opts, args = getopt.getopt(args[1:], 'qDcn:bas:') opts, args = getopt.getopt(args[1:], 'qDcn:bas:g')
except getopt.GetoptError as ge: except getopt.GetoptError as ge:
raise error.general('source setup error: %s' % str(ge)) raise error.general('source setup error: %s' % str(ge))
quiet = False quiet = False
@ -282,6 +288,7 @@ class build:
changed_dir = False changed_dir = False
strip_components = 0 strip_components = 0
opt_name = None opt_name = None
download_only = False
for o in opts: for o in opts:
if o[0] == '-q': if o[0] == '-q':
quiet = True quiet = True
@ -297,30 +304,37 @@ class build:
unpack_before_chdir = False unpack_before_chdir = False
elif o[0] == '-s': elif o[0] == '-s':
if not o[1].isdigit(): if not o[1].isdigit():
raise error.general('source setup error: invalid strip count: %s' % (o[1])) raise error.general('source setup error: invalid strip count: %s' % \
(o[1]))
strip_components = int(o[1]) strip_components = int(o[1])
elif o[0] == '-g':
download_only = True
name = None name = None
for source in self.source(setup_name, strip_components): for source in self.source(setup_name, strip_components, download_only):
if name is None: if name is None:
if opt_name is None: if opt_name is None:
if source: if source:
opt_name = source['name'] opt_name = source['name']
else: else:
raise error.general('setup source tag not found: %d' % (source_tag)) raise error.general('setup source tag not found: %d' % \
(source_tag))
else: else:
name = opt_name name = opt_name
self.script_build.append(self.config.expand('cd %{_builddir}')) if not download_only:
if not deleted_dir and delete_before_unpack: self.script_build.append(self.config.expand('cd %{_builddir}'))
self.script_build.append(self.config.expand('%{__rm} -rf ' + name)) if not deleted_dir and delete_before_unpack and name is not None:
deleted_dir = True self.script_build.append(self.config.expand('%{__rm} -rf ' + name))
if not created_dir and create_dir: deleted_dir = True
self.script_build.append(self.config.expand('%{__mkdir_p} ' + name)) if not created_dir and create_dir and name is not None:
created_dir = True self.script_build.append(self.config.expand('%{__mkdir_p} ' + name))
if not changed_dir and (not unpack_before_chdir or create_dir): created_dir = True
self.script_build.append(self.config.expand('cd ' + name)) if not changed_dir and (not unpack_before_chdir or create_dir) and \
changed_dir = True name is not None:
self.script_build.append(self.config.expand(source['script'])) self.script_build.append(self.config.expand('cd ' + name))
if not changed_dir and (unpack_before_chdir and not create_dir): changed_dir = True
self.script_build.append(self.config.expand(source['script']))
if not changed_dir and (unpack_before_chdir and not create_dir) and \
name is not None and not download_only:
self.script_build.append(self.config.expand('cd ' + name)) self.script_build.append(self.config.expand('cd ' + name))
changed_dir = True changed_dir = True
self.script_build.append(self.config.expand('%{__setup_post}')) self.script_build.append(self.config.expand('%{__setup_post}'))
@ -345,7 +359,7 @@ class build:
else: else:
url += [pp] url += [pp]
if len(url) == 0: if len(url) == 0:
raise error.general('patch URL not found: %s' % (' '.join(args))) raise error.general('patch URL not found: %s' % (' '.join(opts)))
# #
# Look for --rsb-file as an option we use as a local file name. # Look for --rsb-file as an option we use as a local file name.
# This can be used if a URL has no reasonable file name the # This can be used if a URL has no reasonable file name the
@ -357,9 +371,11 @@ class build:
if o.startswith('--rsb-file'): if o.startswith('--rsb-file'):
os_ = o.split('=') os_ = o.split('=')
if len(os_) != 2: if len(os_) != 2:
raise error.general('invalid --rsb-file option: %s' % (' '.join(args))) raise error.general('invalid --rsb-file option: %s' % \
(' '.join(opts)))
if os_[0] != '--rsb-file': if os_[0] != '--rsb-file':
raise error.general('invalid --rsb-file option: %s' % (' '.join(args))) raise error.general('invalid --rsb-file option: %s' % \
(' '.join(opts)))
file_override = os_[1] file_override = os_[1]
opts = [o for o in opts if not o.startswith('--rsb-')] opts = [o for o in opts if not o.startswith('--rsb-')]
if len(opts) == 0: if len(opts) == 0:
@ -371,7 +387,8 @@ class build:
# #
# Parse the URL first in the source builder's patch directory. # Parse the URL first in the source builder's patch directory.
# #
patch = download.parse_url(url, '_patchdir', self.config, self.opts, file_override) patch = download.parse_url(url, '_patchdir', self.config,
self.opts, file_override)
# #
# Download the patch # Download the patch
# #

View File

@ -52,6 +52,7 @@ def load():
'_var': ('dir', 'optional', '/usr/local/var'), '_var': ('dir', 'optional', '/usr/local/var'),
'_prefix': ('dir', 'optional', '%{_usr}'), '_prefix': ('dir', 'optional', '%{_usr}'),
'__ldconfig': ('exe', 'none', ''), '__ldconfig': ('exe', 'none', ''),
'__cmake': ('exe', 'optional', 'cmake'),
'__cvs': ('exe', 'optional', 'cvs'), '__cvs': ('exe', 'optional', 'cvs'),
'__xz': ('exe', 'required', 'xz'), '__xz': ('exe', 'required', 'xz'),
'with_zlib': ('none', 'none', '--with-zlib=no'), 'with_zlib': ('none', 'none', '--with-zlib=no'),

View File

@ -63,6 +63,7 @@ def load():
'_var': ('dir', 'optional', '/usr/local/var'), '_var': ('dir', 'optional', '/usr/local/var'),
'__bash': ('exe', 'optional', '/usr/local/bin/bash'), '__bash': ('exe', 'optional', '/usr/local/bin/bash'),
'__bison': ('exe', 'required', '/usr/local/bin/bison'), '__bison': ('exe', 'required', '/usr/local/bin/bison'),
'__cmake': ('exe', 'optional', '/usr/local/bin/cmake'),
'__git': ('exe', 'required', '/usr/local/bin/git'), '__git': ('exe', 'required', '/usr/local/bin/git'),
'__svn': ('exe', 'optional', '/usr/local/bin/svn'), '__svn': ('exe', 'optional', '/usr/local/bin/svn'),
'__unzip': ('exe', 'optional', '/usr/local/bin/unzip'), '__unzip': ('exe', 'optional', '/usr/local/bin/unzip'),

View File

@ -293,6 +293,8 @@ class command_line:
'--without-log', '--without-log',
'--without-error-report', '--without-error-report',
'--without-release-url'] '--without-release-url']
if a == '--dry-run':
self.args += ['--without-error-report']
arg += 1 arg += 1
def post_process(self, logfile = True): def post_process(self, logfile = True):

View File

@ -405,18 +405,6 @@ class buildset:
if nesting_count != 1: if nesting_count != 1:
if self.installing(): if self.installing():
self.macros['install_mode'] = 'staging' self.macros['install_mode'] = 'staging'
#
# Prepend staging areas, bin directory tothe
# path. Lets the later package depend on the eailier
# ones.
#
pathprepend = ['%{stagingroot}/bin'] + \
macro_expand(self.macros, '%{_pathprepend}').split(':')
pathprepend = [pp for pp in pathprepend if len(pp)]
if len(pathprepend) == 1:
self.macros['_pathprepend'] = pathprepend[0]
else:
self.macros['_pathprepend'] = ':'.join(pathprepend)
# #
# Only the outter build set can have staging to install. Get the staging # Only the outter build set can have staging to install. Get the staging
@ -430,6 +418,20 @@ class buildset:
log.trace('_bset: %2d: %s: configs: %s' % (nesting_count, log.trace('_bset: %2d: %s: configs: %s' % (nesting_count,
self.bset, ', '.join(configs))) self.bset, ', '.join(configs)))
if nesting_count == 1 and len(configs) > 1:
#
# Prepend staging areas, bin directory to the
# path. Lets the later package depend on the earlier
# ones.
#
pathprepend = ['%{stagingroot}/bin'] + \
macro_expand(self.macros, '%{_pathprepend}').split(':')
pathprepend = [pp for pp in pathprepend if len(pp)]
if len(pathprepend) == 1:
self.macros['_pathprepend'] = pathprepend[0]
else:
self.macros['_pathprepend'] = ':'.join(pathprepend)
sizes_valid = False sizes_valid = False
builds = [] builds = []
for s in range(0, len(configs)): for s in range(0, len(configs)):
@ -519,7 +521,7 @@ class buildset:
log.trace('_bset: %2d: %s: builds: %s' % \ log.trace('_bset: %2d: %s: builds: %s' % \
(nesting_count, self.install_mode(), (nesting_count, self.install_mode(),
', '.join([b.name() for b in builds]))) ', '.join([b.name() for b in builds])))
if deps is None and not have_errors: if deps is None and not self.opts.no_install() and not have_errors:
for b in builds: for b in builds:
log.trace('_bset: : %s: %r' % (self.install_mode(), log.trace('_bset: : %s: %r' % (self.install_mode(),
b.installable())) b.installable()))
@ -586,18 +588,22 @@ class buildset:
# If builds have been staged install into the finaly prefix. # If builds have been staged install into the finaly prefix.
# #
if have_staging and not self.opts.no_install() and not have_errors: if have_staging and not self.opts.no_install() and not have_errors:
log.trace('_bset: %2d: install staging' % (nesting_count))
stagingroot = macro_expand(self.macros, '%{stagingroot}') stagingroot = macro_expand(self.macros, '%{stagingroot}')
prefix = macro_expand(self.macros, '%{_prefix}') have_stagingroot = path.exists(stagingroot)
self.install(self.install_mode(), self.bset, stagingroot, prefix) log.trace('_bset: %2d: install staging, present: %s' % \
staging_size = path.get_size(stagingroot) (nesting_count, have_stagingroot))
if not self.opts.no_clean() or self.opts.always_clean(): if have_stagingroot:
log.notice('clean staging: %s' % (self.bset)) prefix = macro_expand(self.macros, '%{_prefix}')
log.trace('removing: %s' % (stagingroot)) self.install(self.install_mode(), self.bset, stagingroot, prefix)
if not self.opts.dry_run(): staging_size = path.get_size(stagingroot)
if path.exists(stagingroot): if not self.opts.no_clean() or self.opts.always_clean():
path.removeall(stagingroot) log.notice('clean staging: %s' % (self.bset))
log.notice('Staging Size: %s' % (build.humanize_number(staging_size, 'B'))) log.trace('removing: %s' % (stagingroot))
if not self.opts.dry_run():
if path.exists(stagingroot):
path.removeall(stagingroot)
log.notice('Staging Size: %s' % \
(build.humanize_number(staging_size, 'B')))
except error.general as gerr: except error.general as gerr:
if not build_error: if not build_error:
log.stderr(str(gerr)) log.stderr(str(gerr))

View File

@ -49,8 +49,8 @@ def add(label, args, macros, error):
def set(label, args, macros, error): def set(label, args, macros, error):
args = _args(args) args = _args(args)
if len(args) < 2: if len(args) < 2:
error('%%%s requires at least 2 arguments' % (label)) error('%%%s set requires at least 2 arguments' % (label))
return return []
_map = '%s-%s' % (label, args[0]) _map = '%s-%s' % (label, args[0])
macros.create_map(_map) macros.create_map(_map)
key = _make_key(label, 0) key = _make_key(label, 0)
@ -63,12 +63,26 @@ def set(label, args, macros, error):
def setup(label, args, macros, error): def setup(label, args, macros, error):
args = _args(args) args = _args(args)
if len(args) < 2: if len(args) < 2:
error('%%%s requires at least 2 arguments: %s' % (label, ' '.join(args))) error('%%%s setup requires at least 2 arguments: %s' % (label, ' '.join(args)))
ss = '%%setup %s %s' % (label, ' '.join(args)) ss = '%%setup %s %s' % (label, ' '.join(args))
_map = '%s-%s' % (label, args[0]) _map = '%s-%s' % (label, args[0])
if 'setup' in macros.map_keys(_map): if 'setup' in macros.map_keys(_map):
error('%%%s already setup source: %s' % (label, ' '.join(args))) error('%%%s already setup source: %s' % (label, ' '.join(args)))
return return []
macros.set_write_map(_map)
macros.define('setup', ss)
macros.unset_write_map()
return [ss]
def download(label, args, macros, error):
args = _args(args)
if len(args) != 1:
error('%%%s download requires 1 argument: %s' % (label, ' '.join(args)))
ss = '%%setup %s %s -g' % (label, ' '.join(args))
_map = '%s-%s' % (label, args[0])
if 'setup' in macros.map_keys(_map):
error('%%%s already setup source: %s' % (label, ' '.join(args)))
return []
macros.set_write_map(_map) macros.set_write_map(_map)
macros.define('setup', ss) macros.define('setup', ss)
macros.unset_write_map() macros.unset_write_map()
@ -79,15 +93,14 @@ def process(label, args, macros, error):
error('invalid source type: %s' % (label)) error('invalid source type: %s' % (label))
args = _args(args) args = _args(args)
log.trace('sources: %s' % (' '.join(args))) log.trace('sources: %s' % (' '.join(args)))
if len(args) < 3:
error('%%%s requires at least 3 arguments: %s' % (label, ' '.join(args)))
return
if args[0] == 'set': if args[0] == 'set':
return set(label, args[1:], macros, error) return set(label, args[1:], macros, error)
elif args[0] == 'add': elif args[0] == 'add':
return add(label, args[1:], macros, error) return add(label, args[1:], macros, error)
elif args[0] == 'setup': elif args[0] == 'setup':
return setup(label, args[1:], macros, error) return setup(label, args[1:], macros, error)
elif args[0] == 'download':
return download(label, args[1:], macros, error)
error('invalid %%%s command: %s' % (label, args[0])) error('invalid %%%s command: %s' % (label, args[0]))
def hash(args, macros, error): def hash(args, macros, error):