在Fedora上构建Docker RPM

时间:2015-03-18 10:34:12

标签: docker fedora rpmbuild fedora-21

我正在尝试从src.rpm为fedora中的docker构建RPM。我从这里得到了src.rpm包:http://koji.fedoraproject.org/koji/buildinfo?buildID=610523

我正在遵循本指南:http://docs.fedoraproject.org/en-US/Fedora_Draft_Documentation/0.1/html/RPM_Guide/ch11s03.html

现在,只要我运行rpmbuild,就会出现以下错误:

[peeyush@localhost ~]$ rpmbuild --rebuild docker-io-1.5.0-1.fc21.src.rpm 
Installing docker-io-1.5.0-1.fc21.src.rpm
error: Failed build dependencies:
    btrfs-progs-devel is needed by docker-io-1.5.0-1.fc21.x86_64
    device-mapper-devel is needed by docker-io-1.5.0-1.fc21.x86_64
    glibc-static is needed by docker-io-1.5.0-1.fc21.x86_64
    go-md2man is needed by docker-io-1.5.0-1.fc21.x86_64
    golang(code.google.com/p/go.net/websocket) is needed by docker-io-1.5.0-1.fc21.x86_64
    golang(code.google.com/p/gosqlite/sqlite3) is needed by docker-io-1.5.0-1.fc21.x86_64
    golang(github.com/Sirupsen/logrus) >= 0.6.0 is needed by docker-io-1.5.0-1.fc21.x86_64
    golang(github.com/coreos/go-systemd/activation) >= 2-1 is needed by docker-io-1.5.0-1.fc21.x86_64
    golang(github.com/docker/libtrust) >= 0-0.2 is needed by docker-io-1.5.0-1.fc21.x86_64
    golang(github.com/docker/libtrust/trustgraph) >= 0-0.2 is needed by docker-io-1.5.0-1.fc21.x86_64
    golang(github.com/godbus/dbus) is needed by docker-io-1.5.0-1.fc21.x86_64
    golang(github.com/gorilla/mux) >= 0-0.13 is needed by docker-io-1.5.0-1.fc21.x86_64
    golang(github.com/kr/pty) >= 0-0.19 is needed by docker-io-1.5.0-1.fc21.x86_64
    golang(github.com/syndtr/gocapability/capability) >= 0-0.7 is needed by docker-io-1.5.0-1.fc21.x86_64
    golang(github.com/tchap/go-patricia/patricia) is needed by docker-io-1.5.0-1.fc21.x86_64

有趣的是,我已经安装了golang:

[peeyush@localhost ~]$ rpm -q golang
golang-1.3.3-1.fc21.x86_64

请帮我弄清楚这里有什么问题?或者你能否告诉我是否有其他方法来构建docker RPM。

1 个答案:

答案 0 :(得分:2)

首先,如果您的目标只是安装较新版本的Docker软件包,请考虑:

# yum --enablerepo=updates-testing install docker-io

目前您将获得docker-io.x86_64 0:1.5.0-2.fc21


您需要先安装所有必需的依赖项,然后才能构建程序包。您可以使用rpm -q手动检查源RPM:

$ rpm -qp --requires docker-io-1.5.0-1.fc21.src.rpm
btrfs-progs-devel
device-mapper-devel
glibc-static
go-md2man
golang >= 1.2.1-3
golang >= 1.3.3
golang(code.google.com/p/go.net/websocket)
golang(code.google.com/p/gosqlite/sqlite3)
golang(github.com/Sirupsen/logrus) >= 0.6.0
golang(github.com/coreos/go-systemd/activation) >= 2-1
golang(github.com/docker/libtrust) >= 0-0.2
golang(github.com/docker/libtrust/trustgraph) >= 0-0.2
golang(github.com/godbus/dbus)
golang(github.com/gorilla/mux) >= 0-0.13
golang(github.com/kr/pty) >= 0-0.19
golang(github.com/syndtr/gocapability/capability) >= 0-0.7
golang(github.com/tchap/go-patricia/patricia)
pkgconfig(systemd)
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(FileDigests) <= 4.6.0-1

您可以手动安装这些要求,确保满足要求 版本要求,或者您可以使用自动化过程 yum-builddep命令,可在yum-utils包中找到:

$ sudo yum-builddep docker-io-1.5.0-1.fc21.src.rpm 

可能会告诉你:

[...]
Error: No Package found for golang(github.com/docker/libtrust) >= 0-0.2
Error: No Package found for golang(github.com/docker/libtrust/trustgraph) >= 0-0.2

这是因为您尝试构建的程序包依赖于程序包 还没有发布。他们 位于updates-testing 存储库,因此您可以运行:

$ sudo yum-builddep --enablerepo=updates-testing \
  docker-io-1.5.0-1.fc21.src.rpm

这将安装所有要求。