rpm-build/scripts/shebang.req.in

70 lines
1.3 KiB
Plaintext
Raw Normal View History

factored shebang.req This is the dependency generator for #! lines. shebang.req.files makes sure that only executable scripts are processed. Here is why I chose the "shebang" name. From Jargon File (4.3.1, 29 Jun 2001) [jargon]: shebang /sh*-bang/ n. The character sequence "#!" that frequently begins executable shell scripts under Unix. Probably derived from "shell bang" under the influence of American slang "the whole shebang" (everything, the works). $ cd /usr/lib/perl5/pod $ grep -i sharpbang * perltoc.pod:C<shar>, C<sharpbang>, C<shmattype>, C<shortsize>, C<shrpenv>, C<shsharp>, $ grep -i shebang * perl58delta.pod:The command-line options -s and -F are now recognized on the shebang perlbs2000.pod:BS2000 POSIX doesn't support the shebang notation perlfaq3.pod:batch file and codify it in C<ALTERNATE_SHEBANG> (see the perlfaq7.pod:line in your perl script (the "shebang" line) does not contain the perlfaq7.pod:where you expect it so you need to adjust your shebang line. perlfaq8.pod:but my shebang line is not the path to perl, so the shell runs the perlglossary.pod:=item shebang perljp.pod: "shebang"ѹǡJperlѤscriptΤۤȤɤѹʤѲǽȻפޤ perlplan9.pod:such as "#!/usr/local/bin/perl". This is known as a shebang perlplan9.pod:shebang path from config information located in Plan 9 perlport.pod:sub-systems do not support the C<#!> shebang trick for script invocation. perlport.pod:OS/390 will support the C<#!> shebang trick in release 2.8 and beyond. perlrun.pod:C<ALTERNATE_SHEBANG> (see the F<dosish.h> file in the source perltoc.pod:serialization, server, service, setgid, setuid, shared memory, shebang, perlwin32.pod:Perl scripts on UNIX use the "#!" (a.k.a "shebang") line to $
2007-03-06 02:20:57 +03:00
#!/bin/sh -efu
#
# Make dependencies for the first line in scripts.
# http://en.wikipedia.org/wiki/Shebang_(Unix)
#
# Copyright (C) 2007, 2008 Alexey Tourbin <at@altlinux.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
factored shebang.req This is the dependency generator for #! lines. shebang.req.files makes sure that only executable scripts are processed. Here is why I chose the "shebang" name. From Jargon File (4.3.1, 29 Jun 2001) [jargon]: shebang /sh*-bang/ n. The character sequence "#!" that frequently begins executable shell scripts under Unix. Probably derived from "shell bang" under the influence of American slang "the whole shebang" (everything, the works). $ cd /usr/lib/perl5/pod $ grep -i sharpbang * perltoc.pod:C<shar>, C<sharpbang>, C<shmattype>, C<shortsize>, C<shrpenv>, C<shsharp>, $ grep -i shebang * perl58delta.pod:The command-line options -s and -F are now recognized on the shebang perlbs2000.pod:BS2000 POSIX doesn't support the shebang notation perlfaq3.pod:batch file and codify it in C<ALTERNATE_SHEBANG> (see the perlfaq7.pod:line in your perl script (the "shebang" line) does not contain the perlfaq7.pod:where you expect it so you need to adjust your shebang line. perlfaq8.pod:but my shebang line is not the path to perl, so the shell runs the perlglossary.pod:=item shebang perljp.pod: "shebang"ѹǡJperlѤscriptΤۤȤɤѹʤѲǽȻפޤ perlplan9.pod:such as "#!/usr/local/bin/perl". This is known as a shebang perlplan9.pod:shebang path from config information located in Plan 9 perlport.pod:sub-systems do not support the C<#!> shebang trick for script invocation. perlport.pod:OS/390 will support the C<#!> shebang trick in release 2.8 and beyond. perlrun.pod:C<ALTERNATE_SHEBANG> (see the F<dosish.h> file in the source perltoc.pod:serialization, server, service, setgid, setuid, shared memory, shebang, perlwin32.pod:Perl scripts on UNIX use the "#!" (a.k.a "shebang") line to $
2007-03-06 02:20:57 +03:00
. @RPMCONFIGDIR@/functions
. @RPMCONFIGDIR@/find-package
ShebangReq()
{
local f="$1" line=; shift
line=$(sed -n '1s|^#![[:space:]]*/|/|p;q' "$f")
factored shebang.req This is the dependency generator for #! lines. shebang.req.files makes sure that only executable scripts are processed. Here is why I chose the "shebang" name. From Jargon File (4.3.1, 29 Jun 2001) [jargon]: shebang /sh*-bang/ n. The character sequence "#!" that frequently begins executable shell scripts under Unix. Probably derived from "shell bang" under the influence of American slang "the whole shebang" (everything, the works). $ cd /usr/lib/perl5/pod $ grep -i sharpbang * perltoc.pod:C<shar>, C<sharpbang>, C<shmattype>, C<shortsize>, C<shrpenv>, C<shsharp>, $ grep -i shebang * perl58delta.pod:The command-line options -s and -F are now recognized on the shebang perlbs2000.pod:BS2000 POSIX doesn't support the shebang notation perlfaq3.pod:batch file and codify it in C<ALTERNATE_SHEBANG> (see the perlfaq7.pod:line in your perl script (the "shebang" line) does not contain the perlfaq7.pod:where you expect it so you need to adjust your shebang line. perlfaq8.pod:but my shebang line is not the path to perl, so the shell runs the perlglossary.pod:=item shebang perljp.pod: "shebang"ѹǡJperlѤscriptΤۤȤɤѹʤѲǽȻפޤ perlplan9.pod:such as "#!/usr/local/bin/perl". This is known as a shebang perlplan9.pod:shebang path from config information located in Plan 9 perlport.pod:sub-systems do not support the C<#!> shebang trick for script invocation. perlport.pod:OS/390 will support the C<#!> shebang trick in release 2.8 and beyond. perlrun.pod:C<ALTERNATE_SHEBANG> (see the F<dosish.h> file in the source perltoc.pod:serialization, server, service, setgid, setuid, shared memory, shebang, perlwin32.pod:Perl scripts on UNIX use the "#!" (a.k.a "shebang") line to $
2007-03-06 02:20:57 +03:00
[ -n "$line" ] || return 0
set -- $line
CR=$'\r'
line="#!$(echo "$line" |sed -e "s/$CR/<CR>/g")"
CheckInterp()
{
case "$1" in
*"$CR") ;;
*) return 0 ;;
esac
Fatal "$f: trailing <CR> in interpreter: $line"
}
CheckArgs()
{
case "$*" in
*"$CR") ;;
*) return 0 ;;
esac
Warning "$f: trailing <CR> in arguments: $line"
}
factored shebang.req This is the dependency generator for #! lines. shebang.req.files makes sure that only executable scripts are processed. Here is why I chose the "shebang" name. From Jargon File (4.3.1, 29 Jun 2001) [jargon]: shebang /sh*-bang/ n. The character sequence "#!" that frequently begins executable shell scripts under Unix. Probably derived from "shell bang" under the influence of American slang "the whole shebang" (everything, the works). $ cd /usr/lib/perl5/pod $ grep -i sharpbang * perltoc.pod:C<shar>, C<sharpbang>, C<shmattype>, C<shortsize>, C<shrpenv>, C<shsharp>, $ grep -i shebang * perl58delta.pod:The command-line options -s and -F are now recognized on the shebang perlbs2000.pod:BS2000 POSIX doesn't support the shebang notation perlfaq3.pod:batch file and codify it in C<ALTERNATE_SHEBANG> (see the perlfaq7.pod:line in your perl script (the "shebang" line) does not contain the perlfaq7.pod:where you expect it so you need to adjust your shebang line. perlfaq8.pod:but my shebang line is not the path to perl, so the shell runs the perlglossary.pod:=item shebang perljp.pod: "shebang"ѹǡJperlѤscriptΤۤȤɤѹʤѲǽȻפޤ perlplan9.pod:such as "#!/usr/local/bin/perl". This is known as a shebang perlplan9.pod:shebang path from config information located in Plan 9 perlport.pod:sub-systems do not support the C<#!> shebang trick for script invocation. perlport.pod:OS/390 will support the C<#!> shebang trick in release 2.8 and beyond. perlrun.pod:C<ALTERNATE_SHEBANG> (see the F<dosish.h> file in the source perltoc.pod:serialization, server, service, setgid, setuid, shared memory, shebang, perlwin32.pod:Perl scripts on UNIX use the "#!" (a.k.a "shebang") line to $
2007-03-06 02:20:57 +03:00
case "$#,$1" in
1,*)
CheckInterp "$1"
FindPackage "$f" "$1"
;;
factored shebang.req This is the dependency generator for #! lines. shebang.req.files makes sure that only executable scripts are processed. Here is why I chose the "shebang" name. From Jargon File (4.3.1, 29 Jun 2001) [jargon]: shebang /sh*-bang/ n. The character sequence "#!" that frequently begins executable shell scripts under Unix. Probably derived from "shell bang" under the influence of American slang "the whole shebang" (everything, the works). $ cd /usr/lib/perl5/pod $ grep -i sharpbang * perltoc.pod:C<shar>, C<sharpbang>, C<shmattype>, C<shortsize>, C<shrpenv>, C<shsharp>, $ grep -i shebang * perl58delta.pod:The command-line options -s and -F are now recognized on the shebang perlbs2000.pod:BS2000 POSIX doesn't support the shebang notation perlfaq3.pod:batch file and codify it in C<ALTERNATE_SHEBANG> (see the perlfaq7.pod:line in your perl script (the "shebang" line) does not contain the perlfaq7.pod:where you expect it so you need to adjust your shebang line. perlfaq8.pod:but my shebang line is not the path to perl, so the shell runs the perlglossary.pod:=item shebang perljp.pod: "shebang"ѹǡJperlѤscriptΤۤȤɤѹʤѲǽȻפޤ perlplan9.pod:such as "#!/usr/local/bin/perl". This is known as a shebang perlplan9.pod:shebang path from config information located in Plan 9 perlport.pod:sub-systems do not support the C<#!> shebang trick for script invocation. perlport.pod:OS/390 will support the C<#!> shebang trick in release 2.8 and beyond. perlrun.pod:C<ALTERNATE_SHEBANG> (see the F<dosish.h> file in the source perltoc.pod:serialization, server, service, setgid, setuid, shared memory, shebang, perlwin32.pod:Perl scripts on UNIX use the "#!" (a.k.a "shebang") line to $
2007-03-06 02:20:57 +03:00
2,/usr/bin/env)
CheckInterp "$2"
FindPackage "$f" "$1" "$2"
;;
2,*)
CheckArgs "$2"
FindPackage "$f" "$1"
;;
*,/usr/bin/env)
CheckArgs "$*"
Fatal "$f: too many arguments: $line"
;;
factored shebang.req This is the dependency generator for #! lines. shebang.req.files makes sure that only executable scripts are processed. Here is why I chose the "shebang" name. From Jargon File (4.3.1, 29 Jun 2001) [jargon]: shebang /sh*-bang/ n. The character sequence "#!" that frequently begins executable shell scripts under Unix. Probably derived from "shell bang" under the influence of American slang "the whole shebang" (everything, the works). $ cd /usr/lib/perl5/pod $ grep -i sharpbang * perltoc.pod:C<shar>, C<sharpbang>, C<shmattype>, C<shortsize>, C<shrpenv>, C<shsharp>, $ grep -i shebang * perl58delta.pod:The command-line options -s and -F are now recognized on the shebang perlbs2000.pod:BS2000 POSIX doesn't support the shebang notation perlfaq3.pod:batch file and codify it in C<ALTERNATE_SHEBANG> (see the perlfaq7.pod:line in your perl script (the "shebang" line) does not contain the perlfaq7.pod:where you expect it so you need to adjust your shebang line. perlfaq8.pod:but my shebang line is not the path to perl, so the shell runs the perlglossary.pod:=item shebang perljp.pod: "shebang"ѹǡJperlѤscriptΤۤȤɤѹʤѲǽȻפޤ perlplan9.pod:such as "#!/usr/local/bin/perl". This is known as a shebang perlplan9.pod:shebang path from config information located in Plan 9 perlport.pod:sub-systems do not support the C<#!> shebang trick for script invocation. perlport.pod:OS/390 will support the C<#!> shebang trick in release 2.8 and beyond. perlrun.pod:C<ALTERNATE_SHEBANG> (see the F<dosish.h> file in the source perltoc.pod:serialization, server, service, setgid, setuid, shared memory, shebang, perlwin32.pod:Perl scripts on UNIX use the "#!" (a.k.a "shebang") line to $
2007-03-06 02:20:57 +03:00
*)
CheckArgs "$*"
Warning "$f: too many arguments: $line"
FindPackage "$f" "$1"
;;
factored shebang.req This is the dependency generator for #! lines. shebang.req.files makes sure that only executable scripts are processed. Here is why I chose the "shebang" name. From Jargon File (4.3.1, 29 Jun 2001) [jargon]: shebang /sh*-bang/ n. The character sequence "#!" that frequently begins executable shell scripts under Unix. Probably derived from "shell bang" under the influence of American slang "the whole shebang" (everything, the works). $ cd /usr/lib/perl5/pod $ grep -i sharpbang * perltoc.pod:C<shar>, C<sharpbang>, C<shmattype>, C<shortsize>, C<shrpenv>, C<shsharp>, $ grep -i shebang * perl58delta.pod:The command-line options -s and -F are now recognized on the shebang perlbs2000.pod:BS2000 POSIX doesn't support the shebang notation perlfaq3.pod:batch file and codify it in C<ALTERNATE_SHEBANG> (see the perlfaq7.pod:line in your perl script (the "shebang" line) does not contain the perlfaq7.pod:where you expect it so you need to adjust your shebang line. perlfaq8.pod:but my shebang line is not the path to perl, so the shell runs the perlglossary.pod:=item shebang perljp.pod: "shebang"ѹǡJperlѤscriptΤۤȤɤѹʤѲǽȻפޤ perlplan9.pod:such as "#!/usr/local/bin/perl". This is known as a shebang perlplan9.pod:shebang path from config information located in Plan 9 perlport.pod:sub-systems do not support the C<#!> shebang trick for script invocation. perlport.pod:OS/390 will support the C<#!> shebang trick in release 2.8 and beyond. perlrun.pod:C<ALTERNATE_SHEBANG> (see the F<dosish.h> file in the source perltoc.pod:serialization, server, service, setgid, setuid, shared memory, shebang, perlwin32.pod:Perl scripts on UNIX use the "#!" (a.k.a "shebang") line to $
2007-03-06 02:20:57 +03:00
esac
}
ArgvFileAction ShebangReq "$@"