[Merge] lp:~sergiusens/goget-ubuntu-touch/developer_mode into lp:goget-ubuntu-touch

Ricardo Salveti rsalveti at rsalveti.net
Tue Jun 17 16:43:36 UTC 2014


Review: Needs Fixing

Minor comments inline.

Also, was this tested before approved?

Will test and update the results.

Diff comments:

> === modified file 'debian/changelog'
> --- debian/changelog	2014-05-27 19:02:51 +0000
> +++ debian/changelog	2014-05-30 12:35:20 +0000
> @@ -1,3 +1,10 @@
> +goget-ubuntu-touch (0.2+14.10.20140530-0ubuntu1) UNRELEASED; urgency=medium
> +
> +  * ubuntu-touch-do: new tool to interact with touch devices.
> +  * ubuntu-device-flash: option to flash with developer mode enabled.
> +
> + -- Sergio Schvezov <sergio.schvezov at canonical.com>  Fri, 30 May 2014 09:28:52 -0300
> +
>  goget-ubuntu-touch (0.2+14.10.20140527-0ubuntu1) utopic; urgency=low
>  
>    [ Sergio Schvezov ]
> 
> === modified file 'debian/control'
> --- debian/control	2014-03-10 13:03:23 +0000
> +++ debian/control	2014-05-30 12:35:20 +0000
> @@ -24,6 +24,14 @@
>   bootstrapping from fastboot or reflashing from an already
>   supported device.
>  
> +Package: ubuntu-touch-do
> +Architecture: any
> +Depends: android-tools-adb,
> +         ${misc:Depends},
> +         ${shlibs:Depends},
> +Description: Tool to interact with Ubuntu Touch devices
> + Use this tool to interact with your Ubuntu Touch device
> +
>  Package: ubuntu-emulator
>  Architecture: i386 amd64
>  Depends: ubuntu-emulator-runtime,
> 
> === modified file 'debian/rules'
> --- debian/rules	2014-01-09 17:42:55 +0000
> +++ debian/rules	2014-05-30 12:35:20 +0000
> @@ -12,3 +12,4 @@
>  	rm -rf ${CURDIR}/debian/tmp/usr/bin/abootimg-extract
>  	rm -rf ${CURDIR}/debian/tmp/usr/share/gocode/src/launchpad.net/goget-ubuntu-touch/ubuntu-emulator
>  	rm -rf ${CURDIR}/debian/tmp/usr/share/gocode/src/launchpad.net/goget-ubuntu-touch/ubuntu-device-flash
> +	rm -rf ${CURDIR}/debian/tmp/usr/share/gocode/src/launchpad.net/goget-ubuntu-touch/ubuntu-touch-do
> 
> === added file 'debian/ubuntu-touch-do.install'
> --- debian/ubuntu-touch-do.install	1970-01-01 00:00:00 +0000
> +++ debian/ubuntu-touch-do.install	2014-05-30 12:35:20 +0000
> @@ -0,0 +1,1 @@
> +usr/bin/ubuntu-touch-do
> 
> === modified file 'ubuntu-device-flash/args.go'
> --- ubuntu-device-flash/args.go	2014-05-15 13:21:24 +0000
> +++ ubuntu-device-flash/args.go	2014-05-30 12:35:20 +0000
> @@ -35,6 +35,7 @@
>  	Server        string `long:"server" description:"Use a different image server"`
>  	CleanCache    bool   `long:"clean-cache" description:"Cleans up cache with all downloaded bits"`
>  	TLSSkipVerify bool   `long:"tls-skip-verify" description:"Skip TLS certificate validation"`
> +	DeveloperMode bool   `long:"developer-mode" description:"Enables developer mode after the factory reset"`
>  	RunScript     string `long:"run-script" description:"Run a script given by path to finish the flashing process, instead of rebooting to recovery (mostly used during development to work around quirky or incomplete recovery images)"`
>  }
>  
> 
> === modified file 'ubuntu-device-flash/main.go'
> --- ubuntu-device-flash/main.go	2014-05-27 19:02:35 +0000
> +++ ubuntu-device-flash/main.go	2014-05-30 12:35:20 +0000
> @@ -180,7 +180,12 @@
>  	for i := 0; i < totalFiles; i++ {
>  		<-done
>  	}
> -	ubuntuCommands, err := ubuntuimage.GetUbuntuCommands(image.Files, cacheDir, args.Wipe)
> +
> +	var enableList []string
> +	if args.DeveloperMode {
> +		enableList = append(enableList, "developer_mode")
> +	}
> +	ubuntuCommands, err := ubuntuimage.GetUbuntuCommands(image.Files, cacheDir, args.Wipe, enableList)
>  	if err != nil {
>  		log.Fatal("Cannot create commands file")
>  	}
> 
> === added directory 'ubuntu-touch-do'
> === added file 'ubuntu-touch-do/factory_reset.go'
> --- ubuntu-touch-do/factory_reset.go	1970-01-01 00:00:00 +0000
> +++ ubuntu-touch-do/factory_reset.go	2014-05-30 12:35:20 +0000
> @@ -0,0 +1,69 @@
> +//
> +// ubuntu-emu - Tool to download and run Ubuntu Touch emulator instances

ubuntu-emu? :-)

> +//
> +// Copyright (c) 2013 Canonical Ltd.
> +//
> +// Written by Sergio Schvezov <sergio.schvezov at canonical.com>
> +//
> +package main
> +
> +// This program is free software: you can redistribute it and/or modify it
> +// under the terms of 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 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/>.
> +
> +import (
> +	"fmt"
> +
> +	"log"
> +
> +	"launchpad.net/goget-ubuntu-touch/devices"
> +	"launchpad.net/goget-ubuntu-touch/ubuntuimage"
> +)
> +
> +type FactoryResetCmd struct {
> +	DeveloperMode bool   `long:"developer-mode" description:"Enables developer mode after the factory reset"`
> +	Serial        string `long:"serial" description:"Serial of the device to operate"`
> +}
> +
> +var factoryResetCmd FactoryResetCmd
> +
> +func init() {
> +	parser.AddCommand("factory-reset",
> +		"Resets to stock install",
> +		"Resets a device to its stock install with the possibility to enable developer mode by default",
> +		&factoryResetCmd)
> +}
> +
> +func (factoryResetCmd *FactoryResetCmd) Execute(args []string) error {
> +	var enableList []string
> +	if factoryResetCmd.DeveloperMode {
> +		enableList = append(enableList, "developer_mode")
> +	}
> +	//files: nil, files location: "", wipe: true, enable: enableList
> +	ubuntuCommands, err := ubuntuimage.GetUbuntuCommands(nil, "", true, enableList)
> +	if err != nil {
> +		return fmt.Errorf("cannot create commands file: %s", err)
> +	}
> +
> +	adb, err := devices.NewUbuntuDebugBridge()
> +	if err != nil {
> +		log.Fatal(err)
> +	}
> +	if factoryResetCmd.Serial != "" {
> +		adb.SetSerial(factoryResetCmd.Serial)
> +	}
> +	if err := adb.Push(ubuntuCommands, "/cache/recovery/ubuntu_command"); err != nil {
> +		return err
> +	}
> +	fmt.Println("Rebooting to finish factory reset")
> +	adb.RebootRecovery()
> +	return nil
> +}
> 
> === added file 'ubuntu-touch-do/main.go'
> --- ubuntu-touch-do/main.go	1970-01-01 00:00:00 +0000
> +++ ubuntu-touch-do/main.go	2014-05-30 12:35:20 +0000
> @@ -0,0 +1,38 @@
> +//
> +// ubuntu-emu - Tool to download and run Ubuntu Touch emulator instances

ubuntu-emu? :-)

> +//
> +// Copyright (c) 2013 Canonical Ltd.
> +//
> +// Written by Sergio Schvezov <sergio.schvezov at canonical.com>
> +//
> +package main
> +
> +// This program is free software: you can redistribute it and/or modify it
> +// under the terms of 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 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/>.
> +
> +import (
> +	"os"
> +
> +	flags "github.com/jessevdk/go-flags"
> +)
> +
> +var parser = flags.NewParser(nil, flags.Default)
> +
> +func init() {
> +
> +}
> +
> +func main() {
> +	if _, err := parser.Parse(); err != nil {
> +		os.Exit(1)
> +	}
> +}
> 
> === modified file 'ubuntuimage/images.go'
> --- ubuntuimage/images.go	2014-04-16 15:01:28 +0000
> +++ ubuntuimage/images.go	2014-05-30 12:35:20 +0000
> @@ -56,7 +56,7 @@
>  mount system
>  `
>  
> -func GetUbuntuCommands(files []File, downloadDir string, wipe bool) (commandsFile string, err error) {
> +func GetUbuntuCommands(files []File, downloadDir string, wipe bool, enable []string) (commandsFile string, err error) {
>  	tmpFile, err := ioutil.TempFile(downloadDir, "ubuntu_commands")
>  	if err != nil {
>  		return commandsFile, err
> @@ -70,16 +70,23 @@
>  	if wipe {
>  		writer.WriteString("format data\n")
>  	}
> -	writer.WriteString(commandsStart)
> -	order := func(f1, f2 *File) bool {
> -		return f1.Order < f2.Order
> -	}
> -	By(order).Sort(files)
> -	for _, file := range files {
> -		writer.WriteString(
> -			fmt.Sprintf("update %s %s\n", filepath.Base(file.Path), filepath.Base(file.Signature)))
> -	}
> -	writer.WriteString("unmount system\n")
> +	if files != nil {
> +		writer.WriteString(commandsStart)
> +		order := func(f1, f2 *File) bool {
> +			return f1.Order < f2.Order
> +		}
> +		By(order).Sort(files)
> +		for _, file := range files {
> +			writer.WriteString(
> +				fmt.Sprintf("update %s %s\n", filepath.Base(file.Path), filepath.Base(file.Signature)))
> +		}
> +		writer.WriteString("unmount system\n")
> +	}
> +
> +	//we cannot enable "things" outside of userdata
> +	for i := range enable {
> +		writer.WriteString(fmt.Sprintf("enable %s\n", enable[i]))
> +	}
>  	return tmpFile.Name(), err
>  }
>  
> 


-- 
https://code.launchpad.net/~sergiusens/goget-ubuntu-touch/developer_mode/+merge/221534
Your team Ubuntu Phablet Team is subscribed to branch lp:goget-ubuntu-touch.



More information about the Ubuntu-reviews mailing list