Subject: Re: about pkg_path
To: Rui-Xiang Guo <rxg@myrealbox.com>
From: Johnny C. Lam <jlam@pkgsrc.org>
List: tech-pkg
Date: 01/28/2006 22:34:29
--5vNYLRcllDrimb99
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
On Sat, Jan 28, 2006 at 01:20:24PM +0800, Rui-Xiang Guo wrote:
> Index: pkg_path
> ===================================================================
> RCS file: /cvsroot/pkgsrc/mk/scripts/pkg_path,v
> retrieving revision 1.3
> diff -b -u -r1.3 pkg_path
> --- pkg_path 23 Jan 2006 18:38:27 -0000 1.3
> +++ pkg_path 28 Jan 2006 03:11:20 -0000
> @@ -108,8 +108,7 @@
> exitcode=1
> continue
> fi
> - pkgpath=`cd $startdir/$dir && ${PWD_CMD}`
> - pkgpath="${pkgpath#${PKGSRCDIR}/}"
> + pkgpath="${dir#../../}"
> ${ECHO} "$pkgpath"
> done
>
> Because the $dir comes from ${_ALL_DEPENDS:C/^[^:]*://:O:u} which is always
> with prefix "../../".
This breaks for package directory references that don't start with
"../../". Please try the following patch instead.
Cheers,
-- Johnny Lam <jlam@pkgsrc.org>
--5vNYLRcllDrimb99
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="pkg_path.diff"
Index: pkg_path
===================================================================
RCS file: /cvsroot/pkgsrc/mk/scripts/pkg_path,v
retrieving revision 1.3
diff -u -r1.3 pkg_path
--- pkg_path 23 Jan 2006 18:38:27 -0000 1.3
+++ pkg_path 28 Jan 2006 22:29:37 -0000
@@ -92,12 +92,18 @@
esac
done
+if ${TEST} ! -d "${PKGSRCDIR}"; then
+ ${ECHO} 1>&2 "$self: \`\`${PKGSRCDIR}'' not found"
+ exit 1
+fi
+pkgsrcdir=`cd ${PKGSRCDIR} && ${PWD_CMD}`
+
# Process required arguments
startdir=`${PWD_CMD}`
while ${TEST} $# -gt 0; do
dir="$1"; shift
case "$dir" in
- ${PKGSRCDIR}/*) ;;
+ ${PKGSRCDIR}/*|$pkgsrcdir/*) ;;
/*) ${ECHO} 1>&2 "$self: \`\`$dir'' not a valid package directory"
exitcode=1
continue
@@ -109,7 +115,7 @@
continue
fi
pkgpath=`cd $startdir/$dir && ${PWD_CMD}`
- pkgpath="${pkgpath#${PKGSRCDIR}/}"
+ pkgpath="${pkgpath#$pkgsrcdir/}"
${ECHO} "$pkgpath"
done
--5vNYLRcllDrimb99--