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

Bug 343581

Summary: darcs.eclass: export current revision after the checkout
Product: Gentoo Linux Reporter: Alexander Vershilov (RETIRED) <qnikst>
Component: EclassesAssignee: Gentoo's Haskell Language team <haskell>
Status: RESOLVED FIXED    
Severity: enhancement CC: mgorny
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 311101    
Attachments: darcs.eclass.patch exports DARCS_REPO_ID as current ID
darcs.eclass.patch - added proposed changes
Fixed patch

Description Alexander Vershilov (RETIRED) gentoo-dev 2010-10-31 21:00:28 UTC
Darcs.eclass doesn't export current code revision after doing the checkout.
This will allow programs to grab it from environment.bz2 and know
which revision the package was built against.

A similar feature is already provided by git (EGIT_VERSION), hg (HG_REV_ID),
subversion (ESVN_WC_REVISION) and even cvs (ECVS_VERSION and ESCM_VERSION.



Reproducible: Always
Comment 1 Alexander Vershilov (RETIRED) gentoo-dev 2010-10-31 21:03:30 UTC
An idea to track darcs version is to check current number of patches, this will cover most of the darcs use cases. It can be done with next command:
# darcs show repo | grep "Num Patches" | sed 's/ *//' | cut -s -d' ' -f3

alternatively md5 or sha for all files can be calculated. 
Comment 2 Sergei Trofimovich (RETIRED) gentoo-dev 2010-10-31 22:11:05 UTC
Created attachment 252723 [details, diff]
darcs.eclass.patch exports DARCS_REPO_ID as current ID

What do you think of such thing?
Comment 3 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2010-11-01 08:16:16 UTC
I'd suggest naming it EDARCS_PATCHCOUNT or something like that.

And if you really want to do implicit shell magic like that, you could make it simpler:

set -- $(${EDARCS_DARCS_CMD} show repo | grep "Num Patches")
echo ${3}
Comment 4 Sergei Trofimovich (RETIRED) gentoo-dev 2010-11-01 14:38:05 UTC
Created attachment 252799 [details, diff]
darcs.eclass.patch - added proposed changes

Yeah, changes sound fine. Attached another version.

BEWARE, completely untested!. I'll thest it this evening (in 3-4 hours).
Comment 5 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2010-11-01 14:54:38 UTC
Created attachment 252803 [details, diff]
Fixed patch

Confirmed working.
Comment 6 Sergei Trofimovich (RETIRED) gentoo-dev 2010-11-01 20:58:13 UTC
Pushed to the tree.

Thank you, guys!