From e4094b1efc41b57ffec01044f0023f8cca03e99e Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Sun, 26 Apr 2009 11:15:05 +0000 Subject: [PATCH] Revamped the entire buildsystem to become somewhat cleaner, at least more readable and faster. Still can't run make check after make, as we still only expand in the install phase. It needs excessive investments with incompatabilities with trunk to get this right. svn path=/main/branches/prefix/; revision=13398 --- Makefile.am | 39 +--------- bin/Makefile.in | 87 +++++++--------------- cnf/Makefile.in | 60 ++++++--------- cnf/dispatch-conf.conf | 2 +- cnf/make.conf | 26 +++---- cnf/make.globals | 14 ++-- cnf/sets.conf | 2 +- configure.in | 51 ++++--------- pym/Makefile.in | 62 ++++------------ pym/portage/const_autotool.py | 8 +- subst-install.in | 133 +++++++++++++++++----------------- tarball.sh | 3 +- 12 files changed, 176 insertions(+), 311 deletions(-) diff --git a/Makefile.am b/Makefile.am index d03a80acb..0a5f95427 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,41 +1,8 @@ +SHELL=@PORTAGE_BASH@ + SUBDIRS = src man bin pym cnf AUTOMAKE_OPTIONS = dist-bzip2 no-dist-gzip -BUILT_SOURCES = subst-install.vars - -subst-install: subst-install.vars - -# -# shells vary interpreting backslash within single quote: echo '\\' -# bourne shell: \ -# bash: \\ -# -subst-install.vars: subst-install.vars.in - @rm -f $@ \ - ; case `echo '\\'` in \ - \\) bss='\\\\\\\\';; \ - \\\\) bss='\\\\';; \ - *) echo "unknown shell escape behaviour"; exit 1 ;; \ - esac \ - ; { echo; sed -e "s,"'\\'"\",\",g" \ - -e "s,\\\\,$${bss},g" \ - -e "s,#,\\\\\\#,g" \ - -e "s,\","'\\'"\",g" \ - < subst-install.vars.in \ - ; echo "$@:" \ - ; echo " @echo 'creating \$$@'" \ - ; echo " @{ \\" \ - ; eval `grep '^all_configurevars=' $@.in` \ - ; for v in `echo $${all_configurevars}` all_configurevars \ - ; do echo " echo $${v}='\"\$$($${v})\"' ; \\" \ - ; done \ - ; echo " } > \$$@" \ - ; } \ - | ${MAKE} -f - $@ - -distclean-local: - rm -f subst-install.vars - -MAINTAINERCLEANFILES = subst-install.vars.in.in \ +MAINTAINERCLEANFILES = \ Makefile.in config.guess config.sub configure ltmain.sh aclocal.m4 diff --git a/bin/Makefile.in b/bin/Makefile.in index d066f062f..a832dcca9 100644 --- a/bin/Makefile.in +++ b/bin/Makefile.in @@ -3,20 +3,18 @@ exec_prefix = @exec_prefix@ sysconfdir = @sysconfdir@ libdir = @libdir@ -srcdir=@srcdir@ -top_builddir=@top_builddir@ +srcdir = @srcdir@ +top_builddir = @top_builddir@ -portageuser = "@portageuser@" -portagegroup = "@portagegroup@" +portageuser = @portageuser@ +portagegroup = @portagegroup@ PORTAGE_BIN = @PORTAGE_BASE@/bin -EBUILD_HELPER_BIN = $(PORTAGE_BIN)/ebuild-helpers LN_S = @LN_S@ INSTALL = @INSTALL@ -INSTALL_script = @INSTALL_PROGRAM@ -o "$(portageuser)" -g "$(portagegroup)" -m 755 -INSTALL_scriptsubst = $(SHELL) ${top_builddir}/subst-install --installcmd='${INSTALL_script}' +INSTALL_subst = $(top_builddir)/subst-install -user_binprogs = \ +usr_binprogs = \ ebuild \ egencache \ emerge \ @@ -24,7 +22,7 @@ user_binprogs = \ repoman \ xpak -user_sbinprogs = \ +usr_sbinprogs = \ archive-conf \ dispatch-conf \ emaint \ @@ -35,41 +33,39 @@ user_sbinprogs = \ quickpkg \ regenworld -ebuild_helperprogs = \ - ( cd ${srcdir}/ebuild-helpers && find . -name 'Makefile*' -prune \ - -o -name '.svn' -prune -o -type f -print ) - -list_sourcedir = \ - ( cd ${srcdir} && find . -name 'Makefile*' -prune \ - -o -name '.svn' -prune -o -name 'ebuild-helpers' -prune \ - -o -type f -print ) +list_sourcedir_dirs = \ + ( cd "$(srcdir)" && find . -name '.svn' -prune -o -type d -print ) all: install: $(INSTALL) -d -m 755 -o "$(portageuser)" -g "$(portagegroup)" $(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 - $(INSTALL) -d -m 755 -o "$(portageuser)" -g "$(portagegroup)" $(DESTDIR)$(EBUILD_HELPER_BIN) - $(ebuild_helperprogs) | while read f \ - ; do echo "$(INSTALL_scriptsubst) ${srcdir}/ebuild-helpers/$${f} $(DESTDIR)$(EBUILD_HELPER_BIN)/$${f}" \ - ; $(INSTALL_scriptsubst) ${srcdir}/ebuild-helpers/$${f} $(DESTDIR)$(EBUILD_HELPER_BIN)/$${f} \ - ; done + $(list_sourcedir_dirs) | while read f ; do \ + files=( ) ; \ + for t in "$(srcdir)/$${f}"/* ; do \ + [[ -d $${t} ]] && continue ; \ + [[ $${t} == Makefile* ]] && continue ; \ + files=( "$${files[@]}" "$${t}" ) ; \ + done ; \ + $(INSTALL) -d -m 755 \ + -o "$(portageuser)" -g "$(portagegroup)" \ + "$(DESTDIR)$(PORTAGE_BIN)/$${f}" && \ + $(INSTALL_subst) -m 755 \ + -o "$(portageuser)" -g "$(portagegroup)" \ + -t "$(DESTDIR)$(PORTAGE_BIN)/$${f}" \ + "$${files[@]}" ; \ + done $(INSTALL) -d -m 755 -o "$(portageuser)" -g "$(portagegroup)" $(DESTDIR)$(prefix)/bin cd $(DESTDIR)$(prefix)/bin \ - ; for p in $(user_binprogs) \ + ; for p in $(usr_binprogs) \ ; do test -f $(DESTDIR)$(PORTAGE_BIN)/$${p} \ || { echo "$(DESTDIR)$(PORTAGE_BIN)/$${p} does not exist" ; exit 1 ; } \ - ; echo "rm -f $(DESTDIR)$(prefix)/bin/$${p}" \ ; rm -f $(DESTDIR)$(prefix)/bin/$${p} \ - ; echo "$(LN_S) ../lib/portage/bin/$${p} $${p}" \ ; $(LN_S) ../lib/portage/bin/$${p} $${p} || exit 1 \ ; done $(INSTALL) -d -m 755 -o "$(portageuser)" -g "$(portagegroup)" $(DESTDIR)$(prefix)/sbin cd $(DESTDIR)$(prefix)/sbin \ - ; for p in $(user_sbinprogs) \ + ; for p in $(usr_sbinprogs) \ ; do test -f $(DESTDIR)$(PORTAGE_BIN)/$${p} \ || { echo "$(DESTDIR)$(PORTAGE_BIN)/$${p} does not exist" ; exit 1 ; } \ ; echo "rm -f $(DESTDIR)$(prefix)/sbin/$${p}" \ @@ -78,33 +74,4 @@ install: ; $(LN_S) ../lib/portage/bin/$${p} $${p} || exit 1 \ ; done -uninstall: - $(list_sourcedir) | while read f \ - ; do echo "rm -f $(DESTDIR)$(PORTAGE_BIN)/$${f}" \ - ; rm -f $(DESTDIR)$(PORTAGE_BIN)/$${f} \ - ; done - $(ebuild_helperprogs) | while read f \ - ; do echo "rm -f $(DESTDIR)$(EBUILD_HELPER_BIN)/$${f}" \ - ; rm -f $(DESTDIR)$(EBUILD_HELPER_BIN)/$${f} \ - ; done - for p in $(user_binprogs) \ - ; do echo "rm -f $(DESTDIR)$(prefix)/bin/$${p}" \ - ; rm -f $(DESTDIR)$(prefix)/bin/$${p} \ - ; done - for p in $(user_sbinprogs) \ - ; do echo "rm -f $(DESTDIR)$(prefix)/sbin/$${p}" \ - ; rm -f $(DESTDIR)$(prefix)/sbin/$${p} \ - ; done - -distdir: - $(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: all install distdir uninstall -.PHONY: dvi check installcheck -.PHONY: clean distclean maintainer-clean +.PHONY: all install diff --git a/cnf/Makefile.in b/cnf/Makefile.in index 24786b04d..ac69c727c 100644 --- a/cnf/Makefile.in +++ b/cnf/Makefile.in @@ -1,48 +1,36 @@ prefix = @prefix@ sysconfdir = @sysconfdir@ datadir = @datadir@ -DEFAULT_PATH = @DEFAULT_PATH@ -srcdir=@srcdir@ -top_builddir=@top_builddir@ +srcdir = @srcdir@ +top_builddir = @top_builddir@ +PORTAGE_CONF = $(datadir)/portage/config -portageuser = "@portageuser@" -portagegroup = "@portagegroup@" +portageuser = @portageuser@ +portagegroup = @portagegroup@ INSTALL = @INSTALL@ -INSTALL_cnf = @INSTALL_PROGRAM@ -o "$(portageuser)" -g "$(portagegroup)" -m 644 -INSTALL_cnfsubst = $(SHELL) ${top_builddir}/subst-install --installcmd='${INSTALL_cnf}' - -list_sourcedir = \ - ( cd ${srcdir} \ - && find . -name 'CVS' -prune \ - -o -name 'Makefile*' -prune \ - -o -name 'make.*' -type f -print \ - -o -name 'dispatch-conf.conf' -type f -print \ - -o -name 'etc-update.conf' -type f -print \ - ) +INSTALL_subst = ${top_builddir}/subst-install +LN_S = @LN_S@ all: install: - $(INSTALL) -d -m 755 -o "$(portageuser)" -g "$(portagegroup)" $(DESTDIR)$(datadir)/portage/config - $(INSTALL_cnfsubst) $(srcdir)/make.globals $(DESTDIR)$(datadir)/portage/config/make.globals - $(INSTALL_cnfsubst) $(srcdir)/make.conf $(DESTDIR)$(datadir)/portage/config/make.conf.example - $(INSTALL_cnfsubst) $(srcdir)/sets.conf $(DESTDIR)$(datadir)/portage/config/sets.conf + $(INSTALL) -d -m 755 -o "$(portageuser)" -g "$(portagegroup)" $(DESTDIR)$(PORTAGE_CONF) + $(INSTALL_subst) \ + -o "$(portageuser)" -g "$(portagegroup)" \ + -t "$(DESTDIR)$(PORTAGE_CONF)" \ + "$(srcdir)"/make.globals \ + "$(srcdir)"/sets.conf + $(INSTALL_subst) \ + -o "$(portageuser)" -g "$(portagegroup)" \ + "$(srcdir)"/make.conf "$(DESTDIR)$(PORTAGE_CONF)"/make.conf.example $(INSTALL) -d -m 755 -o "$(portageuser)" -g "$(portagegroup)" $(DESTDIR)$(sysconfdir) - $(INSTALL_cnfsubst) $(srcdir)/dispatch-conf.conf $(DESTDIR)$(sysconfdir)/dispatch-conf.conf - $(INSTALL_cnfsubst) $(srcdir)/etc-update.conf $(DESTDIR)$(sysconfdir)/etc-update.conf - ( cd $(DESTDIR)$(sysconfdir) && ln -s $(DESTDIR)$(datadir)/portage/config/make.globals ) - -distdir: - $(list_sourcedir) | while read f \ - ; do echo $(INSTALL_cnf) ${srcdir}/$${f} $(distdir)/$${f} \ - ; $(INSTALL_cnf) ${srcdir}/$${f} $(distdir)/$${f} \ - ; done - -all dvi check installcheck: -uninstall clean distclean maintainer-clean: - -.PHONY: all install distdir uninstall -.PHONY: dvi check installcheck -.PHONY: clean distclean maintainer-clean + $(INSTALL_subst) \ + -o "$(portageuser)" -g "$(portagegroup)" \ + -t "$(DESTDIR)$(sysconfdir)" \ + "$(srcdir)"/dispatch-conf.conf \ + "$(srcdir)"/etc-update.conf + ( cd $(DESTDIR)$(sysconfdir) && $(LN_S) $(DESTDIR)$(PORTAGE_CONF)/make.globals ) + +.PHONY: all install diff --git a/cnf/dispatch-conf.conf b/cnf/dispatch-conf.conf index b1a535dc9..ef35827ad 100644 --- a/cnf/dispatch-conf.conf +++ b/cnf/dispatch-conf.conf @@ -3,7 +3,7 @@ # # Directory to archive replaced configs -archive-dir=@DOMAIN_PREFIX@/etc/config-archive +archive-dir="@PORTAGE_EPREFIX@"/etc/config-archive # Use rcs for storing files in the archive directory? # (yes or no) diff --git a/cnf/make.conf b/cnf/make.conf index 252105f7c..61229ca9a 100644 --- a/cnf/make.conf +++ b/cnf/make.conf @@ -74,7 +74,7 @@ # PORTAGE_TMPDIR is the location portage will use for compilations and # temporary storage of data. This can get VERY large depending upon # the application being installed. -#PORTAGE_TMPDIR=@DOMAIN_PREFIX@/var/tmp +#PORTAGE_TMPDIR=@PORTAGE_EPREFIX@/var/tmp # # PORTDIR is the location of the portage tree. This is the repository # for all profile information as well as all ebuilds. If you change @@ -85,7 +85,7 @@ # will protect the default locations of DISTDIR and PKGDIR, but users are # warned that any other locations inside PORTDIR are not necessarily safe # for data storage. -#PORTDIR=@DOMAIN_PREFIX@/usr/portage +#PORTDIR=@PORTAGE_EPREFIX@/usr/portage # # DISTDIR is where all of the source code tarballs will be placed for # emerges. After packages are built, it is safe to remove any and @@ -95,14 +95,14 @@ # eclean from the gentoolkit package. Note that locations under # /usr/portage are not necessarily safe for data storage. See the # PORTDIR documentation for more information. -#DISTDIR=@DOMAIN_PREFIX@/usr/portage/distfiles +#DISTDIR=@PORTAGE_EPREFIX@/usr/portage/distfiles # # PKGDIR is the location of binary packages that you can have created # with '--buildpkg' or '-b' while emerging a package. This can get # up to several hundred megs, or even a few gigs. Note that # locations under /usr/portage are not necessarily safe for data # storage. See the PORTDIR documentation for more information. -#PKGDIR=@DOMAIN_PREFIX@/usr/portage/packages +#PKGDIR=@PORTAGE_EPREFIX@/usr/portage/packages # # PORT_LOGDIR is the location where portage will store all the logs it # creates from each individual merge. They are stored as @@ -115,7 +115,7 @@ # PORTDIR_OVERLAY is a directory where local ebuilds may be stored without # concern that they will be deleted by rsync updates. Default is not # defined. -#PORTDIR_OVERLAY=@DOMAIN_PREFIX@/usr/local/portage +#PORTDIR_OVERLAY=@PORTAGE_EPREFIX@/usr/local/portage # Fetching files # ============== @@ -130,20 +130,20 @@ # at \${DISTDIR}/\${FILE}. # # Default fetch command (5 tries, passive ftp for firewall compatibility) -#FETCHCOMMAND="@DOMAIN_PREFIX@/usr/bin/wget -t 5 -T 60 --passive-ftp -O \"\${DISTDIR}/\${FILE}\" \"\${URI}\"" -#RESUMECOMMAND="@DOMAIN_PREFIX@/usr/bin/wget -c -t 5 -T 60 --passive-ftp -O \"\${DISTDIR}/\${FILE}\" \"\${URI}\"" +#FETCHCOMMAND="@PORTAGE_EPREFIX@/usr/bin/wget -t 5 -T 60 --passive-ftp -O \"\${DISTDIR}/\${FILE}\" \"\${URI}\"" +#RESUMECOMMAND="@PORTAGE_EPREFIX@/usr/bin/wget -c -t 5 -T 60 --passive-ftp -O \"\${DISTDIR}/\${FILE}\" \"\${URI}\"" # # Using wget, ratelimiting downloads -#FETCHCOMMAND="@DOMAIN_PREFIX@/usr/bin/wget -t 5 -T 60 --passive-ftp --limit-rate=200k -O \"\${DISTDIR}/\${FILE}\" \"\${URI}\"" -#RESUMECOMMAND="@DOMAIN_PREFIX@/usr/bin/wget -c -t 5 -T 60 --passive-ftp --limit-rate=200k -O \"\${DISTDIR}/\${FILE}\" \"\${URI}\"" +#FETCHCOMMAND="@PORTAGE_EPREFIX@/usr/bin/wget -t 5 -T 60 --passive-ftp --limit-rate=200k -O \"\${DISTDIR}/\${FILE}\" \"\${URI}\"" +#RESUMECOMMAND="@PORTAGE_EPREFIX@/usr/bin/wget -c -t 5 -T 60 --passive-ftp --limit-rate=200k -O \"\${DISTDIR}/\${FILE}\" \"\${URI}\"" # # curl groks urls -#FETCHCOMMAND="@DOMAIN_PREFIX@/usr/bin/curl -f --connect-timeout 15 -# -o \${DISTDIR}/\${FILE} \${URI}" -#RESUMECOMMAND="@DOMAIN_PREFIX@/usr/bin/curl -f --connect-timeout 15 -# -C - -o \${DISTDIR}/\${FILE} \${URI}" +#FETCHCOMMAND="@PORTAGE_EPREFIX@/usr/bin/curl -f --connect-timeout 15 -# -o \${DISTDIR}/\${FILE} \${URI}" +#RESUMECOMMAND="@PORTAGE_EPREFIX@/usr/bin/curl -f --connect-timeout 15 -# -C - -o \${DISTDIR}/\${FILE} \${URI}" # # Lukemftp (BSD ftp): -#FETCHCOMMAND="@DOMAIN_PREFIX@/usr/bin/lukemftp -s -a -o \"\${DISTDIR}/\${FILE}\" \"\${URI}\"" -#RESUMECOMMAND="@DOMAIN_PREFIX@/usr/bin/lukemftp -s -a -R -o \"\${DISTDIR}/\${FILE}\" \"\${URI}\"" +#FETCHCOMMAND="@PORTAGE_EPREFIX@/usr/bin/lukemftp -s -a -o \"\${DISTDIR}/\${FILE}\" \"\${URI}\"" +#RESUMECOMMAND="@PORTAGE_EPREFIX@/usr/bin/lukemftp -s -a -R -o \"\${DISTDIR}/\${FILE}\" \"\${URI}\"" # # Portage uses GENTOO_MIRRORS to specify mirrors to use for source retrieval. # The list is a space separated list which is read left to right. If you use diff --git a/cnf/make.globals b/cnf/make.globals index c41c23a6b..d97e07945 100644 --- a/cnf/make.globals +++ b/cnf/make.globals @@ -25,17 +25,17 @@ SYNC="rsync://rsync.prefix.freens.org/gentoo-portage-prefix" GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo" # Repository Paths -PORTDIR=@DOMAIN_PREFIX@/usr/portage -DISTDIR=@DOMAIN_PREFIX@/usr/portage/distfiles -PKGDIR=@DOMAIN_PREFIX@/usr/portage/packages -RPMDIR=@DOMAIN_PREFIX@/usr/portage/rpm +PORTDIR="@PORTAGE_EPREFIX@/usr/portage" +DISTDIR="@PORTAGE_EPREFIX@/usr/portage/distfiles" +PKGDIR="@PORTAGE_EPREFIX@/usr/portage/packages" +RPMDIR="@PORTAGE_EPREFIX@/usr/portage/rpm" # Temporary build directory -PORTAGE_TMPDIR=@DOMAIN_PREFIX@/var/tmp +PORTAGE_TMPDIR="@PORTAGE_EPREFIX@/var/tmp" # Fetching command (5 tries, passive ftp for firewall compatibility) -FETCHCOMMAND="wget -t 5 -T 60 --passive-ftp -O \"\${DISTDIR}/\${FILE}\" \"\${URI}\"" -RESUMECOMMAND="wget -c -t 5 -T 60 --passive-ftp -O \"\${DISTDIR}/\${FILE}\" \"\${URI}\"" +FETCHCOMMAND="@PORTAGE_WGET@ -t 5 -T 60 --passive-ftp -O \"\${DISTDIR}/\${FILE}\" \"\${URI}\"" +RESUMECOMMAND="@PORTAGE_WGET@ -c -t 5 -T 60 --passive-ftp -O \"\${DISTDIR}/\${FILE}\" \"\${URI}\"" # Default user options FEATURES="distlocks fixpackages parallel-fetch protect-owned sandbox diff --git a/cnf/sets.conf b/cnf/sets.conf index 0be4827bc..66c132e8b 100644 --- a/cnf/sets.conf +++ b/cnf/sets.conf @@ -38,7 +38,7 @@ world-candidate = False [usersets] class = portage.sets.files.StaticFileSet multiset = true -directory = @DOMAIN_PREFIX@/etc/portage/sets +directory = @PORTAGE_EPREFIX@/etc/portage/sets # Set to rebuild all packages that need a preserved lib that only remains due # to FEATURES=preserve-libs diff --git a/configure.in b/configure.in index 7722592fc..e42b9a39b 100644 --- a/configure.in +++ b/configure.in @@ -17,10 +17,10 @@ AC_CANONICAL_TARGET AM_INIT_AUTOMAKE dnl Checks for programs. -dnl store clfags prior, otherwise it's not propagated. +dnl store cflags prior, otherwise it's not propagated. if test "x$CFLAGS" != "x" then -CFLAGS=$CFLAGS + CFLAGS=$CFLAGS fi AC_PREFIX_DEFAULT([/usr]) @@ -46,7 +46,6 @@ GENTOO_PATH_GNUPROG(PORTAGE_XARGS, [xargs]) GENTOO_PATH_GNUPROG(PORTAGE_GREP, [grep]) dnl Checks for header files. -AC_HEADER_STDC AC_CHECK_HEADERS([string.h strings.h errno.h unistd.h stdio.h stdlib.h]) AC_CHECK_HEADERS([sys/stat.h sys/types.h dirent.h sys/time.h alloca.h]) AC_CHECK_HEADERS([fcntl.h]) @@ -193,37 +192,25 @@ fi AC_ARG_WITH(offset-prefix, AC_HELP_STRING([--with-offset-prefix], [specify the installation prefix for all packages, defaults to an empty string]), - [DOMAIN_PREFIX=$withval], - [DOMAIN_PREFIX='']) + [PORTAGE_EPREFIX=$withval], + [PORTAGE_EPREFIX='']) -if test "x$DOMAIN_PREFIX" = "x" +if test "x$PORTAGE_EPREFIX" != "x" then - PORTAGE_EPREFIX='""' -else - PORTAGE_EPREFIX='path.normpath("'"$DOMAIN_PREFIX"'")' + PORTAGE_EPREFIX=`${PORTAGE_PYTHON} -c "import os; print os.path.normpath('$PORTAGE_EPREFIX')"` fi -DEFAULT_PATH="${DOMAIN_PREFIX}/usr/bin:${DOMAIN_PREFIX}/usr/sbin:${DOMAIN_PREFIX}/bin:${DOMAIN_PREFIX}/sbin:${prefix}/bin" +DEFAULT_PATH="${PORTAGE_EPREFIX}/usr/bin:${PORTAGE_EPREFIX}/usr/sbin:${PORTAGE_EPREFIX}/bin:${PORTAGE_EPREFIX}/sbin:${PORTAGE_EPREFIX}/bin" AC_ARG_WITH(default-path, AC_HELP_STRING([--with-default-path], [specify additional PATHs available to the portage build environment ]), [DEFAULT_PATH="${DEFAULT_PATH}":$withval], [DEFAULT_PATH="${DEFAULT_PATH}"]) -AC_CONFIG_FILES([ Makefile ]) -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([ bin/Makefile ]) -AC_CONFIG_FILES([ pym/Makefile ]) -AC_CONFIG_FILES([ cnf/Makefile ]) - AC_SUBST(portageuser) AC_SUBST(portagegroup) AC_SUBST(rootuser) AC_SUBST(rootuid) AC_SUBST(rootgid) -AC_SUBST(DOMAIN_PREFIX) AC_SUBST(PORTAGE_EPREFIX) AC_SUBST(DEFAULT_PATH) AC_SUBST(PORTAGE_BASE,['${exec_prefix}/lib/portage']) @@ -239,20 +226,14 @@ AC_SUBST(PORTAGE_FIND) AC_SUBST(PORTAGE_XARGS) AC_SUBST(PORTAGE_GREP) -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/'$//"` -{ - pt_all_configurevars= - for pt_configvar in ${pt_configvars} - do - echo "${pt_configvar}=@${pt_configvar}@" - pt_all_configurevars="${pt_all_configurevars} ${pt_configvar}" - done - - echo "all_configurevars='${pt_all_configurevars}'" - -} > subst-install.vars.in.in -$as_unset pt_configvar pt_configvars pt_all_configurevars -AC_MSG_RESULT([ok]) +AC_CONFIG_FILES([subst-install], [chmod +x subst-install]) +AC_CONFIG_FILES([ + Makefile + src/Makefile + man/Makefile + bin/Makefile + pym/Makefile + cnf/Makefile +]) AC_OUTPUT diff --git a/pym/Makefile.in b/pym/Makefile.in index 792beba99..227fe7dff 100644 --- a/pym/Makefile.in +++ b/pym/Makefile.in @@ -7,64 +7,28 @@ PYTHON = @PORTAGE_PYTHON@ srcdir=@srcdir@ top_builddir=@top_builddir@ -portageuser = "@portageuser@" -portagegroup = "@portagegroup@" +portageuser = @portageuser@ +portagegroup = @portagegroup@ PORTAGE_PYM = @PORTAGE_BASE@/pym INSTALL = @INSTALL@ -INSTALL_PY = @INSTALL_DATA@ -o "$(portageuser)" -g "$(portagegroup)" -INSTALL_PYsubst = $(SHELL) ${top_builddir}/subst-install --installcmd='${INSTALL_PY}' +INSTALL_subst = ${top_builddir}/subst-install list_sourcedir_dirs = \ - ( cd ${srcdir} && find . \ - -name 'CVS' -prune \ - -o -name '.svn' -prune \ - -o -type d -print ) - -list_sourcedir = \ - ( cd ${srcdir} && find . \ - -name 'CVS' -prune \ - -o -name '.\#*' -prune \ - -o -name '.svn' -prune \ - -o -type f -name '*.py' \ - -print ) + ( cd "$(srcdir)" && find . -name '.svn' -prune -o -type d -print ) all: install: $(INSTALL) -d -m 755 -o "$(portageuser)" -g "$(portagegroup)" $(DESTDIR)$(PORTAGE_PYM) - $(list_sourcedir_dirs) | while read f \ - ; do echo $(INSTALL) -d -m 755 -o "$(portageuser)" -g "$(portagegroup)" $(DESTDIR)$(PORTAGE_PYM)/$${f} \ - ; $(INSTALL) -d -m 755 -o "$(portageuser)" -g "$(portagegroup)" $(DESTDIR)$(PORTAGE_PYM)/$${f} \ - ; done - $(list_sourcedir) | while read f \ - ; do echo $(INSTALL_PYsubst) ${srcdir}/$${f} $(DESTDIR)$(PORTAGE_PYM)/$${f} \ - ; $(INSTALL_PYsubst) ${srcdir}/$${f} $(DESTDIR)$(PORTAGE_PYM)/$${f} \ - ; done - -distdir: - $(list_sourcedir_dirs) | while read f \ - ; do echo $(INSTALL) -d $(distdir)/$${f} \ - ; $(INSTALL) -d $(distdir)/$${f} \ - ; done - $(list_sourcedir) | while read f \ - ; do echo $(INSTALL) ${srcdir}/$${f} $(distdir)/$${f} \ - ; $(INSTALL) ${srcdir}/$${f} $(distdir)/$${f} \ + $(list_sourcedir_dirs) | while read f ; do \ + $(INSTALL) -d -m 755 \ + -o "$(portageuser)" -g "$(portagegroup)" \ + "$(DESTDIR)$(PORTAGE_PYM)/$${f}" && \ + $(INSTALL_subst) \ + -o "$(portageuser)" -g "$(portagegroup)" \ + -t "$(DESTDIR)$(PORTAGE_PYM)/$${f}" \ + "$(srcdir)/$${f}"/*.py \ ; 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 \ - ; echo rm -f $(DESTDIR)$(PORTAGE_PYM)/$${f}o \ - ; rm -f $(DESTDIR)$(PORTAGE_PYM)/$${f}o \ - ; done - -all dvi check installcheck: -clean distclean maintainer-clean: - -.PHONY: all install distdir -.PHONY: dvi check installcheck -.PHONY: clean distclean maintainer-clean +.PHONY: all install diff --git a/pym/portage/const_autotool.py b/pym/portage/const_autotool.py index 834382241..413d03515 100644 --- a/pym/portage/const_autotool.py +++ b/pym/portage/const_autotool.py @@ -10,10 +10,10 @@ __all__ = ["EPREFIX", "SYSCONFDIR", "DATADIR", "PORTAGE_BASE", from os import path -EPREFIX = @PORTAGE_EPREFIX@ -SYSCONFDIR = path.normpath("@sysconfdir@") -DATADIR = path.normpath("@datadir@") -PORTAGE_BASE = path.normpath("@PORTAGE_BASE@") +EPREFIX = "@PORTAGE_EPREFIX@" +SYSCONFDIR = "@sysconfdir@" +DATADIR = "@datadir@" +PORTAGE_BASE = "@PORTAGE_BASE@" portagegroup = "@portagegroup@" portageuser = "@portageuser@" diff --git a/subst-install.in b/subst-install.in index bc50065ed..d02968e0a 100644 --- a/subst-install.in +++ b/subst-install.in @@ -1,72 +1,71 @@ -#!@BASH@ - -SED="@PORTAGE_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="${TMPDIR-/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=,,'` +#!@PORTAGE_BASH@ + +# for expansion below we need some things to be defined +prefix="@prefix@" +exec_prefix="@exec_prefix@" + +# there are many ways to do this all dynamic, but we only care for raw +# speed here, so let configure fill in this list and be done with it +at='@' +sedexp=( + -e "s,${at}DEFAULT_PATH${at},@DEFAULT_PATH@,g" + -e "s,${at}EGREP${at},@EGREP@,g" + -e "s,${at}PORTAGE_BASE${at},@PORTAGE_BASE@,g" + -e "s,${at}PORTAGE_BASENAME${at},@PORTAGE_BASENAME@,g" + -e "s,${at}PORTAGE_BASH${at},@PORTAGE_BASH@,g" + -e "s,${at}PORTAGE_DIRNAME${at},@PORTAGE_DIRNAME@,g" + -e "s,${at}PORTAGE_EPREFIX${at},@PORTAGE_EPREFIX@,g" + -e "s,${at}PORTAGE_FIND${at},@PORTAGE_FIND@,g" + -e "s,${at}PORTAGE_GREP${at},@PORTAGE_GREP@,g" + -e "s,${at}PORTAGE_MV${at},@PORTAGE_MV@,g" + -e "s,${at}PORTAGE_PYTHON${at},@PORTAGE_PYTHON@,g" + -e "s,${at}PORTAGE_RM${at},@PORTAGE_RM@,g" + -e "s,${at}PORTAGE_SED${at},@PORTAGE_SED@,g" + -e "s,${at}PORTAGE_WGET${at},@PORTAGE_WGET@,g" + -e "s,${at}PORTAGE_XARGS${at},@PORTAGE_XARGS@,g" + -e "s,${at}datadir${at},@datadir@,g" + -e "s,${at}portagegroup${at},@portagegroup@,g" + -e "s,${at}portageuser${at},@portageuser@,g" + -e "s,${at}rootgid${at},@rootgid@,g" + -e "s,${at}rootuid${at},@rootuid@,g" + -e "s,${at}rootuser${at},@rootuser@,g" + -e "s,${at}sysconfdir${at},@sysconfdir@,g" +) + +sources=( ) +target= +args=( "$@" ) + +while [[ ${#@} != 0 ]] ; do + case "$1" in + -t) + [[ -n ${target} ]] && sources=( "${sources[@]}" "${target##*/}" ) + shift + target=":${1}" ;; - *) - substinstall_sources="${substinstall_sources} ${substinstall_target}" - substinstall_target="${substinstall_arg}" + -*) + shift + ;; + *) + if [[ -z ${target} ]] ; then + target="${1}" + elif [[ ${target} != ":"* ]] ; then + sources=( "${sources[@]}" "${target##*/}" ) + target="${1}" + else + sources=( "${sources[@]}" "${1##*/}" ) + fi ;; esac + shift 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 - -eval "${substinstall_installcmd} ${substinstall_tmpsources} ${substinstall_target}" - -substinstall_installrv=$? - -"${RM}" -rf "${substinstall_tmpdir}" - -exit ${substinstall_installrv} +target=${target#:} +INSTALL="@INSTALL@" +echo @INSTALL_DATA@ "${args[@]}" +if [[ ! -d ${target} ]] ; then + # either install will die, or it was just a single file copy + @INSTALL_DATA@ "${args[@]}" && sed -i "${sedexp[@]}" "${target}" +else + @INSTALL_DATA@ "${args[@]}" && sed -i "${sedexp[@]}" "${sources[@]/#/${target}/}" +fi diff --git a/tarball.sh b/tarball.sh index d0618e793..f3c9e9dbf 100755 --- a/tarball.sh +++ b/tarball.sh @@ -30,7 +30,6 @@ rsync -a --exclude='.svn' . ${DEST} sed -i -e '/^VERSION=/s/^.*$/VERSION="'${V}-prefix'"/' ${DEST}/pym/portage/__init__.py sed -i -e "s/##VERSION##/${V}-prefix/g" ${DEST}/man/emerge.1 sed -i -e "s/@version@/${V}/" ${DEST}/configure.in -touch ${DEST}/subst-install.vars.in.in cd ${DEST} find -name '*~' | xargs --no-run-if-empty rm -f @@ -40,7 +39,7 @@ cd $TMP rm -f ${PKG}-${V}/bin/emerge.py ${PKG}-${V}/bin/{pmake,sandbox} ${PKG}-${V}/{bin,pym}/'.#'* ${PKG}-${V}/{bin,pym}/*.{orig,diff} ${PKG}-${V}/{bin,pym}/*.py[oc] cd $TMP/${PKG}-${V} chmod a+x autogen.sh && ./autogen.sh || { echo "autogen failed!"; exit -1; }; -rm -f autogen.sh make-man-tarball.sh tabcheck.py tarball.sh ChangeLog.000 COPYING +rm -f autogen.sh tabcheck.py tarball.sh commit svnlogmsg.awk cd $TMP tar -jcf ${TMP}/${PKG}-${V}.tar.bz2 ${PKG}-${V} rm -R ${TMP}/${PKG}-${V} -- 2.26.2