Bug 1473772

Summary: Cannot build a package in Copr , when Version is complicated
Product: [Community] Copr Reporter: Patrick Pichon <patrick.pichon>
Component: backendAssignee: Miroslav Suchý <msuchy>
Status: CLOSED NOTABUG QA Contact:
Severity: medium Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: clime, patrick.pichon, praiskup
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-07-24 10:40:06 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Builder-live log / see the last lines none

Description Patrick Pichon 2017-07-21 15:09:45 UTC
Description of problem:
It looks like Copr only only standard/simple Version number. I wanted to have a more complicated one , which is the result of a calculation

%define dovecotversion %(rpm --queryformat "%{VERSION}" -q dovecot)
Version:        2.0_%{dovecotversion}

Version-Release number of selected component (if applicable):


How reproducible:
Build the following package pipiche.fr/dovecot-antispam-2.0_2.2.31-1.fc26.src.rpm

Steps to Reproduce:
1.
2.
3.

Actual results:
failure

Expected results:
should work as it works manualy with rpmbuild --rebuild http://pipiche.fr/dovecot-antispam-2.0_2.2.31-1.fc26.src.rpm

Additional info:

Comment 1 Patrick Pichon 2017-07-21 15:30:49 UTC
Created attachment 1302493 [details]
Builder-live log / see the last lines

Here is the log from Builder live. It looks like the 2 following lines doesn't work, because dovecot-devel is not yet installed by Copr !


Version:        2.0_%{dovecotversion}
%define dovecotversion %(/usr/bin/rpm --queryformat "%{VERSION}" -q dovecot-devel)


Start: creating root cache
Finish: creating root cache
Finish: chroot init
INFO: Installed packages:
Start: buildsrpm
Start: rpmbuild -bs
error: line 9: Tag takes single token only: Version:        2.0_package dovecot-devel is not installed

Comment 2 Patrick Pichon 2017-07-24 10:05:22 UTC
For your information I have updated the statement:

From : 

%define dovecotversion %(/usr/bin/rpm --queryformat "%{VERSION}" -q dovecot-devel)

To :

%define dovecotversion %(dnf install dovecot dovecot-devel; /usr/bin/rpm --queryformat \"%{VERSION}\" -q dovecot-devel | tr \".\")


And the workaround works in the sense that it does install dovecot-devel prior to execute the rpm --queryformat.

Comment 3 clime 2017-07-24 10:40:06 UTC
(In reply to Patrick Pichon from comment #2)
> For your information I have updated the statement:
> 
> From : 
> 
> %define dovecotversion %(/usr/bin/rpm --queryformat "%{VERSION}" -q
> dovecot-devel)
> 
> To :
> 
> %define dovecotversion %(dnf install dovecot dovecot-devel; /usr/bin/rpm
> --queryformat \"%{VERSION}\" -q dovecot-devel | tr \".\")
> 
> 
> And the workaround works in the sense that it does install dovecot-devel
> prior to execute the rpm --queryformat.

You can define additional buildroot packages that will be installed before srpm is built and put dovecot-devel there. In UI, this feature is accessible under Project Settings and clicking "Edit" button at a particular chroot (the field is called 'Packages').

Comment 4 Patrick Pichon 2017-07-24 11:52:30 UTC
(In reply to clime from comment #3)
> (In reply to Patrick Pichon from comment #2)
> > For your information I have updated the statement:
> > 
> > From : 
> > 
> > %define dovecotversion %(/usr/bin/rpm --queryformat "%{VERSION}" -q
> > dovecot-devel)
> > 
> > To :
> > 
> > %define dovecotversion %(dnf install dovecot dovecot-devel; /usr/bin/rpm
> > --queryformat \"%{VERSION}\" -q dovecot-devel | tr \".\")
> > 
> > 
> > And the workaround works in the sense that it does install dovecot-devel
> > prior to execute the rpm --queryformat.
> 
> You can define additional buildroot packages that will be installed before
> srpm is built and put dovecot-devel there. In UI, this feature is accessible
> under Project Settings and clicking "Edit" button at a particular chroot
> (the field is called 'Packages').

I do confirm! 
Thanks