Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 343581 - darcs.eclass: export current revision after the checkout
Summary: darcs.eclass: export current revision after the checkout
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All Linux
: High enhancement (vote)
Assignee: Gentoo's Haskell Language team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 311101
  Show dependency tree
 
Reported: 2010-10-31 21:00 UTC by Alexander Vershilov (RETIRED)
Modified: 2010-11-01 20:58 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
darcs.eclass.patch exports DARCS_REPO_ID as current ID (darcs.eclass.patch,778 bytes, patch)
2010-10-31 22:11 UTC, Sergei Trofimovich (RETIRED)
Details | Diff
darcs.eclass.patch - added proposed changes (darcs.eclass.patch,577 bytes, patch)
2010-11-01 14:38 UTC, Sergei Trofimovich (RETIRED)
Details | Diff
Fixed patch (darcs.eclass-export-patchcount.patch,785 bytes, patch)
2010-11-01 14:54 UTC, Michał Górny
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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!