From 32e18a9df30cfae1580351f7bc72b153b85cb5b5 Mon Sep 17 00:00:00 2001 From: "Tom G. Christensen" Date: Sat, 17 May 2008 10:23:36 +0000 Subject: [PATCH] Cleanup tools usage and only use __ prefixed tool namespace. --- buildpkg.functions | 159 ++++++++++++-------------------- buildpkg.packaging.irix | 180 ++++++++++++++++++------------------- buildpkg.packaging.solaris | 154 +++++++++++++++---------------- buildpkg.tools | 8 +- newpkg | 20 ++--- 5 files changed, 239 insertions(+), 282 deletions(-) diff --git a/buildpkg.functions b/buildpkg.functions index f0ed0d2..4944b1b 100644 --- a/buildpkg.functions +++ b/buildpkg.functions @@ -29,54 +29,7 @@ fi # All patching will be done from *within* $srcdir/$topsrcdir directory with patch -p1 # patches must be in uncompressed format -# Define tool programs -STRIP=/usr/bin/strip -UNAME=/usr/bin/uname -TAR=/usr/local/bin/tar # GNU tar please! -VTAR=/usr/bin/tar # vendor supplied tar -BZIP2=/usr/bin/bzip2 -GZIP=/usr/bin/gzip -PATCH=/usr/local/bin/patch # GNU patch 2.5 or better please! -RM=/usr/bin/rm -RMDIR=/usr/bin/rmdir -MKDIR=/usr/bin/mkdir -MAKE_PROG=/usr/local/bin/make # GNU make please! -FIND=/usr/bin/find # vendor supplied find, GNU find will require changes to the script -XARGS=/usr/bin/xargs -CAT=/usr/bin/cat -AWK=/usr/bin/nawk # This must be nawk or GNU awk - plain /usr/bin/awk will *not* work -SED=/usr/bin/sed -GSED=/usr/local/bin/sed -SORT=/usr/bin/sort -CUT=/usr/bin/cut -LS=/usr/bin/ls -EXPR=/usr/bin/expr -MV=/usr/bin/mv -MKDIR=/usr/bin/mkdir -CP=/usr/bin/cp -TEE=/bin/tee -GREP=/bin/grep -EGREP=/bin/egrep -UNIQ=/bin/uniq -BASENAME=/bin/basename -DIRNAME=/bin/dirname -TR=/bin/tr -FILE=/usr/bin/file # Used by do_strip() -PRINTF=/usr/bin/printf -LN=/usr/bin/ln -GINSTALL=/usr/local/bin/install # BSD compatible install - usually GNU install -COMPRESS=/usr/bsd/compress -PACK=/usr/bin/pack -SHA1SUM=/usr/local/bin/sha1sum -UNZIP=/usr/local/bin/unzip -LDD=/usr/bin/ldd -HEAD=/usr/bin/head # Must support -n - -# Groff stuff for manpages -NROFF=/usr/local/bin/nroff -NROFFOPTS="-c -mandoc -Tascii -t" - -# __ prefixed namespace for tool programs +# Define tools programs in __ prefixed namespace . $BUILDPKG_BASE/scripts/buildpkg.tools # Define defaults @@ -115,7 +68,7 @@ _datadir=$_sharedir tmpdir=/tmp -_os=$($UNAME -sr|$SED -e 's/ //g' -e 's/\.//g'|$TR '[A-Z]' '[a-z]') +_os=$(${__uname} -sr|${__sed} -e 's/ //g' -e 's/\.//g'|${__tr} '[A-Z]' '[a-z]') # pkg information. # The following 3 vars can be used when constructing pkg metadata @@ -282,7 +235,7 @@ patch() fi # We are now sure that $patch[$pnum] contains file with absolute path echo "Processing patch[$pnum] - ${patch[$pnum]}" if [ -r ${patch[$pnum]} ]; then # file is readable - $PATCH -Es $2 < ${patch[$pnum]} + ${__patch} -Es $2 < ${patch[$pnum]} if [ $? -ne 0 ]; then error $E_PATCH_FAILED patch fi @@ -315,12 +268,12 @@ unpack() # Determine filetype and unpack case $suffix in - 'tar') $TAR -xf ${source[$snum]};; - 'gz') $GZIP -dc ${source[$snum]} | $TAR -xf -;; - 'bz2') $BZIP2 -dc ${source[$snum]} | $TAR -xf -;; - 'Z') $GZIP -dc ${source[$snum]} | $TAR -xf -;; - 'tgz') $GZIP -dc ${source[$snum]} | $TAR -xf -;; - 'zip') $UNZIP -q ${source[$snum]};; + 'tar') ${__tar} -xf ${source[$snum]};; + 'gz') ${__gzip} -dc ${source[$snum]} | ${__tar} -xf -;; + 'bz2') ${__bzip2} -dc ${source[$snum]} | ${__tar} -xf -;; + 'Z') ${__gzip} -dc ${source[$snum]} | ${__tar} -xf -;; + 'tgz') ${__gzip} -dc ${source[$snum]} | ${__tar} -xf -;; + 'zip') ${__unzip} -q ${source[$snum]};; *) error $E_BAD_COMPRESS unpack esac if [ $? -ne 0 ]; then @@ -341,34 +294,34 @@ clean() case $1 in 'source') if [ -d "$srcdir/$topsrcdir" ]; then echo "Removing $srcdir/$topsrcdir" - $RM -rf $srcdir/$topsrcdir + ${__rm} -rf $srcdir/$topsrcdir else echo "No unpacked source to scrub" fi ;; 'stage') if [ -d $stagedir -a "$stagedir" != "/" ]; then echo "Emptying $stagedir" - $RM -rf $stagedir # This is very dangerous! - $MKDIR $stagedir + ${__rm} -rf $stagedir # This is very dangerous! + ${__mkdir} $stagedir else error $E_BAD_DIR clean fi ;; 'meta') - if [ "$($UNAME -s)" == "SunOS" ]; then + if [ "$(${__uname} -s)" == "SunOS" ]; then for secname in $(list_pkgs) do META_CLEAN="$META_CLEAN prototype.$secname pkginfo.$secname" pkgname=$(get_pkgname $secname) echo "Removing $buildpkgbase/$pkgdir/$pkgname" - [ ! -z "$pkgname" ] && $RM -rf $buildpkgbase/$pkgdir/$pkgname + [ ! -z "$pkgname" ] && ${__rm} -rf $buildpkgbase/$pkgdir/$pkgname done fi for i in $META_CLEAN do echo "Removing $metadir/$i" - $RM -f $metadir/$i + ${__rm} -f $metadir/$i done ;; @@ -376,7 +329,7 @@ clean() clean stage clean meta # Irix only - ugly hack - $RM -f $metadir/relnotes*.txt + ${__rm} -f $metadir/relnotes*.txt ;; *) error $E_BAD_CLEANOPTION clean esac @@ -416,22 +369,22 @@ do_autonuke() if [ -d "${_infodir}" ]; then if [ -r ${_infodir}/dir ]; then echo "Nuking ${_infodir}/dir" - ${RM} -f ${_infodir}/dir + ${__rm} -f ${_infodir}/dir didnuke=1 fi fi if [ -d "${_libdir}" ]; then if [ -r ${_libdir}/charset.alias ]; then echo "Nuking ${_libdir}/charset.alias" - ${RM} -f ${_libdir}/charset.alias + ${__rm} -f ${_libdir}/charset.alias didnuke=1 fi fi - if [ -d "${_libdir}" -a ! -z "$($LS ${_libdir}/*.la 2>/dev/null)" ]; then + if [ -d "${_libdir}" -a ! -z "$(${__ls} ${_libdir}/*.la 2>/dev/null)" ]; then for i in ${_libdir}/*.la do echo "Nuking $i" - ${RM} -f "$i" + ${__rm} -f "$i" done didnuke=1 fi @@ -462,11 +415,11 @@ symlink_man() manpages="$(echo $i/*)" for manpage in $manpages do - solink="$($HEAD -n 1 $manpage)" + solink="$(${__head} -n 1 $manpage)" if [ "${solink:0:3}" = ".so" ]; then # .so style link to be converted linkdest="${solink#.so*/}" [ "$symlinkman_verbose" -eq 1 ] && echo "Symlinking $linkdest->$manpage" - $LN -sf "$linkdest" "$manpage" + ${__ln} -sf "$linkdest" "$manpage" fi done IFS="$OIFS" @@ -489,22 +442,22 @@ fix_man() do if [ -d $i ]; then catdir=cat${i##man} - $MKDIR $catdir + ${__mkdir} $catdir cd $i for manpage in * do if [ -L "$manpage" ]; then - TARGET=$($LS -l "$manpage" | $AWK '{ print $NF }') - $LN -sf "$TARGET" "$manpage" - $MV "$manpage" "../$catdir" - $RM -f "$manpage" + TARGET=$(${__ls} -l "$manpage" | ${__awk} '{ print $NF }') + ${__ln} -sf "$TARGET" "$manpage" + ${__mv} "$manpage" "../$catdir" + ${__rm} -f "$manpage" else - $NROFF $NROFFOPTS "$manpage" > "../$catdir/$manpage" - $RM -f $manpage + ${__nroff} $NROFFOPTS "$manpage" > "../$catdir/$manpage" + ${__rm} -f $manpage fi done cd .. - ${RMDIR} $i + ${__rmdir} $i fi done } @@ -516,15 +469,15 @@ compress_man() { if [ "$gzman" -eq 1 ]; then # Use gzip local compsuffix=gz - local pack=$GZIP + local pack=${__gzip} fi if [ "$compressman" -eq 1 ]; then # Use compress(1) local compsuffix=Z - local pack="$COMPRESS -f" + local pack="${__compress} -f" fi if [ "$packman" -eq 1 ]; then # Use pack(1) local compsuffix=z - local pack="$PACK -f" + local pack="${__pack} -f" fi echo "Compressing manpages" @@ -537,9 +490,9 @@ compress_man() suffix="${manpage##*.}" if [ "$suffix" != "gz" -a "$suffix" != "Z" ]; then #probably uncompressed... if [ -L "$manpage" ]; then - TARGET=$($LS -l "$manpage" | $AWK '{ print $NF }') - $LN -sf "$TARGET".$compsuffix "$manpage".$compsuffix - $RM -f "$manpage" + TARGET=$(${__ls} -l "$manpage" | ${__awk} '{ print $NF }') + ${__ln} -sf "$TARGET".$compsuffix "$manpage".$compsuffix + ${__rm} -f "$manpage" else $pack "$manpage" fi @@ -558,7 +511,7 @@ compress_info() echo "Compressing info pages" for i in * do - ${GZIP} $i + ${__gzip} $i done } @@ -573,13 +526,13 @@ doc() if [ ! -z $# ]; then setdir source ddir=${stagedir}${prefix}/${_docdir}/${topdir}-${version} - ${MKDIR} -p $ddir + ${__mkdir} -p $ddir echo "Adding docs" until [ -z "$1" ] do for f in $(_upls $1) do - ($TAR -cf - "$f")|(cd $ddir; $TAR -xvBpf -) + (${__tar} -cf - "$f")|(cd $ddir; ${__tar} -xvBpf -) done shift done @@ -690,7 +643,7 @@ generic_build() if [ $? -ne 0 ]; then error $E_BAD_CONFIG generic_build fi - $MAKE_PROG $(_upls $make_build_target) + ${__make} $(_upls $make_build_target) if [ $? -ne 0 ]; then error $E_BAD_MAKE generic_build fi @@ -701,7 +654,7 @@ generic_build() generic_check() { setdir ${srcdir}/${topsrcdir}/$1 - $MAKE_PROG -k $(_upls $make_check_target) + ${__make} -k $(_upls $make_check_target) } # generic_build_perl(): Build a perl module from source @@ -713,16 +666,16 @@ generic_check() generic_build_perl() { setdir source - $GGREP -rsl '^#!.*perl' . | - $GGREP -v '.bak$' |$XARGS --no-run-if-empty \ - ${__PERL} -MExtUtils::MakeMaker -e 'MY->fixin(@ARGV)' - ${__PERL} Makefile.PL `${__PERL} -MExtUtils::MakeMaker -e " print qq|PREFIX=${stagedir}${prefix}| if \$ExtUtils::MakeMaker::VERSION =~ /5\.9[1-6]|6\.0[0-5]/ "` + ${__ggrep} -rsl '^#!.*perl' . | + ${__ggrep} -v '.bak$' |${__xargs} --no-run-if-empty \ + ${__perl} -MExtUtils::MakeMaker -e 'MY->fixin(@ARGV)' + ${__perl} Makefile.PL `${__perl} -MExtUtils::MakeMaker -e " print qq|PREFIX=${stagedir}${prefix}| if \$ExtUtils::MakeMaker::VERSION =~ /5\.9[1-6]|6\.0[0-5]/ "` # Now do the actual build using std. generic_build with no_configure=1 no_configure=1 generic_build # And a little extra, this is a candidate for inclusion in plain generic_build if [ "$maketest" -eq 1 ]; then - $MAKE_PROG test + ${__make} test fi } @@ -730,7 +683,7 @@ generic_build_perl() # params: $@ passed directly to make install makeinstall() { - $MAKE_PROG \ + ${__make} \ prefix=${stagedir}${prefix} \ exec_prefix=${stagedir}${prefix} \ bindir=${stagedir}${prefix}/${_bindir} \ @@ -767,10 +720,10 @@ generic_install() clean stage if [ "$shortroot" -eq 1 ]; then dest="${stagedir}${prefix}" - ${MKDIR} -p "$dest" + ${__mkdir} -p "$dest" fi setdir ${srcdir}/${topsrcdir}/$2 - $MAKE_PROG $destvar=$dest install + ${__make} $destvar=$dest install if [ $? -ne 0 ]; then error $E_BAD_MAKE generic_install fi @@ -792,22 +745,22 @@ generic_install_perl() { clean stage setdir source - makeinstall $(${__PERL} -MExtUtils::MakeMaker -e " print \$ExtUtils::MakeMaker::VERSION <= 6.05 ? qq|PREFIX=${stagedir}${prefix}| : qq|DESTDIR=${stagedir}| ") + makeinstall $(${__perl} -MExtUtils::MakeMaker -e " print \$ExtUtils::MakeMaker::VERSION <= 6.05 ? qq|PREFIX=${stagedir}${prefix}| : qq|DESTDIR=${stagedir}| ") # remove special files - $FIND ${stagedir} -name "perllocal.pod" \ + ${__find} ${stagedir} -name "perllocal.pod" \ -o -name ".packlist" \ -o -name "*.bs" \ - | $XARGS -i rm -f {} + | ${__xargs} -i rm -f {} # no empty directories - $FIND ${stagedir}${prefix} \ + ${__find} ${stagedir}${prefix} \ -type d -depth \ -exec rmdir {} \; 2>/dev/null export BUILDROOT="$stagedir" - ${__PERL} -MFile::Find -le ' + ${__perl} -MFile::Find -le ' my $buildroot = $ENV{BUILDROOT}; find({ wanted => \&wanted, no_chdir => 1}, "$buildroot"); # No docs here, add them in the usual way but to pkgdef.template @@ -848,7 +801,7 @@ generic_install_perl() exit -1 } # For handling any doc lines in the filelist, disabled for now (see above) - #eval $($GREP '^doc' filelist) + #eval $(${__grep} '^doc' filelist) # To get stripping etc we call the regular generic_install now but with custom_install=1 custom_install=1 @@ -879,7 +832,7 @@ esac # by generic_install_perl. generic_pack_perl() { - $CAT $metadir/pkgdef.template $srcdir/$topsrcdir/filelist | $SED -e "s;^$prefix/;;g" > $metadir/pkgdef + ${__cat} $metadir/pkgdef.template $srcdir/$topsrcdir/filelist | ${__sed} -e "s;^$prefix/;;g" > $metadir/pkgdef generic_pack "$@" } diff --git a/buildpkg.packaging.irix b/buildpkg.packaging.irix index 081e0dc..f87c1a3 100644 --- a/buildpkg.packaging.irix +++ b/buildpkg.packaging.irix @@ -112,8 +112,8 @@ declare -a opscript # Ops to associate with opfiles pkgprefix=tgc_ pkgname=$pkgprefix$topdir -os=irix`$UNAME -r` -_os=$($UNAME -sr|$SED -e 's/ //g' -e 's/\.//g' -e 's/IRIX64/IRIX/g'|$TR '[A-Z]' '[a-z]') +os=irix`${__uname} -r` +_os=$(${__uname} -sr|${__sed} -e 's/ //g' -e 's/\.//g' -e 's/IRIX64/IRIX/g'|${__tr} '[A-Z]' '[a-z]') cpu=mips3 configure_args='--prefix=$prefix --mandir=${prefix}/${_mandir} --infodir=${prefix}/${_infodir}' @@ -146,7 +146,7 @@ fix_ver() local i local version=$1 local rev=${version##*-} - local ver=$(echo ${version%%-*} | $SED -e 's/-//g' -e 's/[a-zA-Z]//g') + local ver=$(echo ${version%%-*} | ${__sed} -e 's/-//g' -e 's/[a-zA-Z]//g') if [ $useextendedver -eq 1 ]; then ### experimental ### zero prefixes all single digits in a versionstring @@ -165,7 +165,7 @@ fix_ver() fi if [ $useextendedver -eq 0 ]; then # Remove the dots - ver=$(echo $ver | $SED -e 's/\.//g') + ver=$(echo $ver | ${__sed} -e 's/\.//g') fi let "numpad = $ver_width - ${#ver} - ${#rev}" [ $numpad -lt 0 ] && error $E_BAD_VERSION fix_ver @@ -279,7 +279,7 @@ fix_fname() local return # Replace ' ' with '_' - return=$(echo $name|$SED -e 's/ /_/g') + return=$(echo $name|${__sed} -e 's/ /_/g') echo $return } @@ -309,7 +309,7 @@ add_files() # Sometimes $topinstalldir:1 returns garbage when topinstalldir=/ [ "$topinstalldir" = "/" ] && topinstd="" - local FILES=$($FIND $fspec -type f -print|$TEE -a $metadir/files.tmp) + local FILES=$(${__find} $fspec -type f -print|${__tee} -a $metadir/files.tmp) OIFS=$IFS # We play IFS tricks so we can handle filenames with embedded spaces IFS=" " @@ -317,7 +317,7 @@ add_files() do IFS=$OIFS if [ "$defperm" == "-" ]; then - permlist=`$LS -l "$i" | $CUT -d " " -f 1` + permlist=`${__ls} -l "$i" | ${__cut} -d " " -f 1` perm=$(compute_octal $permlist) else perm=$defperm @@ -340,7 +340,7 @@ add_files() done IFS=$OIFS # Handle symlinks - local FILES=$($FIND $fspec -type l -print|$TEE -a $metadir/files.tmp) + local FILES=$(${__find} $fspec -type l -print|${__tee} -a $metadir/files.tmp) OIFS=$IFS IFS=" " @@ -348,12 +348,12 @@ add_files() do IFS=$OIFS if [ "$defperm" == "-" ]; then - permlist=`$LS -l "$i" | $CUT -d " " -f 1` + permlist=`${__ls} -l "$i" | ${__cut} -d " " -f 1` perm=$(compute_octal $permlist) else perm=$defperm fi - local temp=`$LS -l "$i"|$CUT -d '>' -f 2` + local temp=`${__ls} -l "$i"|${__cut} -d '>' -f 2` local symval=${temp# } fname=$(fix_fname "$i") echo "l $perm $owner $group ${topinstd}${slash}$fname $i ${pkgname}.${prodcat} symval($symval)" >>$idbfile @@ -381,7 +381,7 @@ add_dir() [ "$topinstd" = "/" ] && topinstd="" # Note that dir blablah is *not* added to $metadir/files.tmp - #local FILES=$($FIND $fspec -type d -print) + #local FILES=$(${__find} $fspec -type d -print) local FILES=$fspec OIFS=$IFS IFS=" @@ -390,7 +390,7 @@ add_dir() do IFS=$OIFS if [ "$defperm" == "-" ]; then - permlist=$($LS -ld "$i" | $CUT -d " " -f 1) + permlist=$(${__ls} -ld "$i" | ${__cut} -d " " -f 1) perm=$(compute_octal $permlist) else perm=$defperm @@ -460,16 +460,16 @@ fetch_depends() { local reqidx=0 local havedep=0 - [ -r ${depends} ] && $CAT ${depends} > ${depends}_all - [ -r ${depends}_auto ] && $CAT ${depends}_auto >> ${depends}_all + [ -r ${depends} ] && ${__cat} ${depends} > ${depends}_all + [ -r ${depends}_auto ] && ${__cat} ${depends}_auto >> ${depends}_all # Are there any deps we should ignore? if [ -n "$ignore_deps" ]; then local j local cmd for j in $ignore_deps do - cmd="$(echo $j | $SED -e 's;\.;\\\.;g')" - $GSED -i "/$cmd/d" ${depends}_all + cmd="$(echo $j | ${__sed} -e 's;\.;\\\.;g')" + ${__gsed} -i "/$cmd/d" ${depends}_all done fi if [ -r ${depends}_all ]; then @@ -484,10 +484,10 @@ fetch_depends() # Now if $deplen is longer than the same string with all dots removed # then we know there was more than one dot and we can assume it's # not an internal depend - if [ $deplen -gt "$(/bin/echo -n "$reqpkg" | $TR -d '.' | wc -c)" ]; then + if [ $deplen -gt "$(/bin/echo -n "$reqpkg" | ${__tr} -d '.' | wc -c)" ]; then # External depend # Grab version - nver="$($SHOWPRODS -n $reqpkg | $GREP $reqpkg | $AWK '{ print $3 }')" + nver="$($SHOWPRODS -n $reqpkg | ${__grep} $reqpkg | ${__awk} '{ print $3 }')" req="$reqpkg $nver maxint" havedep=1 else @@ -587,10 +587,10 @@ fetch_ops() do_strip_bin() { echo "Stripping ELF binaries..." - for f in `$FIND . -type f \( -perm -0100 -o -perm -0010 -o -perm -0001 \) -exec $FILE {} \; | \ - $GREP -v ' dynamic lib ' | \ - $SED -n -e 's/^\(.*\):[ ]*ELF.*\(not stripped\).*/\1/p'`; do - $STRIP $strip_elf_args $f || : + for f in `${__find} . -type f \( -perm -0100 -o -perm -0010 -o -perm -0001 \) -exec ${__file} {} \; | \ + ${__grep} -v ' dynamic lib ' | \ + ${__sed} -n -e 's/^\(.*\):[ ]*ELF.*\(not stripped\).*/\1/p'`; do + ${__strip} $strip_elf_args $f || : done } @@ -602,10 +602,10 @@ do_strip_shared() # Strip ELF shared objects (see brp-strip-shared from RPM) # Please note we don't restrict our search to executable files because # our libraries are not (should not be, at least) +x. - for f in `$FIND . -type f -a -exec $FILE {} \; | \ + for f in `${__find} . -type f -a -exec ${__file} {} \; | \ grep ' dynamic lib ' | \ - $SED -n -e 's/^\(.*\):[ ]*ELF.*\(not stripped\).*/\1/p'`; do - $STRIP $strip_shared_args $f + ${__sed} -n -e 's/^\(.*\):[ ]*ELF.*\(not stripped\).*/\1/p'`; do + ${__strip} $strip_shared_args $f done } @@ -615,10 +615,10 @@ do_strip_static() { echo "Stripping static archives..." # Strip static libraries. (see brp-strip-static-archive from RPM) - for f in `$FIND . -type f -a -exec $FILE {} \; | \ - $GREP 'current ar archive' | \ - $SED -n -e 's/^\(.*\):[ ]*current ar archive .*/\1/p'`; do - $STRIP $strip_static_args $f + for f in `${__find} . -type f -a -exec ${__file} {} \; | \ + ${__grep} 'current ar archive' | \ + ${__sed} -n -e 's/^\(.*\):[ ]*current ar archive .*/\1/p'`; do + ${__strip} $strip_static_args $f done } @@ -654,7 +654,7 @@ create_idb() done if [ -r ${metadir}/${rn} ]; then local relmetadir=${stagedir}${metainstalldir}relnotes/$topdir-$version-$pkgver - $MKDIR -p $relmetadir + ${__mkdir} -p $relmetadir echo "" > ${relmetadir}/${topdir}.txt fi if [ -d "${stagedir}${metainstalldir}relnotes" ]; then # We have releasenotes, add them to idb file @@ -670,7 +670,7 @@ create_idb() echo "${metaprefix}dist/$topdir-$version-$pkgver/$topdir.idb" >> $metadir/files.tmp echo "${metaprefix}dist/$topdir-$version-$pkgver/$topdir.spec" >> $metadir/files.tmp - $SORT +4u -6 < $idbfile > $metadir/idbtemp + ${__sort} +4u -6 < $idbfile > $metadir/idbtemp lines=$(wc -l < $metadir/idbtemp) if [ ! -z "$firstop" ]; then echo "$(head -1 $metadir/idbtemp) $firstop" > $metadir/idbtemp2 @@ -685,7 +685,7 @@ create_idb() else mv $metadir/idbtemp2 $idbfile fi - $RM -f $metadir/idbtemp $metadir/idbtemp2 + ${__rm} -f $metadir/idbtemp $metadir/idbtemp2 } # create_spec(): Create the .spec file. @@ -711,9 +711,9 @@ create_spec() spec_img_header ${pctop[$i]} "${pdtop[$i]}" $version-$pkgver >> $specfile while [ "$pcidx" -lt "$pcsize" ] do - rv=`$EXPR match "${pc[$pcidx]}" ''${pctop[$i]}\\\.''` + rv=`${__expr} match "${pc[$pcidx]}" ''${pctop[$i]}\\\.''` if [ ! "$rv" -eq 0 ]; then # We got a hit! - spec_subsys_header ${pctop[$i]} `echo ${pc[$pcidx]}|$CUT -d . -f 2` "${pd[$pcidx]}" "${ps[$pcidx]}" >> $specfile + spec_subsys_header ${pctop[$i]} `echo ${pc[$pcidx]}|${__cut} -d . -f 2` "${pd[$pcidx]}" "${ps[$pcidx]}" >> $specfile # Add 'replaces' statements spec_subsys_replaces self >> $specfile replacepkgsize=${#replacepkg[@]} @@ -777,16 +777,16 @@ make_dist() local sbase=${stagedir}${topinstalldir} local disttmp=/tmp/disttmp$$ - $MKDIR $disttmp + ${__mkdir} $disttmp local dfile=$(_upls $distfile) $GENDIST $GENDIST_OPTS -rbase $topinstalldir -sbase $sbase -idb $idbfile -spec $specfile -dist $disttmp setdir $disttmp - $VTAR -cf $distdir/$dfile $pkgname* + ${__vtar} -cf $distdir/$dfile $pkgname* setdir stage - $RM -rf $disttmp + ${__rm} -rf $disttmp echo "Done. Package was created as $dfile" } @@ -866,9 +866,9 @@ parse_def() else # Perhaps we hit 'files'? if [ "${line:0:5}" == "files" ]; then triplet="${line:6:((${#line}-5-2))}" - defaultperms=$(_upls $(echo $triplet | $AWK -F, '{ print $1 }')) - defaultuid=$(_upls $(echo $triplet | $AWK -F, '{ print $2 }')) - defaultgid=$(_upls $(echo $triplet | $AWK -F, '{ print $3 }')) + defaultperms=$(_upls $(echo $triplet | ${__awk} -F, '{ print $1 }')) + defaultuid=$(_upls $(echo $triplet | ${__awk} -F, '{ print $2 }')) + defaultgid=$(_upls $(echo $triplet | ${__awk} -F, '{ print $3 }')) foundfiles=1 else if [ $foundfiles -eq 1 ]; then # We already found the 'files' line so this must be the filelist @@ -906,24 +906,24 @@ check_unpackaged() { local upf local i - $FIND . -type f -print|$SED -e 's/\.\///g' > $tmpdir/files.tmp - $FIND . -type l -print|$SED -e 's/\.\///g' >> $tmpdir/files.tmp -# $FIND . -type d -print|$SED -e 's/\.\///g'|$GREP -v '^\.' >> $tmpdir/files.tmp - $SORT $metadir/files.tmp|$UNIQ > $tmpdir/f1 - $SORT $tmpdir/files.tmp > $tmpdir/f2 - upf="$($CAT $tmpdir/f1 $tmpdir/f2 | $SORT | $UNIQ -u)" + ${__find} . -type f -print|${__sed} -e 's/\.\///g' > $tmpdir/files.tmp + ${__find} . -type l -print|${__sed} -e 's/\.\///g' >> $tmpdir/files.tmp +# ${__find} . -type d -print|${__sed} -e 's/\.\///g'|${__grep} -v '^\.' >> $tmpdir/files.tmp + ${__sort} $metadir/files.tmp|${__uniq} > $tmpdir/f1 + ${__sort} $tmpdir/files.tmp > $tmpdir/f2 + upf="$(${__cat} $tmpdir/f1 $tmpdir/f2 | ${__sort} | ${__uniq} -u)" if [ ! -z "$upf" ]; then echo "There are unpackaged files in the stagedir:" for i in $upf do echo "${indent4}${i}" done - $RM -f $tmpdir/f1 $tmpdir/f2 + ${__rm} -f $tmpdir/f1 $tmpdir/f2 if [ "$ignore_unpackaged_files" -eq 0 ]; then error $E_UNPACKAGED_FILES check_unpackaged fi fi - $RM -f $tmpdir/f1 $tmpdir/f2 + ${__rm} -f $tmpdir/f1 $tmpdir/f2 } # auto_src(): Automatically place any patches and srcfiles into the stagedir @@ -937,7 +937,7 @@ auto_src() local numpatch=${#patch[@]} local pnum=0 if [ "$numpatch" -gt 0 ]; then - $MKDIR -p $distsrcdir + ${__mkdir} -p $distsrcdir for ((pnum=0; pnum < $numpatch; pnum++)) do if [ ! -z ${patch[$pnum]} ]; then # They didn't give us an empty string @@ -947,7 +947,7 @@ auto_src() fi # We are now sure that $patch[$pnum] contains file with absolute path if [ -r ${patch[$pnum]} ]; then # file is readable echo "Copying patch[$pnum] - ${patch[$pnum]}" - $CP ${patch[$pnum]} $distsrcdir + ${__cp} ${patch[$pnum]} $distsrcdir else error $E_BAD_FILE patch fi @@ -958,7 +958,7 @@ auto_src() fi # Add sourcecode if [ $include_source -eq 1 ]; then - $MKDIR -p $distsrcdir + ${__mkdir} -p $distsrcdir local numsource=${#source[@]} local snum=0 for ((snum=0; $snum < $numsource; snum++)) @@ -969,7 +969,7 @@ auto_src() fi # We are now sure that ${source[$snum]} contains file with absolute path if [ -r ${source[$snum]} ]; then echo "Copying source[$snum] - ${source[$snum]}" - $CP ${source[$snum]} $distsrcdir + ${__cp} ${source[$snum]} $distsrcdir fi done fi @@ -991,14 +991,14 @@ rel_conf_sub() # Duplicated code from auto_rel :( # compute configure info for relnotes local cf="$(_upls $configure_args)" - [ -n "$ac_overrides" ] && local aco="$(echo $ac_overrides | $TR ' ' '\n' | $AWK '{ printf "%s \\\\ \\n",$0 }')" - local temp_fullcf="$(echo "$__configure $cf" | $AWK '{ printf "%s\\n",$0 }')" + [ -n "$ac_overrides" ] && local aco="$(echo $ac_overrides | ${__tr} ' ' '\n' | ${__awk} '{ printf "%s \\\\ \\n",$0 }')" + local temp_fullcf="$(echo "$__configure $cf" | ${__awk} '{ printf "%s\\n",$0 }')" temp_fullcf="$(echo "${aco}${temp_fullcf}")" # Remove trailing whitespace and \n local fullcf="${temp_fullcf%\\*}" # end if [ -r ${metadir}/${rn} ]; then - $SED -e "s;%%CONFIGURE%%;$fullcf;g" \ + ${__sed} -e "s;%%CONFIGURE%%;$fullcf;g" \ ${metadir}/${rn} > ${metadir}/${rn}.txt fi } @@ -1031,14 +1031,14 @@ auto_rel() local relmetadir=${stagedir}${metainstalldir}relnotes/$topdir-$version-$pkgver # compute configure info for relnotes local cf="$(_upls $configure_args)" - [ -n "$ac_overrides" ] && local aco="$(for ar in $ac_overrides; do echo $ar; done | $AWK '{ printf "%s \\\\ \\n",$0 }')" - local temp_fullcf="$(echo "$__configure $cf" | $AWK '{ printf "%s\\n",$0 }')" + [ -n "$ac_overrides" ] && local aco="$(for ar in $ac_overrides; do echo $ar; done | ${__awk} '{ printf "%s \\\\ \\n",$0 }')" + local temp_fullcf="$(echo "$__configure $cf" | ${__awk} '{ printf "%s\\n",$0 }')" temp_fullcf="$(echo "${aco}${temp_fullcf}")" # Remove trailing whitespace and \n local fullcf="${temp_fullcf%\\*}" # end if [ $mipspro -eq 0 ]; then - local compiler_temp="$(gcc --version 2>&1 | $SED -n '1,1p')" + local compiler_temp="$(gcc --version 2>&1 | ${__sed} -n '1,1p')" local compiler="gcc ${compiler_temp##* }" else # not gcc if [ "$_os" = "irix53" ]; then @@ -1048,14 +1048,14 @@ auto_rel() fi if [ "$CXX" = "g++" ]; then # SGI cc with gnu g++ - local compiler_temp="$(g++ --version 2>&1 | $SED -n '1,1p')" - local compiler="$((echo $compiler; echo g++ ${compiler_temp##* }) | $AWK '{ printf "%s\\n",$0 }')" + local compiler_temp="$(g++ --version 2>&1 | ${__sed} -n '1,1p')" + local compiler="$((echo $compiler; echo g++ ${compiler_temp##* }) | ${__awk} '{ printf "%s\\n",$0 }')" local compiler="${compiler%\\*}" fi fi - local pkgnam_temp=$($GREP 'pkgname=' $metadir/pkgdef) + local pkgnam_temp=$(${__grep} 'pkgname=' $metadir/pkgdef) local pkgnam=$(_upls ${pkgnam_temp#pkgname=*}) - local vendor_temp=$($GREP 'pkgvendor=' $metadir/pkgdef) + local vendor_temp=$(${__grep} 'pkgvendor=' $metadir/pkgdef) local vendor=$(_upls ${vendor_temp#pkgvendor=*}) local packager="${pkgedby} <${email}>" # Compute SHA1 sums for all source entries @@ -1076,22 +1076,22 @@ auto_rel() # into relnotes we cd first then run sha1sum path="${source[$s]%/*}" # Extract path part file="${source[$s]##*/}" # Extract filename part - (cd "$path"; $SHA1SUM "$file") >> $metadir/sums + (cd "$path"; ${__sha1sum} "$file") >> $metadir/sums done - [ -r "$metadir/sums" ] && temp_source_sha1sum="$(cat $metadir/sums | $AWK '{ printf "%s\\n",$0 }')" + [ -r "$metadir/sums" ] && temp_source_sha1sum="$(cat $metadir/sums | ${__awk} '{ printf "%s\\n",$0 }')" source_sha1sum="${temp_source_sha1sum%\\*}" # End of SHA1 sum computing - local temp_extracted_env="$($SED -e 's/export /echo ENV /g' ${buildpkgbase}/${pkgdir}/build.sh >> /tmp/env.sh; bash /tmp/env.sh|$GREP ^ENV|$SED -e 's/ENV //g'|$AWK '{ printf "%s\\n",$0 }' && $RM -f /tmp/env.sh)" + local temp_extracted_env="$(${__sed} -e 's/export /echo ENV /g' ${buildpkgbase}/${pkgdir}/build.sh >> /tmp/env.sh; bash /tmp/env.sh|${__grep} ^ENV|${__sed} -e 's/ENV //g'|${__awk} '{ printf "%s\\n",$0 }' && ${__rm} -f /tmp/env.sh)" # Remove trailing \n local extracted_env="${temp_extracted_env%\\*}" if [ -r ${depends}_all ]; then - local temp_deps="$($CAT ${depends}_all | $GREP -v $pkgnam | $GREP $pkgprefix | $SED -e "s/.*${pkgprefix}//" | $CUT -d. -f1 | $SORT -u | $AWK '{ printf "%s\\n",$0 }')" + local temp_deps="$(${__cat} ${depends}_all | ${__grep} -v $pkgnam | ${__grep} $pkgprefix | ${__sed} -e "s/.*${pkgprefix}//" | ${__cut} -d. -f1 | ${__sort} -u | ${__awk} '{ printf "%s\\n",$0 }')" else local temp_deps="" fi local deps="${temp_deps%\\*}" - $MKDIR -p $relmetadir - $SED -e "s;%%PKGNAME%%;${pkgnam};g" \ + ${__mkdir} -p $relmetadir + ${__sed} -e "s;%%PKGNAME%%;${pkgnam};g" \ -e "s;%%SOURCE_AND_VER%%;${topdir}-${version};g" \ -e "s;%%CONFIGURE%%;${fullcf};g" \ -e "s;%%COMPILER%%;${compiler};g" \ @@ -1113,9 +1113,9 @@ auto_rel() auto_dist() { local distmetadir=${stagedir}${metainstalldir}dist/$topdir-$version-$pkgver - $MKDIR -p $distmetadir - $CP $idbfile $distmetadir - $CP $specfile $distmetadir + ${__mkdir} -p $distmetadir + ${__cp} $idbfile $distmetadir + ${__cp} $specfile $distmetadir } # dep_pkg_name: Given a filename it will look it up and find the subsystemname @@ -1129,8 +1129,8 @@ dep_pkg_name() do for i in $files do - [ -L "$i" -a $deps_resolve_symlinks -eq 1 ] && i=$(${READLINK} -f "$i") - pkg=$(${GREP} " ${i:1}$" $showfilescache 2>/dev/null) + [ -L "$i" -a $deps_resolve_symlinks -eq 1 ] && i=$(${__readlink} -f "$i") + pkg=$(${__grep} " ${i:1}$" $showfilescache 2>/dev/null) if [ -n "$pkg" ]; then #echo "Found $i in $pkg" >> /tmp/depdebug echo "$pkg" @@ -1150,46 +1150,46 @@ extract_deps() cd ${stagedir}${topinstalldir} # Grab the filelist and classify files - local filelist=$($GREP $1 $idbfile | $AWK '{ print $6 }') - local exelist=$(echo $filelist | $XARGS $FILE | $EGREP -v ":.* (commands|script) " | $GREP ":.*executable" | $CUT -d: -f1) - local scriptlist=$(echo $filelist | $XARGS $FILE | $EGREP ":.* (commands|script) " | $CUT -d: -f1) - local liblist=$(echo $filelist | $XARGS $FILE | $GREP ":.*dynamic lib" | $CUT -d: -f1) + local filelist=$(${__grep} $1 $idbfile | ${__awk} '{ print $6 }') + local exelist=$(echo $filelist | ${__xargs} ${__file} | ${__egrep} -v ":.* (commands|script) " | ${__grep} ":.*executable" | ${__cut} -d: -f1) + local scriptlist=$(echo $filelist | ${__xargs} ${__file} | ${__egrep} ":.* (commands|script) " | ${__cut} -d: -f1) + local liblist=$(echo $filelist | ${__xargs} ${__file} | ${__grep} ":.*dynamic lib" | ${__cut} -d: -f1) # Compute dependencies for executables if [ -n "$exelist" ]; then for f in $exelist; do [ -r $f -a -x $f ] || continue # Generic Irix ldd - # $LDD $f | $GREP \= | $AWK -F' ' '{ print $3 }' | $CUT -d\ -f2 + # ${__ldd} $f | ${__grep} \= | ${__awk} -F' ' '{ print $3 }' | ${__cut} -d\ -f2 # Ariel Faigons perl5 ldd - $LDD $f | $GREP \= | $GREP -v 'not found' | $SED -e 's/.*=> //g' - done | $SORT -u | dep_pkg_name | $AWK '{ print $4 }' | $SORT -u + ${__ldd} $f | ${__grep} \= | ${__grep} -v 'not found' | ${__sed} -e 's/.*=> //g' + done | ${__sort} -u | dep_pkg_name | ${__awk} '{ print $4 }' | ${__sort} -u fi # Compute dependencies for dynamic libraries if [ -n "$liblist" ]; then for f in $liblist; do [ -r $f ] || continue # Generic Irix ldd - #$LDD $f | $GREP \= | $AWK -F' ' '{ print $3 }' | $CUT -d\ -f2 + #${__ldd} $f | ${__grep} \= | ${__awk} -F' ' '{ print $3 }' | ${__cut} -d\ -f2 # Ariel Faigon's perl5 ldd - $LDD $f | $GREP \= | $GREP -v 'not found' | $SED -e 's/.*=> //g' - done | $SORT -u | dep_pkg_name | $AWK '{ print $4 }' | $SORT -u + ${__ldd} $f | ${__grep} \= | ${__grep} -v 'not found' | ${__sed} -e 's/.*=> //g' + done | ${__sort} -u | dep_pkg_name | ${__awk} '{ print $4 }' | ${__sort} -u fi # Compute dependencies for scripts if [ -n "$scriptlist" ]; then for f in $scriptlist; do [ -r $f -a -x $f ] || continue - interp="$($HEAD -n 1 $f | $CUT -d\! -f2- | $SED -e 's/ -.*//')" + interp="$(${__head} -n 1 $f | ${__cut} -d\! -f2- | ${__sed} -e 's/ -.*//')" if [ -L "$interp" ]; then - echo $($FILE -h "$interp" | $SED -e 's/.* to //') + echo $(${__file} -h "$interp" | ${__sed} -e 's/.* to //') else - if [ "$(echo $interp | $CUT -d' ' -f1)" = "/usr/bin/env" ]; then + if [ "$(echo $interp | ${__cut} -d' ' -f1)" = "/usr/bin/env" ]; then echo "/usr/bin/env" else echo $interp fi fi - done | $SORT -u | dep_pkg_name | $AWK '{ print $4 }' | $SORT -u + done | ${__sort} -u | dep_pkg_name | ${__awk} '{ print $4 }' | ${__sort} -u fi } @@ -1208,15 +1208,15 @@ auto_deps() # Populate showfiles cache $SHOWFILES -l > $showfilescache - subsystems="$($AWK '{ print $7 }' < $idbfile | $SORT -u | $GREP sw)" + subsystems="$(${__awk} '{ print $7 }' < $idbfile | ${__sort} -u | ${__grep} sw)" for i in $subsystems do deps="$(extract_deps $i)" for j in $deps do - echo "${i#*.} $j $($SHOWPRODS -n $j | $GREP $j | $AWK '{ print $3 }') maxint" + echo "${i#*.} $j $($SHOWPRODS -n $j | ${__grep} $j | ${__awk} '{ print $3 }') maxint" done - done | $SORT -u | grep $pkgprefix > ${depends}_auto + done | ${__sort} -u | grep $pkgprefix > ${depends}_auto rm -f $showfilescache } diff --git a/buildpkg.packaging.solaris b/buildpkg.packaging.solaris index 98b22d2..93cb746 100644 --- a/buildpkg.packaging.solaris +++ b/buildpkg.packaging.solaris @@ -9,7 +9,7 @@ PKGMK=/usr/bin/pkgmk PKGTRANS=/usr/bin/pkgtrans # Override generic location -STRIP=/usr/ccs/bin/strip +__strip=/usr/ccs/bin/strip # /usr/ccs/bin/strip destroys the symbol table in static archives # So this is disabled by default dostrip_static=0 @@ -34,7 +34,7 @@ pkgedby="Tom G. Christensen" email=swpkg@jupiterrise.com arch=`uname -p` -os=sunos`$UNAME -r` +os=sunos`${__uname} -r` # Courtesy of nba (see dm2conv/solaris/mkpkg.sh) #case $os in #5.[0123456]|5.5.1) @@ -125,13 +125,13 @@ pack_info() fi local secname=$1 - local pstamp="$os-$($UNAME -n)`date '+%Y%m%d%H%M'`" + local pstamp="$os-$(${__uname} -n)`date '+%Y%m%d%H%M'`" # Check length of pkgname and name to make sure we're within limits [ ${#pkgname} -gt 9 ] && error $E_SVR4_PKG_OVERFLOW pack_info [ ${#name} -gt 256 ] && error $E_SVR4_NAME_OVERFLOW pack_info - $SED -e "s#%%pkgname%%#$pkgname#g" \ + ${__sed} -e "s#%%pkgname%%#$pkgname#g" \ -e "s#%%version%%#$version#g" \ -e "s#%%pkgcat%%#$pkgcat#g" \ -e "s#%%pkgvendor%%#$pkgvendor - packaged by $pkgedby#g" \ @@ -153,9 +153,9 @@ list_pkgs() local i local it # We can't rely on shell expansion here since we would be burned if * is empty! - for i in $($LS -1 $metadir/prototype.* 2>/dev/null) + for i in $(${__ls} -1 $metadir/prototype.* 2>/dev/null) do - it=$($BASENAME $i) + it=$(${__basename} $i) echo ${it##prototype.} done } @@ -248,7 +248,7 @@ add_proto() local fspec=$(_upls $4) local secname=$5 - local FILES=$($FIND $fspec -type f -print|$TEE -a $metadir/files.tmp) + local FILES=$(${__find} $fspec -type f -print|${__tee} -a $metadir/files.tmp) OIFS=$IFS IFS=" " @@ -256,7 +256,7 @@ add_proto() do IFS=$OIFS if [ "$defperm" == "-" ]; then - permlist=$($LS -l "$i" | $CUT -d " " -f 1) + permlist=$(${__ls} -l "$i" | ${__cut} -d " " -f 1) perm=$(compute_octal $permlist) else perm=$defperm @@ -265,7 +265,7 @@ add_proto() done IFS=$OIFS # Handle symlinks - local FILES=$($FIND $fspec -type l -print|$TEE -a $metadir/files.tmp) + local FILES=$(${__find} $fspec -type l -print|${__tee} -a $metadir/files.tmp) OIFS=$IFS IFS=" " @@ -273,16 +273,16 @@ add_proto() do IFS=$OIFS if [ "$defperm" == "-" ]; then - permlist=$($LS -l "$i" | $CUT -d " " -f 1) + permlist=$(${__ls} -l "$i" | ${__cut} -d " " -f 1) perm=$(compute_octal $permlist) fi - local temp=`$LS -l "$i"|$CUT -d '>' -f 2` + local temp=`${__ls} -l "$i"|${__cut} -d '>' -f 2` local symval=${temp# } echo "s none $i=$symval $perm $owner $group" >> $metadir/prototype.$secname done IFS=$OIFS # Handle directories - local FILES=$($FIND $fspec -type d -print|$TEE -a $metadir/files.tmp) + local FILES=$(${__find} $fspec -type d -print|${__tee} -a $metadir/files.tmp) OIFS=$IFS IFS=" " @@ -290,7 +290,7 @@ add_proto() do IFS=$OIFS if [ "$defperm" == "-" ]; then - permlist=$($LS -ld "$i" | $CUT -d " " -f 1) + permlist=$(${__ls} -ld "$i" | ${__cut} -d " " -f 1) perm=$(compute_octal $permlist) else perm=$defperm @@ -315,7 +315,7 @@ add_dir() local secname=$5 if [ "$defperm" == "-" ]; then - permlist=$($LS -ld "$dir" | $CUT -d " " -f 1) + permlist=$(${__ls} -ld "$dir" | ${__cut} -d " " -f 1) perm=$(compute_octal $permlist) else perm=$defperm @@ -342,23 +342,23 @@ auto_rel() local relmetadir=${stagedir}${metainstalldir}relnotes/$secname-$version-$pkgver ### compute configure info for relnotes local cf="$(_upls $configure_args)" - [ -n "$ac_overrides" ] && local aco="$(for ar in $ac_overrides; do echo $ar; done | $AWK '{ printf "%s \\\\ \\n",$0 }')" - local temp_fullcf="$(echo "$__configure $cf" | $AWK '{ printf "%s\\n",$0 }')" + [ -n "$ac_overrides" ] && local aco="$(for ar in $ac_overrides; do echo $ar; done | ${__awk} '{ printf "%s \\\\ \\n",$0 }')" + local temp_fullcf="$(echo "$__configure $cf" | ${__awk} '{ printf "%s\\n",$0 }')" temp_fullcf="$(echo "${aco}${temp_fullcf}")" # Remove trailing whitespace and \n local fullcf="${temp_fullcf%\\*}" ### ### compute compiler info for relnotes if [ $suncc -eq 0 ]; then - #local compiler_temp="$(gcc --version 2>&1 | $SED -n '1,1p')" + #local compiler_temp="$(gcc --version 2>&1 | ${__sed} -n '1,1p')" #local compiler="gcc ${compiler_temp##* }" - local compiler="$(gcc -v 2>&1 | $SED -n '/^gcc/ s/ version//p')" + local compiler="$(gcc -v 2>&1 | ${__sed} -n '/^gcc/ s/ version//p')" else # not gcc local compiler="$(cc -version 2>&1)" if [ "$CXX" = "g++" ]; then # SUN cc with gnu g++ - local compiler_temp="$(g++ --version 2>&1 | $SED -n '1,1p')" - local compiler="$((echo $compiler; echo g++ ${compiler_temp##* }) | $AWK '{ printf "%s\\n",$0 }')" + local compiler_temp="$(g++ --version 2>&1 | ${__sed} -n '1,1p')" + local compiler="$((echo $compiler; echo g++ ${compiler_temp##* }) | ${__awk} '{ printf "%s\\n",$0 }')" local compiler="${compiler%\\*}" fi fi @@ -387,23 +387,23 @@ auto_rel() # into relnotes we cd first then run sha1sum path="${source[$s]%/*}" # Extract path part file="${source[$s]##*/}" # Extract filename part - (cd "$path"; $SHA1SUM "$file") >> $metadir/sums.${secname} + (cd "$path"; ${__sha1sum} "$file") >> $metadir/sums.${secname} let s=s+1 done - [ -r "$metadir/sums.${secname}" ] && temp_source_sha1sum="$(cat $metadir/sums.${secname} | $AWK '{ printf "%s\\n",$0 }')" + [ -r "$metadir/sums.${secname}" ] && temp_source_sha1sum="$(cat $metadir/sums.${secname} | ${__awk} '{ printf "%s\\n",$0 }')" source_sha1sum="${temp_source_sha1sum%\\*}" ### End of SHA1 sum computing ### Extract environtment variables - local temp_extracted_env="$($SED -e 's/export /echo ENV /g' ${buildpkgbase}/${pkgdir}/build.sh >> /tmp/env.sh; bash /tmp/env.sh|$GREP ^ENV|$SED -e 's/ENV //g'|$AWK '{ printf "%s\\n",$0 }' && $RM -f /tmp/env.sh)" + local temp_extracted_env="$(${__sed} -e 's/export /echo ENV /g' ${buildpkgbase}/${pkgdir}/build.sh >> /tmp/env.sh; bash /tmp/env.sh|${__grep} ^ENV|${__sed} -e 's/ENV //g'|${__awk} '{ printf "%s\\n",$0 }' && ${__rm} -f /tmp/env.sh)" # Remove trailing \n local extracted_env="${temp_extracted_env%\\*}" ### ### Add dependencies - local temp_deps="$($CAT $metadir/depend.$secname.all | $SED -e '/^$/d;/^ /d' | $SORT -u | $AWK '{ printf "%s\\n",$0 }')" + local temp_deps="$(${__cat} $metadir/depend.$secname.all | ${__sed} -e '/^$/d;/^ /d' | ${__sort} -u | ${__awk} '{ printf "%s\\n",$0 }')" local deps="${temp_deps%\\*}" ### - $MKDIR -p $relmetadir - $GSED -e "s;%%PKGNAME%%;${pkgnam};g" \ + ${__mkdir} -p $relmetadir + ${__gsed} -e "s;%%PKGNAME%%;${pkgnam};g" \ -e "s;%%SOURCE_AND_VER%%;${topdir}-${version};g" \ -e "s;%%CONFIGURE%%;${fullcf};g" \ -e "s;%%COMPILER%%;${compiler};g" \ @@ -436,8 +436,8 @@ auto_dir() local i local j - fdirs=$($AWK '/^[fs]/ { print $3 }' $metadir/prototype.$secname | $SED -e 's,\(.*\)=.*$,\1,' | $SED -e 's,\(.*\)/.*$,\1,' | $SORT -u) - ddirs=$($AWK '/^d/ { print $3 }' $metadir/prototype.$secname | $SORT -u) + fdirs=$(${__awk} '/^[fs]/ { print $3 }' $metadir/prototype.$secname | ${__sed} -e 's,\(.*\)=.*$,\1,' | ${__sed} -e 's,\(.*\)/.*$,\1,' | ${__sort} -u) + ddirs=$(${__awk} '/^d/ { print $3 }' $metadir/prototype.$secname | ${__sort} -u) for i in $fdirs do @@ -482,8 +482,8 @@ dep_pkg_name() do for i in $files do - [ -L "$i" -a $deps_resolve_symlinks -eq 1 ] && i=$(${READLINK} -f "$i") - pkg=$(pkgchk -l -p $i | $AWK '/^\t/ { print $1 }') + [ -L "$i" -a $deps_resolve_symlinks -eq 1 ] && i=$(${__readlink} -f "$i") + pkg=$(pkgchk -l -p $i | ${__awk} '/^\t/ { print $1 }') if [ -n "$pkg" -a $(echo $pkg | wc -l) -eq 1 ]; then #echo "Found $i in $pkg" >> /tmp/depdebug echo "$pkg" @@ -505,42 +505,42 @@ extract_deps() cd ${stagedir}${topinstalldir} # Grab the filelist and classify files - local filelist=$($AWK '{ print $3 }' $metadir/prototype.$secname | $GREP '.') - local exelist=$(echo $filelist | $XARGS $FILE | $EGREP -v ":.* (commands|script)" | $GREP -v "ar archive" | $GREP ":.*executable" | $CUT -d: -f1) - local scriptlist=$(echo $filelist | $XARGS $FILE | $EGREP ":.* (commands|script)" | $CUT -d: -f1) - local liblist=$(echo $filelist | $XARGS $FILE | $GREP -v "ar archive" | $GREP ":.*dynamic lib" | $CUT -d: -f1) + local filelist=$(${__awk} '{ print $3 }' $metadir/prototype.$secname | ${__grep} '.') + local exelist=$(echo $filelist | ${__xargs} ${__file} | ${__egrep} -v ":.* (commands|script)" | ${__grep} -v "ar archive" | ${__grep} ":.*executable" | ${__cut} -d: -f1) + local scriptlist=$(echo $filelist | ${__xargs} ${__file} | ${__egrep} ":.* (commands|script)" | ${__cut} -d: -f1) + local liblist=$(echo $filelist | ${__xargs} ${__file} | ${__grep} -v "ar archive" | ${__grep} ":.*dynamic lib" | ${__cut} -d: -f1) # Compute dependencies for executables if [ -n "$exelist" ]; then for f in $exelist; do [ -r $f -a -x $f ] || continue # Generic Solaris ldd - $LDD $f | $GREP -v 'not found' | $AWK '/\=/ { print $3 }' - done | $SORT -u | dep_pkg_name | $SORT -u + ${__ldd} $f | ${__grep} -v 'not found' | ${__awk} '/\=/ { print $3 }' + done | ${__sort} -u | dep_pkg_name | ${__sort} -u fi # Compute dependencies for dynamic libraries if [ -n "$liblist" ]; then for f in $liblist; do [ -r $f ] || continue # Generic Solaris ldd - $LDD $f | $GREP -v 'not found' | $AWK '/\=/ { print $3 }' - done | $SORT -u | dep_pkg_name | $SORT -u + ${__ldd} $f | ${__grep} -v 'not found' | ${__awk} '/\=/ { print $3 }' + done | ${__sort} -u | dep_pkg_name | ${__sort} -u fi # Compute dependencies for scripts if [ -n "$scriptlist" ]; then for f in $scriptlist; do [ -r $f -a -x $f ] || continue - interp="$($HEAD -n 1 $f | $CUT -d\! -f2- | $SED -e 's/ -.*//')" + interp="$(${__head} -n 1 $f | ${__cut} -d\! -f2- | ${__sed} -e 's/ -.*//')" if [ -L "$interp" ]; then - echo $($FILE -h "$interp" | $SED -e 's/.* to //') + echo $(${__file} -h "$interp" | ${__sed} -e 's/.* to //') else - if [ "$(echo $interp | $CUT -d' ' -f1)" = "/usr/bin/env" ]; then + if [ "$(echo $interp | ${__cut} -d' ' -f1)" = "/usr/bin/env" ]; then echo "/usr/bin/env" else echo $interp fi fi - done | $SORT -u | dep_pkg_name | $SORT -u + done | ${__sort} -u | dep_pkg_name | ${__sort} -u fi } @@ -558,13 +558,13 @@ auto_deps() local pkgname=$(get_pkgname $secname) local temp - deps="$(extract_deps $secname | $SORT -u)" + deps="$(extract_deps $secname | ${__sort} -u)" # We need to sort out any packages created from the same build # Internal deps *must* be recorded in a depend file instead for j in $(list_pkgs) do temp=$(get_pkgname $j) - deps=$(echo $deps | $SED -e "/$temp/d") + deps=$(echo $deps | ${__sed} -e "/$temp/d") done # Parse any speciel depends # We don't do ignore_deps processing for these deps @@ -572,7 +572,7 @@ auto_deps() local extra_pkgname # Package that should have the depend local extra_dep_pkgname # The name of depend (either a pkgname or a secname) local extra_dep_version # version of the depend (or auto keyword) - $SED -n "/^$pkgname /p" $metadir/depend | + ${__sed} -n "/^$pkgname /p" $metadir/depend | while read extra_pkgname extra_dep_pkgname extra_dep_version do local internal_dep=0 @@ -597,7 +597,7 @@ auto_deps() fi # Only for deps with $pkgprefix? if [ $version_all_deps -eq 0 ]; then - [ -n "$(echo $extra_dep_pkgname | $GREP $pkgprefix)" ] && echo -e "\t($arch) $extra_dep_version" + [ -n "$(echo $extra_dep_pkgname | ${__grep} $pkgprefix)" ] && echo -e "\t($arch) $extra_dep_version" else echo -e "\t($arch) $extra_dep_version" fi @@ -621,7 +621,7 @@ auto_deps() # create versioned_deps # Only for deps with $pkgprefix? if [ $version_all_deps -eq 0 ]; then - [ -n "$(echo $j | $GREP $pkgprefix)" ] && echo -e "\t($arch) $(pkgparam $j VERSION)" + [ -n "$(echo $j | ${__grep} $pkgprefix)" ] && echo -e "\t($arch) $(pkgparam $j VERSION)" else echo -e "\t($arch) $(pkgparam $j VERSION)" fi @@ -669,7 +669,7 @@ parse_def() fi ;; *) - equalindex=$($EXPR index "$line" =) + equalindex=$(${__expr} index "$line" =) if [ ! $equalindex -eq 0 ]; then case "${line:0:(($equalindex-1))}" in 'pkgname') @@ -697,9 +697,9 @@ parse_def() else # Perhaps we hit 'files'? if [ "${line:0:5}" == "files" ]; then triplet="${line:6:((${#line}-5-2))}" - defaultperms=$(echo $triplet | $AWK -F, '{ print $1 }') - defaultuid=$(echo $triplet | $AWK -F, '{ print $2 }') - defaultgid=$(echo $triplet | $AWK -F, '{ print $3 }') + defaultperms=$(echo $triplet | ${__awk} -F, '{ print $1 }') + defaultuid=$(echo $triplet | ${__awk} -F, '{ print $2 }') + defaultgid=$(echo $triplet | ${__awk} -F, '{ print $3 }') foundfiles=1 if [ $hasaddedpkginfo -eq 0 ]; then # start a new package @@ -743,24 +743,24 @@ check_unpackaged() local i local indent4=" " - $FIND . -type f -print|$SED -e 's/\.\///g' > $tmpdir/files.tmp - $FIND . -type l -print|$SED -e 's/\.\///g' >> $tmpdir/files.tmp - $FIND . -type d -print|$SED -e 's/\.\///g'|$GREP -v '^\.' >> $tmpdir/files.tmp - $SORT $metadir/files.tmp|$UNIQ > $tmpdir/f1 - $SORT $tmpdir/files.tmp > $tmpdir/f2 - upf="$($CAT $tmpdir/f1 $tmpdir/f2 | $SORT | $SED -e '/^relnotes/d' | $UNIQ -u)" + ${__find} . -type f -print|${__sed} -e 's/\.\///g' > $tmpdir/files.tmp + ${__find} . -type l -print|${__sed} -e 's/\.\///g' >> $tmpdir/files.tmp + ${__find} . -type d -print|${__sed} -e 's/\.\///g'|${__grep} -v '^\.' >> $tmpdir/files.tmp + ${__sort} $metadir/files.tmp|${__uniq} > $tmpdir/f1 + ${__sort} $tmpdir/files.tmp > $tmpdir/f2 + upf="$(${__cat} $tmpdir/f1 $tmpdir/f2 | ${__sort} | ${__sed} -e '/^relnotes/d' | ${__uniq} -u)" if [ ! -z "$upf" ]; then echo "There are unpackaged files in the stagedir:" for i in $upf do echo "${indent4}${i}" done - $RM -f $tmpdir/f1 $tmpdir/f2 + ${__rm} -f $tmpdir/f1 $tmpdir/f2 if [ "$ignore_unpackaged_files" -eq 0 ]; then error $E_UNPACKAGED_FILES check_unpackaged fi fi - $RM -f $tmpdir/f1 $tmpdir/f2 + ${__rm} -f $tmpdir/f1 $tmpdir/f2 } # get_pkgname(): Extract pkgname (PKG) from a pkginfo file @@ -770,7 +770,7 @@ get_pkgname() local secname=$1 if [ -r $metadir/pkginfo.$secname ]; then - local pn=$($GREP PKG $metadir/pkginfo.$secname) + local pn=$(${__grep} PKG $metadir/pkginfo.$secname) local pname=$(_upls ${pn##PKG=}) echo $pname fi @@ -782,7 +782,7 @@ get_pkgrev() { local secname=$1 - local verfield="$($GREP VERSION $metadir/pkginfo.$secname|$SED -e 's/"//g')" + local verfield="$(${__grep} VERSION $metadir/pkginfo.$secname|${__sed} -e 's/"//g')" local secver=$(_upls ${verfield#*REV=}) echo $secver } @@ -793,7 +793,7 @@ get_pkgversion() { local secname=$1 - local verfield="$($GREP VERSION $metadir/pkginfo.$secname|$SED -e 's/"//g')" + local verfield="$(${__grep} VERSION $metadir/pkginfo.$secname|${__sed} -e 's/"//g')" local secver=$(_upls ${verfield##VERSION=}) echo $secver } @@ -805,7 +805,7 @@ get_pkgdesc() local secname=$1 if [ -r $metadir/pkginfo.$secname ]; then - local pd=$($GREP NAME $metadir/pkginfo.$secname) + local pd=$(${__grep} NAME $metadir/pkginfo.$secname) local pdesc=$(_upls ${pd##NAME=}) echo $pdesc fi @@ -818,7 +818,7 @@ get_pkgvendor() local secname=$1 if [ -r $metadir/pkginfo.$secname ]; then - local pv=$($SED -n 's/VENDOR=\(.*\) - .*/\1/p' $metadir/pkginfo.$secname | $TR -d '"') + local pv=$(${__sed} -n 's/VENDOR=\(.*\) - .*/\1/p' $metadir/pkginfo.$secname | ${__tr} -d '"') echo $(_upls $pv) fi } @@ -854,13 +854,13 @@ docs_for() if [ ! -z $# ]; then setdir source ddir=${stagedir}${prefix}/${_docdir}/${secname}-${version} - ${MKDIR} -p $ddir + ${__mkdir} -p $ddir echo "Adding docs" until [ -z "$1" ] do for f in $(_upls $1) do - ($TAR -cf - "$f")|(cd $ddir; $TAR -xvBpf -) + (${__tar} -cf - "$f")|(cd $ddir; ${__tar} -xvBpf -) done shift done @@ -872,10 +872,10 @@ docs_for() do_strip_bin() { echo "Stripping ELF binaries..." - for f in `$FIND . -type f \( -perm -0100 -o -perm -0010 -o -perm -0001 \) -exec $FILE {} \; | \ - $GREP -v ' dynamic lib ' | \ - $SED -n -e 's/^\(.*\):[ ]*ELF.*, not stripped/\1/p'`; do - $STRIP $strip_elf_args $f || : + for f in `${__find} . -type f \( -perm -0100 -o -perm -0010 -o -perm -0001 \) -exec ${__file} {} \; | \ + ${__grep} -v ' dynamic lib ' | \ + ${__sed} -n -e 's/^\(.*\):[ ]*ELF.*, not stripped/\1/p'`; do + ${__strip} $strip_elf_args $f || : done } @@ -887,10 +887,10 @@ do_strip_shared() # Strip ELF shared objects (see brp-strip-shared from RPM) # Please note we don't restrict our search to executable files because # our libraries are not (should not be, at least) +x. - for f in `$FIND . -type f -a -exec $FILE {} \; | \ + for f in `${__find} . -type f -a -exec ${__file} {} \; | \ grep ' dynamic lib ' | \ - $SED -n -e 's/^\(.*\):[ ]*ELF.*, not stripped/\1/p'`; do - $STRIP $strip_shared_args $f + ${__sed} -n -e 's/^\(.*\):[ ]*ELF.*, not stripped/\1/p'`; do + ${__strip} $strip_shared_args $f done } @@ -900,10 +900,10 @@ do_strip_static() { echo "Stripping static archives..." # Strip static libraries. (see brp-strip-static-archive from RPM) - for f in `$FIND . -type f -a -exec $FILE {} \; | \ - $GREP 'current ar archive' | \ - $SED -n -e 's/^\(.*\):[ ]*current ar archive,.*/\1/p'`; do - $STRIP $strip_static_args $f + for f in `${__find} . -type f -a -exec ${__file} {} \; | \ + ${__grep} 'current ar archive' | \ + ${__sed} -n -e 's/^\(.*\):[ ]*current ar archive,.*/\1/p'`; do + ${__strip} $strip_static_args $f done } diff --git a/buildpkg.tools b/buildpkg.tools index 15d2e77..728e003 100644 --- a/buildpkg.tools +++ b/buildpkg.tools @@ -6,8 +6,8 @@ __strip=/usr/bin/strip __uname=/usr/bin/uname __tar=/usr/tgcware/bin/tar # GNU tar v1.14 or better please! __vtar=/usr/bin/tar # vendor supplied tar -__bzip2=/usr/bin/bzip2 -__gzip=/usr/bin/gzip +__bzip2=/usr/tgcware/bin/bzip2 +__gzip=/usr/tgcware/bin/gzip __patch=/usr/tgcware/bin/patch # GNU patch 2.5 or better please! __rm=/usr/bin/rm __rmdir=/usr/bin/rmdir @@ -29,6 +29,7 @@ __cp=/usr/bin/cp __tee=/bin/tee __grep=/bin/grep __egrep=/bin/egrep +__ggrep=/usr/tgcware/bin/grep # GNU grep __uniq=/bin/uniq __basename=/bin/basename __dirname=/bin/dirname @@ -42,6 +43,9 @@ __pack=/usr/bin/pack __sha1sum=/usr/tgcware/bin/sha1sum __unzip=/usr/tgcware/bin/unzip __head=/usr/bin/head # Must support -n +__perl=/usr/tgcware/bin/perl +__readlink=/usr/tgcware/bin/readlink +__ldd=/usr/bin/ldd # Groff stuff for manpages __nroff=/usr/tgcware/bin/nroff diff --git a/newpkg b/newpkg index f9fb160..be108fb 100644 --- a/newpkg +++ b/newpkg @@ -16,23 +16,23 @@ else fi echo "Creating sandbox for $arg1" -$MKDIR "$arg1" +${__mkdir} "$arg1" for i in $REQ_DIRS do - $MKDIR $arg1/$i + ${__mkdir} $arg1/$i done -$CP scripts/build.sh.generic $arg1/build.sh -if [ "$($UNAME -s)" == "IRIX" -o "$($UNAME -s)" == "IRIX64" ]; then - $SED -e 's;bin/bash;usr/tgcware/bin/bash;g' $arg1/build.sh > $arg1/build.sh.tmp - $MV $arg1/build.sh.tmp $arg1/build.sh - $CP scripts/pkgdef.template.irix $arg1/meta/pkgdef +${__cp} scripts/build.sh.generic $arg1/build.sh +if [ "$(${__uname} -s)" == "IRIX" -o "$(${__uname} -s)" == "IRIX64" ]; then + ${__sed} -e 's;bin/bash;usr/tgcware/bin/bash;g' $arg1/build.sh > $arg1/build.sh.tmp + ${__mv} $arg1/build.sh.tmp $arg1/build.sh + ${__cp} scripts/pkgdef.template.irix $arg1/meta/pkgdef fi -if [ "$($UNAME -s)" == "SunOS" ]; then - $CP scripts/pkgdef.template $arg1/meta/pkgdef +if [ "$(${__uname} -s)" == "SunOS" ]; then + ${__cp} scripts/pkgdef.template $arg1/meta/pkgdef fi -$CP scripts/relnotes.template.irix $arg1/meta/relnotes +${__cp} scripts/relnotes.template.irix $arg1/meta/relnotes # Make build script executable chmod 755 $arg1/build.sh