Skip to contentSkip to conversation

Rename creat-lsb-image and improve some functions in script

PATCH In review Xiaofeng Yan 3 participants 4 messages Apr 22, 2011 – Apr 25, 2011

lore
Share & tools
lore
#0 lore raw

cover Rename creat-lsb-image and improve some functions in script

From: Xiaofeng Yan <[email protected]>

Thank Darren Hart and Robert to give me suggestions which make this script more professional. The function for this script is to create a 8G lsb image with lsb test suite. Changes for this script:
1 Correct name of this script
2 Improve some function

Pull URL: git://git.pokylinux.org/poky-contrib.git
Branch: xiaofeng/Modify_creat-lsb-image
Browse: http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=xiaofeng/Modify_creat-lsb-image

Thanks,
Xiaofeng Yan <[email protected]>
---

Xiaofeng Yan (1):
create-lsb-image:Rename creat-lsb-image and improve some function

 scripts/creat-lsb-image  |  198 ----------------------------------------
 scripts/create-lsb-image |  228 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 228 insertions(+), 198 deletions(-)
 delete mode 100755 scripts/creat-lsb-image
 create mode 100755 scripts/create-lsb-image
#1 lore raw

PATCH 1/1 create-lsb-image:Rename creat-lsb-image and improve some function

From: Xiaofeng Yan <[email protected]>

Rename creat-lsb-image to create-lsb-image
Improve some function to look more professional

---
 scripts/creat-lsb-image  |  198 ----------------------------------------
 scripts/create-lsb-image |  228 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 228 insertions(+), 198 deletions(-)
 delete mode 100755 scripts/creat-lsb-image
 create mode 100755 scripts/create-lsb-image
scripts/creat-lsb-image deleted +0 -198
deleted file mode 100755
index 657784c..0000000
@@ -1,198 +0,0 @@
-#!/bin/bash
-#
-# Copyright (c) 2005-2010 Wind River Systems, Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 2 as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-
-red='\E[31;40m'
-green='\E[32;40m'
-USER=`whoami`
-ARCH=$1
-MACHINE_ARCH=` bitbake -e | grep ^MACHINE_ARCH | cut -d '=' -f2 | cut -d '"' -f2`
-IMAGE_PATH=` bitbake -e | grep ^COREBASE | cut -d '=' -f2 | cut -d '"' -f2`/build/tmp/deploy/images/
-
-
-ECHO()
-{
-    echo -e "${green}$@"
-    tput sgr0
-}
-
-exit_check()
-{
-    if [ ! $? -eq 0 ]; then
-        exit $?
-    fi
-}
-
-usage()
-{
-    ECHO "${red}usage:you should input one of the next commmands according to detailed target platform:"
-    ECHO "creat-lsb-image x86"
-    ECHO "creat-lsb-image x86_64"
-    ECHO "creat-lsb-image ppc32"
-}
-
-#There should be a patameter to get machine type
-if [ $# -ne 1 ]; then
-    usage
-    exit 1
-fi
-
-#check lsb image
-if [ ! -d $IMAGE_PATH ];then
-    ECHO "${red}There isn't image directory"
-    exit 1
-fi
-ECHO "Enter directory $IMAGE_PATH"
-cd $IMAGE_PATH
-
-#get architecture
-PN=`find . -name core-image-lsb-${MACHINE_ARCH}\*.rootfs.tar.bz2 -type f | awk -F- 'BEGIN{ max=0;} {if( NR!=0 && $5>max ) max=$5 }END{ printf "%d" ,max ;}'`
-if [ "XPN" == "X" ];then
-   ECHO "${red}Don't find lsb image on platform, Please run \"core-image-lsb\" to generate lsb image"
-   exit 1
-fi
-
-if [ $PN -eq 0 ];then
-	ECHO "${red}Can't ${MACHINE_ARCH} rootfs.tar.gz,Please run core-image-lsb to get lsb image"
-	exit 1
-fi
-#set varible ARCH
-if [ ${ARCH} == x86 ];then
-	T_ARCH=ia32
-    P_ARCH=i486
-elif [ ${ARCH} == x86_64 ];then
-	T_ARCH=ia64
-    P_ARCH=ia64
-else
-	P_ARCH=ppc
-	T_ARCH=${ARCH}
-fi
-
-#umount lsbtmp 
-if [ -d lsbtmp ];then
-	sudo umount lsbtmp
-fi
- 
-#download lsb test suite
-mkdir -p lsb-test-suite-${MACHINE_ARCH} 
-if [ -d lsb-test-suite-${MACHINE_ARCH} ];then
-	cd lsb-test-suite-${MACHINE_ARCH}
-	ECHO "Download lsb test suite, it could take some time..."
-    wget -c -t 5  http://ftp.linuxfoundation.org/pub/lsb/bundles/released-4.1.0/dist-testkit/lsb-dist-testkit-4.1.0-5.${T_ARCH}.tar.gz
-    exit_check
-	ECHO "Download lsb-xdg-utils-4.0.0-2.${P_ARCH}.rpm"
-	wget -c -t 5 http://ftp.linux-foundation.org/pub/lsb/lsbdev/released-4.1.0/binary/${T_ARCH}/lsb-xdg-utils-4.0.0-2.${P_ARCH}.rpm
-    exit_check
-	ECHO "Downlocad lsb-apache-2.2.8-2.lsb4.${P_ARCH}.rpm"
-	wget -c -t 5 http://ftp.linux-foundation.org/pub/lsb/app-battery/released-4.1.0/${T_ARCH}/lsb-apache-2.2.14-3.lsb4.${P_ARCH}.rpm
-    exit_check
-	ECHO "Downlocad lsb-tcl-8.5.1-2.lsb4.${P_ARCH}.rpm"
-	wget -c -t 5 http://ftp.linux-foundation.org/pub/lsb/app-battery/released-4.1.0/${T_ARCH}/lsb-tcl-8.5.7-6.lsb4.${P_ARCH}.rpm
-    exit_check
-	ECHO "Downlocad lsb-expect-5.43.0-7.lsb4.${P_ARCH}.rpm"
-	wget -c -t 5 http://ftp.linux-foundation.org/pub/lsb/app-battery/released-4.1.0/${T_ARCH}/lsb-expect-5.43.0-11.lsb4.${P_ARCH}.rpm 
-    exit_check
-	ECHO "Downlocad lsb-groff-1.19.2-4.lsb4.${P_ARCH}.rpm"
-	wget -c -t 5 http://ftp.linux-foundation.org/pub/lsb/app-battery/released-4.1.0/${T_ARCH}/lsb-groff-1.20.1-5.lsb4.${P_ARCH}.rpm  
-    exit_check
-	ECHO "Downlocad lsb-raptor-1.4.16-2.lsb4.${P_ARCH}.rpm"
-	wget -c -t 5 http://ftp.linux-foundation.org/pub/lsb/app-battery/released-4.1.0/${T_ARCH}/lsb-raptor-1.4.19-3.lsb4.${P_ARCH}.rpm 
-    exit_check
-	ECHO "Downlocad lsb-xpdf-1.01-7.lsb4.${P_ARCH}.rpm"
-	wget -c -t 5 http://ftp.linux-foundation.org/pub/lsb/app-battery/released-4.1.0/${T_ARCH}/lsb-xpdf-1.01-10.lsb4.${P_ARCH}.rpm
-    exit_check
-	ECHO "Downlocad lsb-samba-3.0.28a-3.lsb4.${P_ARCH}.rpm"
-	wget -c -t 5 http://ftp.linux-foundation.org/pub/lsb/app-battery/released-4.1.0/${T_ARCH}/lsb-samba-3.4.3-5.lsb4.${P_ARCH}.rpm 
-    exit_check
-	ECHO "Downlocad lsb-rsync-3.0.0-2.lsb4.${P_ARCH}.rpm"
-	wget -c -t 5 http://ftp.linux-foundation.org/pub/lsb/app-battery/released-4.1.0/${T_ARCH}/lsb-rsync-3.0.6-3.lsb4.${P_ARCH}.rpm
-    exit_check
-else
-	ECHO "Can't find lsb test suite for ${MACHINE_ARCH}"
-fi
-cd ..
-if [ -L core-image-lsb-${MACHINE_ARCH}.ext3 ];then
-    /bin/rm core-image-lsb-${MACHINE_ARCH}.ext3
-    exit_check
-fi
-
-#creat lsb image
-if [ -f core-image-lsb-${MACHINE_ARCH}-test.ext3 ];then
-	if [ -d lsbtmp ];then
-    	sudo umount lsbtmp
-	fi
-	ECHO "Remove old lsb image..."
-	/bin/rm core-image-lsb-${MACHINE_ARCH}-test.ext3
-fi	
-ECHO "creat a big ext3 file for lsb image with 5G..."
-dd if=/dev/zero of=core-image-lsb-${MACHINE_ARCH}-test.ext3 bs=1M count=5000
-exit_check
-ECHO "Format ext3 image,please input \"y\""
-mkfs.ext3 core-image-lsb-${MACHINE_ARCH}-test.ext3
-tune2fs -j  core-image-lsb-${MACHINE_ARCH}-test.ext3
-
-
-ECHO "get a lsb image with lsb test suite"
-if [ ! -d lsbtmp ];then
-	mkdir lsbtmp
-fi
-
-
-#install file system and lsb test suite to lsb image
-sudo mount -o loop core-image-lsb-${MACHINE_ARCH}-test.ext3 lsbtmp
-exit_check
-
-ECHO "  ->Install file system..."
-sudo tar jxf core-image-lsb-${MACHINE_ARCH}-${PN}.rootfs.tar.bz2 -C lsbtmp
-exit_check
-
-ECHO "  ->Install lsb test suite..."
-cd lsb-test-suite-${MACHINE_ARCH}
-sudo tar zxf lsb-dist-testkit-4.1.0-5.${T_ARCH}.tar.gz -C ../lsbtmp
-exit_check
-sudo mkdir ../lsbtmp/lsb-Application
-sudo cp *.rpm ../lsbtmp/lsb-Application
-exit_check
-cd ..
-
-if [ -f modules-*-${MACHINE_ARCH}.tgz ];then
-ECHO "  ->Install moules of driver..."	
-	sudo tar zxf modules-*-${MACHINE_ARCH}.tgz -C lsbtmp/
-fi
-
-
-#unmount lsbtmp
-sudo umount lsbtmp
-exit_check
-sudo rm -rf lsbtmp
-
-#change file attribute
-sudo chown ${USER}:${USER} core-image-lsb-${MACHINE_ARCH}-test.ext3 
-exit_check
-sudo chmod 755 core-image-lsb-${MACHINE_ARCH}-test.ext3
-exit_check
-
-#set up link
-if [ -L core-image-lsb-${MACHINE_ARCH}.ext3 ];then
-ECHO "Set up link"
-    /bin/rm core-image-lsb-${MACHINE_ARCH}.ext3
-    exit_check
-fi
-ln -s core-image-lsb-${MACHINE_ARCH}-test.ext3 core-image-lsb-${MACHINE_ARCH}.ext3
-
-ECHO "LSB test environment is set successfully, Please run this image on platform ${MACHINE_ARCH}"
-
scripts/create-lsb-image new file +228 -0

228 lines not on this page · raw message

Signature · 1 line
1.7.0.4
#2 lore raw
In reply to Xiaofeng Yan
Quoted 23 lines · Xiaofeng Yan

From: Xiaofeng Yan<[email protected]>

Thank Darren Hart and Robert to give me suggestions which make this script more professional. The function for this script is to create a 8G lsb image with lsb test suite. Changes for this script:
1 Correct name of this script
2 Improve some function

Pull URL: git://git.pokylinux.org/poky-contrib.git
Branch: xiaofeng/Modify_creat-lsb-image
Browse: http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=xiaofeng/Modify_creat-lsb-image

Thanks,
Xiaofeng Yan<[email protected]>
---

Xiaofeng Yan (1):
create-lsb-image:Rename creat-lsb-image and improve some function

  scripts/creat-lsb-image  |  198 ----------------------------------------
  scripts/create-lsb-image |  228 ++++++++++++++++++++++++++++++++++++++++++++++
  2 files changed, 228 insertions(+), 198 deletions(-)
Quoted 8 lines

delete mode 100755 scripts/creat-lsb-image
create mode 100755 scripts/create-lsb-image

_______________________________________________
poky mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/poky

Pulled into oe-core and poky/master

Thanks
Sau!

#3 lore raw

Hi Xiaofeng,

Thanks for accepting all the feedback you received and working through another patch.

As a matter of process (for the future) please remember to:

1) make sure people who influenced a patch rewrite are CC'd on it
2) Separate patches into logical blocks
o white space fixes
o renames
o contained functional changes

#1 gives the reviewers an opportunity to perform a follow-up review and
ensure the feedback was communicated and received correctly.

#2 is important as with the patch below, the rename and the functional
changes are merged into a single patch, so important changes are invisible, making it very difficult to review. Also, if a problem is detected with this file, it is now impossible to revert the functional change without also renaming the file.

Thanks,

Darren Hart

Quoted 41 lines · Saul Wold
Quoted 23 lines · Xiaofeng Yan

From: Xiaofeng Yan<[email protected]>

Thank Darren Hart and Robert to give me suggestions which make this script more professional. The function for this script is to create a 8G lsb image with lsb test suite. Changes for this script:
1 Correct name of this script
2 Improve some function

Pull URL: git://git.pokylinux.org/poky-contrib.git
Branch: xiaofeng/Modify_creat-lsb-image
Browse: http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=xiaofeng/Modify_creat-lsb-image

Thanks,
Xiaofeng Yan<[email protected]>
---

Xiaofeng Yan (1):
create-lsb-image:Rename creat-lsb-image and improve some function

  scripts/creat-lsb-image  |  198 ----------------------------------------
  scripts/create-lsb-image |  228 ++++++++++++++++++++++++++++++++++++++++++++++
  2 files changed, 228 insertions(+), 198 deletions(-)
Quoted 8 lines

delete mode 100755 scripts/creat-lsb-image
create mode 100755 scripts/create-lsb-image

_______________________________________________
poky mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/poky

Pulled into oe-core and poky/master

Thanks
Sau!

_______________________________________________
poky mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/poky

Signature · 3 lines
Darren Hart
Intel Open Source Technology Center
Yocto Project - Linux Kernel