From: Fabian Groffen Date: Mon, 2 Jul 2007 20:52:02 +0000 (-0000) Subject: Cleaned up configure, removed unnecessary checks (greatly speeds up) X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=db4f603ffdd9c7621ab57a34cb08063af67b643b;p=portage.git Cleaned up configure, removed unnecessary checks (greatly speeds up) Cleaned up users/groups stuff with configure arguments Removed python-missingos since we don't work with prehistoric pythons for ages any more (prehistoric starts at < 2.2.3) svn path=/main/branches/prefix/; revision=7130 --- diff --git a/acinclude.m4 b/acinclude.m4 index 499d068dd..bb73db5ac 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -42,11 +42,6 @@ AC_DEFUN([GENTOO_PATH_XCU_ID], [ AC_PATH_PROG([XCU_ID], [id], no, $1) - dnl is is there at all? - if test "$PYTHON" = "no" ; then - AC_MSG_ERROR([no python found in your path]) - fi - dnl does it support all the bells and whistles we need? AC_MSG_CHECKING([whether $XCU_ID is good enough]) for a in '' '-G' '-Gn' '-g' '-gn' '-gr' '-gnr' '-u' '-un' '-ur' '-unr' ; do diff --git a/cnf/make.globals b/cnf/make.globals index 0d79408e5..f3336c8fe 100644 --- a/cnf/make.globals +++ b/cnf/make.globals @@ -68,8 +68,7 @@ PORTAGE_GROUP="@portagegroup@" # Default ownership of installed files. PORTAGE_INST_UID="@rootuid@" -PORTAGE_INST_USER="@rootuser@" -PORTAGE_INST_GID="@wheelgid@" +PORTAGE_INST_GID="@rootgid@" # Default PATH for ebuild env DEFAULT_PATH="@DEFAULT_PATH@" @@ -83,7 +82,7 @@ PORTAGE_ELOG_SYSTEM="save_summary echo" PORTAGE_ELOG_MAILURI="@rootuser@" PORTAGE_ELOG_MAILSUBJECT="[portage] ebuild log for \${PACKAGE} on \${HOST}" -PORTAGE_ELOG_MAILFROM="portage" +PORTAGE_ELOG_MAILFROM="@portageuser@" # ***************************** # ** DO NOT EDIT THIS FILE ** diff --git a/configure.in b/configure.in index 6166a2f78..22b3defc8 100644 --- a/configure.in +++ b/configure.in @@ -46,32 +46,9 @@ GENTOO_PATH_GNUPROG(FIND, [find]) GENTOO_PATH_GNUPROG(XARGS, [xargs]) GENTOO_PATH_GNUPROG(GREP, [grep]) -dnl Checks for libraries. -dnl Replace `main' with a function in -lc: -AC_CHECK_LIB(c, main) -dnl Replace `main' with a function in -ldl: -AC_CHECK_LIB(dl, main) -dnl Replace `main' with a function in -lgcc: -AC_CHECK_LIB(gcc, main) -dnl Replace `main' with a function in -lpthread: -AC_CHECK_LIB(pthread, main) - dnl Checks for header files. -AC_HEADER_DIRENT AC_HEADER_STDC -AC_HEADER_SYS_WAIT -AC_CHECK_HEADERS(fcntl.h limits.h strings.h sys/file.h sys/time.h unistd.h getopt.h stdio.h) - -dnl Checks for typedefs, structures, and compiler characteristics. -AC_C_CONST -AC_TYPE_UID_T -AC_TYPE_MODE_T -AC_TYPE_SIZE_T - -dnl Checks for library functions. -AC_FUNC_ALLOCA -AC_TYPE_SIGNAL -AC_CHECK_FUNCS(getcwd mkdir regcomp rmdir strdup strerror strspn strstr) +AC_CHECK_HEADERS([string.h errno.h unistd.h stdio.h stdlib.h sys/stat.h sys/types.h]) AC_ARG_ENABLE(tbz2tool, AC_HELP_STRING([--enable-tbz2tool],[build tbz2tool, tool for creating binpkgs (default yes)]), @@ -82,16 +59,6 @@ AC_HELP_STRING([--enable-tbz2tool],[build tbz2tool, tool for creating binpkgs (d esac], [enable_tbz2tool=true]) -AC_ARG_ENABLE(missingos, -AC_HELP_STRING([--enable-missingos],[build compatibility missingos code for python 2.2 (default auto)]), -[case "${enableval}" in - yes) enable_missingos=true;; - no) enable_missingos=false;; - auto) enable_missingos=auto;; - *) AC_MSG_ERROR(bad value ${enableval} for --enable-missingos);; -esac], -[enable_missingos=auto]) - AC_ARG_ENABLE(just-compiled-sources, AC_HELP_STRING([--enable-just-compiled-sources],[install just the bytecode, not the sources (default no)]), [case "${enableval}" in @@ -101,30 +68,29 @@ AC_HELP_STRING([--enable-just-compiled-sources],[install just the bytecode, not esac], [enable_py_sources=true]) -AC_ARG_WITH(user, -AC_HELP_STRING([--with-user=me],[use user 'me' for portage to work as (default portage)]), +AC_ARG_WITH(portage-user, +AC_HELP_STRING([--with-portage-user=myuser],[use user 'myuser' as portage owner (default portage)]), [case "${withval}" in - ""|yes) AC_MSG_ERROR(bad value ${withval} for --with-user);; + ""|yes) AC_MSG_ERROR(bad value ${withval} for --with-portage-user);; *) portageuser="${withval}";; esac], [portageuser="portage"]) -AC_ARG_WITH(group, -AC_HELP_STRING([--with-group=mygroup],[use group 'mygroup' for portage to work as (default portage)]), +AC_ARG_WITH(portage-group, +AC_HELP_STRING([--with-portage-group=mygroup],[use group 'mygroup' as portage users group (default portage)]), [case "${withval}" in - ""|yes) AC_MSG_ERROR(bad value ${withval} for --with-group);; + ""|yes) AC_MSG_ERROR(bad value ${withval} for --with-portage-group);; *) portagegroup="${withval}";; esac], [portagegroup="portage"]) AC_ARG_WITH(rootuser, -AC_HELP_STRING([--with-rootuser=me],[declares 'me' as the portage owner (default root)]), +AC_HELP_STRING([--with-rootuser=myuser],[uses 'myuser' as owner of installed files (default is portage-user)]), [case "${withval}" in ""|yes) AC_MSG_ERROR(bad value ${withval} for --with-rootuser);; - *) rootuser=${withval} - rootuid=`id -u ${withval}`;; + *) rootuser=${withval};; esac], -[rootuser=root]) +[rootuser=${portageuser}]) AC_MSG_CHECKING([for user id of ${rootuser}]) dnl grab uid of rootuser @@ -135,6 +101,14 @@ then else AC_MSG_ERROR([error finding the user id of ${rootuser}]) fi +AC_MSG_CHECKING([for group id of ${rootuser}]) +rootgid=`${XCU_ID} -g ${rootuser}` +if [[ `echo ${rootgid} | ${EGREP} '^[[:digit:]]+$'` ]] +then + AC_MSG_RESULT([${rootgid}]) +else + AC_MSG_ERROR([error finding the group id of ${rootuser}]) +fi AC_ARG_WITH(offset-prefix, AC_HELP_STRING([--with-offset-prefix], [specify the installation prefix for all packages , defaults to /]), @@ -148,17 +122,6 @@ AC_HELP_STRING([--with-default-path], [specify additional PATHs available to the [DEFAULT_PATH="${DEFAULT_PATH}"]) -if test x$enable_missingos = xauto -then - pyver=[`python -c 'import sys;print sys.version[0:3]';`] - case ${pyver} in - 2.4) ;; - 2.3) ;; - 2.2) enable_missingos=true;; - *) AC_MSG_WARN([unable to determine python version, ${pyver}]);; - esac -fi - AC_MSG_CHECKING([for ARCH to be used]) dnl detect ARCH from target_cpu case "${target_cpu}" in @@ -178,7 +141,6 @@ AC_CONFIG_FILES([ subst-install ]) AC_CONFIG_FILES([ subst-install.vars.in ]) AC_CONFIG_FILES([ src/Makefile ]) AC_CONFIG_FILES([ man/Makefile ]) -AC_CONFIG_FILES([ src/python-missingos/Makefile ]) AC_CONFIG_FILES([ bin/Makefile ]) AC_CONFIG_FILES([ pym/Makefile ]) AC_CONFIG_FILES([ cnf/Makefile ]) @@ -187,14 +149,13 @@ AC_SUBST(portageuser) AC_SUBST(portagegroup) AC_SUBST(rootuser) AC_SUBST(rootuid) +AC_SUBST(rootgid) AC_SUBST(DOMAIN_PREFIX) AC_SUBST(DEFAULT_PATH) AC_SUBST(ARCH) AC_SUBST(PORTAGE_BASE,['${exec_prefix}/lib/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]) pt_configvars=`sed -n -e "/^ac_subst_vars='/,/'$/p" ${srcdir}/configure | sed -e "s/^ac_subst_vars='//" -e "s/'$//"` diff --git a/pym/portage/const_autotool.py b/pym/portage/const_autotool.py index 1e43355e7..9da998de3 100644 --- a/pym/portage/const_autotool.py +++ b/pym/portage/const_autotool.py @@ -1,11 +1,11 @@ -# Copyright: 2005 Gentoo Foundation -# Author(s): Brian Harring (ferringb@gentoo.org) -# License: GPL2 -# $Id:$ +# Copyright: 2005-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id: $ # all vars that are to wind up in portage_const must have their name listed in __all__ -__all__ = ["EPREFIX", "SYSCONFDIR", "PORTAGE_BASE", "portageuser", "portagegroup", "rootuser", "rootuid"] +__all__ = ["EPREFIX", "SYSCONFDIR", "PORTAGE_BASE", "portageuser", + "portagegroup", "rootuser", "rootuid"] from os import path @@ -15,4 +15,4 @@ PORTAGE_BASE=path.normpath("@PORTAGE_BASE@") portagegroup="@portagegroup@" portageuser="@portageuser@" rootuser="@rootuser@" -rootuid=int("@rootuid@") +rootuid=@rootuid@ diff --git a/pym/portage/data.py b/pym/portage/data.py index 5ff416b56..90c68c55e 100644 --- a/pym/portage/data.py +++ b/pym/portage/data.py @@ -69,7 +69,7 @@ secpass=0 uid=os.getuid() wheelgid=0 -if uid==int(rootuid): +if uid==rootuid: secpass=2 try: wheelgid=grp.getgrnam("wheel")[2] diff --git a/src/Makefile.am b/src/Makefile.am index b4ca0958b..4c7b06b47 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -6,10 +6,6 @@ if BUILD_TBZ2TOOL bin_PROGRAMS += tbz2tool endif -if BUILD_MISSINGOS -SUBDIRS += python-missingos -endif - tbz2tool_SOURCES = tbz2tool.c MAINTAINERCLEANFILES = Makefile.in diff --git a/src/python-missingos/ChangeLog b/src/python-missingos/ChangeLog deleted file mode 100644 index acec66bd8..000000000 --- a/src/python-missingos/ChangeLog +++ /dev/null @@ -1,16 +0,0 @@ -# $Id$ - -python-missingos ChangeLog -Jonathon D Nelson -2 April 2002 - - 2 April 2002 14:15 jnelson - * Add optional 'mode' parameter to mknod - * Change from missingosmodule to missingos. - * Add some __doc__ entries - * Remove stupid hack for Python 1.5.2 support, - 1.5.2 doesn't have Py_FileSystemDefaultEncoding anyway. - * Return description of error when mode not p,b,c,u in mknod - - 2 April 2002 12:10 jnelson - * Populate files diff --git a/src/python-missingos/Makefile.in b/src/python-missingos/Makefile.in deleted file mode 100644 index b126e4e79..000000000 --- a/src/python-missingos/Makefile.in +++ /dev/null @@ -1,45 +0,0 @@ -srcdir = @srcdir@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ - -INSTALL = @INSTALL@ - -DISTFILES = setup.py \ - Makefile.in \ - PKG-INFO \ - README \ - 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 ${srcdir}/$${x} $(distdir)/$${x}; \ - done - chmod 755 $(distdir)/setup.py - -distclean: clean-builddir - -clean maintainer-clean: -.PHONY: all install distdir builddir -.PHONY: distclean clean maintainer-clean clean-builddir - diff --git a/src/python-missingos/PKG-INFO b/src/python-missingos/PKG-INFO deleted file mode 100644 index cb8087f4c..000000000 --- a/src/python-missingos/PKG-INFO +++ /dev/null @@ -1,10 +0,0 @@ -Metadata-Version: 1.0 -Name: python-missingos -Version: 0.2 -Summary: UNKNOWN -Home-page: UNKNOWN -Author: Jonathon D Nelson -Author-email: jnelson@gentoo.org -License: UNKNOWN -Description: UNKNOWN -Platform: UNKNOWN diff --git a/src/python-missingos/README b/src/python-missingos/README deleted file mode 100644 index f776fed45..000000000 --- a/src/python-missingos/README +++ /dev/null @@ -1,15 +0,0 @@ -# $Id$ - -python-missingos -Jonathon D Nelson -2 April 2002 - -INTRO -===== -This module provides some missing file operations that don't -seem to be provided by the standard os and posix modules. -This list currently includes lchown and mknod. - -COPYRIGHT -========= -GPL diff --git a/src/python-missingos/missingos.c b/src/python-missingos/missingos.c deleted file mode 100644 index 4e4ad96ee..000000000 --- a/src/python-missingos/missingos.c +++ /dev/null @@ -1,120 +0,0 @@ -/* $Id$ */ - -#include "Python.h" - -#include -#include -#include -#include - -static char missingos_lchown__doc__[]; -static PyObject * missingos_lchown(PyObject *self, PyObject *args); -static char missingos_mknod__doc__[]; -static PyObject * missingos_mknod(PyObject *self, PyObject *args); - -static char missingos__doc__[] = "Provide some operations that\ - are missing from the standard os / posix modules."; - -static PyMethodDef missingos_methods[] = { - {"lchown", missingos_lchown, METH_VARARGS, missingos_lchown__doc__}, - {"mknod", missingos_mknod, METH_VARARGS, missingos_mknod__doc__}, - {NULL, NULL} /* sentinel */ -}; - -static PyObject * -posix_error_with_allocated_filename(char* name) -{ - PyObject *rc = PyErr_SetFromErrnoWithFilename(PyExc_OSError, name); - PyMem_Free(name); - return rc; -} - -static char missingos_lchown__doc__[] = -"lchown(path, uid, gid) -> None\n\ -Change the owner and group id of path to the numeric uid and gid."; - -static PyObject * -missingos_lchown(PyObject *self, PyObject *args) { - char *path = NULL; - int uid, gid; - int res; - if (!PyArg_ParseTuple(args, "etii:lchown", - Py_FileSystemDefaultEncoding, &path, - &uid, &gid)) - return NULL; - res = lchown(path, (uid_t) uid, (gid_t) gid); - if (res < 0) - return posix_error_with_allocated_filename(path); - PyMem_Free(path); - Py_INCREF(Py_None); - return Py_None; -} - -static char missingos_mknod__doc__[] = -"mknod(path, type, major, minor [, mode=0600 ]) -> None\n\ -Create a special file. Mode fixed at 0600.\ -Note that for type 'p' major and minor are ignored.\ -"; - -static PyObject * -missingos_mknod(PyObject *self, PyObject *args) { - char *path = NULL; - char *type = NULL; - int major = 0; - int minor = 0; - mode_t real_mode; - dev_t real_dev; - int mode = 0600; - - int res; - if (!PyArg_ParseTuple(args, "etsii|i:mknod", - Py_FileSystemDefaultEncoding, &path, - &type, &major, &minor, &mode)) - return NULL; - /* type can be *one* of b, c, u, p */ - /* major/minor are forbidden for p, reqd otherwise */ - if (!strcmp(type, "p")) { - /* pipe */ - if (major != 0 || minor != 0) { - return NULL; - } - real_mode = S_IFIFO; - major = 0; - minor = 0; - } else if (!strcmp(type, "b")) { - /* block */ - real_mode = S_IFBLK; - } else if (!strcmp(type, "c")) { - real_mode = S_IFCHR; - /* char */ - } else if (!strcmp(type, "u")) { - real_mode = S_IFCHR; - /* unbuffered char */ - } else { - /* error */ - PyErr_SetString(PyExc_ValueError, "type must be one of p,b,c,u"); - return NULL; - } - - real_mode |= mode; - real_dev = (major << 8) | minor; - - /* use mode to modify real_mode */ - - res = mknod(path, real_mode, real_dev); - if (res < 0) - return posix_error_with_allocated_filename(path); - PyMem_Free(path); - Py_INCREF(Py_None); - return Py_None; -} - - -DL_EXPORT(void) -initmissingos(void) { - PyObject *m; - - m = Py_InitModule4("missingos", missingos_methods, - missingos__doc__, (PyObject *)NULL, - PYTHON_API_VERSION); -} diff --git a/src/python-missingos/setup.cfg b/src/python-missingos/setup.cfg deleted file mode 100644 index d43ea60e0..000000000 --- a/src/python-missingos/setup.cfg +++ /dev/null @@ -1,8 +0,0 @@ -# python-missingos -# $Id$ - -[bdist_rpm] -release = 1 -doc_files = ChangeLog - README -python=python2 diff --git a/src/python-missingos/setup.py b/src/python-missingos/setup.py deleted file mode 100755 index f2d254beb..000000000 --- a/src/python-missingos/setup.py +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/python -# $Id$ - -from os import chdir, stat -from distutils.core import setup, Extension - -setup (# Distribution meta-data - name = "python-missingos", - version = "0.2", - description = "", - author = "Jonathon D Nelson", - author_email = "jnelson@gentoo.org", - license = "", - long_description = \ - '''''', - ext_modules = [ Extension( - "missingos", - ["missingos.c"], - libraries=[], - ) - ], - url = "", - ) -