Bug 732434

Summary: [patch] make rpm doesn't take version into account when run on directory outside version control
Product: [Retired] Beaker Reporter: Alexander Todorov <atodorov>
Component: command lineAssignee: Bill Peck <bpeck>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 0.6CC: bpeck, dcallagh, mcsontos, psplicha, rmancy, stl
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-09-08 02:43:23 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
patch none

Description Alexander Todorov 2011-08-22 13:11:21 UTC
Created attachment 519279 [details]
patch

Description of problem:
When you execute make rpm in a test directory which is not under version control then the version is always 1.0 regardless of what the Makefile says. 

This is useful sometimes when you develop locally before committing to version control or even when users decide to use some SCM different from cv, svn and git which are currently supported. 


To fix apply this simple patch:

--- rhts-mk-get-current-tag.orig	2011-08-22 15:47:48.173392306 +0300
+++ rhts-mk-get-current-tag	2011-08-22 15:55:40.843376412 +0300
@@ -16,6 +16,10 @@
 #
 # determine the next available package tag for test package
 
+function usage {
+        echo "Usage: rhts-mk-get-current-tag [directory]"
+}
+
 if [ $# -gt 1 ]; then
 	usage
 	exit 1
@@ -26,6 +30,8 @@
 fi
 
 PACKAGE_NAME=`rhts-mk-get-test-package-name`
+CURRENT_VERSION=$(echo $TESTVERSION | sed -e 's/\./_/g')  # from the make file.
+CURRENT_TAG="$PACKAGE_NAME-$CURRENT_VERSION-1"
 
 # for CVS, find the tag with the package name
 if [ -d "CVS" ]; then



Also adds the usage function which was missing. 


Version-Release number of selected component (if applicable):
rhts-devel-4.29-1.git.1.1342206.el6.noarch

How reproducible:
always

Steps to Reproduce:
1. Run rhts-wizard/beaker-wizard in an empty directory outside version control to create a test skeleton. TESTVERSION=1.0 by default
2. make rpm - the resulting RPM has version 1.0
3. change TESTVERSION in Makefile to 2.0 or something different than 1.0
4. make rpm again - version is still 1.0
  
Actual results:
version doesn't change regardless of what Makefile says

Expected results:
version field is taken from Makefile

Additional info:
The patch adds a default value for version and current tag. Release field is always 1. If we're under version control these value will be overridden.

Comment 1 Bill Peck 2011-08-23 16:54:18 UTC
This change has been pushed into rhts-devel-4.39-1

to test please use beaker-stage repo

yum upgrade --enablerepo=beaker-stage rhts\*

Comment 2 Petr Šplíchal 2011-08-31 12:58:02 UTC
Verified with rhts-devel-4.39-1.git.1.7288cd1.el6eso.noarch. Tried
to "make package" with TESTVERSION=1.0/1.1/2.1 and expected rpms
were created:

$ ls
Makefile    tmp-CoreOS-tmp-Sanity-a-few-descriptive-words-1.0-1.noarch.rpm
PURPOSE     tmp-CoreOS-tmp-Sanity-a-few-descriptive-words-1.1-1.noarch.rpm
runtest.sh  tmp-CoreOS-tmp-Sanity-a-few-descriptive-words-2.1-1.noarch.rpm

Comment 3 Dan Callaghan 2011-09-08 02:43:23 UTC
Beaker 0.7.1 has been released.