OpenWrt Forum Archive

Topic: How to build a specific revision of trunk

The content of this topic has been archived on 23 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi all,

I'd like to build a specific revision of trunk and I'm not sure how to handle the feeds...

Here's what I'm doing so far:

git clone git://git.openwrt.org/openwrt.git
git log --grep=40698

Then I get:

commit 1fd51fcb9970994c57faa933453bc426dcbc3007
Author: nbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Date:   Mon May 5 18:44:46 2014 +0000

    x86_64: enable high res timers by default
    
    Signed-off-by: Felix Fietkau <nbd@openwrt.org>
    
    git-svn-id: svn://svn.openwrt.org/openwrt/trunk@40698 3c298f89-4303-0410-b956-a3cf2f4a3e73

Out of which I use the commit Id to perform the following:

git checkout 1fd51fcb9970994c57faa933453bc426dcbc3007

That seems to be fine as far as the main repository is concerned.

Now I'm unsure how I can proceed for the feeds since they also moved to GIT (no "src-svn" anymore in the feeds.conf) so I cannot use the "@40698" in the URL to get what I need.

I know a lot of you out there must be doing something similar and I would appreciate if you can share your procedure with me.

Thank you!

Like djgend said, you can specify the exact git commit hash in feed definition in feeds.conf.default by using  ^commithash like the wiki article explains. Concrete example: https://dev.openwrt.org/changeset/41987/

But personally I use a "time-machine" script, which I have written.
You give the exact datetime as the argument, and it pulls the correct code for the main Openwrt and the feeds (luci, packages and routing, as I use packages only from those).
It handles main Openwrt with both git/svn and feeds with git.
Note that time needs to be either  yyyy-mm-dd or "yyyy-mm-dd hh:mm" (with quotes).

#!/bin/bash
#
# versionT  -  Update source code to revision T and then build
#              T argument: date as yyyy-mm-dd or "yyyy-mm-dd hh:mm"
#              first "git pull --depth=500" to deepen git history (shallow)
#              use "git checkout master" for each feed to get back to HEAD

echo "...update main source..."
[ -d .svn ] && svn up -r {"$1"}
[ -d .git ] && git checkout `git rev-list -n 1 --before="$1" master`
echo "...update feeds..."
(cd feeds/luci     ; git checkout `git rev-list -n 1 --before="$1" master`)
(cd feeds/packages ; git checkout `git rev-list -n 1 --before="$1" master`)
(cd feeds/routing  ; git checkout `git rev-list -n 1 --before="$1" master`)
echo "...install feeds..."
./scripts/feeds install -a
echo "...make defconfig..."
make defconfig

(Last edited by hnyman on 28 Feb 2016, 14:29)

how to checkout a single package at specific revison?

"git checkout <hash> ." in the package's directory.

Example using "adblock". Jumping from current 1.0 to previous commit 0.91 and then back:

perus@ub1510:/Openwrt/trunk/feeds/packages/net/adblock$ git log --oneline . | head -n 5
9f719e4 adblock: release 1.0.0
8a0e3c0 adblock: 0.91.0
a869954 adblock: 0.90.0
babad56 adblock: 0.80.1
43fb20c adblock: 0.80.0

perus@ub1510:/Openwrt/trunk/feeds/packages/net/adblock$ git status .
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean

perus@ub1510:/Openwrt/trunk/feeds/packages/net/adblock$ grep cfgver files/adblock.conf 
    option adb_cfgver '1.0'

perus@ub1510:/Openwrt/trunk/feeds/packages/net/adblock$ git checkout 8a0e3c0 .

perus@ub1510:/Openwrt/trunk/feeds/packages/net/adblock$ grep cfgver files/adblock.conf 
    option adb_cfgver '0.91'

perus@ub1510:/Openwrt/trunk/feeds/packages/net/adblock$ git status .
On branch master
Your branch is up-to-date with 'origin/master'.
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

    modified:   Makefile
    modified:   files/README.md
    modified:   files/adblock-helper.sh
    modified:   files/adblock-update.sh
    modified:   files/adblock.conf
    modified:   files/adblock.init

perus@ub1510:/Openwrt/trunk/feeds/packages/net/adblock$ git checkout 9f719e4 .

perus@ub1510:/Openwrt/trunk/feeds/packages/net/adblock$ git status .
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean

perus@ub1510:/Openwrt/trunk/feeds/packages/net/adblock$ grep cfgver files/adblock.conf 
    option adb_cfgver '1.0'

(Last edited by hnyman on 18 Mar 2016, 15:13)

The discussion might have continued from here.