Marius Mauch wrote:
On Mon, 28 Feb 2005 13:31:01 +0100
Michael Haubenwallner <[EMAIL PROTECTED]> wrote:
Hi all,
To be able to become portage a more general useable tool than just
within Gentoo Linux, it might be necessary to have it autotoolized
to say sth. like this:
# ./configure --prefix=/usr/local --with-managedroot=/my/packages
--with-portageuser=haubi --with-portagegroup=tools
BASH=/opt/bash/bin/bash PYTHON=/opt/sfw/python
# make
# make install
Portage-2.{1,2,5,whatever} (not released yet) is already using
autotools.
Based on portage-cvs as of today (2005/03/08) i've done my work again
now and got these things working:
1) 'make distcheck'. This includes the ability to install portage
into prefixes other than '/usr' - though it does not work yet there.
2) There's a script 'subst-install{,.in}' used to install files.
This allows portage to get run in non-/usr-prefixes and with
non-standard locations of bash/python/whatever with minimal changes.
3) The "--enable-just-compiled-sources" switch works.
The intention of 'subst-install' is to get keywords like @PORTAGE_BASE@,
@PYTHON@,@BASH@,@MANAGEDROOT@ substituted into py-files and scripts,
without renaming files to ".in", so the code-changes can be kept
minimal. Such changes might look like this:
-#!/usr/bin/python -O
+#! @PYTHON@ -O
import sys
-sys.path.insert(0, "/usr/lib/portage/pym")
+sys.path.insert(0, "@PORTAGE_BASE@/pym")
if os.environ.has_key("ROOT"):
root=os.environ["ROOT"]
if not len(root):
- root="/"
+ root="@MANAGEDROOT@"
elif root[-1]!="/":
root=root+"/"
else:
- root="/"
+ root="@MANAGEDROOT@"
Are there chances to get support for non-/usr-prefix and non-/-managed
root into portage-cvs, or will i have to create my own repository with
the overhead of importing from portage-cvs all the time ?
Thanks,
haubi
PS: The attached patchfile includes ChangeLog text.
--
Michael Haubenwallner SALOMON Automation GmbH
Forschung & Entwicklung A-8114 Friesach bei Graz
T +43 3127 200 308 F +43 3127 200 22
mailto:[EMAIL PROTECTED] http://www.salomon.at
No HTML/MIME please, see http://expita.com/nomime.html
Index: ChangeLog
===================================================================
RCS file: /cvsroot/portage/ChangeLog,v
retrieving revision 1.1.1.3
retrieving revision 1.2
diff -u -r1.1.1.3 -r1.2
--- ChangeLog 8 Mar 2005 07:45:18 -0000 1.1.1.3
+++ ChangeLog 8 Mar 2005 07:55:01 -0000 1.2
@@ -1,12 +1,21 @@
# ChangeLog for Portage; the Gentoo Linux ports system
# Copyright 1999-2005 Gentoo Foundation; Distributed under the GPL v2
-# $Id: ChangeLog,v 1.1.1.3 2005/03/08 07:45:18 haubi Exp $
+# $Id: ChangeLog,v 1.2 2005/03/08 07:55:01 haubi Exp $
MAJOR CHANGES in 2.0.51:
1. /var/cache/edb/virtuals is no longer used at all. It's calculated now.
2. /var/cache/edb/world is now /var/lib/portage/world.
3. /etc/portage/profile/virtuals is _USER_ configs only.
+ 08 Mar 2005; Michael Haubenwallner <[EMAIL PROTECTED]>
+ Makefile.am, autogen.sh, configure.in, subst-install.in, bin/Makefile.in,
+ pym/Makefile.in, src/python-missingos/Makefile.in:
+ Fixed to get 'make distcheck' work.
+ Added support for substituting autoconf-keywords within py-files and
+ shell-scripts while installing, using script 'subst-install', which
+ substitutes all the keywords found in configure-script. This is needed
+ to get portage work when installed into prefix other than /usr.
+
08 Mar 2005; Marius Mauch <[EMAIL PROTECTED]> pym/portage.py, pym/ebuild.py:
Fixing fetch restriction code. Replace references to PORTAGE_RESTRICT with
just RESTRICT and fix broken writemsg() calls.
Index: Makefile.am
===================================================================
RCS file: /cvsroot/portage/Makefile.am,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- Makefile.am 4 Mar 2005 10:29:00 -0000 1.1.1.1
+++ Makefile.am 8 Mar 2005 07:43:56 -0000 1.2
@@ -1,3 +1,27 @@
SUBDIRS = src man bin pym
AUTOMAKE_OPTIONS = dist-bzip2 no-dist-gzip
+
+BUILT_SOURCES = subst-install.vars
+
+subst-install: subst-install.vars
+
+subst-install.vars: subst-install.vars.in
+ @rm -f $@ \
+ ; { sed -e 's,[\\#],\\&,g' < subst-install.vars.in \
+ ; echo "$@:" \
+ ; echo " @echo 'creating \$$@'" \
+ ; echo " @{ \\" \
+ ; eval `grep '^all_configurevars=' [EMAIL PROTECTED] \
+ ; for v in $${all_configurevars} all_configurevars \
+ ; do echo " echo $${v}=\'\$$($${v})\' ; \\" \
+ ; done \
+ ; echo " } > \$$@" \
+ ; } \
+ | ${MAKE} -f - $@
+
+distclean-local:
+ rm -f subst-install.vars
+
+maintainer-clean-local:
+ rm -f subst-install.vars.in.in
Index: autogen.sh
===================================================================
RCS file: /cvsroot/portage/autogen.sh,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- autogen.sh 7 Mar 2005 10:46:31 -0000 1.1.1.1
+++ autogen.sh 8 Mar 2005 07:43:56 -0000 1.2
@@ -1,6 +1,7 @@
#!/bin/sh
-autoheader || exit 1
+test -f subst-install.vars.in.in || touch subst-install.vars.in.in
+#autoheader || exit 1
aclocal-1.8 || exit 1
libtoolize --automake -c -f || exit 1
autoconf || exit 1
Index: configure.in
===================================================================
RCS file: /cvsroot/portage/configure.in,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- configure.in 4 Mar 2005 10:29:00 -0000 1.1.1.1
+++ configure.in 8 Mar 2005 07:43:56 -0000 1.2
@@ -90,6 +90,8 @@
fi
AC_CONFIG_FILES([ Makefile ])
+AC_CONFIG_FILES([ subst-install ])
+AC_CONFIG_FILES([ subst-install.vars.in ])
AC_CONFIG_FILES([ src/Makefile ])
AC_CONFIG_FILES([ src/filter-env/Makefile ])
AC_CONFIG_FILES([ man/Makefile ])
@@ -97,9 +99,34 @@
AC_CONFIG_FILES([ bin/Makefile ])
AC_CONFIG_FILES([ pym/Makefile ])
-AC_SUBST(PORTAGE_BASE,"/usr/lib/portage")
+AC_SUBST(PORTAGE_BASE,['${libdir}/portage'])
AM_CONDITIONAL(INSTALL_PYTHON_SOURCES, test x$enable_py_sources = xtrue)
AM_CONDITIONAL(BUILD_TBZ2TOOL, test x$enable_tbz2tool = xtrue)
AM_CONDITIONAL(BUILD_MISSINGOS, test x$enable_missingos = xtrue)
AM_CONDITIONAL(BUILD_FILTER_ENV, test x$enable_filter_env = xtrue)
+
+AC_MSG_CHECKING([for a list of variables known by configure])
+rm -f subst-install.vars.in.in.tmp
+pt_configvars=`grep '^s,@' ${srcdir}/configure | sed -e 's|^s,@\([EMAIL PROTECTED]@]]*\)@.*$|\1|'`
+{
+ pt_all_configurevars=
+ for pt_configvar in ${pt_configvars}
+ do
+ echo "[EMAIL PROTECTED]@"
+ pt_all_configurevars="${pt_all_configurevars} ${pt_configvar}"
+ done
+
+ echo "all_configurevars='${pt_all_configurevars}'"
+
+} > subst-install.vars.in.in.tmp
+diff ${srcdir}/subst-install.vars.in.in subst-install.vars.in.in.tmp >/dev/null
+if [[ $? != 0 ]]
+then
+ rm -f ${srcdir}/subst-install.vars.in.in
+ cp subst-install.vars.in.in.tmp ${srcdir}/subst-install.vars.in.in
+fi
+rm -f subst-install.vars.in.in.tmp
+$as_unset pt_configvar pt_configvars pt_all_configurevars
+AC_MSG_RESULT([ok])
+
AC_OUTPUT
Index: subst-install.in
===================================================================
RCS file: subst-install.in
diff -N subst-install.in
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ subst-install.in 8 Mar 2005 07:43:56 -0000 1.1
@@ -0,0 +1,72 @@
+#! @SHELL@
+
+SED="@SED@"
+RM="@RM@"
+BASENAME="@BASENAME@"
+DIRNAME="@DIRNAME@"
+
+case "${SED}" in ""|@*@) SED=sed ;; esac
+case "${RM}" in ""|@*@) RM=rm ;; esac
+case "${BASENAME}" in ""|@*@) BASENAME=basename ;; esac
+case "${DIRNAME}" in ""|@*@) DIRNAME=dirname ;; esac
+
+mydir=`${DIRNAME} $0`
+myname=`${BASENAME} $0`
+mydir=`cd ${mydir};pwd`
+me=${mydir}/${myname}
+
+. ${mydir}/subst-install.vars
+
+substinstall_tmpdir=${TMP-/tmp}/${myname}.$$
+trap "${RM} -rf \${substinstall_tmpdir}" "0"
+mkdir -p ${substinstall_tmpdir} \
+|| { echo "cannot create directory ${substinstall_tmpdir}" >&2 ; exit 1 ; }
+
+substinstall_tmpsed=${substinstall_tmpdir}/sedscript
+
+{ for v in ${all_configurevars}
+ do
+ eval "echo \"s,@${v}@,\${${v}},g;\""
+ done
+} | ${SED} 's/^s,@/s@@/; s/@,/@@/; s/,g;$/@;/; s/[\\&,]/\\&/g;
+ s/^s@@/s,@/; s/@@/@,/; s/@;$/,g;/' > ${substinstall_tmpsed}
+
+substinstall_installcmd=
+substinstall_sources=
+substinstall_target=
+
+while [ "$1" ]
+do
+ substinstall_arg=$1
+ shift
+ case "${substinstall_arg}" in
+ --installcmd=*)
+ substinstall_installcmd=`echo ${substinstall_arg} | ${SED} -e 's,^--installcmd=,,'`
+ ;;
+ *)
+ substinstall_sources="${substinstall_sources} ${substinstall_target}"
+ substinstall_target=${substinstall_arg}
+ ;;
+ esac
+done
+
+[ -n "${substinstall_installcmd}" ] || { echo "missing --installcmd=" ; exit 1 ; }
+
+substinstall_tmpsources=
+
+for substinstall_s in ${substinstall_sources}
+do
+ [ -r ${substinstall_s} ] || { echo "cannot read ${substinstall_s}" >&2 ; exit 1 ; }
+ tmpsource=${substinstall_tmpdir}/`basename ${substinstall_s}`.subst
+ ${SED} -f ${substinstall_tmpsed} < ${substinstall_s} > ${tmpsource} \
+ || { echo "cannot sed from ${substinstall_s} to ${tmpsource}" >&2 ; exit 1 ; }
+ substinstall_tmpsources="${substinstall_tmpsources} ${tmpsource}"
+done
+
+${substinstall_installcmd} ${substinstall_tmpsources} ${substinstall_target}
+
+substinstall_installrv=$?
+
+${RM} -rf ${substinstall_tmpdir}
+
+exit ${substinstall_installrv}
Index: bin/Makefile.in
===================================================================
RCS file: /cvsroot/portage/bin/Makefile.in,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- bin/Makefile.in 4 Mar 2005 10:29:00 -0000 1.1.1.1
+++ bin/Makefile.in 8 Mar 2005 07:43:56 -0000 1.2
@@ -1,15 +1,47 @@
-PORTAGE_BASEDIR = @PORTAGE_BASE@
-INSTALL = @INSTALL@
-INSTALL_script = @INSTALL_PROGRAM@ -D -o 0 -g portage -m 755
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+libdir = @libdir@
+
[EMAIL PROTECTED]@
[EMAIL PROTECTED]@
+
+PORTAGE_BIN = @PORTAGE_BASE@/bin
+INSTALL = @INSTALL@
+INSTALL_script = @INSTALL_PROGRAM@ -D -o 0 -g portage -m 755
+INSTALL_scriptsubst = $(SHELL) ${top_builddir}/subst-install --installcmd='${INSTALL_script}'
+
+
+list_sourcedir = \
+ ( cd ${srcdir} \
+ && find . -name 'CVS' -prune \
+ -o -name 'Makefile*' -prune \
+ -o -type f -print \
+ )
all:
+
install:
- $(INSTALL) -d -m 755 -o 0-g portage $(DESTDIR)/$(PORTAGE_BASEDIR)/bin || exit 1
- find . -type f -maxdepth 1 -exec $(INSTALL_script) {} $(DESTDIR)/$(PORTAGE_BASEDIR)/bin/{} \; || exit 1
- rm $(DESTDIR)/$(PORTAGE_BASEDIR)/bin/Makefile* || exit 1
+ $(INSTALL) -d -m 755 -o 0 -g portage $(DESTDIR)$(PORTAGE_BIN)
+ $(list_sourcedir) | while read f \
+ ; do echo $(INSTALL_scriptsubst) ${srcdir}/$${f} $(DESTDIR)$(PORTAGE_BIN)/$${f} \
+ ; $(INSTALL_scriptsubst) ${srcdir}/$${f} $(DESTDIR)$(PORTAGE_BIN)/$${f} \
+ ; done
+
+uninstall:
+ $(list_sourcedir) | while read f \
+ ; do echo rm -f $(DESTDIR)$(PORTAGE_BIN)/$${f} \
+ ; rm -f $(DESTDIR)$(PORTAGE_BIN)/$${f} \
+ ; done
distdir:
- find . -type f -maxdepth 1 -exec $(INSTALL_script) {} $(distdir)/{} \;
-clean:
+ $(list_sourcedir) | while read f \
+ ; do echo $(INSTALL_script) ${srcdir}/$${f} $(distdir)/$${f} \
+ ; $(INSTALL_script) ${srcdir}/$${f} $(distdir)/$${f} \
+ ; done
+
+all dvi check installcheck:
+clean distclean maintainer-clean:
-.PHONY: distdir install clean
+.PHONY: all install distdir uninstall
+.PHONY: dvi check installcheck
+.PHONY: clean distclean maintainer-clean
Index: pym/Makefile.in
===================================================================
RCS file: /cvsroot/portage/pym/Makefile.in,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- pym/Makefile.in 4 Mar 2005 10:29:00 -0000 1.1.1.1
+++ pym/Makefile.in 8 Mar 2005 07:43:56 -0000 1.2
@@ -1,24 +1,51 @@
-INSTALL = @INSTALL@
-INSTALL_PY = @INSTALL_DATA@ -D -g portage -o 0
-PORTAGE_PYM = @PORTAGE_BASE@/pym
-DESTDIR = @DESTDIR@
-INSTALL_PYTHON_SOURCES = @INSTALL_PYTHON_SOURCES@
-
-compile:
- python -c 'import compileall; compileall.compile_dir(".")' || exit 1
-clean:
- find . -type f -name '*.pyc' -exec rm {} \;
-
-install: compile
- $(INSTALL) -d -m755 -o 0 -g portage $(DESTDIR)/$(PORTAGE_PYM) || exit 1
- if test -n "$(INSTALL_PYTHON_SOURCES)"; then \
- find . -type f -name '*.py' -exec $(INSTALL_PY) {} $(DESTDIR)/$(PORTAGE_PYM)/{} \; || exit 1; \
- fi
- find . -type f -name '*.pyc' -exec $(INSTALL_PY) {} $(DESTDIR)/$(PORTAGE_PYM)/{} \; || exit 1
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+libdir = @libdir@
-all: compile
[EMAIL PROTECTED]@
[EMAIL PROTECTED]@
+
+PORTAGE_PYM = @PORTAGE_BASE@/pym
+INSTALL = @INSTALL@
+INSTALL_PY = @INSTALL_DATA@ -D -o 0 -g portage
+INSTALL_PYsubst = $(SHELL) ${top_builddir}/subst-install --installcmd='${INSTALL_PY}'
+
+list_sourcedir = \
+ ( cd ${srcdir} \
+ && find . -name 'CVS' -prune \
+ -o -type f -name '*.py' -print \
+ )
+
+all:
+
+install:
+ $(INSTALL) -d -m755 -o 0 -g portage $(DESTDIR)$(PORTAGE_PYM)
+ $(list_sourcedir) | while read f \
+ ; do echo $(INSTALL_PYsubst) ${srcdir}/$${f} $(DESTDIR)$(PORTAGE_PYM)/$${f} \
+ ; $(INSTALL_PYsubst) ${srcdir}/$${f} $(DESTDIR)$(PORTAGE_PYM)/$${f} \
+ ; done
+ python -c 'import compileall; compileall.compile_dir("$(DESTDIR)$(PORTAGE_PYM)")'
[EMAIL PROTECTED]@ $(list_sourcedir) | while read f \
[EMAIL PROTECTED]@ ; do rm -f $(DESTDIR)$(PORTAGE_PYM)/$${f} \
[EMAIL PROTECTED]@ ; done
distdir:
- find -type f -name '*.py' -exec $(INSTALL) -D {} $(distdir)/{} \;
-
-.PHONY: distdir install clean
+ $(list_sourcedir) | while read f \
+ ; do echo $(INSTALL) -D ${srcdir}/$${f} $(distdir)/$${f} \
+ ; $(INSTALL) -D ${srcdir}/$${f} $(distdir)/$${f} \
+ ; done
+
+uninstall:
+ $(list_sourcedir) | while read f \
+ ; do echo rm -f $(DESTDIR)$(PORTAGE_PYM)/$${f} \
+ ; rm -f $(DESTDIR)$(PORTAGE_PYM)/$${f} \
+ ; echo rm -f $(DESTDIR)$(PORTAGE_PYM)/$${f}c \
+ ; rm -f $(DESTDIR)$(PORTAGE_PYM)/$${f}c \
+ ; done
+
+all dvi check installcheck:
+clean distclean maintainer-clean:
+
+.PHONY: all install distdir
+.PHONY: dvi check installcheck
+.PHONY: clean distclean maintainer-clean
Index: src/python-missingos/Makefile.in
===================================================================
RCS file: /cvsroot/portage/src/python-missingos/Makefile.in,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 Makefile.in
--- src/python-missingos/Makefile.in 4 Mar 2005 10:29:00 -0000 1.1.1.1
+++ src/python-missingos/Makefile.in 8 Mar 2005 08:23:55 -0000
@@ -1,10 +1,8 @@
-INSTALL = @INSTALL@
-
-all:
- setup.py build
+srcdir = @srcdir@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
-install:
- setup.py install --root $(DESTDIR)
+INSTALL = @INSTALL@
DISTFILES = setup.py \
Makefile.in \
@@ -13,13 +11,35 @@
missingos.c \
setup.cfg \
ChangeLog
+
+all: builddir
+ setup.py build
+
+builddir:
+ test "${abs_builddir}" != "${abs_srcdir}" \
+ && for x in $(DISTFILES) \
+ ; do $(INSTALL) ${abs_srcdir}/$${x} ${abs_builddir}/$${x} \
+ ; done
+
+clean-builddir:
+ if test "${abs_builddir}" != "${abs_srcdir}" \
+ ; then for x in $(DISTFILES) \
+ ; do rm -f ${abs_builddir}/$${x} \
+ ; done \
+ ; fi
+
+install: builddir
+ setup.py install --root $(DESTDIR)/
+
distdir:
for x in $(DISTFILES); do \
- $(INSTALL) -D $$x $(distdir)/$$x; \
+ $(INSTALL) -D ${srcdir}/$${x} $(distdir)/$${x}; \
done
chmod 755 $(distdir)/setup.py
+distclean: clean-builddir
-clean:
-.PHONY: clean install all distdir
+clean maintainer-clean:
+.PHONY: all install distdir builddir
+.PHONY: distclean clean maintainer-clean clean-builddir
--
[email protected] mailing list