为什么没有包装复制h文件?

时间:2016-01-07 10:48:58

标签: python package scons

我有一个包含许多子目录和文件类型(python,c ++,配置文件,图像等)的项目。 当我像这样使用SCons env.Package时:

    env.Package( 
    NAME           = 'isid',
    VERSION        = '1.0', 
    PACKAGEVERSION = '11',
    PACKAGETYPE    = 'rpm',
    LICENSE        = 'gpl',
    SUMMARY        = 'just a test',
    DESCRIPTION    = 'the most test app in the world',
    X_RPM_GROUP    = 'Application/isid',
    SOURCE_URL     = 'http://isid.com/versions/isid-1.0.11.tar.gz',
)

我在isid-1.0.11.tar.gz 中获取所有之外的h文件。 这会自动导致./isid-1.0.11中的构建错误导致rpmbuild无法运行。

修改

我的项目分为几个子目录。 在每个我都有SConscript,从这些行开始,或类似,取决于它需要的包括:

  # import all variables
  Import('*') 

  include = Dir([ 
     '../inc/',
  ])

  local_env = env.Clone( CPPPATH = include )

SConstruct只定义变量并在每个子目录上调用SConscript()。

对Package的调用是在SConstruct中完成的,所以我猜SCons确实不知道依赖项。

的片段 # scons --tree=prune:

scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
scons: `.' is up to date.
+-.
  +-SConstruct
  +-correlator
  | +-correlator/SConscript
  | +-correlator/collector
  | +-correlator/correlation_command
  | | +-correlator/correlation_command/app_command_device.cpp
  | | +-correlator/correlation_command/app_command_device.h
  | | +-correlator/correlation_command/app_command_device.o
  | | | +-correlator/correlation_command/app_command_device.cpp
  | | | +-correlator/correlation_command/app_command_device.h
  | | | +-correlator/entity/entity.h
  | | | +-infra/inc/app_command/app_command.h
  | | | +-/bin/g++
  | | +-correlator/correlation_command/app_command_event.cpp
  | | +-correlator/correlation_command/app_command_event.h

编辑#2

这是一个完整的,最小的例子,可以产生同样的问题。 要重现此问题,请运行:

  

scons pack = 1.0 ver = 1

文件: SConstruct。 APP1 / SConscript APP1 / main.cpp中 APP1 / inc.h

清单

SConstruct

 1  
 2  # main file
 3  
 4  env = Environment(tools=['default', 'packaging'])
 5  
 6  Export( 'env' )
 7  
 8  flags = [ 
 9      '-Wall',
10      '-Werror',
11      '-g',
12      '-ggdb3',
13      '-gdwarf-2',
14      '-std=c++11',
15  ]
16  
17  env.Append( CPPFLAGS = flags ) 
18  
19  
20  scripts = []
21  
22  Sapp1 = 'app1/SConscript'
23  scripts.append( Sapp1 )
24  
25  
26  env.SConscript( scripts )
27  
28  pack = ARGUMENTS.get('pack', '')
29  ver = ARGUMENTS.get('ver', '99' )
30  if pack:
31      env.Package( 
32          NAME           = 'app1',
33          VERSION        = pack,
34          PACKAGEVERSION = ver,
35          PACKAGETYPE    = 'rpm',
36          LICENSE        = 'private',
37          SUMMARY        = 'exampe app #1',
38          DESCRIPTION    = 'the most powerfull exampe #1',
39          X_RPM_GROUP    = 'Application/app1',
40          SOURCE_URL     = 'http://example.com/1/app1-1.0.1.tar.gz',
41      )
42  

APP1 / SConscript

 1  
 2  # import all variables
 3  Import('*')
 4  
 5  # add specific include directory
 6  
 7  include = Dir( [
 8      '.',
 9  ])
10  
11  local_env = env.Clone( CPPPATH = include )
12  
13  # define sources
14  sources = [ 
15      'main.cpp',
16  ]
17  
18  libs = [
19  ]
20  
21  main_name = 'app1',
22  
23  main_obj = local_env.Program( target = main_name, source = sources, LIBS = libs )
24  
25  # install
26  install_dir = '/opt/rf/app1'
27  install_files = [ main_obj ] 
28  
29  local_env.Install( dir = install_dir, source = install_files )
30  local_env.Command( install_dir, install_files, "chown -R rf:rfids $TARGET" )
31  
32  
33  local_env.Alias( 'install', install_dir )

APP1 / main.cpp中

     1  
 2  #include "inc.h"
 3  
 4  
 5  int main()
 6  {
 7      int l = g;
 8  
 9      return l;
10  }

APP1 / inc.h

 1  
 2  int g = 100;

输出:

# scons pack=1.0 ver=1
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
g++ -o app1/main.o -c -Wall -Werror -g -ggdb3 -gdwarf-2 -std=c++11 -Iapp1 app1/main.cpp
g++ -o app1/app1 app1/main.o
LC_ALL=C rpmbuild -ta /home/ran/work/rpmexample/app1-1.0.1.tar.gz
scons: *** [app1-1.0-1.src.rpm] app1-1.0-1.src.rpm: Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.wU9lDZ
+ umask 022
+ cd /home/ran/work/rpmexample/rpmtemp/BUILD
+ '[' -n /home/ran/work/rpmexample/rpmtemp/BUILDROOT/app1-1.0-1.x86_64 -a /home/ran/work/rpmexample/rpmtemp/BUILDROOT/app1-1.0-1.x86_64 '!=' / ']'
+ rm -rf /home/ran/work/rpmexample/rpmtemp/BUILDROOT/app1-1.0-1.x86_64
+ cd /home/ran/work/rpmexample/rpmtemp/BUILD
+ rm -rf app1-1.0
+ /usr/bin/gzip -dc /home/ran/work/rpmexample/app1-1.0.1.tar.gz
+ /usr/bin/tar -xf -
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd app1-1.0
+ /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.gVaX4j
+ umask 022
+ cd /home/ran/work/rpmexample/rpmtemp/BUILD
+ cd app1-1.0
+ '[' '!' -e /home/ran/work/rpmexample/rpmtemp/BUILDROOT/app1-1.0-1.x86_64 -a /home/ran/work/rpmexample/rpmtemp/BUILDROOT/app1-1.0-1.x86_64 '!=' / ']'
+ mkdir /home/ran/work/rpmexample/rpmtemp/BUILDROOT/app1-1.0-1.x86_64
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.JWAdxE
+ umask 022
+ cd /home/ran/work/rpmexample/rpmtemp/BUILD
+ '[' /home/ran/work/rpmexample/rpmtemp/BUILDROOT/app1-1.0-1.x86_64 '!=' / ']'
+ rm -rf /home/ran/work/rpmexample/rpmtemp/BUILDROOT/app1-1.0-1.x86_64
++ dirname /home/ran/work/rpmexample/rpmtemp/BUILDROOT/app1-1.0-1.x86_64
+ mkdir -p /home/ran/work/rpmexample/rpmtemp/BUILDROOT
+ mkdir /home/ran/work/rpmexample/rpmtemp/BUILDROOT/app1-1.0-1.x86_64
+ cd app1-1.0
+ scons --install-sandbox=/home/ran/work/rpmexample/rpmtemp/BUILDROOT/app1-1.0-1.x86_64 /home/ran/work/rpmexample/rpmtemp/BUILDROOT/app1-1.0-1.x86_64
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
g++ -o app1/main.o -c -Wall -Werror -g -ggdb3 -gdwarf-2 -std=c++11 -Iapp1 app1/main.cpp
app1/main.cpp:2:17: fatal error: inc.h: No such file or directory
 #include "inc.h"
                 ^
compilation terminated.
scons: *** [app1/main.o] Error 1
scons: building terminated because of errors.
error: Bad exit status from /var/tmp/rpm-tmp.JWAdxE (%install)


RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.JWAdxE (%install)

scons: building terminated because of errors.

0 个答案:

没有答案