From a33a1371ea84b70034bc17046078d1482e81f7a5 Mon Sep 17 00:00:00 2001 From: Saku Chydenius Date: Tue, 14 May 2019 11:22:03 +0300 Subject: [PATCH] Remove unused code Change-Id: I4d6f533ec2cb5a8483686a5c63078262978c9d6e Signed-off-by: Saku Chydenius --- build_step_create_install_cd.sh | 6 +++--- build_step_create_localrepo.sh | 22 ------------------- build_step_prepare.sh | 27 ----------------------- create_golden_image.sh | 2 +- create_manifest_rpm.sh | 2 +- create_mock_config.sh | 2 +- lib.sh | 47 ++--------------------------------------- repo_summary.sh | 34 ----------------------------- 8 files changed, 8 insertions(+), 134 deletions(-) delete mode 100755 build_step_create_localrepo.sh delete mode 100755 build_step_prepare.sh delete mode 100755 repo_summary.sh diff --git a/build_step_create_install_cd.sh b/build_step_create_install_cd.sh index f2f7dab..ee66b90 100755 --- a/build_step_create_install_cd.sh +++ b/build_step_create_install_cd.sh @@ -103,7 +103,7 @@ cp -fp boot/initrd-provisioning.img $iso_build_dir/isolinux/initrd.img rm -rf boot/ echo "Generating boot iso" -_run_cmd genisoimage -U -r -v -T -J -joliet-long \ +genisoimage -U -r -v -T -J -joliet-long \ -V "${release_version}" -A "${release_version}" -P ${iso_image_label} \ -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 \ -boot-info-table -eltorito-alt-boot -e images/efiboot.img -no-emul-boot \ @@ -116,12 +116,12 @@ cp -f ${input_image} $iso_build_dir/ mkdir -p $iso_build_dir/rpms echo "Generating product iso" -_run_cmd genisoimage -U -r -v -T -J -joliet-long \ +genisoimage -U -r -v -T -J -joliet-long \ -V "${release_version}" -A "${release_version}" -P ${iso_image_label} \ -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 \ -boot-info-table -eltorito-alt-boot -e images/efiboot.img -no-emul-boot \ -o release.iso $iso_build_dir -_run_cmd isohybrid $tmp/release.iso +isohybrid $tmp/release.iso _publish_image $tmp/release.iso $output_image_path echo "Clean up to preserve workspace footprint" diff --git a/build_step_create_localrepo.sh b/build_step_create_localrepo.sh deleted file mode 100755 index 4bb22a0..0000000 --- a/build_step_create_localrepo.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -# Copyright 2019 Nokia -# -# 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. - -set -x -set -e - -scriptdir="$(dirname $(readlink -f ${BASH_SOURCE[0]}))" -source $scriptdir/lib.sh - -_run_cmd_as_step _create_localrepo diff --git a/build_step_prepare.sh b/build_step_prepare.sh deleted file mode 100755 index 57d66cc..0000000 --- a/build_step_prepare.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash -# Copyright 2019 Nokia -# -# 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. - -set -x -set -e - -scriptdir="$(dirname $(readlink -f ${BASH_SOURCE[0]}))" -source $scriptdir/lib.sh -_read_manifest_vars - -_run_cmd_as_step _initialize_work_dirs - -_run_cmd_as_step $LIBDIR/repo_summary.sh - -_run_cmd_as_step $LIBDIR/create_mock_config.sh diff --git a/create_golden_image.sh b/create_golden_image.sh index 19dad38..307da83 100755 --- a/create_golden_image.sh +++ b/create_golden_image.sh @@ -35,7 +35,7 @@ fetch_image() { echo "Download $sourceurl to $WORKTMP/base-img" mkdir -pv $WORKTMP/base-img pushd $WORKTMP/base-img - _run_cmd wget --no-check-certificate --no-verbose -N \ + wget --no-check-certificate --no-verbose -N \ --auth-no-challenge $wget_args \ $sourceurl popd diff --git a/create_manifest_rpm.sh b/create_manifest_rpm.sh index b7ac213..f990e35 100755 --- a/create_manifest_rpm.sh +++ b/create_manifest_rpm.sh @@ -25,7 +25,7 @@ rm -rf $work mkdir -p $work cp -f $MANIFEST_PATH/*.spec $work -$scriptdir/create_mock_config.sh $MANIFEST_PATH/build_config.ini $work/mock_config +$scriptdir/create_mock_config.sh $BUILD_CONFIG_INI $work/mock_config rpm_macros=$work/rpmmacros $scriptdir/mock2rpmbuild_config.py --mock-config $work/mock_config/mock.cfg --output-file-path $rpm_macros diff --git a/create_mock_config.sh b/create_mock_config.sh index c7db5cf..fd39fed 100755 --- a/create_mock_config.sh +++ b/create_mock_config.sh @@ -21,7 +21,7 @@ _read_manifest_vars config_ini=${1:-$BUILD_CONFIG_INI} output_repo_files_dir=${2:-$REPO_FILES} -output_mock_dir=${2:-$(dirname $RPM_BUILDER_SETTINGS)} +output_mock_dir=${2:-$output_repo_files_dir} [ -f "$config_ini" ] || _abort "Config INI '$config_ini' not found" # Create .repo files diff --git a/lib.sh b/lib.sh index 9bc0e16..ecd1121 100644 --- a/lib.sh +++ b/lib.sh @@ -23,7 +23,6 @@ GOLDEN_BASE_IMAGE_FETCH_PASSWORD=${GOLDEN_BASE_IMAGE_FETCH_PASSWORD:-} WORK=$(readlink -f ${WORK:-$(dirname $(dirname $LIBDIR))}) mkdir -p $WORK -RPM_BUILDER=$(find $WORK -maxdepth 2 -type d -name rpmbuilder) WORKTMP=$WORK/tmp WORKLOGS=$WORKTMP/logs @@ -40,7 +39,6 @@ SRC_REPO_DIR=$WORKRESULTS/src_repo RPMLISTS=$WORKRESULTS/rpmlists CHECKSUM_DIR=$WORKRESULTS/bin_checksum RESULT_IMAGES_DIR=$WORKRESULTS/images -RPM_BUILDER_SETTINGS=$WORKTMP/mocksettings/mock.cfg function _read_build_config() { @@ -111,31 +109,6 @@ function _success() _header "STEP OK: $@" } - -function _run_cmd() -{ - _info "[cmd-start]: $@" - stamp_start=$(date +%s) - time $@ 2>&1 || _abort "Command failed: $@" - stamp_end=$(date +%s) - echo "$((stamp_end - stamp_start)) $@" >> $DURATION_LOG.unsorted - sort -nr $DURATION_LOG.unsorted > $DURATION_LOG - _log "[cmd-end]: $@" -} - - -function _run_cmd_as_step() -{ - if [ $# -eq 1 -a -f $1 ]; then - step="$(basename $1)" - else - step="$@" - fi - _step $step - _run_cmd $@ - _success $step -} - function _add_rpms_to_localrepo() { local rpms=$@ @@ -151,32 +124,16 @@ function _add_rpms_to_localrepo() _create_localrepo } -function _add_rpms_dir_to_repo() -{ - local repo_dir=$1 - local rpm_dir=$2 - mkdir -p $repo_dir - cp -f $(repomanage --keep=1 --new $rpm_dir) $repo_dir/ -} - function _create_localrepo() { pushd $REPO_DIR - _run_cmd createrepo --workers=8 --update . + createrepo --workers=8 --update . popd pushd $SRC_REPO_DIR - _run_cmd createrepo --workers=8 --update . + createrepo --workers=8 --update . popd } -function _add_rpms_to_repos_from_workdir() -{ - _add_rpms_dir_to_repo $REPO_DIR $1/buildrepository/mock/rpm - _add_rpms_dir_to_repo $SRC_REPO_DIR $1/buildrepository/mock/srpm - #find $1/ -name '*.tar.gz' | xargs rm -f - true -} - function _publish_results() { local from=$1 diff --git a/repo_summary.sh b/repo_summary.sh deleted file mode 100755 index e533389..0000000 --- a/repo_summary.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -# Copyright 2019 Nokia -# -# 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. - -scriptdir="$(dirname $(readlink -f ${BASH_SOURCE[0]}))" -source $scriptdir/lib.sh - -_run_repo_cmd() -{ - _divider - _run_cmd $@ -} - -pushd $WORK/.repo/repo -_run_repo_cmd git rev-parse --short HEAD -popd -echo q | _run_repo_cmd repo info -_run_repo_cmd repo status -o -echo q | _run_repo_cmd repo forall -p -c git rev-parse HEAD - -# Store build manifest with project HEADS to a file -repo manifest -o $WORKRESULTS/manifest.xml -repo manifest -r -o $WORKRESULTS/manifest_revisions.xml -- 2.16.6