[Merge] lp:~gary-wzl77/livecd-rootfs/classic_image_creation into lp:livecd-rootfs

Ɓukasz Zemczak lukasz.zemczak at canonical.com
Tue Sep 12 13:56:56 UTC 2017


Looks good, although I wouldn't want to formally review it before Adam/Steve take a look at it. Code wise it seems reasonable - with only a few small remarks below.

As for the gadget tree location, the assumption was that livecd-rootfs would, basing on the PROJECT/SUBPROJECT and ARCH variables would then decide which gadget URI to use. The question remaining is: where would all the gadget trees be stored? e.g. the URI would be local, or remote?

Adam, Steve: I would like one of you to take a look at this branch and help us decide on where the gadget trees should reside. Should those be hosted out of nusakan and downloaded from a remote location, extracted and then used? I think you two should be able to answer this question better than I would.

Diff comments:

> === modified file 'live-build/auto/build'
> --- live-build/auto/build	2017-06-30 10:22:29 +0000
> +++ live-build/auto/build	2017-09-05 10:22:23 +0000
> @@ -16,11 +16,17 @@
>  fi
>  
>  if [ "${IMAGEFORMAT:-}" = "ubuntu-image" ]; then
> -	# Use ubuntu-image instead of live-build
> -	env SNAPPY_STORE_NO_CDN=1 \
> -	ubuntu-image -c edge \
> +	if [ "${IMAGETYPE:-}" = "classic" ]; then
> +		# Use ubuntu-image instead of live-build
> +		OPTS="${PROJECT:+--project=$PROJECT} ${SUITE:+--suite=$SUITE} ${ARCH:+--arch=$ARCH} ${SUBPROJECT:+--subproject=$SUBPROJECT} ${SUBARCH:+--subarch=$SUBARCH} ${PROPOSED:+--with-proposed=$PROPOSED} ${IMAGEFORMAT:+--image-format=$IMAGEFORMAT} ${EXTRA_PPAS:+--extra-ppas=$EXTRA_PPAS}"
> +		ubuntu-image classic $OPTS gadget_tree

I'd also add a -O/--output-dir option to the list of ubuntu-image arguments as we want to know where the final files end up. Then I think we should also compress the resulting images as we do in the core case (with xz). Might be good to just extract that out of the conditional then.

> +	else
> +		# Use ubuntu-image instead of live-build
> +		env SNAPPY_STORE_NO_CDN=1 \
> +		ubuntu-image snap -c edge \
>  		-o livecd."$PROJECT".img livecd."$PROJECT".model-assertion
> -	xz -0 -T4 livecd."$PROJECT".img
> +		xz -0 -T4 livecd."$PROJECT".img
> +	fi
>  	exit 0
>  fi
>  
> 
> === modified file 'live-build/auto/config'
> --- live-build/auto/config	2017-06-23 18:23:53 +0000
> +++ live-build/auto/config	2017-09-05 10:22:23 +0000
> @@ -153,34 +153,48 @@
>  		;;
>  
>  	ubuntu-image)
> -		case "$ARCH+${SUBARCH:-}" in
> -			amd64+*)
> -				MODEL=pc-amd64 ;;
> -			i386+*)
> -				MODEL=pc-i386 ;;
> -			arm64+snapdragon)
> -				MODEL=dragonboard ;;
> -			armhf+raspi2)
> -				MODEL=pi2 ;;
> -			armhf+raspi3)
> -				MODEL=pi3 ;;
> -			armhf+cm3)
> -				MODEL=cm3 ;;
> -			*)
> -				echo "Model $ARCH+${SUBARCH:-} unknown to livecd-rootfs" >&2
> -				exit 1
> +		case $IMAGETYPE in
> +			classic)
> +				echo "IMAGEFORMAT=$IMAGEFORMAT" >> config/common

I would split out the common operations out of the classic/* case-statement not to duplicate code. In both cases we need to export the IMAGEFORMAT and fake-finish config.

> +				# TODO livecd-rootfs needs to take a branch URI for the gadget as input, 
> +				# stage it, and pass it to ubuntu-image, where do we get it?
> +
> +				# Fake finished configuration for lb build

As above, I'd drop that out of the case for both classic and *.

> +				mkdir -p .build
> +				touch .build/config
> +				exit 0
> +				;;
> +			*) # backport compatibility for core image creation.
> +				case "$ARCH+${SUBARCH:-}" in
> +					amd64+*)
> +						MODEL=pc-amd64 ;;
> +					i386+*)
> +						MODEL=pc-i386 ;;
> +					arm64+snapdragon)
> +						MODEL=dragonboard ;;
> +					armhf+raspi2)
> +						MODEL=pi2 ;;
> +					armhf+raspi3)
> +						MODEL=pi3 ;;
> +					armhf+cm3)
> +						MODEL=cm3 ;;
> +					*)
> +						echo "Model $ARCH+${SUBARCH:-} unknown to livecd-rootfs" >&2
> +						exit 1
> +						;;
> +				esac
> +				echo "IMAGEFORMAT=$IMAGEFORMAT" >> config/common
> +				# Store model assertion in top dir to get it picked up later as a build artifact
> +				env SNAPPY_STORE_NO_CDN=1 snap known --remote model series=16 model="$MODEL" brand-id=canonical > livecd."$PROJECT".model-assertion
> +				echo "Configured ubuntu-image for the following model assertion:"
> +				cat livecd."$PROJECT".model-assertion
> +				echo "----------------------------------------------------------"
> +				# Fake finished configuration for lb build
> +				mkdir -p .build
> +				touch .build/config
> +				exit 0
>  				;;
>  		esac
> -		echo "IMAGEFORMAT=$IMAGEFORMAT" >> config/common
> -		# Store model assertion in top dir to get it picked up later as a build artifact
> -		env SNAPPY_STORE_NO_CDN=1 snap known --remote model series=16 model="$MODEL" brand-id=canonical > livecd."$PROJECT".model-assertion
> -		echo "Configured ubuntu-image for the following model assertion:"
> -		cat livecd."$PROJECT".model-assertion
> -		echo "----------------------------------------------------------"
> -		# Fake finished configuration for lb build
> -		mkdir -p .build
> -		touch .build/config
> -		exit 0
>  		;;
>  
>  	*)


-- 
https://code.launchpad.net/~gary-wzl77/livecd-rootfs/classic_image_creation/+merge/330211
Your team Ubuntu Core Development Team is requested to review the proposed merge of lp:~gary-wzl77/livecd-rootfs/classic_image_creation into lp:livecd-rootfs.



More information about the Ubuntu-reviews mailing list