scripts: add find_rpm_path.sh and rpm_repo_list.txt 56/1756/1
authorJackie Huang <jackie.huang@windriver.com>
Fri, 15 Nov 2019 08:41:46 +0000 (16:41 +0800)
committerJackie Huang <jackie.huang@windriver.com>
Mon, 25 Nov 2019 03:08:24 +0000 (11:08 +0800)
Issue-ID: INF-4
Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
Change-Id: I92b39f70c750078ab5c0cc17b4278b7919bb372d

scripts/find_rpm_path.sh [new file with mode: 0755]
scripts/rpm_repo_list.txt [new file with mode: 0644]

diff --git a/scripts/find_rpm_path.sh b/scripts/find_rpm_path.sh
new file mode 100755 (executable)
index 0000000..46df1aa
--- /dev/null
@@ -0,0 +1,126 @@
+#!/bin/bash
+#
+# Copyright (C) 2019 Wind River Systems, Inc.
+#
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+# Ensure we fail the job if any steps fail.
+set -e -o pipefail
+
+help_info () {
+cat << ENDHELP
+This script is used to genereate package-index and output the path
+of rpm packages and index files, it must be ran after build_oran.sh
+Usage:
+$(basename $0) [-w WORKSPACE_DIR] [-n] [-h]
+where:
+    -w WORKSPACE_DIR is the path for the project
+    -n dry-run only for bitbake
+    -h this help info
+ENDHELP
+}
+
+echo_info () {
+    echo "INFO: $1"
+}
+
+echo_error () {
+    echo "ERROR: $1"
+}
+
+echo_cmd () {
+    echo
+    echo_info "$1"
+    echo "CMD: ${RUN_CMD}"
+}
+
+DRYRUN=""
+RECIPE_LIST=""
+SCRIPTS_DIR=`dirname $0`
+SCRIPTS_DIR=`readlink -f $SCRIPTS_DIR`
+
+while getopts "w:nh" OPTION; do
+    case ${OPTION} in
+        w)
+            WORKSPACE=`readlink -f ${OPTARG}`
+            ;;
+        n)
+            DRYRUN="-n"
+            ;;
+        h)
+            help_info
+            exit
+            ;;
+    esac
+done
+
+if [ -z ${WORKSPACE} ]; then
+    echo_info "No workspace specified, assume './workspace'"
+    WORKSPACE=`readlink -f workspace`
+fi
+
+if [ ! -d ${WORKSPACE} ]; then
+    echo_error "The workspace ${WORKSPACE} doesn't exist!!"
+    echo_error "You need to run build_oran.sh to create a valid worksapce and build image first."
+    echo_error "Then run this script with -w option to specify the correct path of the worksapce."
+    help_info
+    exit 1
+fi
+
+SRC_WRL_DIR=${WORKSPACE}/src_wrl1018
+SRC_ORAN_DIR=${WORKSPACE}/src_oran
+PRJ_BUILD_DIR=${WORKSPACE}/prj_oran-inf
+RPM_REPO_LIST=${SRC_ORAN_DIR}/rtp/scripts/rpm_repo_list.txt
+RPM_DEPLOY_DIR=${PRJ_BUILD_DIR}/tmp-glibc/deploy/rpm
+RPM_REPODATA=${RPM_DEPLOY_DIR}/repodata
+
+echo_info "For wrlinux1018 source: ${SRC_WRL_DIR}"
+echo_info "For oran layer source: ${SRC_ORAN_DIR}"
+echo_info "For build project: ${PRJ_BUILD_DIR}"
+
+# Source the build env
+cd ${SRC_WRL_DIR}
+. ./environment-setup-x86_64-wrlinuxsdk-linux
+set ${PRJ_BUILD_DIR}
+. ./oe-init-build-env ${PRJ_BUILD_DIR}
+
+mkdir -p logs
+TIMESTAMP=`date +"%Y%m%d_%H%M%S"`
+
+RECIPE_LIST=`grep -v '^#' ${RPM_REPO_LIST}|awk '{print $1}'|sort|uniq`
+RPM_PKG_LIST=`grep -v '^#' ${RPM_REPO_LIST}|awk '{print $2}'|sort|uniq`
+
+if [ -z "${RECIPE_LIST}" ]; then
+    echo_info "The recipes list is empty, nothing to do!!"
+    exit 0
+fi
+
+# Build the recipes
+RUN_CMD="bitbake ${DRYRUN} ${RECIPE_LIST}"
+echo_cmd "Build the recipes: '${RECIPE_LIST}'"
+bitbake ${DRYRUN} ${RECIPE_LIST} 2>&1|tee logs/bitbake_recipes_${TIMESTAMP}.log
+
+# Build the package-index
+RUN_CMD="bitbake ${DRYRUN} package-index"
+echo_cmd "Build the package-index'"
+bitbake ${DRYRUN} package-index 2>&1|tee logs/bitbake_package-index_${TIMESTAMP}.log
+
+echo_info "Build succeeded"
+
+echo_info "Package index files"
+find ${RPM_REPODATA}
+
+echo_info "RPM files"
+for i in ${RPM_PKG_LIST}; do
+    readlink -f ${RPM_DEPLOY_DIR}/*/$i
+done
diff --git a/scripts/rpm_repo_list.txt b/scripts/rpm_repo_list.txt
new file mode 100644 (file)
index 0000000..5c0cbb1
--- /dev/null
@@ -0,0 +1,7 @@
+# recipe #     # rpm #
+virtual/kernel  kernel-vmlinux-4.18.45+git0+748e4eb3d4_dea1a8c936-r0.intel_x86_64.rpm
+virtual/kernel  kernel-dev-4.18.45+git0+748e4eb3d4_dea1a8c936-r0.intel_x86_64.rpm
+dpdk           dpdk-dev-17.11.3-r0.intel_x86_64.rpm
+dpdk           dpdk-examples-17.11.3-r0.intel_x86_64.rpm
+dpdk           dpdk-staticdev-17.11.3-r0.intel_x86_64.rpm
+dpdk           dpdk-test-17.11.3-r0.intel_x86_64.rpm