Redefine the meaning of the topdir variable.
From now on pkgdir will be used to designate the toplevel dir of the pkg under $BUILDPKG_BASE Irix specific changes: Source formatting fixes Finally get rid of the FIXME on imageconf Automatically handle opt.src and opt.relnotes subsystems
This commit is contained in:
parent
0a32c3529f
commit
ec325c188b
@ -15,8 +15,7 @@ fi
|
|||||||
# Variables that *must* be overridden pr. package
|
# Variables that *must* be overridden pr. package
|
||||||
# They are used to construct paths and more so they
|
# They are used to construct paths and more so they
|
||||||
# must have sane values
|
# must have sane values
|
||||||
# topdir= The toplevel dir name under $buildpkgbase
|
# topdir= The default package dirname, it's used pr. default in pkgname
|
||||||
# It is also used pr. default in the pkgname
|
|
||||||
# and it is also used pr. default as the toplevel name inside the sourcetar ($topsrcdir)
|
# and it is also used pr. default as the toplevel name inside the sourcetar ($topsrcdir)
|
||||||
# version= source version ie. 0.14.2b
|
# version= source version ie. 0.14.2b
|
||||||
# pkgver= the package revision, an increasing number is recommended but a date could be used instead
|
# pkgver= the package revision, an increasing number is recommended but a date could be used instead
|
||||||
@ -71,11 +70,12 @@ NROFF=/usr/local/bin/nroff
|
|||||||
NROFFOPTS="-c -man"
|
NROFFOPTS="-c -man"
|
||||||
|
|
||||||
# Define defaults
|
# Define defaults
|
||||||
|
pkgdir=${PWD##*/} # topdir under $BUILDPKG_BASE
|
||||||
buildpkgbase=$BUILDPKG_BASE
|
buildpkgbase=$BUILDPKG_BASE
|
||||||
stagedir=$buildpkgbase/$topdir/stage
|
stagedir=$buildpkgbase/$pkgdir/stage
|
||||||
srcdir=$buildpkgbase/$topdir/src
|
srcdir=$buildpkgbase/$pkgdir/src
|
||||||
patchdir=$srcdir # Allow the possibility of easily putting a load of patches in a different location
|
patchdir=$srcdir # Allow the possibility of easily putting a load of patches in a different location
|
||||||
metadir=$buildpkgbase/$topdir/meta
|
metadir=$buildpkgbase/$pkgdir/meta
|
||||||
distdir=$buildpkgbase/distfiles/beta
|
distdir=$buildpkgbase/distfiles/beta
|
||||||
topsrcdir=$topdir-$version # it may be necessary to override this
|
topsrcdir=$topdir-$version # it may be necessary to override this
|
||||||
|
|
||||||
@ -302,8 +302,8 @@ clean()
|
|||||||
do
|
do
|
||||||
META_CLEAN="$META_CLEAN prototype.$secname pkginfo.$secname"
|
META_CLEAN="$META_CLEAN prototype.$secname pkginfo.$secname"
|
||||||
pkgname=$(get_pkgname $secname)
|
pkgname=$(get_pkgname $secname)
|
||||||
echo "Removing $buildpkgbase/$topdir/$pkgname"
|
echo "Removing $buildpkgbase/$pkgdir/$pkgname"
|
||||||
$RM -rf $buildpkgbase/$topdir/$pkgname
|
$RM -rf $buildpkgbase/$pkgdir/$pkgname
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -86,36 +86,36 @@ fix_ver()
|
|||||||
# param: $1=product name $2=description
|
# param: $1=product name $2=description
|
||||||
spec_header()
|
spec_header()
|
||||||
{
|
{
|
||||||
echo "product $1"
|
echo "product $1"
|
||||||
echo "$indent4 id \"$2\""
|
echo "$indent4 id \"$2\""
|
||||||
}
|
}
|
||||||
spec_footer()
|
spec_footer()
|
||||||
{
|
{
|
||||||
echo "endproduct"
|
echo "endproduct"
|
||||||
}
|
}
|
||||||
# spec_img_header()
|
# spec_img_header()
|
||||||
# param: $1=image name $2=image description $3=version
|
# param: $1=image name $2=image description $3=version
|
||||||
spec_img_header()
|
spec_img_header()
|
||||||
{
|
{
|
||||||
local nver=$(fix_ver $3)
|
local nver=$(fix_ver $3)
|
||||||
echo "$indent4 image $1"
|
echo "$indent4 image $1"
|
||||||
echo "$indent8 id \"$2\""
|
echo "$indent8 id \"$2\""
|
||||||
echo "$indent8 version $nver"
|
echo "$indent8 version $nver"
|
||||||
echo "$indent8 order 9999"
|
echo "$indent8 order 9999"
|
||||||
}
|
}
|
||||||
# spec_img_footer()
|
# spec_img_footer()
|
||||||
spec_img_footer()
|
spec_img_footer()
|
||||||
{
|
{
|
||||||
echo "$indent4 endimage"
|
echo "$indent4 endimage"
|
||||||
}
|
}
|
||||||
# spec_subsys_header()
|
# spec_subsys_header()
|
||||||
# param: $1=image $2=subsys $3=description
|
# param: $1=image $2=subsys $3=description
|
||||||
spec_subsys_header()
|
spec_subsys_header()
|
||||||
{
|
{
|
||||||
echo "$indent8 subsys $2 default"
|
echo "$indent8 subsys $2 default"
|
||||||
echo "$indent12 id \"$3\""
|
echo "$indent12 id \"$3\""
|
||||||
echo "$indent12 replaces self"
|
echo "$indent12 replaces self"
|
||||||
echo "$indent12 exp $pkgname.$1.$2"
|
echo "$indent12 exp $pkgname.$1.$2"
|
||||||
}
|
}
|
||||||
# spec_subsys_req_header()
|
# spec_subsys_req_header()
|
||||||
# param: none
|
# param: none
|
||||||
@ -244,15 +244,25 @@ add_files()
|
|||||||
|
|
||||||
# fetch_imageconf(): Fetch a list of toplevel image entries with descriptions
|
# fetch_imageconf(): Fetch a list of toplevel image entries with descriptions
|
||||||
# params: none
|
# params: none
|
||||||
# Discard the ones that we don't have any subsystems for FIXME!
|
# Discard the ones that we don't have any subsystems for
|
||||||
fetch_imageconf()
|
fetch_imageconf()
|
||||||
{
|
{
|
||||||
pctopidx=0
|
local pctopidx=0
|
||||||
|
local numloops=${#pc[@]}
|
||||||
|
local i=0
|
||||||
|
|
||||||
while read image desc
|
while read image desc
|
||||||
do
|
do
|
||||||
pctop[$pctopidx]=$image
|
for ((i=0; i < $numloops; i++))
|
||||||
pdtop[$pctopidx]=$desc
|
do
|
||||||
let "pctopidx = $pctopidx + 1"
|
temp="${pc[$i]%%.*}"
|
||||||
|
if [ "$image" == "$temp" ]; then
|
||||||
|
pctop[$pctopidx]=$image
|
||||||
|
pdtop[$pctopidx]=$desc
|
||||||
|
let "pctopidx = $pctopidx + 1"
|
||||||
|
break # We found a match no need to loop further
|
||||||
|
fi
|
||||||
|
done
|
||||||
done < $imageconf
|
done < $imageconf
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -372,6 +382,18 @@ create_idb()
|
|||||||
fetch_ops
|
fetch_ops
|
||||||
parse_def
|
parse_def
|
||||||
|
|
||||||
|
# hackish - FIXME perhaps?
|
||||||
|
local pcpos=${#pc[@]} # First vacant position in the subsys list array $pc
|
||||||
|
if [ -d src ]; then # We have a srcdir which means we have patches, so add them to the idb file
|
||||||
|
add_files "src" opt.src - root sys ""
|
||||||
|
pc[$pcpos]="opt.src"
|
||||||
|
let "pcpos = pcpos + 1"
|
||||||
|
fi
|
||||||
|
if [ -d relnotes ]; then # We have releasenotes, add them to idb file
|
||||||
|
add_files "relnotes" opt.relnotes - root sys ""
|
||||||
|
pc[$pcpos]="opt.relnotes"
|
||||||
|
fi
|
||||||
|
|
||||||
$SORT +4u -6 < $idbfile > $metadir/idbtemp
|
$SORT +4u -6 < $idbfile > $metadir/idbtemp
|
||||||
lines=$(wc -l < $metadir/idbtemp)
|
lines=$(wc -l < $metadir/idbtemp)
|
||||||
if [ ! -z $firstop ]; then
|
if [ ! -z $firstop ]; then
|
||||||
@ -490,6 +512,8 @@ parse_def()
|
|||||||
local legalend=0
|
local legalend=0
|
||||||
local index=0
|
local index=0
|
||||||
local found=0
|
local found=0
|
||||||
|
local i=0
|
||||||
|
local equalindex=""
|
||||||
|
|
||||||
while read line
|
while read line
|
||||||
do
|
do
|
||||||
@ -607,6 +631,45 @@ check_unpackaged()
|
|||||||
$RM -f $tmpdir/f1 $tmpdir/f2
|
$RM -f $tmpdir/f1 $tmpdir/f2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# auto_src(): Automatically place any patches into the correct location for packaging
|
||||||
|
# params: none
|
||||||
|
# Grabs any patches and shoves them into $prefix/src/$topdir-$version-$pkgver
|
||||||
|
# for adding to the opt.src subsystem
|
||||||
|
auto_src()
|
||||||
|
{
|
||||||
|
local distsrcdir="src/$topdir-$version-$pkgver"
|
||||||
|
$MKDIR -p $distsrcdir
|
||||||
|
|
||||||
|
local numpatch=${#patch[@]}
|
||||||
|
local pnum=0
|
||||||
|
for ((pnum=0; pnum < $numpatch; pnum++))
|
||||||
|
do
|
||||||
|
if [ ! -z ${patch[$pnum]} ]; then # They didn't give us an empty string
|
||||||
|
if [ "${patch[$pnum]:0:1}" != "/" ]; then # We have a relative pathname
|
||||||
|
# expand to absolute
|
||||||
|
patch[$pnum]=$patchdir/${patch[$pnum]}
|
||||||
|
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
|
||||||
|
$CP ${patch[$pnum]} $distsrcdir
|
||||||
|
else
|
||||||
|
error $E_BAD_FILE patch
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Patch $pnum has empty filename"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# auto_rel(): Fix up and add releasenotes to stagedir
|
||||||
|
# params: none
|
||||||
|
# This will make some substitutions on a release note template
|
||||||
|
# and then copy the result to $stagedir/$prefix/relnotes/$topdir-$version-$pkgver.txt
|
||||||
|
auto_rel()
|
||||||
|
{
|
||||||
|
echo "auto_rel() is unimplemented"
|
||||||
|
}
|
||||||
|
|
||||||
# generic_pack(): Build package using files from 'install' stage
|
# generic_pack(): Build package using files from 'install' stage
|
||||||
# params: $1 - indicating whether or not the root is complete as described below
|
# params: $1 - indicating whether or not the root is complete as described below
|
||||||
# We expect generic_install to have made $stagedir the "root" dir
|
# We expect generic_install to have made $stagedir the "root" dir
|
||||||
@ -632,6 +695,8 @@ generic_pack()
|
|||||||
fi
|
fi
|
||||||
setdir $stagedir$topinstalldir
|
setdir $stagedir$topinstalldir
|
||||||
fi
|
fi
|
||||||
|
auto_src # Add any patches
|
||||||
|
auto_rel # Fix up and add releasenotes
|
||||||
create_idb
|
create_idb
|
||||||
create_spec
|
create_spec
|
||||||
check_unpackaged
|
check_unpackaged
|
||||||
|
@ -71,8 +71,8 @@ make_pkg()
|
|||||||
local pname=$(get_pkgname $secname)
|
local pname=$(get_pkgname $secname)
|
||||||
|
|
||||||
echo "Creating package and transferring it to datastream format"
|
echo "Creating package and transferring it to datastream format"
|
||||||
$PKGMK -r `pwd` -d $buildpkgbase/$topdir -o -f $metadir/$prototype
|
$PKGMK -r `pwd` -d $buildpkgbase/$pkgdir -o -f $metadir/$prototype
|
||||||
$PKGTRANS -o -s $buildpkgbase/$topdir $distdir/$dfile $pname
|
$PKGTRANS -o -s $buildpkgbase/$pkgdir $distdir/$dfile $pname
|
||||||
echo "Done. Package was created as $dfile"
|
echo "Done. Package was created as $dfile"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user