Re: [Freeipa-devel] git versions for rpms in makefile

2013-03-27 Thread John Dennis

On 03/26/2013 10:41 PM, Orion Poplawski wrote:

On 03/26/2013 07:36 PM, Simo Sorce wrote:

On Tue, 2013-03-26 at 19:14 -0400, Rob Crittenden wrote:

Orion Poplawski wrote:

This patch uses the Fedora standard for git versioning
(version-#.git) when making rpms.  I'm afraid I haven't been able
to test for the non-git version case.


What is the purpose of this? We don't do upstream releases from
developer build, so having the wrong Source0 doesn't seem like a big
deal (though I'll admit no strictly correct).


Sound like a reasonable improvement to me, and makes it sure you do not
confuse an upstream build with a developer build, I am not so sure about
using __GIT__, it's kinda annoying to type, although shell completion
here helps I guess.

I lean toward acking this approach, if you do not have objections Rob.

Simo.


My motivation for this was from testing the pkcs12 patches.  First I did
an srpm build and got 3.1.99GITec94138-0.fc18.src.rpm.  Then I updated
the git repo, did another srpm build and got
3.1.99GIT5acd43d-1.fc18.src.rpm which would have been lower EVR wise.
Now I can get:

3.1.99-1.GIT5acd43d.fc18.src.rpm

which would have been newer than

3.1.99-0.GITec94138.fc18.src.rpm

and allowed me to do yum update.

(actually, for pre-releases it should be -0.1.GIT, -0.2.GIT, ...)

So it doesn't impact releases, just local developer testing - which I
don't know how much is done via rpms.


I think you're confusing issues. You cannot use a git hash to properly 
collate based on build sequence. This is why in our development builds 
we prefix the git hash with a timestamp. It's the timestamp which 
affords the proper collation, the git hash is only informative. These 
issues to not arise in "release builds" because version and or release 
value is incremented.


But the above is independent of whether we should follow the fedora 
convention for git hash, that's probably a good idea, just realize it 
won't solve your problem of version collation.



--
John Dennis 

Looking to carve out IT costs?
www.redhat.com/carveoutcosts/

___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel


Re: [Freeipa-devel] git versions for rpms in makefile

2013-03-26 Thread Rob Crittenden

Orion Poplawski wrote:

On 03/26/2013 07:36 PM, Simo Sorce wrote:

On Tue, 2013-03-26 at 19:14 -0400, Rob Crittenden wrote:

Orion Poplawski wrote:

This patch uses the Fedora standard for git versioning
(version-#.git) when making rpms.  I'm afraid I haven't been able
to test for the non-git version case.


What is the purpose of this? We don't do upstream releases from
developer build, so having the wrong Source0 doesn't seem like a big
deal (though I'll admit no strictly correct).


Sound like a reasonable improvement to me, and makes it sure you do not
confuse an upstream build with a developer build, I am not so sure about
using __GIT__, it's kinda annoying to type, although shell completion
here helps I guess.

I lean toward acking this approach, if you do not have objections Rob.

Simo.


My motivation for this was from testing the pkcs12 patches.  First I did
an srpm build and got 3.1.99GITec94138-0.fc18.src.rpm.  Then I updated
the git repo, did another srpm build and got
3.1.99GIT5acd43d-1.fc18.src.rpm which would have been lower EVR wise.
Now I can get:

3.1.99-1.GIT5acd43d.fc18.src.rpm

which would have been newer than

3.1.99-0.GITec94138.fc18.src.rpm

and allowed me to do yum update.

(actually, for pre-releases it should be -0.1.GIT, -0.2.GIT, ...)

So it doesn't impact releases, just local developer testing - which I
don't know how much is done via rpms.

I also wouldn't expect you would ever have to type __GIT__, why do think
you would?  That is just in the spec.in and gets substituted out for the
GIT.


The root of the problem is the release in n-v-r is always the same value 
in builds because it makes no difference in a developer build. So either 
this patch needs to go farther and generate a real value for RELEASE or 
it just shifts the problem.


For pre-releases you build with IPA_VERSION_IS_GIT_SNAPSHOT=no and the 
values from the file VERSION are used.


I generally build and develop on the same machine so a repo never comes 
into play and use rpm --force -Uvh dist/rpms/* to update.


rob

___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel


Re: [Freeipa-devel] git versions for rpms in makefile

2013-03-26 Thread Orion Poplawski

On 03/26/2013 07:36 PM, Simo Sorce wrote:

On Tue, 2013-03-26 at 19:14 -0400, Rob Crittenden wrote:

Orion Poplawski wrote:

This patch uses the Fedora standard for git versioning
(version-#.git) when making rpms.  I'm afraid I haven't been able
to test for the non-git version case.


What is the purpose of this? We don't do upstream releases from
developer build, so having the wrong Source0 doesn't seem like a big
deal (though I'll admit no strictly correct).


Sound like a reasonable improvement to me, and makes it sure you do not
confuse an upstream build with a developer build, I am not so sure about
using __GIT__, it's kinda annoying to type, although shell completion
here helps I guess.

I lean toward acking this approach, if you do not have objections Rob.

Simo.


My motivation for this was from testing the pkcs12 patches.  First I did 
an srpm build and got 3.1.99GITec94138-0.fc18.src.rpm.  Then I updated 
the git repo, did another srpm build and got 
3.1.99GIT5acd43d-1.fc18.src.rpm which would have been lower EVR wise. 
Now I can get:


3.1.99-1.GIT5acd43d.fc18.src.rpm

which would have been newer than

3.1.99-0.GITec94138.fc18.src.rpm

and allowed me to do yum update.

(actually, for pre-releases it should be -0.1.GIT, -0.2.GIT, ...)

So it doesn't impact releases, just local developer testing - which I 
don't know how much is done via rpms.


I also wouldn't expect you would ever have to type __GIT__, why do think 
you would?  That is just in the spec.in and gets substituted out for the 
GIT.




--
Orion Poplawski
Technical Manager 303-415-9701 x222
NWRA/CoRA DivisionFAX: 303-415-9702
3380 Mitchell Lane  or...@cora.nwra.com
Boulder, CO 80301  http://www.cora.nwra.com

___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel


Re: [Freeipa-devel] git versions for rpms in makefile

2013-03-26 Thread Simo Sorce
On Tue, 2013-03-26 at 19:14 -0400, Rob Crittenden wrote:
> Orion Poplawski wrote:
> > This patch uses the Fedora standard for git versioning
> > (version-#.git) when making rpms.  I'm afraid I haven't been able
> > to test for the non-git version case.
> 
> What is the purpose of this? We don't do upstream releases from 
> developer build, so having the wrong Source0 doesn't seem like a big 
> deal (though I'll admit no strictly correct).

Sound like a reasonable improvement to me, and makes it sure you do not
confuse an upstream build with a developer build, I am not so sure about
using __GIT__, it's kinda annoying to type, although shell completion
here helps I guess.

I lean toward acking this approach, if you do not have objections Rob.

Simo.

-- 
Simo Sorce * Red Hat, Inc * New York

___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel


Re: [Freeipa-devel] git versions for rpms in makefile

2013-03-26 Thread Rob Crittenden

Orion Poplawski wrote:

This patch uses the Fedora standard for git versioning
(version-#.git) when making rpms.  I'm afraid I haven't been able
to test for the non-git version case.


What is the purpose of this? We don't do upstream releases from 
developer build, so having the wrong Source0 doesn't seem like a big 
deal (though I'll admit no strictly correct).


rob

___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel


[Freeipa-devel] git versions for rpms in makefile

2013-03-26 Thread Orion Poplawski
This patch uses the Fedora standard for git versioning (version-#.git) 
when making rpms.  I'm afraid I haven't been able to test for the non-git 
version case.


--
Orion Poplawski
Technical Manager 303-415-9701 x222
NWRA, Boulder Office  FAX: 303-415-9702
3380 Mitchell Lane   or...@nwra.com
Boulder, CO 80301   http://www.nwra.com
>From a90c3f3d7a6889e774f81867689d497b8dd146f6 Mon Sep 17 00:00:00 2001
From: Orion Poplawski 
Date: Tue, 26 Mar 2013 12:48:45 -0600
Subject: [PATCH] Use Fedora git versioning for rpms

---
 Makefile  | 33 ++---
 freeipa.spec.in   |  4 ++--
 ipa-client/ipa-client.spec.in |  4 ++--
 3 files changed, 26 insertions(+), 15 deletions(-)

diff --git a/Makefile b/Makefile
index 9034969..527951c 100644
--- a/Makefile
+++ b/Makefile
@@ -14,9 +14,10 @@ SUPPORTED_PLATFORM ?= redhat
 # target.
 
 ifeq ($(IPA_VERSION_IS_GIT_SNAPSHOT),"yes")
-GIT_VERSION=$(shell git show --pretty=format:"%h" --stat HEAD 2>/dev/null|head -1)
+GIT_VERSION=GIT$(shell git show --pretty=format:"%h" --stat HEAD 2>/dev/null|head -1)
 ifneq ($(GIT_VERSION),)
-IPA_VERSION=$(IPA_VERSION_MAJOR).$(IPA_VERSION_MINOR).$(IPA_VERSION_RELEASE)GIT$(GIT_VERSION)
+IPA_VERSION=$(IPA_VERSION_MAJOR).$(IPA_VERSION_MINOR).$(IPA_VERSION_RELEASE)$(GIT_VERSION)
+IPA_RPM_VERSION=$(IPA_VERSION_MAJOR).$(IPA_VERSION_MINOR).$(IPA_VERSION_RELEASE)
 endif # in a git tree and git returned a version
 endif # git
 
@@ -36,10 +37,20 @@ endif # beta
 endif # pre
 endif # ipa_version
 
+ifndef IPA_RPM_VERSION
+IPA_RPM_VERSION=$(IPA_VERSION)
+endif # ipa_rpm_version
+
 TARBALL_PREFIX=freeipa-$(IPA_VERSION)
 TARBALL=$(TARBALL_PREFIX).tar.gz
 
+ifeq ($(IPA_VERSION_IS_GIT_SNAPSHOT),"yes")
+ifneq ($(GIT_VERSION),)
+IPA_RPM_RELEASE+=$(shell cat RELEASE).$(GIT_VERSION)
+else
 IPA_RPM_RELEASE=$(shell cat RELEASE)
+endif # in a git tree and git returned a version
+endif # git
 
 LIBDIR ?= /usr/lib
 
@@ -107,8 +118,8 @@ release-update:
 	if [ ! -e RELEASE ]; then echo 0 > RELEASE; fi
 
 version-update: release-update
-	sed -e s/__VERSION__/$(IPA_VERSION)/ -e s/__RELEASE__/$(IPA_RPM_RELEASE)/ \
-		freeipa.spec.in > freeipa.spec
+	sed -e s/__VERSION__/$(IPA_RPM_VERSION)/ -e s/__RELEASE__/$(IPA_RPM_RELEASE)/ \
+		-e s/__GIT__/$(GIT_VERSION)/ freeipa.spec.in > freeipa.spec
 	sed -e s/__VERSION__/$(IPA_VERSION)/ version.m4.in \
 		> version.m4
 
@@ -123,8 +134,8 @@ version-update: release-update
 	perl -pi -e "s:__NUM_VERSION__:$(IPA_VERSION_MAJOR)$(IPA_VERSION_MINOR)$(IPA_VERSION_RELEASE):" daemons/ipa-version.h
 	perl -pi -e "s:__DATA_VERSION__:$(IPA_DATA_VERSION):" daemons/ipa-version.h
 
-	sed -e s/__VERSION__/$(IPA_VERSION)/ -e s/__RELEASE__/$(IPA_RPM_RELEASE)/ \
-		ipa-client/ipa-client.spec.in > ipa-client/ipa-client.spec
+	sed -e s/__VERSION__/$(IPA_RPM_VERSION)/ -e s/__RELEASE__/$(IPA_RPM_RELEASE)/ \
+		-e s/__GIT__/$(GIT_VERSION)/ ipa-client/ipa-client.spec.in > ipa-client/ipa-client.spec
 	sed -e s/__VERSION__/$(IPA_VERSION)/ ipa-client/version.m4.in \
 		> ipa-client/version.m4
 
@@ -182,21 +193,21 @@ rpmdistdir:
 rpms: rpmroot rpmdistdir version-update lint tarballs
 	cp dist/sources/$(TARBALL) $(RPMBUILD)/SOURCES/.
 	rpmbuild --define "_topdir $(RPMBUILD)" -ba freeipa.spec
-	cp $(RPMBUILD)/RPMS/*/$(PRJ_PREFIX)-*-$(IPA_VERSION)-*.rpm dist/rpms/
-	cp $(RPMBUILD)/SRPMS/$(PRJ_PREFIX)-$(IPA_VERSION)-*.src.rpm dist/srpms/
+	cp $(RPMBUILD)/RPMS/*/$(PRJ_PREFIX)-*-$(IPA_RPM_VERSION)-*.rpm dist/rpms/
+	cp $(RPMBUILD)/SRPMS/$(PRJ_PREFIX)-$(IPA_RPM_VERSION)-*.src.rpm dist/srpms/
 	rm -rf $(RPMBUILD)
 
 client-rpms: rpmroot rpmdistdir version-update lint tarballs
 	cp dist/sources/$(TARBALL) $(RPMBUILD)/SOURCES/.
 	rpmbuild --define "_topdir $(RPMBUILD)" --define "ONLY_CLIENT 1" -ba freeipa.spec
-	cp $(RPMBUILD)/RPMS/*/$(PRJ_PREFIX)-*-$(IPA_VERSION)-*.rpm dist/rpms/
-	cp $(RPMBUILD)/SRPMS/$(PRJ_PREFIX)-$(IPA_VERSION)-*.src.rpm dist/srpms/
+	cp $(RPMBUILD)/RPMS/*/$(PRJ_PREFIX)-*-$(IPA_RPM_VERSION)-*.rpm dist/rpms/
+	cp $(RPMBUILD)/SRPMS/$(PRJ_PREFIX)-$(IPA_RPM_VERSION)-*.src.rpm dist/srpms/
 	rm -rf $(RPMBUILD)
 
 srpms: rpmroot rpmdistdir version-update lint tarballs
 	cp dist/sources/$(TARBALL) $(RPMBUILD)/SOURCES/.
 	rpmbuild --define "_topdir $(RPMBUILD)" -bs freeipa.spec
-	cp $(RPMBUILD)/SRPMS/$(PRJ_PREFIX)-$(IPA_VERSION)-*.src.rpm dist/srpms/
+	cp $(RPMBUILD)/SRPMS/$(PRJ_PREFIX)-$(IPA_RPM_VERSION)-*.src.rpm dist/srpms/
 	rm -rf $(RPMBUILD)
 
 
diff --git a/freeipa.spec.in b/freeipa.spec.in
index b47e651..b343a17 100644
--- a/freeipa.spec.in
+++ b/freeipa.spec.in
@@ -15,7 +15,7 @@ Summary:The Identity, Policy and Audit system
 Group:  System Environment/Base
 License:GPLv3+
 URL:http://www.freeipa.org/
-Source0:freeipa-%{version}.tar.gz
+Source0:freeipa-%{version}__GIT__.tar.gz
 BuildRoot:  %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 %if ! %{ONLY_CLIENT