So, if you want to get SOURCES from the look-aside cache using get_sources.sh for an older revision, you might possibly hit a DETACHED HEAD snag that I just hit.
1. git checkout https://git.centos.org/git/rpms/firefox.git
(or if you already have it, git pull from within the firefox directory)
2. If you look at firefox's log, there are 2 things to build for c7 GA and the beta and the RC are there, so four commits for four different SRPMS.
the command "git log" shows us that:
commit 9e6d29c3f16d3692c9cb30371b227d6c08edd591 Author: CentOS Sources bugs@centos.org Date: Tue Jun 10 16:10:41 2014 -0400
import firefox-24.6.0-1.el7_0
commit 9a1d2ed9c6faf3da49e78eb41872bde7cfefece2 Author: CentOS Sources bugs@centos.org Date: Mon Jun 9 03:31:45 2014 -0400
import firefox-24.5.0-1.el7
commit 6ca8db34a0fc78f0454e96c6f9b715df86529195 Author: CentOS Buildsys bugs@centos.org Date: Tue Mar 18 09:47:19 2014 +0000
import firefox-24.4.0-1.el7.src.rpm
commit 29a772037be917dc94c382403705291699865c88 Author: CentOS Buildsys bugs@centos.org Date: Fri Nov 8 10:07:07 2013 +0000
import firefox-24.1.0-3.el7.src.rpm
commit 591789b9e3e230f74954ed27b377f8e72068d895 Author: CentOS Buildsys bugs@centos.org Date: Fri Nov 8 10:07:10 2013 +0000
init git for firefox
3. I want to get the sources for .. firefox-24.5.0-1.el7 ... at revision 9a1d2ed9c6faf3da49e78eb41872bde7cfefece2. I tried and failed to get it by simply doing:
git checkout 9a1d2ed9c6faf3da49e78eb41872bde7cfefece2
and then
get_sources.sh
4. The problem is that going one commit back changes git's HEAD to a link to the commit number and not what it is when you are on the c7 branch .. and that breaks the get_sources.sh script's branch detection. For more on what detached head looks like see this:
http://alblue.bandlem.com/2011/08/git-tip-of-week-detached-heads.html
5. So, we will try to fix the get_source.sh script to work in that situation .. in the meantime, you can do this instead.
=================================================
1. go to the firefox repo and make sure you are on the c7 branch:
git checkout c7
2. Do a git log and find the revision you want (see the above list, step 2)
3. I want to get the sources for "firefox-24.5.0-1.el7", which is one revision back from current ... so do this command:
git reset --hard c7~1
4. It will tell you this:
HEAD is now at 9a1d2ed import firefox-24.5.0-1.el7
5. Now you can use get_sources.sh to pull the SOURCES for firefox-24.5.0-1.el7
get_sources.sh
6. Once the sources are done downloading, build the SRPM with the command:
rpmbuild --define "_topdir $(pwd)" --define "dist .el7" -bs --nodeps SPECS/firefox.spec
7. To get back to the current revision of firefox in the c7 branch do this:
git pull --ff-only
8. It will tell you this:
Updating 9a1d2ed..9e6d29c Fast-forward .firefox.metadata | 4 ++-- .gitignore | 4 ++-- SOURCES/xulrunner-2.0-chromium-types.patch | 34 ---------------------------------- SOURCES/xulrunner-webrtc-secondarch.patch | 34 ---------------------------------- SPECS/firefox.spec | 14 ++++++++------ 5 files changed, 12 insertions(+), 78 deletions(-) delete mode 100644 SOURCES/xulrunner-2.0-chromium-types.patch delete mode 100644 SOURCES/xulrunner-webrtc-secondarch.patch
============================================
If you wanted to go two revisions back (in this example that would be version "firefox-24.4.0-1.el7.src.rpm" , you would do:
git reset --hard c7~2
(the ~1 or ~2 is the number of revisions to go back)
Don't forget to go back to the top with the "git pull --ff-only" when you are ready to be on the current revision again
As I said, we are going to try to come up with better branch detection for getting the sources, but until we do, this should help anyone with this issue.
Thanks very much to Mike McLean and Karanbir Singh for helping figure out the issue and the workaround.
Thanks, Johnny Hughes