什么是ConanException:执行柯南安装命令时出现错误32512?

时间:2019-02-06 06:58:42

标签: conan

我正在尝试从正在构建的软件包信息中执行源命令,但是在尝试安装它时却出现以下错误。

sh: 1: source: not found
ERROR: package_name/7.0@repo/stable: Error in package_info() method, line 23
    self.run("source "+self.package_folder+"/pkgsdp-env.sh")
    ConanException: Error 32512 while executing source /home/tusharecmc/.conan/data/pkg/7.0/repo/stable/package/4db1be536558d833e52e862fd84d64d75c2b3656/pkgsdp-env.sh

我的conanfile.py如下

from conans import ConanFile, tools


class pkgConan(ConanFile):
    name = "qnx"
    version = "7.0"
    settings = {"os":["Linux"],
                "arch":["x86_64"]
               }
    description = "Package for qnx os 7.0"
    url = "None"
    license = "None"
    author = "None"
    topics = ["pkg","os"]

    def package(self):
        self.copy("*")
        self.copy("pkgsdp-env.sh", src="./pkg700/")

    def package_info(self):
        self.cpp_info.libs = tools.collect_libs(self)
        self.env_info.path.append(self.package_folder+"/pkg700")
        self.run("source "+self.package_folder+"/pkgsdp-env.sh")

1 个答案:

答案 0 :(得分:1)

我已经创建了很长时间的柯南软件包,这是我第一次看到有人试图在食谱中运行 source 。您的命令将不起作用,因为您的系统使用的是 / bin / dash ,它不支持命令 source

我会说要更改权限并直接运行它:

qnxsdpenv = os.path.join(self.package_folder, "qnxsdp-env.sh")
permission = stat.S_IMODE(os.lstat(qnxsdpenv).st_mode)
os.chmod(qnxsdpenv, (permission | stat.S_IEXEC))
self.run(qnxsdpenv)

但是,如果qnxsdp-env.sh仅设置了几个env变量,那么我将通过self.env_info来设置它们,这更加清晰易读。