[arch-general] Howto look outside chroot for local git tree?
David C. Rankin
drankinatty at suddenlinkmail.com
Wed Feb 29 19:13:40 EST 2012
Guys,
Is it possible to look outside of the chroot while building in an archroot
from the PKGBUILD to check for a local copy of a git tree? Logically, what I
want to do from inside the archroot is:
(1) check for an existing git source in the ${srcdir}
(if so, then use it)
(if not, then...)
(2) check for a local copy of the git tree outside chroot
(if found)
(3) change to that directory and update and copy to ${srcdir}
(else)
(4) clone new copy into ${srcdir}
Is this even possible? I have made an attempt at implementing this, but I
think I'm prevented from looking outside the chroot. Everything works except for
(2) above. The check for the local copy always fails forcing a new clone into
${srcdir} instead of simply being able to update the local tree and copy to
${srcdir}.
## GIT repository variables and location
_gitlocal="/home/david/tde/tde/main"
_gitname="${pkgname#*-}"
_gitdir="${_gitlocal}/dependencies/${_gitname}"
_giturl="$url"
_gitsfx="-git"
_prefix="/opt/tde"
build() {
cd ${srcdir}
<snip>
## update or clone from GIT
msg "Checking for existing GIT source: $_gitname"
if [ -d $_gitname ] ; then
msg "Using existing source in: ${srcdir}/${_gitname}"
else
msg "Looking for local GIT tree: $_gitdir"
if [ -d $_gitdir ] ; then
msg "Updating local tree: $_gitdir"
cd $_gitdir && {
git pull
git submodule init
git submodule update --recursive
git submodule foreach --recursive "git checkout master"
git submodule foreach --recursive "git pull"
}
cd ${srcdir} && cp -a "$_gitdir" .
msg "The local files are updated."
else
msg "Connecting to GIT server...."
msg "Cloning new source from: $url"
git clone --depth 1 $_giturl
fi
msg "GIT checkout done or server timeout"
fi
msg "Starting configure..."
# ./configure \
msg "Building - ${pkgname}..."
# make
}
The output from makechrootpkg is always the same even though the local copy of
the git tree is present:
==> Making package: tde-libart-lgpl 1.3.2.4-1 (Wed Feb 29 23:55:20 UTC 2012)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving Sources...
==> Extracting Sources...
==> Starting build()...
==> Checking for existing GIT source: libart-lgpl
==> Looking for local GIT tree: /home/david/tde/tde/main/dependencies/libart-lgpl
==> Connecting to GIT server....
==> Cloning new source from: http://scm.trinitydesktop.org/scm/git/libart-lgpl
Cloning into 'libart-lgpl'...
==> GIT checkout done or server timeout
==> Starting configure...
==> Building - tde-libart-lgpl...
==> Entering fakeroot environment...
==> Starting package()...
==> Packaging - tde-libart-lgpl-1.3.2.4
Possible? Or would the solution be to set the local copy of the git tree up
inside a apache (or whatever it takes) and pretend to run a local copy? Even
then, there would be no way to check for its existence from inside the chroot?
What say the experts?
--
David C. Rankin, J.D.,P.E.
More information about the arch-general
mailing list