Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1509550 - Can't build waf-1.9.13-1.fc26.src.rpm if waf is already installed
Summary: Can't build waf-1.9.13-1.fc26.src.rpm if waf is already installed
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: waf
Version: 27
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Thomas Moschny
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-11-04 14:23 UTC by Van de Bugger
Modified: 2018-11-30 22:14 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-11-30 22:14:02 UTC


Attachments (Terms of Use)
rpmbuild complete output (deleted)
2017-11-04 14:23 UTC, Van de Bugger
no flags Details
Program to unpack wafdir. (deleted)
2017-11-04 14:43 UTC, Van de Bugger
no flags Details
Patch for waf.spec (deleted)
2017-11-04 14:59 UTC, Van de Bugger
no flags Details | Diff

Description Van de Bugger 2017-11-04 14:23:33 UTC
Created attachment 1347783 [details]
rpmbuild complete output

Description of problem:

waf source rpm can't be successfully built if waf rpm is already installed.


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

Fedora 26 @ x86_64, waf-1.9.13-1.fc26


How reproducible:

Always.


Steps to Reproduce:
1. dnf install waf
2. dnf download --source waf
3. rpmbuild -rb waf-1.9.13-1.fc26.src.rpm


Actual results:

<...>
+ pushd '.waf-1.9.13-*'
/var/tmp/rpm-tmp.QKFT8j: line 40: pushd: .waf-1.9.13-*: No such file or directory
error: Bad exit status from /var/tmp/rpm-tmp.QKFT8j (%install)

RPM build errors:
    user mockbuild does not exist - using root
    group mockbuild does not exist - using root
    user mockbuild does not exist - using root
    group mockbuild does not exist - using root
    user mockbuild does not exist - using root
    group mockbuild does not exist - using root
    user mockbuild does not exist - using root
    group mockbuild does not exist - using root
    user mockbuild does not exist - using root
    group mockbuild does not exist - using root
    Bad exit status from /var/tmp/rpm-tmp.QKFT8j (%install)

(See complete build log in the attached rpmbuild.log file.)


Expected results:

waf-1.9.13-1.noarch.rpm is built successfully (with subpackages waf-doc-1.9.13-1.noarch.rpm and waf-python3-1.9.13-1.noarch.rpm). 


Additional info:

The problem is in %install section of waf.spec. Root cause and fix will follow soon.

Comment 1 Van de Bugger 2017-11-04 14:32:45 UTC
== Root cause analysis ==

This is fragment of waf.spec %install section:

# use waf so it unpacks itself
mkdir _temp ; pushd _temp
cp -av ../waf .
%{__python2} ./waf >/dev/null 2>&1
pushd .waf-%{version}-*
find . -name '*.py' -printf '%%P\0' |
  xargs -0 -I{} install -m 0644 -p -D {} %{buildroot}%{_datadir}/waf/{}
popd

Note the following line:

%{__python2} ./waf >/dev/null 2>&1

The code expects that waf will unpack waflib, a library of supporting modules. However, this will *not* occur if waf is already installed to the system. Here is a fragment of waf:

def find_lib():
    <...>
    w = test('/usr/share/%s' % WAF)
        if w: return w
    <...>

waf found an installed waflib module library in /usr/share/waf and does *not* unpack library encoded into the waf executable.

Comment 2 Van de Bugger 2017-11-04 14:42:05 UTC
== Proposed bug fix ==

Small Python program to call unpack_wafdir function from waf program:

#!/usr/bin/python

import os, sys, imp, io

if len( sys.argv ) != 3 :
    raise RuntimeError( "Not enough arguments" )

dir = os.path.abspath( sys.argv[ 1 ] )  # Directory to write `waflib` to.
src = os.path.abspath( sys.argv[ 2 ] )  # Path to `waf` script.

sys.dont_write_bytecode = True
# Trivial 'import waf' will not work because 'waf' filename does not have '.py' suffix.
waf = imp.load_module( 'waf', open( src, 'rb' ), src, ( '', 'r', imp.PY_SOURCE ) )
waf.unpack_wafdir( dir, src )
sys.exit( 0 )

# end of file #

Let's name it unpack-wafdir.py. This script should be specified in waf.spec as one of source files, e. g.:

Source1: unpack-wafdir.py

Then, used in %install section:

%install
%{__python2} %{S:1} _temp waf
pushd _temp
find . -name '*.py' -printf '%%P\0' |
  xargs -0 -I{} install -m 0644 -p -D {} %{buildroot}%{_datadir}/waf/{}
popd
%if 0%{?with_python3}
%{__python3} %{S:1} _temp3 waf
pushd _temp3
find . -name '*.py' -printf '%%P\0' |
  xargs -0 -I{} install -m 0644 -p -D {} %{buildroot}%{_datadir}/waf3/{}
popd
%endif # with_python3

Comment 3 Van de Bugger 2017-11-04 14:43:17 UTC
Created attachment 1347784 [details]
Program to unpack wafdir.

Comment 4 Van de Bugger 2017-11-04 14:59:01 UTC
Created attachment 1347797 [details]
Patch for waf.spec

Comment 5 Fedora End Of Life 2018-05-03 08:24:23 UTC
This message is a reminder that Fedora 26 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 26. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '26'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 26 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 6 Thomas Moschny 2018-07-20 08:01:07 UTC
Implemented in https://src.fedoraproject.org/rpms/waf/c/f38e89c - thanks for the analysis and the suggested solution!

Comment 7 Ben Cotton 2018-11-27 14:57:02 UTC
This message is a reminder that Fedora 27 is nearing its end of life.
On 2018-Nov-30  Fedora will stop maintaining and issuing updates for
Fedora 27. It is Fedora's policy to close all bug reports from releases
that are no longer maintained. At that time this bug will be closed as
EOL if it remains open with a Fedora  'version' of '27'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 27 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 8 Ben Cotton 2018-11-30 22:14:02 UTC
Fedora 27 changed to end-of-life (EOL) status on 2018-11-30. Fedora 27 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.