Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 152189

Summary: git.eclass: Store the actual hash in EGIT_BRANCH
Product: Gentoo Linux Reporter: Avuton Olrich <avuton>
Component: EclassesAssignee: Fernando J. Pereda (RETIRED) <ferdy>
Status: RESOLVED INVALID    
Severity: enhancement CC: dberkholz
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: git-show-hash.patch from comment 1

Description Avuton Olrich 2006-10-20 21:49:42 UTC
I am making a bash script to update if a ebuild if the repository from which the ebuild's source was from has updated, I simply wish to diff git.eclass with the following:

--- /usr/portage/eclass/git.eclass      2006-09-11 01:46:09.000000000 -0700
+++ git.eclass  2006-10-20 21:37:16.482600856 -0700
@@ -204,6 +204,7 @@
                ${EGIT_UPDATE_CMD} ${EGIT_OPTIONS} origin ${EGIT_BRANCH}:${EGIT_BRANCH} \
                        || die "${EGIT}: can't update from ${EGIT_REPO_URI}."

+               EGIT_BRANCH=$(git rev-parse ${EGIT_BRANCH})
                ${EGIT_DIFFSTAT_CMD} ${oldsha1}..${EGIT_BRANCH}
        fi

This will produce much more helpful output in the environment, and will do the same exact thing it's always done in the eclass.

Before:
EGIT_BRANCH=master (default)

After:
EGIT_BRANCH=a12e57fe4b6db23c4c7f8a6095692e4ce633bb72 (or whatever the head is at the time)

To go into more detail, this is needed due to those who use a shared distfiles directory, if one computer updates, the other will never know if the ebuild in question has been updated.

Thank you.
Comment 1 Avuton Olrich 2006-10-20 21:52:06 UTC
Created attachment 100117 [details, diff]
git-show-hash.patch from comment 1
Comment 2 Donnie Berkholz (RETIRED) gentoo-dev 2006-10-21 22:30:15 UTC
I don't like the idea of showing something other than the branch name when we're advertising that it is the branch name. However, I'd be fine with displaying that as the head of that branch in a separate line.
Comment 3 Avuton Olrich 2006-10-21 22:49:51 UTC
OK, in that case, I'll tell you what I need and hopefully you can figure the best way of doing this :)

I need the actual hash of the installed version (after the update). I also need it to be accessible from the /var/db/pkg/*/environment.bz2.

This is the case I was trying to make above, substituting EGIT_BRANCH's name for it's hash after the update.

Again, Thanks
Comment 4 Fernando J. Pereda (RETIRED) gentoo-dev 2006-10-29 14:16:06 UTC
I'd agree to add something like this if it was 'standard' across all of the scm.eclass'es. Maybe you should open a RFC thread in gentoo-dev.

- ferdy
Comment 5 Avuton Olrich 2006-10-29 20:28:52 UTC
I'm not sure about a standard, but svn does have something like this: ESVN_WC_REVISION, which was all I was looking for in git. Anyhow, nevermind, I think I've found another way to skin the cat. Thanks for your time.
Comment 6 Fernando J. Pereda (RETIRED) gentoo-dev 2007-01-03 02:04:58 UTC
@Avuton: Is there anything I can do wrt this bug ? or should I close it ?

- ferdy
Comment 7 Avuton Olrich 2007-01-03 05:22:19 UTC
No, I actually worked around this limitation, thanks for the help (I didn't know which resolution to close it with, so I didn't touch that)
Comment 8 Fernando J. Pereda (RETIRED) gentoo-dev 2007-01-03 13:02:16 UTC
Since you don't need it anymore, I'd say it is RESOLVED->INVALID.

Cheers.

- ferdy