RPM

RFE: add an option, or default to handing a closed stdin, to rpmbuild

Bug #669655 reported by herrold
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
RPM
New
Undecided
Unassigned

Bug Description

 rpmbuild -ba ${NODEPS} ${RMSPEC} ${RMSOURCE} ${CLEAN} \
~/rpmbuild/SPECS/${SPC} < /dev/null 2>&1

... or such

that '< /dev/null' often gets rid of builder 'hangs'

and in the usual case we do not input from stdin to rpmbuild, that is not mediated by the .spec file

Tags: rfe
herrold (herrold)
description: updated
Revision history for this message
Jeff Johnson (n3npq) wrote :

You can actually already do what you want, i.e. attaching
/dev/null to stdin/stdout, using these per-script macro templates:

%___build_pre \
   ... environ setup deleted ...
    %{verbose:set -x}%{!verbose:exec > /dev/null}\
    umask 022\
    cd "%{u2p:%{_builddir}}"\
%___build_post exit 0

What is needed is just to wrap the build scriptlet like
   (
      ... the build scriptlet ends up here ...
   ) < /dev/null 2>&1
using the pre/post macros.

Revision history for this message
Jeff Johnson (n3npq) wrote :

Note that the same technique can be use to filter compiler warnings,
or to tee into a global build log, or just about anything else.

Revision history for this message
Jeff Johnson (n3npq) wrote :

And if you really MUST have this on the rpmbuild CLI, then
here is what is needed

 1) stub in wrapper macro switches commented out:
    #%___build_subshell_pre %{nil}
    #%___build_subshell_post %{nil}

2) add the switches to existing %__build_pre/%___build_post with
"expand-iff-defined" existence test (I'll leave it to you to choose where):

    %___build_pre
         ...
         %{?___build_subshell_pre}

    %__build_post
         ...
        %{?___build_subshell_post}

3) add a rpmbuild popt alias for --stdin-is-dev-null to rpmpopt.in:

    rpmbuild alias --stdin-is-dev-null -D '___build_subshell_pre (' -D'__build_subshell_post ) </dev/null 2>&1'

4) test by invoking
    rpmbuild -ba --stdin-is-dev-null foo.spec

5) if all of the above "works" (watch for my typoes), check it into cvs HEAD and rpm-5_3
if you want in RPM. otherwise, you can do all of the above in /etc/rpm/macros and /etc/popt
(or even per user in ~/.rpmmacros and ~/.popt)

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.