On Tue, Oct 23, 2012 at 6:35 PM, Tim Bird <[email protected]> wrote:

> Hi everyone,
>
> I'm conducting a bit of a survey.  I am holding a "Birds-of-a-Feather"
> session at ELC Europe in a few weeks on the topic of embedded
> Linux tips and tricks.  For that session, I'd like to collect
> ideas from people about tips or tricks that you use in your own
> embedded Linux development.
>
>
> 1. git commands:
>
> 2. Custom or homebrew tools:
>
>

Tim,

Here are a few scripts or helpers I use from time to time (mostly for
Android development though):

1. First issue is to access git:// protocol through my company's HTTP proxy.

For that, you need the "socat" package installed on your Linux and add the
following to your $HOME/.gitconfig:

git config --global core.gitproxy /path/to/my_gitproxy.sh

Where my_gitproxy.sh is the following shell script:

#!/bin/sh
# Use socat to proxy git through an HTTP CONNECT firewall.
# Useful if you are trying to clone git:// from inside a company.
# Requires that the proxy allows CONNECT to port 9418.

# Configuration. Common proxy ports are 3128, 8123, 8000.
_proxy=proxy.mycompany.com
_proxyport=3128

exec socat STDIO PROXY:$_proxy:$1:$2,proxyport=$_proxyport

2. I have a Google's Android git trees mirror in my company's from which
developers pull from as to avoid pulling from the WAN every time.
The attached "repo-sync-upstream" script synchronizes all local git tree
mirrors with upstream, fetching all possible heads through "git fetch --all"

3. I sometimes want to create a whole patchset of all the changes we have
made in our Android tree.
This really helps isolating all the changes you made against Google's
upstream tree so that you can more easily migrate to new AOSP versions and
see what you've added/changed.
The attached "repo-extract-changes" script parses manifest and extracts
changes for all project within, from one branch/tag to another.
Can be used through: repo-extract-changes output_dir {branch|tag}_orig
{branch|tag}_new
and mostly uses "git format-patch" internally.

It's really useful if you intend to create some kind of BSP for example.
The idea is: "You, client, just need to download public Google's android
sources (revision X.Y) and patch them with this massive BSP patchset".

It creates a directory with all updated git tree listed as a directory with
patchset within.
You just need to tarball the output directory and send to your client.

4. If I need to create a remote tag to all git trees from my Android
manifest (the repo-extract-changes script does wonders after that) :

aosp_tag () {
  [ "$1" = "" ] && exit 1
  TAG="$1"
  [ "$2" != "" ] && COMMENT="-m '$2'"
  # local tagging
  repo forall -c 'git tag $COMMENT $TAG'
  # push tag to remote end
  repo forall -c 'REMOTE=$(cat .git/config | grep -e "\[remote" | head -n 1
| sed "s%.*\"\(.*\)\".*%\1%"); git push --tags $REMOTE'
}

And just "aosp_tag my_tag [my_comment]"

Same if, for any reason, you need to create remote branches in all your
trees:

aosp_branch () {
  [ "$1" = "" ] && exit 1
  NEW_BRANCH="$1"
  # create local branch
  repo forall -c 'git checkout -b "$NEW_BRANCH"'
  # push it upstream
  repo forall -c 'REMOTE=$(cat .git/config | grep -e "\[remote" | head -n 1
| sed "s%.*\"\(.*\)\".*%\1%"); git push $REMOTE $NEW_BRANCH:$NEW_BRANCH'
}


See you in Barcelona/ELCE,

Ben

Attachment: repo-extract-changes
Description: Binary data

Attachment: repo-sync-upstream
Description: Binary data

_______________________________________________
Celinux-dev mailing list
[email protected]
https://lists.celinuxforum.org/mailman/listinfo/celinux-dev

Reply via email to