Bring Irix into line with the latest changes
Now Irix also uses pkgdef and checks for unpackaged files in the stagedir. subsys.conf will only contain descriptions like image.conf What missing? ops & depend functionality is untested strip function needs to be either generalized or moved to the pr. pkgsystem function libraries. Perhaps introduce something like attr from RPM to set specific permissions in pkgdef.
This commit is contained in:
parent
6ca155d0c4
commit
0958686fd0
@ -26,7 +26,14 @@ hidefile=$metadir/hide
|
||||
# Preformat manpages since Irix is not likely to have nroff available
|
||||
catman=1
|
||||
|
||||
# strip?
|
||||
dostrip=0
|
||||
|
||||
# Other
|
||||
usedepend=0 # Don't use depend file even if it's available
|
||||
usescripts=0 # Don't add ops even if they're available
|
||||
ignore_unpackaged_files=0 # default to check for unpackaged files in the stage area
|
||||
|
||||
# Comment these declarations to get it to run with ksh
|
||||
declare -a pc # Array of product categories (image.subsys)
|
||||
declare -a pd # Array of matching descriptions
|
||||
@ -47,12 +54,12 @@ cpu=mips3
|
||||
|
||||
configure_args='--prefix=$prefix'
|
||||
|
||||
META_CLEAN="$topdir.spec $topdir.idb"
|
||||
META_CLEAN="$topdir.spec $topdir.idb files.tmp"
|
||||
|
||||
# Host specific configuration
|
||||
[ -r $buildpkgbase/scripts/config.$($HOSTNAME -s).irix ] && . $buildpkgbase/scripts/config.$($HOSTNAME -s).irix
|
||||
|
||||
distfile=$topdir-$version-$pkgver.tgc-$os-$cpu-$pkgdirdesig.tardist
|
||||
distfile='$topdir-$version-$pkgver.tgc-$os-$cpu-$pkgdirdesig.tardist'
|
||||
|
||||
#####################################################
|
||||
# Internal helper functions
|
||||
@ -130,24 +137,15 @@ spec_subsys_footer()
|
||||
echo "$indent8 endsubsys"
|
||||
}
|
||||
|
||||
# check_hide(): Should the file be "hidden"
|
||||
# params: $1=file to check against $hide
|
||||
check_hide()
|
||||
{
|
||||
local file="$1"
|
||||
for ((i=0; $i < ${#hide[@]}; i++))
|
||||
do
|
||||
if [ "${hide[$i]}" == "$file" ]; then
|
||||
echo 1
|
||||
fi
|
||||
done
|
||||
}
|
||||
# check_ops(): Is there an opscript associated with $1
|
||||
# param: $1=file to check
|
||||
check_ops()
|
||||
{
|
||||
local file="$1"
|
||||
local return
|
||||
local return=""
|
||||
if [ "$usescripts" -eq 0 ]; then
|
||||
echo $return
|
||||
fi
|
||||
#echo "file is $file" >> /tmp/debug
|
||||
for ((i=0; $i < ${#opfiles[@]}; i++))
|
||||
do
|
||||
@ -180,51 +178,57 @@ fix_fname()
|
||||
# $3 = permissions to set on the files we find
|
||||
# $4 = user
|
||||
# $5 = group
|
||||
# $6 = special attribute
|
||||
add_files()
|
||||
{
|
||||
local perm=$3
|
||||
local FILES=`$FIND $1 -type f -print`
|
||||
local fspec=$(_upls $1)
|
||||
local prodcat=$2
|
||||
local defperm=$3
|
||||
local owner=$4
|
||||
local group=$5
|
||||
local specattr=$6
|
||||
|
||||
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="
|
||||
"
|
||||
for i in $FILES
|
||||
do
|
||||
IFS=$OIFS
|
||||
if [ "$3" == "keep" ]; then
|
||||
if [ "$defperm" == "-" ]; then
|
||||
permlist=`$LS -l "$i" | $CUT -d " " -f 1`
|
||||
perm=$(compute_octal $permlist)
|
||||
fi
|
||||
nohist=$(check_hide "$i")
|
||||
doop=$(check_ops "$i")
|
||||
fname=$(fix_fname "$i")
|
||||
if [ ! -z "$nohist" ]; then
|
||||
echo "f $perm $4 $5 ${topinstalldir:1}/$fname $i $pkgname.$2 nohist" >>$idbfile
|
||||
if [ ! -z "$specattr" ]; then
|
||||
echo "f $perm $owner $group ${topinstalldir:1}/$fname $i ${pkgname}.${prodcat} $specattr" >>$idbfile
|
||||
else
|
||||
if [ ! -z "$doop" ]; then
|
||||
echo "f $perm $4 $5 ${topinstalldir:1}/$fname $i $pkgname.$2 $doop" >>$idbfile
|
||||
echo "f $perm $owner $group ${topinstalldir:1}/$fname $i ${pkgname}.${prodcat} $doop" >>$idbfile
|
||||
else
|
||||
echo "f $perm $4 $5 ${topinstalldir:1}/$fname $i $pkgname.$2" >>$idbfile
|
||||
echo "f $perm $owner $group ${topinstalldir:1}/$fname $i ${pkgname}.${prodcat}" >>$idbfile
|
||||
fi
|
||||
fi
|
||||
|
||||
done
|
||||
IFS=$OIFS
|
||||
# Handle symlinks
|
||||
local FILES=`$FIND $1 -type l -print`
|
||||
local FILES=$($FIND $fspec -type l -print|$TEE -a $metadir/files.tmp)
|
||||
OIFS=$IFS
|
||||
IFS="
|
||||
"
|
||||
for i in $FILES
|
||||
do
|
||||
IFS=$OIFS
|
||||
if [ "$3" == "keep" ]; then
|
||||
if [ "$defperm" == "-" ]; then
|
||||
permlist=`$LS -l "$i" | $CUT -d " " -f 1`
|
||||
perm=`compute_octal $permlist`
|
||||
fi
|
||||
local temp=`$LS -l "$i"|$CUT -d '>' -f 2`
|
||||
local symval=${temp# }
|
||||
fname=$(fix_fname "$i")
|
||||
echo "l $perm $4 $5 ${topinstalldir:1}/$fname $i $pkgname.$2 symval($symval)" >>$idbfile
|
||||
echo "l $perm $owner $group ${topinstalldir:1}/$fname $i ${pkgname}.${prodcat} symval($symval)" >>$idbfile
|
||||
done
|
||||
IFS=$OIFS
|
||||
}
|
||||
@ -243,6 +247,25 @@ fetch_imageconf()
|
||||
done < $imageconf
|
||||
}
|
||||
|
||||
# fetch_subsysdesc(): Fetch a list of subsystem descriptions
|
||||
# params: none
|
||||
fetch_subsysdesc()
|
||||
{
|
||||
local i=0
|
||||
local numloops=${#pc[@]}
|
||||
|
||||
while read ss desc
|
||||
do
|
||||
for ((i=0; i < $numloops; i++)) # Find subsystem...
|
||||
do
|
||||
if [ "${pc[$i]}" = "$ss" ]; then
|
||||
pd[$i]="$desc"
|
||||
break # Found it, skip to the next line
|
||||
fi
|
||||
done
|
||||
done < $subsysconf
|
||||
}
|
||||
|
||||
# fetch_depends(): Fetch a list of subsystems and their prereqs
|
||||
# params: none
|
||||
#
|
||||
@ -288,58 +311,18 @@ fetch_ops()
|
||||
fi
|
||||
}
|
||||
|
||||
#fetch_hide(): Fetch list of files to "hide"
|
||||
#params: none
|
||||
fetch_hide()
|
||||
{
|
||||
if [ -r $hidefile ]; then
|
||||
hideidx=0
|
||||
while read filen
|
||||
do
|
||||
hide[$hideidx]=$filen
|
||||
let "hideidx = $hideidx + 1"
|
||||
done < $hidefile
|
||||
fi
|
||||
}
|
||||
|
||||
##################################
|
||||
# "external" functions
|
||||
##################################
|
||||
# create_idb(): Create the .idb file
|
||||
# params: none
|
||||
# Read each line in the subsys config file
|
||||
# and check if we have a $dir in our staging area
|
||||
# Create idb file and insert any firstop/lastops
|
||||
# Note that parse_def does most of the work.
|
||||
create_idb()
|
||||
{
|
||||
fetch_hide
|
||||
fetch_ops
|
||||
local index=0
|
||||
local found=0
|
||||
while read dir pdcat perm user group desc
|
||||
do
|
||||
#local wildcardpos=$($EXPR index "$dir" '*?')
|
||||
#if [ $wildcardpos -gt 2 ]; then
|
||||
# dironly=${dir:0:(($wildcardpos-2))}
|
||||
#else
|
||||
# dironly=$($DIRNAME $dir)
|
||||
#fi
|
||||
found=0
|
||||
#if [ -d $dironly ]; then # This exists
|
||||
add_files "$dir" $pdcat $perm $user $group
|
||||
for i in ${pc[@]} # If $pdcat is already there then don't add it again
|
||||
do
|
||||
if [ "$i" = "$pdcat" ]; then
|
||||
found=1
|
||||
break # It's already there so skip out
|
||||
fi
|
||||
done
|
||||
if [ $found -eq 0 ]; then
|
||||
pc[$index]=$pdcat
|
||||
pd[$index]=$desc
|
||||
let "index = $index + 1"
|
||||
fi
|
||||
#fi
|
||||
done < $subsysconf
|
||||
parse_def
|
||||
|
||||
$SORT +4u -6 < $idbfile > $metadir/idbtemp
|
||||
lines=$(wc -l < $metadir/idbtemp)
|
||||
if [ ! -z $firstop ]; then
|
||||
@ -360,13 +343,14 @@ create_idb()
|
||||
|
||||
# create_spec(): Create the .spec file.
|
||||
# params: none
|
||||
# Uses pkgname & pkgdesc variables
|
||||
# Uses name, pkgname & pkgver variables
|
||||
# Iterate through pctop and for each iteration find
|
||||
# all entries in pc belonging to that image
|
||||
#
|
||||
create_spec()
|
||||
{
|
||||
fetch_imageconf
|
||||
fetch_subsysdesc
|
||||
fetch_depends
|
||||
spec_header $pkgname "$name $version-$pkgver" > $specfile
|
||||
local pcsize=${#pc[@]}
|
||||
@ -432,13 +416,146 @@ make_dist()
|
||||
local disttmp=/tmp/disttmp$$
|
||||
$MKDIR $disttmp
|
||||
|
||||
local dfile=$(_upls $distfile)
|
||||
|
||||
$GENDIST -rbase $topinstalldir -sbase $sbase -idb $idbfile -spec $specfile -dist $disttmp
|
||||
setdir $disttmp
|
||||
$VTAR -cf $distdir/$distfile $pkgname*
|
||||
$VTAR -cf $distdir/$dfile $pkgname*
|
||||
|
||||
setdir stage
|
||||
$RM -rf $disttmp
|
||||
echo "Done. Package was created as $distfile"
|
||||
echo "Done. Package was created as $dfile"
|
||||
}
|
||||
|
||||
# parse_pkgdef(): Read in $metadir/pkgdef
|
||||
# params: none
|
||||
# This will parse the package descriptions in
|
||||
# pkgdef that tells us how many packages there
|
||||
# should be and what they include.
|
||||
parse_def()
|
||||
{
|
||||
local section=0
|
||||
local foundfiles=0
|
||||
local secname=""
|
||||
local secpos=0
|
||||
local legalend=0
|
||||
local index=0
|
||||
local found=0
|
||||
|
||||
while read line
|
||||
do
|
||||
case ${line:0:1} in
|
||||
'#') ;;
|
||||
'[')
|
||||
if [ $section -eq 1 ]; then
|
||||
error $E_BAD_SECTION_BEGIN parse_def
|
||||
else
|
||||
section=1
|
||||
secname="${line:1:((${#line}-2))}"
|
||||
legalend=0
|
||||
fi
|
||||
;;
|
||||
'')
|
||||
if [ $section -eq 0 ]; then
|
||||
error $E_BAD_SECTION_END parse_def
|
||||
else
|
||||
section=0 # Finished this section
|
||||
foundfiles=0 #
|
||||
legalend=1 # We encountered a syntacticly correct section end
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
equalindex=$(expr index "$line" =)
|
||||
if [ ! $equalindex -eq 0 ]; then
|
||||
case "${line:0:(($equalindex-1))}" in
|
||||
'pkgname')
|
||||
pkgname="$(_upls ${line:$equalindex:${#line}})"
|
||||
;;
|
||||
'name')
|
||||
name="$(_upls ${line:$equalindex:${#line}})"
|
||||
;;
|
||||
'pkgver')
|
||||
pkgver="$(_upls ${line:$equalindex:${#line}})"
|
||||
;;
|
||||
'subsys') subsys="$(_upls ${line:$equalindex:${#line}})"
|
||||
found=0
|
||||
for i in ${pc[@]} # If $subsys is already there then don't add it again
|
||||
do
|
||||
if [ "$i" = "$subsys" ]; then
|
||||
found=1
|
||||
break # It's already there so skip out
|
||||
fi
|
||||
done
|
||||
if [ $found -eq 0 ]; then
|
||||
pc[$index]=$subsys
|
||||
let "index = $index + 1"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
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 }')
|
||||
foundfiles=1
|
||||
else
|
||||
if [ $foundfiles -eq 1 ]; then # We already found the 'files' line so this must be the filelist
|
||||
if [ "${line:0:5}" == "hide " ]; then
|
||||
specattr="nohist"
|
||||
line=${line:5}
|
||||
fi
|
||||
if [ "${line:0:4}" == "dir " ]; then
|
||||
echo "Hit unsupported 'dir' directive"
|
||||
#add_dir $defaultperms $defaultuid $defaultgid "${line:4}" $secname # Add dir entry
|
||||
else
|
||||
add_files "$line" $subsys $defaultperms $defaultuid $defaultgid "$specattr" # Build idb file from filespec
|
||||
fi
|
||||
specattr="" # Reset special attribute
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done < $metadir/pkgdef
|
||||
# If there is no blank line at the end of a pkgdef section (if there is only one section that is very
|
||||
# likely) then we end up here without having executed the 'section end' actions (case '' above)
|
||||
if [ $legalend -eq 0 ]; then
|
||||
if [ $section -eq 0 ]; then
|
||||
error $E_BAD_SECTION_END parse_def
|
||||
else
|
||||
section=0 # Finished this section
|
||||
foundfiles=0 #
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# check_unpackaged(): Check if there are unpackaged files in the stage area
|
||||
# params: none
|
||||
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
|
||||
if [ ! "$($CMP $tmpdir/f1 $tmpdir/f2)" == "" ]; then
|
||||
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
|
||||
fi
|
||||
$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
|
||||
}
|
||||
|
||||
# generic_pack(): Build package using files from 'install' stage
|
||||
@ -468,5 +585,6 @@ generic_pack()
|
||||
fi
|
||||
create_idb
|
||||
create_spec
|
||||
check_unpackaged
|
||||
make_dist
|
||||
}
|
||||
|
25
pkgdef.template.irix
Normal file
25
pkgdef.template.irix
Normal file
@ -0,0 +1,25 @@
|
||||
[common]
|
||||
pkgname="$pkgprefix""$topdir"
|
||||
name="$topdir"
|
||||
pkgver="$pkgver"
|
||||
|
||||
[base]
|
||||
subsys=sw.base
|
||||
files(-,root,sys)
|
||||
$_bindir
|
||||
$_sharedir
|
||||
$_libdir/*.so.*
|
||||
$_docdir
|
||||
|
||||
[man]
|
||||
subsys=man.manpages
|
||||
files(-,root,sys)
|
||||
$_mandir
|
||||
$_infodir
|
||||
|
||||
[devel]
|
||||
subsys=sw.devel
|
||||
files(-,root,sys)
|
||||
$_includedir
|
||||
$_libdir/*.so
|
||||
$_libdir/*.a
|
23
subsys.conf
23
subsys.conf
@ -1,19 +1,4 @@
|
||||
bin/* sw.base keep root sys Base Software
|
||||
sbin/* sw.base 0744 root sys Base Software
|
||||
etc/* sw.base keep root sys Base Software
|
||||
libexec/* sw.base keep root sys Base Software
|
||||
mips-sgi-irix5.3/* sw.base keep root sys Base Software
|
||||
mips-sgi-irix6.2/* sw.base keep root sys Base Software
|
||||
lib/*.so sw.devel keep root sys Development files
|
||||
lib/*.a sw.devel keep root sys Development files
|
||||
lib/*.la sw.devel keep root sys Development files
|
||||
lib/pkgconfig/* sw.devel keep root sys Development files
|
||||
lib/*.so.* sw.base keep root sys Base Software
|
||||
lib/GNUstep/* sw.base keep root sys Base Software
|
||||
lib/locale/* sw.base keep root sys Base Software
|
||||
include/* sw.devel keep root sys Development files
|
||||
info/* man.doc keep root sys Documentation
|
||||
man/* man.manpages keep root sys Manpages
|
||||
doc/* man.doc keep root sys Documentation
|
||||
share/* sw.base keep root sys Base Software
|
||||
ssl/* sw.base keep root sys Base Software
|
||||
sw.base Base Software
|
||||
sw.devel Development files
|
||||
man.doc Documentation
|
||||
man.manpages Manpages
|
||||
|
Loading…
x
Reference in New Issue
Block a user