Re: [PATCH] Use a better filename when creating a snapshot

Xavier Bachelot <[email protected]> Sun, 19 Feb 2017 13:10:21 +0100
Newsgroups gmane.comp.video.xine.devel
Message-ID <[email protected]>
On 13/02/2017 12:51, Mikko Rasa wrote:
> On 13.02.2017 12:29, Petri Hintukainen wrote:
>> su, 2017-02-12 kello 23:17 +0100, Xavier Bachelot kirjoitti:
>>> Hi,
>>>
>>> As it seems neither Petri nor Torsten, the 2 active developers, have
>>> enough privileges to make a full release with a proper tarball
>>> uploaded
>>> to the website, I'm leaning toward using snapshots for Fedora.
>>> However,
>>> the generated tarball name is not unique enough for my use, so I came
>>> up
>>> with the attached patch, which will generate a tarball named
>>> xine-lib-"version"-"date_of_changeset"hg"changeset_number".tar.xz
>>> rather than
>>> xine-lib-"version"hg.tar.gz
>>>
>>> Please review.
>>
>> I would also check for local changes / commits and add "dirty" etc. to
>> the version suffix.
>>
>> Maybe something like
>>
>> HG_DIRTY=`hg out 2>/dev/null | grep -q changeset || hg sum | grep -q
>> 'commit:.*modified' && echo "+dirty"`
> 
> An additional thought about this.  Such dirty tarballs are not really 
> appropriate for general distribution.  Maybe it would be too harsh to 
> outright refuse to generate a tarball (it may have some uses during 
> development), and marking it as dirty is definitely appropriate, but a 
> public release should always be made from a clean source tree.
> 
I like the 'dirty' idea, and I agree with Mikko's comment.
The purpose of this patch is exactly that, allow to easily build a
tarball and thus easily generate a binary package from it.

What about this patch ? I just took what Petri suggested for 'dirty' and
added it.
Feel free to remove the date part and change the dash separator to a
plus, or anything else that would fit.

Regards,
Xavier

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot

_______________________________________________
xine-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xine-devel
xine-lib-Use_a_better_filename_when_creating_a_snapshot.patch (text/x-patch, 1.1 KB)
# HG changeset patch
# User Xavier Bachelot <[email protected]>
# Date 1487505408 -3600
#      Sun Feb 19 12:56:48 2017 +0100
# Node ID 765bbd2868b10f007fc9d8b85a51fef573ab8c4c
# Parent  d24c69278026bd37b4d4263fccc62c34bbb89596
# Parent  14180247b4ad9f9c256bc99e87656a5855234cb0
Use a better filename when creating a snapshot

diff -r d24c69278026 -r 765bbd2868b1 version.sh
--- a/version.sh	Fri Feb 17 17:42:05 2017 +0100
+++ b/version.sh	Sun Feb 19 12:56:48 2017 +0100
@@ -39,7 +39,13 @@
 XINE_LT_REVISION=0
 XINE_LT_AGE=6
 
-test -f "`dirname $0`/.cvsversion" && XINE_VERSION_SUFFIX="hg"
+if [ -f "`dirname $0`/.cvsversion" ]; then
+    HG_REV="`hg summary | sed -e '1s/^parent: \([0-9]*\):.*$/\1/;1q'`"
+    HG_DATE_UNIX="`hg export -r ${HG_REV} | sed -n '3s/^# Date \([0-9]*\) .*$/\1/p;3q'`"
+    HG_DATE="`date -u +%Y%m%d --date=@${HG_DATE_UNIX}`"
+    HG_DIRTY=`hg out 2>/dev/null | grep -q changeset || hg sum | grep -q 'commit:.*modified' && echo "+dirty"`
+    XINE_VERSION_SUFFIX="-${HG_DATE}hg${HG_REV}${HG_DIRTY}"
+fi
 XINE_VERSION_SPEC="${XINE_VERSION_MAJOR}.${XINE_VERSION_MINOR}.${XINE_VERSION_SUB}${XINE_VERSION_PATCH}${XINE_VERSION_SUFFIX}"
 
 ####