[Merge] lp:~robru/phablet-tools/citrain-improvements into lp:phablet-tools
Sergio Schvezov
sergio.schvezov at canonical.com
Wed May 21 11:15:42 UTC 2014
On Tue, May 20, 2014 at 7:30 PM, Robert Bruce Park <
robert.park at canonical.com> wrote:
> Robert Bruce Park has proposed merging
> lp:~robru/phablet-tools/citrain-improvements into lp:phablet-tools.
>
> Commit message:
> New citrain tool with more options.
>
> Requested reviews:
> Sergio Schvezov (sergiusens)
> Michał Sawicz (saviq)
> Ubuntu Phablet Team (phablet-team)
>
> For more details, see:
>
> https://code.launchpad.net/~robru/phablet-tools/citrain-improvements/+merge/220335
>
>
> --
>
> https://code.launchpad.net/~robru/phablet-tools/citrain-improvements/+merge/220335
> You are requested to review the proposed merge of
> lp:~robru/phablet-tools/citrain-improvements into lp:phablet-tools.
>
> === added file 'citrain'
> --- citrain 1970-01-01 00:00:00 +0000
> +++ citrain 2014-05-20 22:29:46 +0000
> @@ -0,0 +1,100 @@
> +#!/bin/sh -e
> +# This program is free software: you can redistribute it and/or modify it
> +# under the terms of the the GNU General Public License version 3, 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 warranties of
> +# MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
> +# PURPOSE. See the applicable version of 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, see <http://www.gnu.org/licenses/>.
> +#
> +# Copyright (C) 2014 Canonical, Ltd.
> +
> +usage () {
> +cat <<EOF
> +usage: $0 COMMAND SILO-NUMBER
> +
> +COMMANDS:
> + host-install Installs all packages from the silo on the host
> machine.
> + device-install Installs all packages from the silo on the
> connected device.
> + host-upgrade Uses dist-upgrade to install silo contents on the
> host machine.
> + device-upgrade Uses dist-upgrade to install silo contents on the
> connected device.
> + host-purge Uses ppa-purge to uninstall the silo contents
> from the host machine.
> + device-purge Not implemented.
> +
> +SILO-NUMBER:
> + 1..20
> +EOF
> +exit 1
> +}
> +
> +# Defaults
> +TARGET="slave"
> +PPA="ppa:ci-train-ppa-service"
> +HTTP="http://ppa.launchpad.net/ci-train-ppa-service"
> +SOURCES="ubuntu/dists/devel/main/source/Sources"
> +
> +# Read the first positional argument.
> +COMMAND="$1"
> +[ $# -gt 0 ] && shift || usage
> +
> +# Check that silo number is really a number.
> +echo "$1" | egrep -q "^[0-9]{1,3}$" || usage
> +
> +# Read the second positional argument.
> +SILO=landing-$(printf "%03d" "$1")
>
This should be $2, right?
> +[ $# -gt 0 ] && shift || usage
> +
> +case "$COMMAND" in
> + host-install)
> + sudo add-apt-repository $PPA/$SILO
> + sudo apt-get update -qq
> + wget -qO- $HTTP/$SILO/$SOURCES \
> + | perl -ne 's/,//g; s/^Binary: // && print' \
> + | xargs --verbose sudo apt-get install --yes
> + sudo rm -rf /etc/apt/sources.list.d/ci-train*
> + sudo apt-get update -qq
> + ;;
> +
> + device-install)
> + wget -qO- $HTTP/$SILO/$SOURCES \
> + | perl -ne 'chomp; s/, / -p /g; s/^Binary: / -p / && print' \
> + | xargs --verbose phablet-config writable-image --ppa
> $PPA/$SILO
> + adb reboot
> + ;;
> +
> + host-upgrade)
> + set -x
> + sudo add-apt-repository $PPA/$SILO
> + sudo apt-get update -qq
> + sudo apt-get dist-upgrade --yes
> + sudo rm -rf /etc/apt/sources.list.d/ci-train*
> + sudo apt-get update -qq
> + ;;
> +
> + device-upgrade)
> + set -x
> + phablet-config writable-image --ppa $PPA/$SILO
> + adb shell apt-get dist-upgrade --yes
> + adb reboot
> + ;;
> +
> + host-purge)
> + set -x
> + sudo ppa-purge $PPA/$SILO
> + ;;
> +
> + device-purge)
> + echo "Unfortunately purging from the device is unsupported
> because"
> + echo "ppa-purge is not installed by default in the images."
> + echo "However, the silo packages go away next time you flash the
> device."
> + ;;
> +
> + *)
> + usage
> + ;;
> +esac
>
> === modified file 'citrain-purge'
> --- citrain-purge 2014-05-13 16:48:31 +0000
> +++ citrain-purge 2014-05-20 22:29:46 +0000
> @@ -14,14 +14,6 @@
> #
> # Copyright (C) 2014 Canonical, Ltd.
>
> -if ! echo $1 | egrep -q "^[0-9]{1,3}$"; then
> - echo "This tool will revert all binary packages from a CI Train silo
> back to"
> - echo "the stock packages available to the host machine."
> - echo
> - echo "Usage: $0 [silo number]"
> - exit 1
> -fi
> -
> -silo_number=$(printf "%03d" $1)
> -
> -sudo ppa-purge ppa:ci-train-ppa-service/landing-$silo_number
> +echo "Warning, this tool is deprecated, please use 'citrain host-purge'
> instead."
> +
> +citrain host-purge $1
>
> === modified file 'citrain-push'
> --- citrain-push 2014-05-13 16:48:31 +0000
> +++ citrain-push 2014-05-20 22:29:46 +0000
> @@ -14,18 +14,6 @@
> #
> # Copyright (C) 2014 Canonical, Ltd.
>
> -if ! echo $1 | egrep -q "^[0-9]{1,3}$"; then
> - echo "This tool will install all binary packages from a CI Train silo
> onto"
> - echo "a connected Ubuntu Touch device."
> - echo
> - echo "Usage: $0 [silo number]"
> - exit 1
> -fi
> -
> -silo_number=$(printf "%03d" $1)
> -
> -wget -qO-
> http://ppa.launchpad.net/ci-train-ppa-service/landing-$silo_number/ubuntu/dists/devel/main/source/Sources\
> - | perl -ne 'chomp; s/, / -p /g; s/^Binary: / -p / && print' \
> - | xargs phablet-config writable-image \
> - --ppa ppa:ci-train-ppa-service/landing-$silo_number
> -adb reboot
> +echo "Warning, this tool is deprecated, please use 'citrain
> device-install' instead."
> +
> +citrain device-install $1
>
> === modified file 'citrain-slurp'
> --- citrain-slurp 2014-05-13 16:48:31 +0000
> +++ citrain-slurp 2014-05-20 22:29:46 +0000
> @@ -14,20 +14,6 @@
> #
> # Copyright (C) 2014 Canonical, Ltd.
>
> -if ! echo $1 | egrep -q "^[0-9]{1,3}$"; then
> - echo "This tool will install all binary packages from a CI Train silo
> onto"
> - echo "the host machine."
> - echo
> - echo "Usage: $0 [silo number]"
> - exit 1
> -fi
> -
> -silo_number=$(printf "%03d" $1)
> -
> -sudo add-apt-repository ppa:ci-train-ppa-service/landing-$silo_number
> -sudo apt-get update -qq
> -wget -qO-
> http://ppa.launchpad.net/ci-train-ppa-service/landing-$silo_number/ubuntu/dists/devel/main/source/Sources\
> - | perl -ne 's/,//g; s/^Binary: // && print' \
> - | xargs sudo apt-get install --yes
> -sudo rm -rf /etc/apt/sources.list.d/ci-train*
> -sudo apt-get update -qq
> +echo "Warning, this tool is deprecated, please use 'citrain host-install'
> instead."
> +
> +citrain host-install $1
>
> === modified file 'debian/phablet-tools-citrain.install'
> --- debian/phablet-tools-citrain.install 2014-05-14 23:24:31 +0000
> +++ debian/phablet-tools-citrain.install 2014-05-20 22:29:46 +0000
> @@ -1,1 +1,1 @@
> -usr/bin/citrain-*
> +usr/bin/citrain*
>
> === modified file 'setup.py'
> --- setup.py 2014-05-15 19:59:37 +0000
> +++ setup.py 2014-05-20 22:29:46 +0000
> @@ -13,6 +13,7 @@
> ]
>
> SH_SCRIPTS = [
> + 'citrain',
> 'citrain-purge',
> 'citrain-push',
> 'citrain-slurp',
>
>
>
The only other comment I have is, now that you are redoing it, do you mind
adding multiple device checks? There is a shell thingie you can source now.
--
https://code.launchpad.net/~robru/phablet-tools/citrain-improvements/+merge/220335
Your team Ubuntu Phablet Team is requested to review the proposed merge of lp:~robru/phablet-tools/citrain-improvements into lp:phablet-tools.
More information about the Ubuntu-reviews
mailing list