Using git to manage OpenWrt builds

From Lars' Site
Jump to: navigation, search

I maintain OpenWrt builds for a number of different special purpose routers and "internet things". In order to manage that efficiently I primarily use git.

This document describes how I have set up my Git/OpenWrt environment.

Original OpenWrt Repositories

OpenWrt uses a number of different Git repositories:

Setup Github Repositories

On Github I have created 4 repositories to be used for this:

Clone the Github Repositories

lth@ncpws04:~/openwrt$ git clone git@github.com:lbthomsen/openwrt.git
Cloning into 'openwrt'...
warning: You appear to have cloned an empty repository.
Checking connectivity... done.
lth@ncpws04:~/openwrt$ git clone git@github.com:lbthomsen/openwrt-packages.git
Cloning into 'openwrt-packages'...
warning: You appear to have cloned an empty repository.
Checking connectivity... done.
lth@ncpws04:~/openwrt$ git clone git@github.com:lbthomsen/openwrt-routing.git
Cloning into 'openwrt-routing'...
warning: You appear to have cloned an empty repository.
Checking connectivity... done.
lth@ncpws04:~/openwrt$ git clone git@github.com:lbthomsen/openwrt-luci.git
Cloning into 'openwrt-luci'...
warning: You appear to have cloned an empty repository.
Checking connectivity... done.

Add primary respository as upstream

lth@ncpws04:~/openwrt/openwrt$ git remote add upstream git://git.openwrt.org/openwrt.git
lth@ncpws04:~/openwrt/openwrt$ git pull upstream master                                                                                                                                                                                                                        
remote: Counting objects: 265474, done.
remote: Compressing objects: 100% (75491/75491), done.
remote: Total 265474 (delta 179677), reused 262281 (delta 177536)
Receiving objects: 100% (265474/265474), 100.94 MiB | 455.00 KiB/s, done.                                                                                                                                                                                                      
Resolving deltas: 100% (179677/179677), done.                                                                                                                                                                                                                                  
From git://git.openwrt.org/openwrt                                                                                                                                                                                                                                             
 * branch            master     -> FETCH_HEAD                                                                                                                                                                                                                                  
 * [new branch]      master     -> upstream/master         

Push merged data to primary repository.

lth@ncpws04:~/openwrt/openwrt$ git push                                                                                                                                                                                                                                        
Counting objects: 265474, done.                                                                                                                                                                                                                                                
Delta compression using up to 4 threads.                                                                                                                                                                                                                                       
Compressing objects: 100% (73350/73350), done.                                                                                                                                                                                                                                 
Writing objects: 100% (265474/265474), 100.94 MiB | 572.00 KiB/s, done.                                                                                                                                                                                                        
Total 265474 (delta 179677), reused 265474 (delta 179677)                                                                                                                                                                                                                      
To git@github.com:lbthomsen/openwrt.git                                                                                                                                                                                                                                        
 * [new branch]      master -> master

For the other 3 repositories I create a branch that is essentially the date on which I did this.

lth@ncpws04:~/openwrt/openwrt-packages$ git remote add upstream git://nbd.name/packages.git                                                                                                                                                                                    
lth@ncpws04:~/openwrt/openwrt-packages$ git pull upstream master && git push && git branch 2014-04-19 && git push origin 2014-04-19
remote: Counting objects: 74135, done.
remote: Compressing objects: 100% (28078/28078), done.
remote: Total 74135 (delta 40071), reused 72723 (delta 39236)
Receiving objects: 100% (74135/74135), 16.66 MiB | 566.00 KiB/s, done.                                                                                                                                                                                                         
Resolving deltas: 100% (40071/40071), done.                                                                                                                                                                                                                                    
From git://nbd.name/packages                                                                                                                                                                                                                                                   
 * branch            master     -> FETCH_HEAD                                                                                                                                                                                                                                  
 * [new branch]      master     -> upstream/master                                                                                                                                                                                                                             
Counting objects: 74135, done.                                                                                                                                                                                                                                                 
Delta compression using up to 4 threads.                                                                                                                                                                                                                                       
Compressing objects: 100% (27243/27243), done.                                                                                                                                                                                                                                 
Writing objects: 100% (74135/74135), 16.66 MiB | 592.00 KiB/s, done.                                                                                                                                                                                                           
Total 74135 (delta 40071), reused 74135 (delta 40071)                                                                                                                                                                                                                          
To git@github.com:lbthomsen/openwrt-packages.git                                                                                                                                                                                                                               
 * [new branch]      master -> master                                                                                                                                                                                                                                          
Total 0 (delta 0), reused 0 (delta 0)                                                                                                                                                                                                                                          
To git@github.com:lbthomsen/openwrt-packages.git                                                                                                                                                                                                                               
 * [new branch]      2014-04-19 -> 2014-04-19  
                                                                                                                                                                                                                                
lth@ncpws04:~/openwrt/openwrt-packages$ cd ../openwrt-routing/                                                                                                                                                                                                                 
lth@ncpws04:~/openwrt/openwrt-routing$ git remote add upstream git://github.com/openwrt-routing/packages.git
lth@ncpws04:~/openwrt/openwrt-routing$ git pull upstream master && git push && git branch 2014-04-19 && git push origin 2014-04-19
remote: Counting objects: 2593, done.
remote: Compressing objects: 100% (1571/1571), done.
remote: Total 2593 (delta 807), reused 2584 (delta 803)
Receiving objects: 100% (2593/2593), 815.46 KiB | 415.00 KiB/s, done.
Resolving deltas: 100% (807/807), done.
From git://github.com/openwrt-routing/packages
 * branch            master     -> FETCH_HEAD
 * [new branch]      master     -> upstream/master
Counting objects: 2593, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (1567/1567), done.
Writing objects: 100% (2593/2593), 815.54 KiB | 0 bytes/s, done.
Total 2593 (delta 807), reused 2593 (delta 807)
To git@github.com:lbthomsen/openwrt-routing.git
 * [new branch]      master -> master
Total 0 (delta 0), reused 0 (delta 0)
To git@github.com:lbthomsen/openwrt-routing.git
 * [new branch]      2014-04-19 -> 2014-04-19

lth@ncpws04:~/openwrt/openwrt-routing$ cd ../openwrt-luci/
lth@ncpws04:~/openwrt/openwrt-luci$ git remote add upstream git://nbd.name/luci.git
lth@ncpws04:~/openwrt/openwrt-luci$ git pull upstream master && git push && git branch 2014-04-19 && git push origin 2014-04-19
remote: Counting objects: 66983, done.
remote: Compressing objects: 100% (18712/18712), done.
remote: Total 66983 (delta 41668), reused 65211 (delta 40309)
Receiving objects: 100% (66983/66983), 14.29 MiB | 301.00 KiB/s, done.
Resolving deltas: 100% (41668/41668), done.
From git://nbd.name/luci
 * branch            master     -> FETCH_HEAD
 * [new branch]      master     -> upstream/master
Counting objects: 66983, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (17353/17353), done.
Writing objects: 100% (66983/66983), 14.29 MiB | 596.00 KiB/s, done.
Total 66983 (delta 41668), reused 66983 (delta 41668)
To git@github.com:lbthomsen/openwrt-luci.git
 * [new branch]      master -> master
Total 0 (delta 0), reused 0 (delta 0)
To git@github.com:lbthomsen/openwrt-luci.git
 * [new branch]      2014-04-19 -> 2014-04-19