Don't stow twice the origin package after xstow has been installed and stowned.
Also use a template for xstow to avoid hardcoding the vars into the script, as bonus don't allow to unstow 'xstow' once is stowned... heh. --HG-- extra : convert_revision : 94b5676b13ed79d54f1968120ddb50a20429bca9
This commit is contained in:
parent
553eb8bc14
commit
8a62250ba8
2 changed files with 112 additions and 28 deletions
88
pkgfs.sh
88
pkgfs.sh
|
@ -1,6 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# pkgfs - Builds source distribution files.
|
# pkgfs - Builds source distribution files and stows/unstows them into
|
||||||
|
# a master directory.
|
||||||
#
|
#
|
||||||
#-
|
#-
|
||||||
# Copyright (c) 2008 Juan Romero Pardines.
|
# Copyright (c) 2008 Juan Romero Pardines.
|
||||||
|
@ -31,7 +32,6 @@
|
||||||
# Multiple distfiles in a package.
|
# Multiple distfiles in a package.
|
||||||
# Multiple URLs to download source distribution files.
|
# Multiple URLs to download source distribution files.
|
||||||
# Support GNU/BSD-makefile style source distribution files.
|
# Support GNU/BSD-makefile style source distribution files.
|
||||||
# Actually do the symlink dance (stow/unstow).
|
|
||||||
# Fix PKGFS_{C,CXX}FLAGS, aren't passed to the environment yet.
|
# Fix PKGFS_{C,CXX}FLAGS, aren't passed to the environment yet.
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
@ -111,6 +111,7 @@ run_file()
|
||||||
|
|
||||||
check_path "$file"
|
check_path "$file"
|
||||||
. $path_fixed
|
. $path_fixed
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
info_tmpl()
|
info_tmpl()
|
||||||
|
@ -187,8 +188,9 @@ apply_tmpl_patches()
|
||||||
check_build_vars()
|
check_build_vars()
|
||||||
{
|
{
|
||||||
run_file ${PKGFS_CONFIG_FILE}
|
run_file ${PKGFS_CONFIG_FILE}
|
||||||
|
PKGFS_CONFIG_FILE=$path_fixed
|
||||||
|
|
||||||
if [ ! -f "$path_fixed" ]; then
|
if [ ! -f "$PKGFS_CONFIG_FILE" ]; then
|
||||||
echo -n "*** ERROR: cannot find configuration file: "
|
echo -n "*** ERROR: cannot find configuration file: "
|
||||||
echo "'$PKGFS_CONFIG_FILE' ***"
|
echo "'$PKGFS_CONFIG_FILE' ***"
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -229,17 +231,18 @@ reset_tmpl_vars()
|
||||||
|
|
||||||
check_tmpl_vars()
|
check_tmpl_vars()
|
||||||
{
|
{
|
||||||
|
local pkg="$1"
|
||||||
local dfile=""
|
local dfile=""
|
||||||
|
|
||||||
if [ -z "$build_xstow" ]; then
|
[ -z "$pkg" ] && return 1
|
||||||
run_file ${tmplfile}
|
|
||||||
else
|
if [ -n "$build_xstow" ]; then
|
||||||
|
#
|
||||||
|
# Looks like xstow is not available and we have to install it.
|
||||||
|
#
|
||||||
reset_tmpl_vars
|
reset_tmpl_vars
|
||||||
pkgname="$xstow_version"
|
pkg="$PKGFS_TEMPLATESDIR/$xstow_version.tmpl"
|
||||||
extract_sufx=".tar.bz2"
|
run_file ${pkg}
|
||||||
url="http://kent.dl.sourceforge.net/sourceforge/xstow"
|
|
||||||
checksum="9b99bd9affe9a841503970e903555ce340fcf296"
|
|
||||||
build_style="gnu_configure"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
REQ_VARS="pkgname extract_sufx url build_style"
|
REQ_VARS="pkgname extract_sufx url build_style"
|
||||||
|
@ -285,14 +288,16 @@ check_tmpl_vars()
|
||||||
|
|
||||||
check_rmd160_cksum()
|
check_rmd160_cksum()
|
||||||
{
|
{
|
||||||
local passed_var="$1"
|
local file="$1"
|
||||||
|
|
||||||
|
[ -z "$file" ] && return 1
|
||||||
|
|
||||||
if [ -z "${distfiles}" ]; then
|
if [ -z "${distfiles}" ]; then
|
||||||
dfile="$pkgname$extract_sufx"
|
dfile="$pkgname$extract_sufx"
|
||||||
elif [ -n "${distfiles}" ]; then
|
elif [ -n "${distfiles}" ]; then
|
||||||
dfile="$distfiles$extract_sufx"
|
dfile="$distfiles$extract_sufx"
|
||||||
else
|
else
|
||||||
dfile="$passed_var$extract_sufx"
|
dfile="$file$extract_sufx"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
origsum="$checksum"
|
origsum="$checksum"
|
||||||
|
@ -385,6 +390,8 @@ build_tmpl_sources()
|
||||||
{
|
{
|
||||||
local pkg_builddir=""
|
local pkg_builddir=""
|
||||||
|
|
||||||
|
export PATH="/bin:/sbin:/usr/bin:/usr/sbin:$PKGFS_MASTERDIR/bin:$PKGFS_MASTERDIR/sbin"
|
||||||
|
|
||||||
if [ -z "$wrksrc" ]; then
|
if [ -z "$wrksrc" ]; then
|
||||||
if [ -z "$distfiles" ]; then
|
if [ -z "$distfiles" ]; then
|
||||||
pkg_builddir=$PKGFS_BUILDDIR/$pkgname
|
pkg_builddir=$PKGFS_BUILDDIR/$pkgname
|
||||||
|
@ -451,7 +458,6 @@ build_tmpl_sources()
|
||||||
${MAKE_CMD} ${make_install_args} \
|
${MAKE_CMD} ${make_install_args} \
|
||||||
install prefix="$PKGFS_DESTDIR/$pkgname"
|
install prefix="$PKGFS_DESTDIR/$pkgname"
|
||||||
if [ "$?" -ne 0 ]; then
|
if [ "$?" -ne 0 ]; then
|
||||||
echo "LD_LIBRARY_PATH: $LD_LIBRARY_PATH"
|
|
||||||
echo "*** ERROR instaling $pkgname ***"
|
echo "*** ERROR instaling $pkgname ***"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -468,8 +474,15 @@ build_tmpl_sources()
|
||||||
|
|
||||||
check_stow_cmd()
|
check_stow_cmd()
|
||||||
{
|
{
|
||||||
|
local pkg="$1"
|
||||||
|
|
||||||
|
[ -z "$pkg" ] && return 1
|
||||||
|
|
||||||
# If we have the xstow binary it's done
|
# If we have the xstow binary it's done
|
||||||
[ -x "$PKGFS_XSTOW_CMD" ] && return 0
|
if [ -x "$PKGFS_XSTOW_CMD" ]; then
|
||||||
|
unset build_xstow
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
#
|
#
|
||||||
# Looks like we don't, build our own and re-adjust config file.
|
# Looks like we don't, build our own and re-adjust config file.
|
||||||
|
@ -481,13 +494,15 @@ check_stow_cmd()
|
||||||
#
|
#
|
||||||
# That's enough, build xstow and stow it!
|
# That's enough, build xstow and stow it!
|
||||||
#
|
#
|
||||||
build_tmpl
|
build_tmpl "$pkg"
|
||||||
}
|
}
|
||||||
|
|
||||||
stow_tmpl()
|
stow_tmpl()
|
||||||
{
|
{
|
||||||
local pkg="$1"
|
local pkg="$1"
|
||||||
|
|
||||||
|
[ -z "$pkg" ] && return 2
|
||||||
|
|
||||||
$PKGFS_XSTOW_CMD -dir $PKGFS_DESTDIR -target $PKGFS_MASTERDIR \
|
$PKGFS_XSTOW_CMD -dir $PKGFS_DESTDIR -target $PKGFS_MASTERDIR \
|
||||||
${xstow_args} $PKGFS_DESTDIR/$pkg
|
${xstow_args} $PKGFS_DESTDIR/$pkg
|
||||||
if [ "$?" -ne 0 ]; then
|
if [ "$?" -ne 0 ]; then
|
||||||
|
@ -510,6 +525,17 @@ unstow_tmpl()
|
||||||
{
|
{
|
||||||
local pkg="$1"
|
local pkg="$1"
|
||||||
|
|
||||||
|
if [ -z "$pkg" ]; then
|
||||||
|
echo "*** ERROR: template wasn't specified? ***"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
local tmppkg="${pkg%-[0-9]*}"
|
||||||
|
if [ "$tmppkg" = "xstow" ]; then
|
||||||
|
echo "*** INFO: You aren't allowed to unstow '$xstow_version'!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
$PKGFS_XSTOW_CMD -dir $PKGFS_DESTDIR -target $PKGFS_MASTERDIR \
|
$PKGFS_XSTOW_CMD -dir $PKGFS_DESTDIR -target $PKGFS_MASTERDIR \
|
||||||
-D $PKGFS_DESTDIR/$pkg
|
-D $PKGFS_DESTDIR/$pkg
|
||||||
if [ "$?" -ne 0 ]; then
|
if [ "$?" -ne 0 ]; then
|
||||||
|
@ -521,16 +547,21 @@ unstow_tmpl()
|
||||||
|
|
||||||
build_tmpl()
|
build_tmpl()
|
||||||
{
|
{
|
||||||
export PATH="/bin:/sbin:/usr/bin:/usr/sbin:$PKGFS_MASTERDIR/bin:$PKGFS_MASTERDIR/sbin"
|
|
||||||
|
|
||||||
tmplfile="$1"
|
tmplfile="$1"
|
||||||
if [ -z "$tmplfile" -o ! -f "$tmplfile" ]; then
|
if [ -z "$build_xstow" ]; then
|
||||||
echo "*** ERROR: invalid template file '$tmplfile', aborting ***"
|
if [ -z "$tmplfile" -o ! -f "$tmplfile" ]; then
|
||||||
exit 1
|
echo -n "*** ERROR: invalid template file '$tmplfile',"
|
||||||
|
echo " aborting ***"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
check_build_vars
|
||||||
fi
|
fi
|
||||||
|
|
||||||
check_build_vars
|
run_file ${tmplfile}
|
||||||
check_tmpl_vars
|
tmplfile=$path_fixed
|
||||||
|
prev_tmpl=$path_fixed
|
||||||
|
|
||||||
|
check_tmpl_vars ${pkgname}
|
||||||
|
|
||||||
if [ -n "$only_build" ]; then
|
if [ -n "$only_build" ]; then
|
||||||
build_tmpl_sources
|
build_tmpl_sources
|
||||||
|
@ -550,14 +581,15 @@ build_tmpl()
|
||||||
#
|
#
|
||||||
# xstow has been stowned, now stown the origin package.
|
# xstow has been stowned, now stown the origin package.
|
||||||
#
|
#
|
||||||
unset build_xstow
|
run_file ${prev_tmpl}
|
||||||
reset_tmpl_vars
|
tmplfile=${prev_tmpl}
|
||||||
run_file ${tmplfile}
|
|
||||||
else
|
|
||||||
check_stow_cmd
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
check_stow_cmd ${tmplfile}
|
||||||
|
[ "$?" -eq 1 ] && return 0
|
||||||
|
|
||||||
stow_tmpl $pkgname
|
stow_tmpl $pkgname
|
||||||
|
reset_tmpl_vars
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
52
templates/xstow-0.6.1-unstable.tmpl
Executable file
52
templates/xstow-0.6.1-unstable.tmpl
Executable file
|
@ -0,0 +1,52 @@
|
||||||
|
# ----*---- ----*-----
|
||||||
|
# Example template build file for 'xstow-0.6.1-unstable'.
|
||||||
|
# ----*---- ----*-----
|
||||||
|
#
|
||||||
|
# Name of the package, sometimes you need a different name than
|
||||||
|
# the one used in the source distribution file.
|
||||||
|
pkgname=xstow-0.6.1-unstable
|
||||||
|
|
||||||
|
# Suffix extraction, only supported: zip and tar/tar+(gz|bzip2).
|
||||||
|
extract_sufx=".tar.bz2"
|
||||||
|
|
||||||
|
# Use this if pkgname doesn't match or if there are multiple
|
||||||
|
# source distribution files.
|
||||||
|
#distfiles=""
|
||||||
|
|
||||||
|
# URL to fetch
|
||||||
|
url=http://kent.dl.sourceforge.net/sourceforge/xstow/
|
||||||
|
|
||||||
|
# Arguments passed to configure if $build_style = {,gnu_}configure.
|
||||||
|
#configure_args=""
|
||||||
|
|
||||||
|
# Arguments passed to configure through the environment
|
||||||
|
#configure_env=""
|
||||||
|
|
||||||
|
# Build style: gnu_configure, bsd-makefile, gnu-makefile, configure.
|
||||||
|
build_style=gnu_configure
|
||||||
|
|
||||||
|
# Passed flags to the 'make' command before building the package.
|
||||||
|
#make_build_args=""
|
||||||
|
|
||||||
|
# Passed flags to the 'make' command before installing the package.
|
||||||
|
#make_install_args=""
|
||||||
|
|
||||||
|
# Short description, max 1 line of 72 chars.
|
||||||
|
short_desc="Replacement of GNU Stow written in C++"
|
||||||
|
|
||||||
|
# Maintainer of this pkg: name <email>.
|
||||||
|
maintainer="Juan RP <xtraeme@gmail.com>"
|
||||||
|
|
||||||
|
# Checksum of file with rmd160.
|
||||||
|
checksum=9b99bd9affe9a841503970e903555ce340fcf296
|
||||||
|
|
||||||
|
# Long description. Preferibly first line should be left blank
|
||||||
|
# and use a whitespace while starting lines.
|
||||||
|
#
|
||||||
|
# Please also respect 72 chars per line if possible (max 80).
|
||||||
|
#
|
||||||
|
long_desc="
|
||||||
|
XStow as GNU Stow, are programs for managing the installation of
|
||||||
|
software packages, keeping them separate (/usr/local/stow/emacs vs.
|
||||||
|
/usr/local/stow/perl, for example) while making them appear to be
|
||||||
|
installed in the same place (/usr/local)."
|
Loading…
Reference in a new issue