how to create a local android open source project mirror in 6 easy steps

32
How to create a local Android open source project mirror

Upload: deveo

Post on 16-Jan-2017

688 views

Category:

Software


2 download

TRANSCRIPT

Page 1: How to create a local Android open source project mirror in 6 easy steps

How to create a localAndroid open source

project mirror

Page 2: How to create a local Android open source project mirror in 6 easy steps

1. Obtain necessaryinformation

Page 3: How to create a local Android open source project mirror in 6 easy steps

Before you set up a local Android open sourceproject mirror using Deveo, you need to know:

Page 4: How to create a local Android open source project mirror in 6 easy steps

correct at time of publishing

• The current Android Git server address

android.googlesource.com

Page 5: How to create a local Android open source project mirror in 6 easy steps

correct at time of publishing

•Deveo server address

app.deveo.com

Page 6: How to create a local Android open source project mirror in 6 easy steps

•Name for the Deveo project wewish to setup the local android open source project mirror

Page 7: How to create a local Android open source project mirror in 6 easy steps

• Your Deveo plugin key, company key, andaccount key

These can be found in your user preferenceslocated in the top right of the Deveoweb

interface

Page 8: How to create a local Android open source project mirror in 6 easy steps

• Your Deveo username

Page 9: How to create a local Android open source project mirror in 6 easy steps

• Your company name in DeveoThe company name one you type whenever you

log in to Deveo.

Page 10: How to create a local Android open source project mirror in 6 easy steps

2. Create the Deveo projectfor ourmirror

Page 11: How to create a local Android open source project mirror in 6 easy steps

Wewill create the project programmaticallythroughDeveo REST APIs. But first, lets exportthe Android open source project Git server

URL, Deveo plugin key, company key and youraccount key, as well as the project name and

the Deveo URL as shell variables...

Page 12: How to create a local Android open source project mirror in 6 easy steps

export ANDROID_URL=android.googlesource.com

export PLUGIN_KEY=3a12d59d6220aa024cb45b8c7b82db12

exportCOMPANY_KEY=c18c6317641b13223228b1cd7254e9b8

exportACCOUNT_KEY=462c0f154875824a626c81a26ab3212f

export DEVEO_URL=app.deveo.com

export DEVEO_PROJECT=my-android-open-source-project-fork

export DEVEO_USERNAME=ilmarideveocom

REMEMBER TOREPLACE THE EXAMPLEKEYS, URLS ETC.WITHYOUROWN

For example:

Page 13: How to create a local Android open source project mirror in 6 easy steps

Now use the following curl command to createa newDeveo project in Deveo:

Page 14: How to create a local Android open source project mirror in 6 easy steps

curl -X POST \

-H "Accept: application/vnd.deveo.v1" \

-H "Authorization: deveoplugin_key='$PLUGIN_KEY',company_key='$COMPANY_KEY',account_key='$ACCOUNT_KEY" \

-H "Content-Type: application/json" \

-d '{ "id": "$DEVEO_PROJECT", "name":"$DEVEO_PROJECT" }' \

https://$DEVEO_URL/api/projects

Page 15: How to create a local Android open source project mirror in 6 easy steps

Check the results from theweb interface.There should be a new project in your Deveo

dashboard with the appropriate name.

Page 16: How to create a local Android open source project mirror in 6 easy steps

3. Create the repositories

Page 17: How to create a local Android open source project mirror in 6 easy steps

Create a Git repository in Deveo, using thefollowing curl snippet:

Page 18: How to create a local Android open source project mirror in 6 easy steps

curl -X POST \

-H "Accept: application/vnd.deveo.v1" \

-H "Authorization: deveoplugin_key='$PLUGIN_KEY',company_key='$COMPANY_KEY',account_key='$ACCOUNT_KEY'" \

-H "Content-Type: application/json" \

-d '{ "id": "platform/manifest", "type": "git"}' \

https://$DEVEO_URL/api/projects/$DEVEO_PROJECT/repositories

Page 19: How to create a local Android open source project mirror in 6 easy steps

Grab it from:

https://github.com/Deveo/local-android-open-source-project-mirror

Since it would be tedious to copy-paste thecode snippet over and over for each repositoryin themanifest.xml file, we created an XSL

template that can be used to read and create afile containing one curl snippet for each

repository.

Page 20: How to create a local Android open source project mirror in 6 easy steps

4. Clone the originalrepositories from officialAndroid open sourceproject repository

Page 21: How to create a local Android open source project mirror in 6 easy steps

Clone the repositories using --bare switch inorder to store the repositories within the

hierarchical structure in the local filesystem.

Page 22: How to create a local Android open source project mirror in 6 easy steps

For example:

With themanifest repository, wewould do as follows:

cd platform/manifestgit remote add deveohttps://$DEVEO_USERNAME@$DEVEO_URL/$DEVEO_COMPANY/projects/$DEVEO_PROJECT/repositories/git/platform/manifestgit push --mirror deveocd -

Page 23: How to create a local Android open source project mirror in 6 easy steps

Get the template here:https://github.com/Deveo/local-android-open-source-project-mirror

Tomake this easier, we've used a similartemplate based approach for going through allrepositories.

Page 24: How to create a local Android open source project mirror in 6 easy steps

5. Push the repositories tothe Deveo project

Page 25: How to create a local Android open source project mirror in 6 easy steps

To push repositories to Deveo, go to thedirectory of the repository, add a new remoteto the repository pointing to the Deveorepository URL, and finally, push the changesusing --mirror switch.

Page 26: How to create a local Android open source project mirror in 6 easy steps

For example,With themanifest repository,wewould do as follows:

cd platform/manifest git remote adddeveohttps://$DEVEO_USERNAME@$DEVEO_URL/$DEVEO_COMPANY/projects/$DEVEO_PROJECT/repositories/git/platfor m/manifest git push --mirror deveo cd -

Page 27: How to create a local Android open source project mirror in 6 easy steps

For this snippet to work we need to exportDeveo username and company name as

command line variables.

For example:export DEVEO_USERNAME=ilmarideveocomexport DEVEO_COMPANY=deveo

Page 28: How to create a local Android open source project mirror in 6 easy steps

Like in the previous two steps, our XSLtemplate based approach takes care of the

heavy lifting and copy-pasting.

Get the XSL here:https://github.com/Deveo/local-android-open-source-project-mirror

Page 29: How to create a local Android open source project mirror in 6 easy steps

6. Test everythingworks

Page 30: How to create a local Android open source project mirror in 6 easy steps

Now you have all of the repositories pushed toDeveo, youmust test things out following the

official Android open source projectinstructions, and using Deveo as the clone URL.

Page 31: How to create a local Android open source project mirror in 6 easy steps

For example, run this repo command toinitialize a new client from your freshly created

local mirror:

repo init -uhttps://[email protected]/deveo/projects/aosp-testi/repositories/git/platform/manifest

Page 32: How to create a local Android open source project mirror in 6 easy steps

Howdid you get on?

Let us know!Tweet us@DeveoTeam