[asterisk-dev] [Code Review] Makefile now specifies whether or not DAHDI hardware was found
Oron Peled
oron.peled at xorcom.com
Fri Apr 17 23:05:12 CDT 2009
On Friday, 17 בApril 2009, Russell Bryant wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://reviewboard.digium.com/r/216/#review713
> -----------------------------------------------------------
> /tools/trunk/xpp/dahdi_hardware
> <http://reviewboard.digium.com/r/216/#comment1846>
>
> You should probably put all of this in an if ($opts{'v'}) { } block,
> so that the else part is only printed out in verbose mode.
>
> - Russell
>
> On 2009-04-17 15:05:52, dbrooks wrote:
> >
> > -----------------------------------------------------------
> > This is an automatically generated e-mail. To reply, visit:
> > http://reviewboard.digium.com/r/216/
> > -----------------------------------------------------------
> >
> > (Updated 2009-04-17 15:05:52)
> >
> > Review request for Asterisk Developers.
> >
> > Summary
> > -------
> >
> > This is a patch that allows the DAHDI Makefile to announce to the
> > user whether or not it found DAHDI hardware. Prior to this patch,
> > if DAHDI hardware was not found, "make config" would announce:
> > "I think that the DAHDI hardware you have on your system is: "
> > and stop there.
> >
> > This addresses bug 0014792.
> > http://bugs.digium.com/view.php?id=0014792
> >
> > Diffs
> > -----
> >
> > /tools/trunk/Makefile 6374
> > /tools/trunk/xpp/dahdi_hardware 6374
> >
> > Diff: http://reviewboard.digium.com/r/216/diff
> >
> >
> > Testing
> > -------
> >
> > This patch was tested on x86_64-linux-gnu, and GNU Make 3.81.
> >
> >
> > Thanks,
> >
> > dbrooks
> >
Some points:
* Using the '-v' option from the Makefile is a mistake IMO. There is
a reason it's called 'verbose' -- it will output a lot of extra
information for some devices. Currently, it's only Xorcom Astribanks,
but I'll be more than happy to add similar info for any hardware that
export the required data via sysfs.
* Output (in verbose mode) "No DAHDI devices found" is reasonable and
general response and could be added to dahdi_hardware.
* However, it should be remembered that this tool is useful in many
other places (interactive/scripts/etc.) so polluting it with some
specific use case muttering like: "I think that..." is unreasonable.
The required strings could be added to the Makefile. E.g:
@echo "List of detected DAHDI devices:"
@xpp/dahdi_hardware || true
* If you feel there *must* be a message for empty output, it can always
be achieve by some shell games:
@xpp/dahdi_hardware | pipe_lines_or "No DAHDI devices found"
When pipe_lines_or is the following simple script:
#! /bin/sh
if [ $# -ne 1 ];then
echo 1>&2 "Usage: $0 message_for_empty_input"
exit 1
fi
while read line
do
echo "$line"
gotit=yes
done
if [ "$gotit" != yes ]
then
echo "$1"
fi
# Obviously, this can be a Makefile one-liner, just wanted to make it
# More readable.
Cheers,
--
Oron Peled Voice: +972-4-8228492
oron at actcom.co.il http://www.actcom.co.il/~oron
May the Source be with you!
More information about the asterisk-dev
mailing list