docker/containerd-packaging

Get this working for multi-arch

seemethere opened this issue · 2 comments

So there's a couple things that are needed to get this thing up and running for multi-arch:

For RPM:

ius doesn't work for multi-arch so the git2u package is moot

  • This means we can't use git -C anywhere, should probably replace with git --git-dir ${dir}/.git
Potential patch for `git -C`
diff --git a/dockerfiles/rpm.dockerfile b/dockerfiles/rpm.dockerfile
index ba38fcb..fcde065 100644
--- a/dockerfiles/rpm.dockerfile
+++ b/dockerfiles/rpm.dockerfile
@@ -3,16 +3,13 @@ FROM centos:7
 RUN yum groupinstall -y "Development Tools"
 
 # Install git (git2u) through the IUS repository since it's more up to date
-RUN yum remove -y git
-RUN yum install -y https://centos7.iuscommunity.org/ius-release.rpm epel-release
 RUN yum install -y \
-   pkgconfig \
-   tar \
    cmake \
+   pkgconfig \
    rpm-build \
-   rpmdevtools \
    rpmbuildtools \
-   git2u
+   rpmdevtools \
+   tar
 
 # Install golang since the package managed one probably is too old and ppa's don't cover all distros
 ARG GO_DL_URL
@@ -30,7 +27,7 @@ RUN mkdir -p /go
 ARG REF
 ENV GO_SRC_PATH /go/src/github.com/containerd/containerd
 RUN git clone https://github.com/containerd/containerd.git ${GO_SRC_PATH}
-RUN git -C ${GO_SRC_PATH} checkout ${REF}
+RUN git --git-dir ${GO_SRC_PATH}/.git checkout ${REF}
 
 WORKDIR /root/rpmbuild
 ENTRYPOINT ["/build-rpm"]
diff --git a/scripts/build-rpm b/scripts/build-rpm
index 3b3287b..5d0221f 100755
--- a/scripts/build-rpm
+++ b/scripts/build-rpm
@@ -4,21 +4,21 @@ source /.rpm-helpers
 
 set -e
 
-VERSION="$(git -C "${GO_SRC_PATH}" describe --tags | sed 's/^v//')"
+VERSION="$(git --git-dir "${GO_SRC_PATH}/.git" describe --tags | sed 's/^v//')"
 RPM_VER_BITS=$(gen-rpm-ver-bits "${VERSION}")
 RPM_VERSION=$(echo "${RPM_VER_BITS}" | cut -f1 -d' ')
 RPM_RELEASE_VERSION=$(echo "${RPM_VER_BITS}" | cut -f2 -d' ')
 
 
 # Check if we're on a tagged version, change VERSION to dev build if not
-if ! git -C "${GO_SRC_PATH}" describe --exact-match HEAD >/dev/null 2>&1; then
-    git_date=$(date --date "@$(git -C "${GO_SRC_PATH}" log -1 --pretty='%at')" +'%Y%m%d.%H%M%S')
-    git_sha=$(git -C "${GO_SRC_PATH}" log -1 --pretty='%h')
+if ! git --git-dir "${GO_SRC_PATH}/.git" describe --exact-match HEAD >/dev/null 2>&1; then
+    git_date=$(date --date "@$(git --git-dir "${GO_SRC_PATH}/.git" log -1 --pretty='%at')" +'%Y%m%d.%H%M%S')
+    git_sha=$(git --git-dir "${GO_SRC_PATH}/.git" log -1 --pretty='%h')
     VERSION="0.${git_date}~${git_sha}"
     RPM_RELEASE_VERSION=0
     RPM_VERSION="$VERSION"
 fi
-REF=$(git -C "${GO_SRC_PATH}" rev-parse HEAD)
+REF=$(git --git-dir "${GO_SRC_PATH}/.git" rev-parse HEAD)
 
 export REF
 export RPM_RELEASE_VERSION
An error occurs for `yum-builddep` on `arm64`
+ yum-builddep -y SPECS/containerd.spec
Loaded plugins: fastestmirror, ovl
Enabling base-source repository
Enabling extras-source repository
Enabling updates-source repository
Loading mirror speeds from cached hostfile
base-source                                                                    | 2.9 kB  00:00:00
http://vault.centos.org/altarch/7/extras/Source/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.
To address this issue please refer to the below wiki article

https://wiki.centos.org/yum-errors

If above article doesn't help to resolve this issue please use https://bugs.centos.org/.

failure: repodata/repomd.xml from extras-source: [Errno 256] No more mirrors to try.
http://vault.centos.org/altarch/7/extras/Source/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
Makefile:34: recipe for target 'rpm' failed

Getting a very similar error on PowerPC

17:23:07 + yum-builddep -y SPECS/containerd.spec
17:23:07 Loaded plugins: fastestmirror, ovl
17:23:07 Enabling base-source repository
17:23:07 Enabling extras-source repository
17:23:07 Enabling updates-source repository
17:23:07 Loading mirror speeds from cached hostfile
17:23:07 
base-source                                              | 2.9 kB     00:00     
17:23:07 http://vault.centos.org/altarch/7/extras/Source/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
17:23:07 Trying other mirror.
17:23:07 To address this issue please refer to the below wiki article 
17:23:07 
17:23:07 https://wiki.centos.org/yum-errors
17:23:07 
17:23:07 If above article doesn't help to resolve this issue please use https://bugs.centos.org/.
17:23:07 
17:23:07 failure: repodata/repomd.xml from extras-source: [Errno 256] No more mirrors to try.
17:23:07 http://vault.centos.org/altarch/7/extras/Source/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
17:23:07 Makefile:63: recipe for target 'rpm' failed
17:23:07 make: *** [rpm] Error 1

Closed with #29