Skip to content

Commit

Permalink
fix rpm packaging issues
Browse files Browse the repository at this point in the history
Makefile: split download-dependencies into package-dependencies and
          download-dependencies for reusing codes in packaging.

.travis.yml:
hack/package/rpm/build.sh: synchronize changes with Makefile

Signed-off-by: Alex Jia <[email protected]>
  • Loading branch information
chuanchang committed Aug 15, 2018
1 parent 18df365 commit 75513c2
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 47 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,23 @@ script: |
TEST_FLAGS= make build-integration-test
sudo env "PATH=$PATH" make install
sudo env "PATH=$PATH" make download_dependencies
sudo env "PATH=$PATH" make download-dependencies
sudo env "PATH=$PATH" make integration-test
make coverage
elif [[ "${TEST_SUITE}" = "criv1alpha1test" ]]; then
make build
TEST_FLAGS= make build-daemon-integration
sudo env "PATH=$PATH" make install
sudo env "PATH=$PATH" make download_dependencies
sudo env "PATH=$PATH" make download-dependencies
sudo env "PATH=$PATH" make cri-v1alpha1-test
make coverage
else
make build
TEST_FLAGS= make build-daemon-integration
sudo env "PATH=$PATH" make install
sudo env "PATH=$PATH" make download_dependencies
sudo env "PATH=$PATH" make download-dependencies
sudo env "PATH=$PATH" make cri-v1alpha2-test
make coverage
fi
Expand Down
14 changes: 9 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,20 @@ uninstall: ## uninstall pouchd and pouch binary
@rm -f $(addprefix $(DEST_DIR)/bin/,$(notdir $(DAEMON_BINARY_NAME)))
@rm -f $(addprefix $(DEST_DIR)/bin/,$(notdir $(CLI_BINARY_NAME)))

.PHONY: download_dependencies
download_dependencies: ## download related dependencies, such as dumb_init
.PHONY: package-dependencies
package-dependencies: ## install containerd, runc and lxcfs dependencies for packaging
@echo $@
hack/install/install_ci_related.sh
hack/install/install_containerd.sh
hack/install/install_lxcfs.sh
hack/install/install_runc.sh

.PHONY: download-dependencies
download-dependencies: package-dependencies ## install dumb-init, local-persist, nsenter and CI tools dependencies
@echo $@
hack/install/install_ci_related.sh
hack/install/install_dumb_init.sh
hack/install/install_local_persist.sh
hack/install/install_lxcfs.sh
hack/install/install_nsenter.sh
hack/install/install_runc.sh

.PHONY: clean
clean: ## clean to remove bin/* and files created by module
Expand Down
54 changes: 15 additions & 39 deletions hack/package/rpm/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,10 @@ BINDIR=$POUCHDIR/bin
[ -d "$BINDIR" ] || mkdir -p "$BINDIR"
LIBDIR=$POUCHDIR/lib
[ -d "$LIBDIR" ] || mkdir -p "$LIBDIR"
LXC_DIR=$TMP/lxc
[ -d "$LXC_DIR" ] || mkdir -p "$LXC_DIR"

# Dependency
# lxcfs stable branch
LXC_BRANCH="stable-2.0"
CONTAINERD_VERSION="1.0.3"
RUNC_VERSION="1.0.0-rc4-1"
USRBASE=/usr/local
USRBINDIR=$USRBASE/bin
USRLIBDIR=$USRBASE/lib

# ARCHITECTURE, The architecture name. Usually matches 'uname -m'.
ARCHITECTURE=$(uname -m)
Expand All @@ -39,39 +35,20 @@ VENDOR='Pouch'
LIB_NVIDIA_VERSION="1.0.0-rc.2"
NVIDIA_RUNTIME_VERSION="1.4.0-1"

# build lxcfs
function build_lxcfs ()
{
pushd "$LXC_DIR"
git clone -b "$LXC_BRANCH" https://github.com/lxc/lxcfs.git && cd lxcfs

# change liblxcfs.so to libpouchlxcfs.so
grep -l -r "liblxcfs" . | xargs sed -i 's/liblxcfs/libpouchlxcfs/g'
./bootstrap.sh > /dev/null 2>&1
./configure > /dev/null 2>&1
make install DESTDIR="$LXC_DIR" > /dev/null 2>&1
popd
}

# install containerd, runc and pouch
# build lxcfs and install containerd, runc and pouch
function build_pouch()
{
# install containerd
echo "Downloading containerd."
wget --quiet "https://github.com/containerd/containerd/releases/download/v${CONTAINERD_VERSION}/containerd-${CONTAINERD_VERSION}.linux-amd64.tar.gz" -P "$TMP"
tar xf "$TMP/containerd-${CONTAINERD_VERSION}.linux-amd64.tar.gz" -C "$TMP" && cp -f "$TMP"/bin/* "$BINDIR/"

# install runc
echo "Downloading runc."
wget --quiet "https://github.com/alibaba/runc/releases/download/v${RUNC_VERSION}/runc.amd64" -P "$BINDIR/"
chmod +x "$BINDIR/runc.amd64"
mv "$BINDIR/runc.amd64" "$BINDIR/runc"

# build pouch
echo "Building pouch."
pushd $BASEDIR/pouch
make install DESTDIR="$POUCHDIR"
# install containerd, runc and lxcfs dependencies for packaging
make package-dependencies
# build pouch
make build
make install DEST_DIR="$POUCHDIR"
popd

# make sure related binaries are included by pouch pacakge
cp $USRBINDIR/containerd* $USRBINDIR/ctr $USRBINDIR/runc $BINDIR

}

# install nvidia-container-runtime
Expand Down Expand Up @@ -135,16 +112,15 @@ function build_rpm ()
"$BINDIR/"=/usr/local/bin/ \
"$LIBDIR/"=/usr/lib64/ \
"$SERVICEDIR/"=/usr/lib/systemd/system/ \
"$LXC_DIR/usr/local/bin/lxcfs"=/usr/bin/pouch-lxcfs \
"$LXC_DIR/usr/local/lib/lxcfs/libpouchlxcfs.so"=/usr/lib64/libpouchlxcfs.so \
"$USRBINDIR/lxcfs"=/usr/bin/pouch-lxcfs \
"$USRLIBDIR/lxcfs/liblxcfs.so"=/usr/lib64/libpouchlxcfs.so \

}

function main()
{
echo "Building rpm package."
build_pouch
build_lxcfs
build_nvidia_runtime
build_rpm
}
Expand Down

0 comments on commit 75513c2

Please sign in to comment.