From git at git.pioto.org Fri Aug 1 17:55:38 2008 From: git at git.pioto.org (git at git.pioto.org) Date: Fri, 1 Aug 2008 17:55:38 -0400 (EDT) Subject: [paludis-commits] paludis.git (master) -- 5df950c by David Leverton Message-ID: <20080801215538.2D5B51602B2@everglades.pioto.org> Module: paludis.git Branch: master Commit: 5df950c88f03804d3939f2a5beb2bd31967f24af URL: http://git.pioto.org/?p=paludis.git;a=commit;h=5df950c88f03804d3939f2a5beb2bd31967f24af Author: David Leverton Committer: David Leverton Date: Fri Aug 1 22:49:39 2008 +0100 ---- Add Mercurial syncer. ---- .gitignore | 5 ++ NEWS | 2 + paludis/syncers/Makefile.am | 11 ++++- paludis/syncers/dohg.in | 113 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 129 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 65a5533..f431cdf 100644 --- a/.gitignore +++ b/.gitignore @@ -301,6 +301,11 @@ man-* /paludis/syncers/dogit+https /paludis/syncers/dogit+rsync /paludis/syncers/dogit+ssh +/paludis/syncers/dohg+file +/paludis/syncers/dohg+http +/paludis/syncers/dohg+https +/paludis/syncers/dohg+ssh +/paludis/syncers/dohg+static-http /paludis/syncers/dorsync /paludis/syncers/dorsync+ssh /paludis/syncers/dosvn diff --git a/NEWS b/NEWS index 7d9e804..02b51ae 100644 --- a/NEWS +++ b/NEWS @@ -11,6 +11,8 @@ master: that the GNU versions are used. (This is not necessary on typical Linux systems; check --version if in doubt.) + * Paludis now supports syncing from Mercurial repositories. + 0.28.0: * Compilers without tr1 memory, type traits and functional support are no longer supported. This means you, gcc-3. diff --git a/paludis/syncers/Makefile.am b/paludis/syncers/Makefile.am index 4c23122..8a81a06 100644 --- a/paludis/syncers/Makefile.am +++ b/paludis/syncers/Makefile.am @@ -1,5 +1,5 @@ MAINTAINERCLEANFILES = Makefile.in -CLEANFILES = *~ .keep dobzr dobzr+aftp dobzr+file dobzr+ftp dobzr+http dobzr+https dobzr+sftp dobzr+ssh docvs+ext docvs+pserver docvs+ssh dodarcs+file dodarcs+http dodarcs+https dodarcs+ssh dofile dogit dogit+file dogit+http dogit+https dogit+rsync dogit+ssh dorsync dorsync+ssh dosvn dosvn+file dosvn+http dosvn+https dosvn+ssh dotar+file dotar+ftp dotar+http dotar+https +CLEANFILES = *~ .keep dobzr dobzr+aftp dobzr+file dobzr+ftp dobzr+http dobzr+https dobzr+sftp dobzr+ssh docvs+ext docvs+pserver docvs+ssh dodarcs+file dodarcs+http dodarcs+https dodarcs+ssh dofile dogit dogit+file dogit+http dogit+https dogit+rsync dogit+ssh dohg+file dohg+http dohg+https dohg+ssh dohg+static-http dorsync dorsync+ssh dosvn dosvn+file dosvn+http dosvn+https dosvn+ssh dotar+file dotar+ftp dotar+http dotar+https SUBDIRS = . .keep : @@ -30,6 +30,11 @@ libexecprog_SCRIPTS = \ dogit+https \ dogit+rsync \ dogit+ssh \ + dohg+file \ + dohg+http \ + dohg+https \ + dohg+ssh \ + dohg+static-http \ dorsync \ dorsync+ssh \ dosvn \ @@ -53,7 +58,7 @@ installusersyncersdir = $(datadir)/paludis/syncers installusersyncers_DATA = .keep TESTS = -EXTRA_DIST = $(libexecprog_SCRIPTS) dobzr.in docvs.in dodarcs.in dogit.in dorsync.in dosvn.in dotar.in +EXTRA_DIST = $(libexecprog_SCRIPTS) dobzr.in docvs.in dodarcs.in dogit.in dohg.in dorsync.in dosvn.in dotar.in check_SCRIPTS = check_PROGRAMS = $(TESTS) @@ -68,6 +73,8 @@ dodarcs+file dodarcs+http dodarcs+https dodarcs+ssh : dodarcs.in cat $? > $@ dogit dogit+file dogit+http dogit+https dogit+rsync dogit+ssh : dogit.in cat $? > $@ +dohg+file dohg+http dohg+https dohg+ssh dohg+static-http : dohg.in + cat $? > $@ dofile dorsync dorsync+ssh : dorsync.in cat $? > $@ dosvn dosvn+file dosvn+http dosvn+https dosvn+ssh : dosvn.in diff --git a/paludis/syncers/dohg.in b/paludis/syncers/dohg.in new file mode 100644 index 0000000..aad948c --- /dev/null +++ b/paludis/syncers/dohg.in @@ -0,0 +1,113 @@ +#!/usr/bin/env bash + +source "${PALUDIS_EBUILD_DIR}/echo_functions.bash" + +old_set=$- +set -a +for f in ${PALUDIS_BASHRC_FILES}; do + [[ -f "${f}" ]] && source "${f}" +done +[[ "${old_set}" == *a* ]] || set +a + +LOCAL= +REMOTE= + +HG_OPTIONS=( ) +HG_CLONE_OPTIONS=( ) +HG_PULL_OPTIONS=( ) +HG_UPDATE_OPTIONS=( ) + +while [[ $# -gt 0 ]]; do + case "${1}" in + + --hg-option=*) + HG_OPTIONS[${#HG_OPTIONS[@]}]="${1#*=}" + ;; + + --hg-clone-option=*) + HG_CLONE_OPTIONS[${#HG_CLONE_OPTIONS[@]}]="${1#*=}" + ;; + + --hg-pull-option=*) + HG_PULL_OPTIONS[${#HG_PULL_OPTIONS[@]}]="${1#*=}" + ;; + + --hg-update-option=*) + HG_UPDATE_OPTIONS[${#HG_UPDATE_OPTIONS[@]}]="${1#*=}" + ;; + + --help) + PROTO="${0##*/do}" + if [[ "${PROTO}" == hg+file ]]; then + echo " URL syntax: hg+file:///PATH[#BRANCH]" + elif [[ "${PROTO}" == hg+http || "${PROTO}" == hg+https ]]; then + echo " URL syntax: ${PROTO}://[USERNAME@]SERVER/PATH[#BRANCH]" + elif [[ "${PROTO}" == hg+ssh ]]; then + echo " URL syntax: hg+ssh://[USERNAME@]SERVER[:PORT]/PATH[#BRANCH]" + elif [[ "${PROTO}" == hg+static-http ]]; then + echo " URL syntax: hg+static-http://SERVER[:PORT]/PATH[#BRANCH]" + else + ewarn "URL syntax for ${PROTO} is unknown. This script will likely not work with the ${PROTO} protocol" + fi + + echo " Options:" + echo " --hg-option=OPTION Pass OPTION to hg as a global option" + echo " --hg-clone-option=OPTION Pass OPTION to hg clone" + echo " --hg-pull-option=OPTION Pass OPTION to hg pull" + echo " --hg-update-option=OPTION Pass OPTION to hg update" + exit 0 + ;; + + --*) + ewarn "${0}: unknown option '${1%%=*}'" + ;; + + *) + if [[ -z "${LOCAL}" ]]; then + LOCAL="${1}" + elif [[ -z "${REMOTE}" ]]; then + REMOTE="${1}" + else + eerror "${0}: extra argument '${1}'" + exit 1 + fi + ;; + + esac + shift +done + +if [[ -z "${LOCAL}" ]]; then + eerror "${0}: unspecified local repository directory" + exit 1 +elif [[ -z "${REMOTE}" ]]; then + eerror "${0}: unspecified remote repository URL" + exit 1 +fi + +REMOTE="${REMOTE#hg+}" + +if [[ -d "${LOCAL}" && ! -d "${LOCAL}/.hg" ]]; then + eerror "'${LOCAL}' exists but it is not a Mercurial repository" + exit 1 +fi + +if [[ -d "${LOCAL}" ]]; then + cd "${LOCAL}" + OLD_REMOTE="$(${HG_WRAPPER} hg "${HG_OPTIONS[@]}" paths default)" + if [[ "${OLD_REMOTE}" != "${REMOTE}" ]]; then + if ! sed -i -e '/^\[paths\]$/,/^\[/s,^default = .*,default = '"${REMOTE//,/\\,}," .hg/hgrc; then + eerror "${0}: could not switch from '${OLD_REMOTE}' to '${REMOTE}'" + exit 1 + fi + fi + cd - >/dev/null +fi + +if [[ -d "${LOCAL}/.hg" ]]; then + cd "${LOCAL}" && ${HG_WRAPPER} hg "${HG_OPTIONS[@]}" pull "${HG_PULL_OPTIONS[@]}" && \ + ${HG_WRAPPER} hg "${HG_OPTIONS[@]}" update "${HG_UPDATE_OPTIONS[@]}" +else + ${HG_WRAPPER} hg "${HG_OPTIONS[@]}" clone "${HG_CLONE_OPTIONS[@]}" "${REMOTE}" "${LOCAL}" +fi + --- From git at git.pioto.org Fri Aug 1 18:03:43 2008 From: git at git.pioto.org (git at git.pioto.org) Date: Fri, 1 Aug 2008 18:03:43 -0400 (EDT) Subject: [paludis-commits] paludis.git (master) -- 8db95c4 by David Leverton Message-ID: <20080801220343.5B6F41602B2@everglades.pioto.org> Module: paludis.git Branch: master Commit: 8db95c4c1b9797d088ba7105b13a266d04928e19 URL: http://git.pioto.org/?p=paludis.git;a=commit;h=8db95c4c1b9797d088ba7105b13a266d04928e19 Author: David Leverton Committer: David Leverton Date: Fri Aug 1 23:03:16 2008 +0100 ---- (ruby) Update layman->paludis sync URL mapping code from playboy.rb ---- ruby/demos/playman.rb | 74 ++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 64 insertions(+), 10 deletions(-) diff --git a/ruby/demos/playman.rb b/ruby/demos/playman.rb index 5486736..751c4f0 100755 --- a/ruby/demos/playman.rb +++ b/ruby/demos/playman.rb @@ -147,22 +147,76 @@ end layman_srcs = Hash.new laymanxml.elements.each("layman/overlay") do | element | - name = element.attribute("name").to_s - src = element.attribute("src").to_s - type = element.attribute("type").to_s + name = element.attribute("name").to_s + src = element.attribute("src").to_s + type = element.attribute("type").to_s + subpath = element.attribute("subpath").to_s case type - when 'svn' - if src.include? "http://" or src.include? "https://" - src = "svn+" + src + + when 'bzr' + case src + when %r{^bzr(?:\+ssh)?://} + #src = src + when %r{^[a-z+]+://} + src = "bzr+#{src}" + else + src = "bzr+file://#{src}" + end + + when 'cvs' + case src + when /^:ext:(.*)$/ + src = "cvs+ext://#$1:#{subpath}" + when /^:pserver:(.*)$/ + src = "cvs+pserver://#$1:#{subpath}" end + when 'darcs' - src = "darcs+" + src + case src + when %r{^[a-z+]+://} + src = "darcs+#{src}" + when /..:/ + src = "darcs+ssh://#{src}" + else + src = "darcs+file://#{src}" + end + when 'git' - if src.include? "http://" - src = "git+" + src + case src + when %r{^git(?:\+ssh)?://} + #src = src + when %r{^[a-z+]+://} + src = "git+#{src}" + else + src = "git+file://#{src}" end + + when 'mercurial' + src = "hg+#{src}" + + when 'rsync' + case src + when %r{^rsync://} + #src = src + when /..:/ + src = "rsync+ssh://#{src}" + else + src = "file://#{src}" + end + + when 'svn' + case src + when %r{^svn(?:\+ssh)?://} + #src = src + when %r{^[a-z+]+://} + src = "svn+#{src}" + else + src = "svn+file://#{src}" + end + when 'tar' - src = "tar+" + src + src = "tar+#{src}" if subpath == "" + end layman_srcs[name]=src end --- From git at git.pioto.org Fri Aug 1 18:05:29 2008 From: git at git.pioto.org (git at git.pioto.org) Date: Fri, 1 Aug 2008 18:05:29 -0400 (EDT) Subject: [paludis-commits] paludis.git (0.28) -- 1c86b43 by David Leverton Message-ID: <20080801220529.03EEF1602B3@everglades.pioto.org> Module: paludis.git Branch: 0.28 Commit: 1c86b43723c80c6b052a9883710d46609b1ce609 URL: http://git.pioto.org/?p=paludis.git;a=commit;h=1c86b43723c80c6b052a9883710d46609b1ce609 Author: David Leverton Committer: David Leverton Date: Fri Aug 1 22:49:39 2008 +0100 ---- Add Mercurial syncer. ---- .gitignore | 5 ++ NEWS | 2 + paludis/syncers/Makefile.am | 11 ++++- paludis/syncers/dohg.in | 113 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 129 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 65a5533..f431cdf 100644 --- a/.gitignore +++ b/.gitignore @@ -301,6 +301,11 @@ man-* /paludis/syncers/dogit+https /paludis/syncers/dogit+rsync /paludis/syncers/dogit+ssh +/paludis/syncers/dohg+file +/paludis/syncers/dohg+http +/paludis/syncers/dohg+https +/paludis/syncers/dohg+ssh +/paludis/syncers/dohg+static-http /paludis/syncers/dorsync /paludis/syncers/dorsync+ssh /paludis/syncers/dosvn diff --git a/NEWS b/NEWS index 9c1e31e..7cd02f8 100644 --- a/NEWS +++ b/NEWS @@ -8,6 +8,8 @@ of every change, see the ChangeLog. * Work around compiler issues that eventually lead to unpack dying when it shouldn't on certain EAPIs on certain systems (ticket:622). + * Paludis now supports syncing from Mercurial repositories. + 0.28.0: * Compilers without tr1 memory, type traits and functional support are no longer supported. This means you, gcc-3. diff --git a/paludis/syncers/Makefile.am b/paludis/syncers/Makefile.am index 4c23122..8a81a06 100644 --- a/paludis/syncers/Makefile.am +++ b/paludis/syncers/Makefile.am @@ -1,5 +1,5 @@ MAINTAINERCLEANFILES = Makefile.in -CLEANFILES = *~ .keep dobzr dobzr+aftp dobzr+file dobzr+ftp dobzr+http dobzr+https dobzr+sftp dobzr+ssh docvs+ext docvs+pserver docvs+ssh dodarcs+file dodarcs+http dodarcs+https dodarcs+ssh dofile dogit dogit+file dogit+http dogit+https dogit+rsync dogit+ssh dorsync dorsync+ssh dosvn dosvn+file dosvn+http dosvn+https dosvn+ssh dotar+file dotar+ftp dotar+http dotar+https +CLEANFILES = *~ .keep dobzr dobzr+aftp dobzr+file dobzr+ftp dobzr+http dobzr+https dobzr+sftp dobzr+ssh docvs+ext docvs+pserver docvs+ssh dodarcs+file dodarcs+http dodarcs+https dodarcs+ssh dofile dogit dogit+file dogit+http dogit+https dogit+rsync dogit+ssh dohg+file dohg+http dohg+https dohg+ssh dohg+static-http dorsync dorsync+ssh dosvn dosvn+file dosvn+http dosvn+https dosvn+ssh dotar+file dotar+ftp dotar+http dotar+https SUBDIRS = . .keep : @@ -30,6 +30,11 @@ libexecprog_SCRIPTS = \ dogit+https \ dogit+rsync \ dogit+ssh \ + dohg+file \ + dohg+http \ + dohg+https \ + dohg+ssh \ + dohg+static-http \ dorsync \ dorsync+ssh \ dosvn \ @@ -53,7 +58,7 @@ installusersyncersdir = $(datadir)/paludis/syncers installusersyncers_DATA = .keep TESTS = -EXTRA_DIST = $(libexecprog_SCRIPTS) dobzr.in docvs.in dodarcs.in dogit.in dorsync.in dosvn.in dotar.in +EXTRA_DIST = $(libexecprog_SCRIPTS) dobzr.in docvs.in dodarcs.in dogit.in dohg.in dorsync.in dosvn.in dotar.in check_SCRIPTS = check_PROGRAMS = $(TESTS) @@ -68,6 +73,8 @@ dodarcs+file dodarcs+http dodarcs+https dodarcs+ssh : dodarcs.in cat $? > $@ dogit dogit+file dogit+http dogit+https dogit+rsync dogit+ssh : dogit.in cat $? > $@ +dohg+file dohg+http dohg+https dohg+ssh dohg+static-http : dohg.in + cat $? > $@ dofile dorsync dorsync+ssh : dorsync.in cat $? > $@ dosvn dosvn+file dosvn+http dosvn+https dosvn+ssh : dosvn.in diff --git a/paludis/syncers/dohg.in b/paludis/syncers/dohg.in new file mode 100644 index 0000000..aad948c --- /dev/null +++ b/paludis/syncers/dohg.in @@ -0,0 +1,113 @@ +#!/usr/bin/env bash + +source "${PALUDIS_EBUILD_DIR}/echo_functions.bash" + +old_set=$- +set -a +for f in ${PALUDIS_BASHRC_FILES}; do + [[ -f "${f}" ]] && source "${f}" +done +[[ "${old_set}" == *a* ]] || set +a + +LOCAL= +REMOTE= + +HG_OPTIONS=( ) +HG_CLONE_OPTIONS=( ) +HG_PULL_OPTIONS=( ) +HG_UPDATE_OPTIONS=( ) + +while [[ $# -gt 0 ]]; do + case "${1}" in + + --hg-option=*) + HG_OPTIONS[${#HG_OPTIONS[@]}]="${1#*=}" + ;; + + --hg-clone-option=*) + HG_CLONE_OPTIONS[${#HG_CLONE_OPTIONS[@]}]="${1#*=}" + ;; + + --hg-pull-option=*) + HG_PULL_OPTIONS[${#HG_PULL_OPTIONS[@]}]="${1#*=}" + ;; + + --hg-update-option=*) + HG_UPDATE_OPTIONS[${#HG_UPDATE_OPTIONS[@]}]="${1#*=}" + ;; + + --help) + PROTO="${0##*/do}" + if [[ "${PROTO}" == hg+file ]]; then + echo " URL syntax: hg+file:///PATH[#BRANCH]" + elif [[ "${PROTO}" == hg+http || "${PROTO}" == hg+https ]]; then + echo " URL syntax: ${PROTO}://[USERNAME@]SERVER/PATH[#BRANCH]" + elif [[ "${PROTO}" == hg+ssh ]]; then + echo " URL syntax: hg+ssh://[USERNAME@]SERVER[:PORT]/PATH[#BRANCH]" + elif [[ "${PROTO}" == hg+static-http ]]; then + echo " URL syntax: hg+static-http://SERVER[:PORT]/PATH[#BRANCH]" + else + ewarn "URL syntax for ${PROTO} is unknown. This script will likely not work with the ${PROTO} protocol" + fi + + echo " Options:" + echo " --hg-option=OPTION Pass OPTION to hg as a global option" + echo " --hg-clone-option=OPTION Pass OPTION to hg clone" + echo " --hg-pull-option=OPTION Pass OPTION to hg pull" + echo " --hg-update-option=OPTION Pass OPTION to hg update" + exit 0 + ;; + + --*) + ewarn "${0}: unknown option '${1%%=*}'" + ;; + + *) + if [[ -z "${LOCAL}" ]]; then + LOCAL="${1}" + elif [[ -z "${REMOTE}" ]]; then + REMOTE="${1}" + else + eerror "${0}: extra argument '${1}'" + exit 1 + fi + ;; + + esac + shift +done + +if [[ -z "${LOCAL}" ]]; then + eerror "${0}: unspecified local repository directory" + exit 1 +elif [[ -z "${REMOTE}" ]]; then + eerror "${0}: unspecified remote repository URL" + exit 1 +fi + +REMOTE="${REMOTE#hg+}" + +if [[ -d "${LOCAL}" && ! -d "${LOCAL}/.hg" ]]; then + eerror "'${LOCAL}' exists but it is not a Mercurial repository" + exit 1 +fi + +if [[ -d "${LOCAL}" ]]; then + cd "${LOCAL}" + OLD_REMOTE="$(${HG_WRAPPER} hg "${HG_OPTIONS[@]}" paths default)" + if [[ "${OLD_REMOTE}" != "${REMOTE}" ]]; then + if ! sed -i -e '/^\[paths\]$/,/^\[/s,^default = .*,default = '"${REMOTE//,/\\,}," .hg/hgrc; then + eerror "${0}: could not switch from '${OLD_REMOTE}' to '${REMOTE}'" + exit 1 + fi + fi + cd - >/dev/null +fi + +if [[ -d "${LOCAL}/.hg" ]]; then + cd "${LOCAL}" && ${HG_WRAPPER} hg "${HG_OPTIONS[@]}" pull "${HG_PULL_OPTIONS[@]}" && \ + ${HG_WRAPPER} hg "${HG_OPTIONS[@]}" update "${HG_UPDATE_OPTIONS[@]}" +else + ${HG_WRAPPER} hg "${HG_OPTIONS[@]}" clone "${HG_CLONE_OPTIONS[@]}" "${REMOTE}" "${LOCAL}" +fi + --- From git at git.pioto.org Fri Aug 1 18:05:29 2008 From: git at git.pioto.org (git at git.pioto.org) Date: Fri, 1 Aug 2008 18:05:29 -0400 (EDT) Subject: [paludis-commits] paludis.git (0.28) -- 27b8be4 by David Leverton Message-ID: <20080801220529.694D71602B3@everglades.pioto.org> Module: paludis.git Branch: 0.28 Commit: 27b8be4618afee95fcad12e71627229a8aa77f05 URL: http://git.pioto.org/?p=paludis.git;a=commit;h=27b8be4618afee95fcad12e71627229a8aa77f05 Author: David Leverton Committer: David Leverton Date: Fri Aug 1 23:03:16 2008 +0100 ---- (ruby) Update layman->paludis sync URL mapping code from playboy.rb ---- ruby/demos/playman.rb | 74 ++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 64 insertions(+), 10 deletions(-) diff --git a/ruby/demos/playman.rb b/ruby/demos/playman.rb index e92aaff..cd48792 100755 --- a/ruby/demos/playman.rb +++ b/ruby/demos/playman.rb @@ -161,22 +161,76 @@ end layman_srcs = Hash.new laymanxml.elements.each("layman/overlay") do | element | - name = element.attribute("name").to_s - src = element.attribute("src").to_s - type = element.attribute("type").to_s + name = element.attribute("name").to_s + src = element.attribute("src").to_s + type = element.attribute("type").to_s + subpath = element.attribute("subpath").to_s case type - when 'svn' - if src.include? "http://" or src.include? "https://" - src = "svn+" + src + + when 'bzr' + case src + when %r{^bzr(?:\+ssh)?://} + #src = src + when %r{^[a-z+]+://} + src = "bzr+#{src}" + else + src = "bzr+file://#{src}" + end + + when 'cvs' + case src + when /^:ext:(.*)$/ + src = "cvs+ext://#$1:#{subpath}" + when /^:pserver:(.*)$/ + src = "cvs+pserver://#$1:#{subpath}" end + when 'darcs' - src = "darcs+" + src + case src + when %r{^[a-z+]+://} + src = "darcs+#{src}" + when /..:/ + src = "darcs+ssh://#{src}" + else + src = "darcs+file://#{src}" + end + when 'git' - if src.include? "http://" - src = "git+" + src + case src + when %r{^git(?:\+ssh)?://} + #src = src + when %r{^[a-z+]+://} + src = "git+#{src}" + else + src = "git+file://#{src}" end + + when 'mercurial' + src = "hg+#{src}" + + when 'rsync' + case src + when %r{^rsync://} + #src = src + when /..:/ + src = "rsync+ssh://#{src}" + else + src = "file://#{src}" + end + + when 'svn' + case src + when %r{^svn(?:\+ssh)?://} + #src = src + when %r{^[a-z+]+://} + src = "svn+#{src}" + else + src = "svn+file://#{src}" + end + when 'tar' - src = "tar+" + src + src = "tar+#{src}" if subpath == "" + end layman_srcs[name]=src end --- From git at git.pioto.org Fri Aug 1 18:06:19 2008 From: git at git.pioto.org (git at git.pioto.org) Date: Fri, 1 Aug 2008 18:06:19 -0400 (EDT) Subject: [paludis-commits] paludis.git (0.28) -- d3be131 by David Leverton Message-ID: <20080801220619.B216D1602B2@everglades.pioto.org> Module: paludis.git Branch: 0.28 Commit: d3be13164240f261cddff8d4260c2d01367c6dd0 URL: http://git.pioto.org/?p=paludis.git;a=commit;h=d3be13164240f261cddff8d4260c2d01367c6dd0 Author: David Leverton Committer: David Leverton Date: Fri Aug 1 23:06:11 2008 +0100 ---- Fix NEWS. ---- NEWS | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 7cd02f8..03ef950 100644 --- a/NEWS +++ b/NEWS @@ -4,12 +4,13 @@ News for Paludis This file lists the major changes between versions. For a more detailed list of every change, see the ChangeLog. +0.28.2: + * Paludis now supports syncing from Mercurial repositories. + 0.28.1: * Work around compiler issues that eventually lead to unpack dying when it shouldn't on certain EAPIs on certain systems (ticket:622). - * Paludis now supports syncing from Mercurial repositories. - 0.28.0: * Compilers without tr1 memory, type traits and functional support are no longer supported. This means you, gcc-3. --- From git at git.pioto.org Fri Aug 1 18:53:46 2008 From: git at git.pioto.org (git at git.pioto.org) Date: Fri, 1 Aug 2008 18:53:46 -0400 (EDT) Subject: [paludis-commits] paludis.git (master) -- abd4c4d by David Leverton Message-ID: <20080801225346.53BAD1602B3@everglades.pioto.org> Module: paludis.git Branch: master Commit: abd4c4d73087be66653eb227ea583e15ff02738a URL: http://git.pioto.org/?p=paludis.git;a=commit;h=abd4c4d73087be66653eb227ea583e15ff02738a Author: David Leverton Committer: David Leverton Date: Fri Aug 1 23:52:57 2008 +0100 ---- (ruby) Update copyright and version number on playman.rb ---- ruby/demos/playman.rb | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ruby/demos/playman.rb b/ruby/demos/playman.rb index 751c4f0..6180b92 100755 --- a/ruby/demos/playman.rb +++ b/ruby/demos/playman.rb @@ -2,7 +2,8 @@ # vim: set sw=4 sts=4 et tw=80 ft=ruby : # $Id$ -# Copyright (c) 2007 Mike Kelly +# Copyright (c) 2007 Mike Kelly +# Copyright (c) 2007, 2008 David Leverton # # This file is part of the Paludis package manager. Paludis is free software; # you can redistribute it and/or modify it under the terms of the GNU General @@ -30,7 +31,7 @@ include Paludis Log.instance.log_level = LogLevel::Warning Log.instance.program_name = $0 -version = "0.1.5" +version = "0.1.6" laymanglobal_url = URI.parse('http://www.gentoo.org/proj/en/overlays/layman-global.txt') opts = GetoptLong.new( --- From git at git.pioto.org Fri Aug 1 18:53:52 2008 From: git at git.pioto.org (git at git.pioto.org) Date: Fri, 1 Aug 2008 18:53:52 -0400 (EDT) Subject: [paludis-commits] paludis.git (0.28) -- 730cf12 by David Leverton Message-ID: <20080801225352.6A9E51602B4@everglades.pioto.org> Module: paludis.git Branch: 0.28 Commit: 730cf12b714ef8a23df756f2ecf27a52f2d041da URL: http://git.pioto.org/?p=paludis.git;a=commit;h=730cf12b714ef8a23df756f2ecf27a52f2d041da Author: David Leverton Committer: David Leverton Date: Fri Aug 1 23:52:57 2008 +0100 ---- (ruby) Update copyright and version number on playman.rb ---- ruby/demos/playman.rb | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ruby/demos/playman.rb b/ruby/demos/playman.rb index cd48792..3b63bd6 100755 --- a/ruby/demos/playman.rb +++ b/ruby/demos/playman.rb @@ -2,7 +2,8 @@ # vim: set sw=4 sts=4 et tw=80 ft=ruby : # $Id$ -# Copyright (c) 2007 Mike Kelly +# Copyright (c) 2007 Mike Kelly +# Copyright (c) 2007, 2008 David Leverton # # This file is part of the Paludis package manager. Paludis is free software; # you can redistribute it and/or modify it under the terms of the GNU General @@ -30,7 +31,7 @@ include Paludis Log.instance.log_level = LogLevel::Warning Log.instance.program_name = $0 -version = "0.1.5" +version = "0.1.6" laymanglobal_url = URI.parse('http://www.gentoo.org/proj/en/overlays/layman-global.txt') opts = GetoptLong.new( --- From git at git.pioto.org Sat Aug 2 23:31:29 2008 From: git at git.pioto.org (git at git.pioto.org) Date: Sat, 2 Aug 2008 23:31:29 -0400 (EDT) Subject: [paludis-commits] paludis.git (master) -- af9e861 by Ingmar Vanhassel Message-ID: <20080803033129.3B7881602BA@everglades.pioto.org> Module: paludis.git Branch: master Commit: af9e861a4f454ac4ed37feab8d1237047c2dc3ac URL: http://git.pioto.org/?p=paludis.git;a=commit;h=af9e861a4f454ac4ed37feab8d1237047c2dc3ac Author: Ingmar Vanhassel Committer: Ingmar Vanhassel Date: Sat Aug 2 19:01:21 2008 +0200 ---- Add is_nonfatal(), allowing exlib functions to check whether they're called via nonfatal(). ---- .../e/ebuild/exheres-0/build_functions.bash | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/paludis/repositories/e/ebuild/exheres-0/build_functions.bash b/paludis/repositories/e/ebuild/exheres-0/build_functions.bash index 7a01ace..0af313d 100644 --- a/paludis/repositories/e/ebuild/exheres-0/build_functions.bash +++ b/paludis/repositories/e/ebuild/exheres-0/build_functions.bash @@ -29,6 +29,11 @@ nonfatal() PALUDIS_FAILURE_IS_FATAL= PALUDIS_FAILURE_IS_NONFATAL=yes "${@}" } +is_nonfatal() +{ + [[ -n ${PALUDIS_FAILURE_IS_NONFATAL} ]] +} + expatch() { if [[ "${EBUILD_PHASE}" != "prepare" ]] ; then --- From git at git.pioto.org Sun Aug 3 13:56:37 2008 From: git at git.pioto.org (git at git.pioto.org) Date: Sun, 3 Aug 2008 13:56:37 -0400 (EDT) Subject: [paludis-commits] paludis.git (master) -- 6450119 by David Leverton Message-ID: <20080803175637.21C1A1602C0@everglades.pioto.org> Module: paludis.git Branch: master Commit: 6450119094d0c6dbc68162a815d5a5d8e500ce00 URL: http://git.pioto.org/?p=paludis.git;a=commit;h=6450119094d0c6dbc68162a815d5a5d8e500ce00 Author: David Leverton Committer: David Leverton Date: Sun Aug 3 16:51:54 2008 +0100 ---- Kill epdso_strict_star_operator. ---- paludis/elike_package_dep_spec.cc | 13 +++++-------- paludis/elike_package_dep_spec.se | 1 - paludis/repositories/e/eapis/exheres-0.conf | 2 +- paludis/repositories/fake/dep_parser.cc | 4 ++-- paludis/user_dep_spec.cc | 2 +- 5 files changed, 9 insertions(+), 13 deletions(-) diff --git a/paludis/elike_package_dep_spec.cc b/paludis/elike_package_dep_spec.cc index 49c8d07..e668b28 100644 --- a/paludis/elike_package_dep_spec.cc +++ b/paludis/elike_package_dep_spec.cc @@ -303,14 +303,11 @@ paludis::elike_get_remove_version_operator(std::string & s, const ELikePackageDe { if (op != vo_equal) { - if (! options[epdso_strict_star_operator]) - { - if (options[epdso_strict_parsing]) - throw PackageDepSpecError("Package dep spec uses * with operator '" + stringify(op) + "'"); - else - Log::get_instance()->message("e.package_dep_spec.bad_operator", ll_qa, lc_context) - << "Package dep spec uses * with operator '" << op << "', pretending it uses the equals operator instead"; - } + if (options[epdso_strict_parsing]) + throw PackageDepSpecError("Package dep spec uses * with operator '" + stringify(op) + "'"); + else + Log::get_instance()->message("e.package_dep_spec.bad_operator", ll_qa, lc_context) + << "Package dep spec uses * with operator '" << op << "', pretending it uses the equals operator instead"; } op = vo_equal_star; s.erase(s.length() - 1); diff --git a/paludis/elike_package_dep_spec.se b/paludis/elike_package_dep_spec.se index e116489..ba0e4d6 100644 --- a/paludis/elike_package_dep_spec.se +++ b/paludis/elike_package_dep_spec.se @@ -12,7 +12,6 @@ make_enum_ELikePackageDepSpecOption() key epdso_allow_repository_deps "Allow ::repo deps" key epdso_allow_square_bracket_deps "Allow [use] and [opver] deps" key epdso_allow_tilde_greater_deps "Allow ~> deps" - key epdso_strict_star_operator "* with an operator other than = is an error" key epdso_strict_parsing "Error rather than warn for violations" } diff --git a/paludis/repositories/e/eapis/exheres-0.conf b/paludis/repositories/e/eapis/exheres-0.conf index 3b72c37..af0c1bc 100644 --- a/paludis/repositories/e/eapis/exheres-0.conf +++ b/paludis/repositories/e/eapis/exheres-0.conf @@ -6,7 +6,7 @@ exported_name = exheres-0 can_be_pbin = true package_dep_spec_parse_options = allow_slot_deps allow_square_bracket_deps \ - allow_tilde_greater_deps strict_star_operator strict_parsing \ + allow_tilde_greater_deps strict_parsing \ allow_slot_equal_deps allow_slot_star_deps dependency_spec_tree_parse_options = disallow_any_use uri_supports_arrow iuse_flag_parse_options = strict_parsing diff --git a/paludis/repositories/fake/dep_parser.cc b/paludis/repositories/fake/dep_parser.cc index 1bbff76..389b40b 100644 --- a/paludis/repositories/fake/dep_parser.cc +++ b/paludis/repositories/fake/dep_parser.cc @@ -62,7 +62,7 @@ namespace { PackageDepSpec p(parse_elike_package_dep_spec(s, ELikePackageDepSpecOptions() + epdso_allow_slot_deps + epdso_allow_slot_star_deps + epdso_allow_slot_equal_deps + epdso_allow_repository_deps - + epdso_allow_square_bracket_deps + epdso_allow_tilde_greater_deps + epdso_strict_star_operator + + epdso_allow_square_bracket_deps + epdso_allow_tilde_greater_deps + epdso_strict_parsing, id)); (*h.begin())[k::add_handler()](make_shared_ptr(new TreeLeaf(make_shared_ptr(new PackageDepSpec(p))))); } @@ -77,7 +77,7 @@ namespace make_shared_ptr(new PackageDepSpec(parse_elike_package_dep_spec(s.substr(1), ELikePackageDepSpecOptions() + epdso_allow_slot_deps + epdso_allow_slot_star_deps + epdso_allow_slot_equal_deps + epdso_allow_repository_deps - + epdso_allow_square_bracket_deps + epdso_allow_tilde_greater_deps + epdso_strict_star_operator + + epdso_allow_square_bracket_deps + epdso_allow_tilde_greater_deps + epdso_strict_parsing, id))))); (*h.begin())[k::add_handler()](make_shared_ptr(new TreeLeaf(b))); } diff --git a/paludis/user_dep_spec.cc b/paludis/user_dep_spec.cc index 78823b2..ddde181 100644 --- a/paludis/user_dep_spec.cc +++ b/paludis/user_dep_spec.cc @@ -241,7 +241,7 @@ paludis::parse_user_package_dep_spec(const std::string & ss, const Environment * (k::remove_trailing_slot_if_exists(), std::tr1::bind(&user_remove_trailing_slot_if_exists, _1, _2)) (k::has_version_operator(), std::tr1::bind(&elike_has_version_operator, _1, std::tr1::cref(had_bracket_version_requirements))) (k::get_remove_version_operator(), std::tr1::bind(&elike_get_remove_version_operator, _1, - ELikePackageDepSpecOptions() + epdso_allow_tilde_greater_deps + epdso_strict_star_operator)) + ELikePackageDepSpecOptions() + epdso_allow_tilde_greater_deps)) (k::get_remove_trailing_version(), std::tr1::bind(&elike_get_remove_trailing_version, _1)) (k::add_version_requirement(), std::tr1::bind(&elike_add_version_requirement, _1, _2, _3)) (k::add_package_requirement(), std::tr1::bind(&user_add_package_requirement, _1, _2, env, options, filter)) --- From git at git.pioto.org Sun Aug 3 13:56:37 2008 From: git at git.pioto.org (git at git.pioto.org) Date: Sun, 3 Aug 2008 13:56:37 -0400 (EDT) Subject: [paludis-commits] paludis.git (master) -- e16130d by David Leverton Message-ID: <20080803175637.48E011602C1@everglades.pioto.org> Module: paludis.git Branch: master Commit: e16130d830bf6911e21b6c2d9c1e2d9672d2fcf0 URL: http://git.pioto.org/?p=paludis.git;a=commit;h=e16130d830bf6911e21b6c2d9c1e2d9672d2fcf0 Author: David Leverton Committer: David Leverton Date: Sun Aug 3 16:53:22 2008 +0100 ---- Support Portage-syntax for USE deps. ---- paludis/elike_package_dep_spec.cc | 39 +++- paludis/elike_package_dep_spec.se | 4 +- paludis/elike_use_requirement.cc | 268 ++++++++++++++++---------- paludis/elike_use_requirement.se | 1 + paludis/repositories/e/eapis/exheres-0.conf | 4 +- paludis/repositories/e/eapis/kdebuild-1.conf | 2 +- paludis/repositories/e/eapis/paludis-1.conf | 2 +- paludis/repositories/fake/dep_parser.cc | 4 +- 8 files changed, 207 insertions(+), 117 deletions(-) diff --git a/paludis/elike_package_dep_spec.cc b/paludis/elike_package_dep_spec.cc index e668b28..5d0cb96 100644 --- a/paludis/elike_package_dep_spec.cc +++ b/paludis/elike_package_dep_spec.cc @@ -92,15 +92,6 @@ paludis::elike_remove_trailing_square_bracket_if_exists(std::string & s, Partial if (std::string::npos == ((use_group_p = s.rfind('[')))) return false; - if (! options[epdso_allow_square_bracket_deps]) - { - if (options[epdso_strict_parsing]) - throw PackageDepSpecError("[] dependencies not safe for use here"); - else - Log::get_instance()->message("e.package_dep_spec.brackets_not_allowed", ll_warning, lc_context) - << "[] dependencies not safe for use here"; - } - if (s.at(s.length() - 1) != ']') throw PackageDepSpecError("Mismatched []"); @@ -116,6 +107,15 @@ paludis::elike_remove_trailing_square_bracket_if_exists(std::string & s, Partial case '>': case '=': case '~': + if (! options[epdso_allow_ranged_deps]) + { + if (options[epdso_strict_parsing]) + throw PackageDepSpecError("Version range dependencies not safe for use here"); + else + Log::get_instance()->message("e.package_dep_spec.range_not_allowed", ll_warning, lc_context) + << "Version range dependencies not safe for use here"; + } + { char needed_mode(0); @@ -178,11 +178,32 @@ paludis::elike_remove_trailing_square_bracket_if_exists(std::string & s, Partial break; default: + if (options[epdso_allow_use_deps_portage] || ! options[epdso_allow_use_deps]) + { + if (! options[epdso_allow_use_deps_portage]) + { + if (options[epdso_strict_parsing]) + throw PackageDepSpecError("USE dependencies not safe for use here"); + else + { + // Use Portage syntax for this case, as it + // should only happen in Gentoo EAPIs + Log::get_instance()->message("e.package_dep_spec.use_not_allowed", ll_warning, lc_context) + << "USE dependencies not safe for use here"; + } + } + + std::tr1::shared_ptr req(parse_elike_use_requirement(flag, + id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax)); + result.additional_requirement(req); + } + else { std::tr1::shared_ptr req(parse_elike_use_requirement(flag, id, ELikeUseRequirementOptions() + euro_allow_self_deps)); result.additional_requirement(req); } + break; }; diff --git a/paludis/elike_package_dep_spec.se b/paludis/elike_package_dep_spec.se index ba0e4d6..212f5b8 100644 --- a/paludis/elike_package_dep_spec.se +++ b/paludis/elike_package_dep_spec.se @@ -10,7 +10,9 @@ make_enum_ELikePackageDepSpecOption() key epdso_allow_slot_star_deps "Allow :* slot deps" key epdso_allow_slot_equal_deps "Allow := and :=blah slot deps" key epdso_allow_repository_deps "Allow ::repo deps" - key epdso_allow_square_bracket_deps "Allow [use] and [opver] deps" + key epdso_allow_use_deps "Allow [use] deps" + key epdso_allow_use_deps_portage "Allow [use] deps with Portage syntax" + key epdso_allow_ranged_deps "Allow [op version] deps" key epdso_allow_tilde_greater_deps "Allow ~> deps" key epdso_strict_parsing "Error rather than warn for violations" } diff --git a/paludis/elike_use_requirement.cc b/paludis/elike_use_requirement.cc index 5b9c34b..41a5c66 100644 --- a/paludis/elike_use_requirement.cc +++ b/paludis/elike_use_requirement.cc @@ -21,37 +21,41 @@ #include #include #include +#include +#include #include #include #include +#include +#include using namespace paludis; namespace { - class PALUDIS_VISIBLE UseRequirement : - public AdditionalPackageDepSpecRequirement + class PALUDIS_VISIBLE UseRequirement { private: - const std::string _raw; const UseFlagName _name; public: - UseRequirement(const std::string &, const UseFlagName &); + UseRequirement(const UseFlagName &); + virtual ~UseRequirement() { } const UseFlagName flag() const PALUDIS_ATTRIBUTE((warn_unused_result)) { return _name; } - virtual const std::string as_raw_string() const PALUDIS_ATTRIBUTE((warn_unused_result)); + virtual bool requirement_met(const Environment * const, const PackageID &) const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0; + virtual const std::string as_human_string() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0; }; class PALUDIS_VISIBLE EnabledUseRequirement : public UseRequirement { public: - EnabledUseRequirement(const std::string &, const UseFlagName &); + EnabledUseRequirement(const UseFlagName &); ~EnabledUseRequirement(); virtual bool requirement_met(const Environment * const, const PackageID &) const PALUDIS_ATTRIBUTE((warn_unused_result)); @@ -62,7 +66,7 @@ namespace public UseRequirement { public: - DisabledUseRequirement(const std::string &, const UseFlagName &); + DisabledUseRequirement(const UseFlagName &); ~DisabledUseRequirement(); virtual bool requirement_met(const Environment * const, const PackageID &) const PALUDIS_ATTRIBUTE((warn_unused_result)); @@ -76,7 +80,7 @@ namespace const std::tr1::shared_ptr _id; public: - ConditionalUseRequirement(const std::string &, const UseFlagName &, const std::tr1::shared_ptr &); + ConditionalUseRequirement(const UseFlagName &, const std::tr1::shared_ptr &); ~ConditionalUseRequirement(); const std::tr1::shared_ptr package_id() const PALUDIS_ATTRIBUTE((warn_unused_result)) @@ -89,7 +93,7 @@ namespace public ConditionalUseRequirement { public: - IfMineThenUseRequirement(const std::string &, const UseFlagName &, const std::tr1::shared_ptr &); + IfMineThenUseRequirement(const UseFlagName &, const std::tr1::shared_ptr &); ~IfMineThenUseRequirement(); virtual bool requirement_met(const Environment * const, const PackageID &) const PALUDIS_ATTRIBUTE((warn_unused_result)); @@ -100,7 +104,7 @@ namespace public ConditionalUseRequirement { public: - IfNotMineThenUseRequirement(const std::string &, const UseFlagName &, const std::tr1::shared_ptr &); + IfNotMineThenUseRequirement(const UseFlagName &, const std::tr1::shared_ptr &); ~IfNotMineThenUseRequirement(); virtual bool requirement_met(const Environment * const, const PackageID &) const PALUDIS_ATTRIBUTE((warn_unused_result)); @@ -111,7 +115,7 @@ namespace public ConditionalUseRequirement { public: - IfMineThenNotUseRequirement(const std::string &, const UseFlagName &, const std::tr1::shared_ptr &); + IfMineThenNotUseRequirement(const UseFlagName &, const std::tr1::shared_ptr &); ~IfMineThenNotUseRequirement(); virtual bool requirement_met(const Environment * const, const PackageID &) const PALUDIS_ATTRIBUTE((warn_unused_result)); @@ -122,7 +126,7 @@ namespace public ConditionalUseRequirement { public: - IfNotMineThenNotUseRequirement(const std::string &, const UseFlagName &, const std::tr1::shared_ptr &); + IfNotMineThenNotUseRequirement(const UseFlagName &, const std::tr1::shared_ptr &); ~IfNotMineThenNotUseRequirement(); virtual bool requirement_met(const Environment * const, const PackageID &) const PALUDIS_ATTRIBUTE((warn_unused_result)); @@ -133,7 +137,7 @@ namespace public ConditionalUseRequirement { public: - EqualUseRequirement(const std::string &, const UseFlagName &, const std::tr1::shared_ptr &); + EqualUseRequirement(const UseFlagName &, const std::tr1::shared_ptr &); ~EqualUseRequirement(); virtual bool requirement_met(const Environment * const, const PackageID &) const PALUDIS_ATTRIBUTE((warn_unused_result)); @@ -144,28 +148,136 @@ namespace public ConditionalUseRequirement { public: - NotEqualUseRequirement(const std::string &, const UseFlagName &, const std::tr1::shared_ptr &); + NotEqualUseRequirement(const UseFlagName &, const std::tr1::shared_ptr &); ~NotEqualUseRequirement(); virtual bool requirement_met(const Environment * const, const PackageID &) const PALUDIS_ATTRIBUTE((warn_unused_result)); virtual const std::string as_human_string() const PALUDIS_ATTRIBUTE((warn_unused_result)); }; -} -UseRequirement::UseRequirement(const std::string & r, const UseFlagName & f) : - _raw(r), - _name(f) -{ + class UseRequirements : + public AdditionalPackageDepSpecRequirement + { + private: + std::string _raw; + std::vector > _reqs; + + public: + UseRequirements(const std::string & r) : + _raw(r) + { + } + + virtual bool requirement_met(const Environment * const env, const PackageID & id) const + { + using namespace std::tr1::placeholders; + return _reqs.end() == std::find_if(_reqs.begin(), _reqs.end(), std::tr1::bind( + std::logical_not(), std::tr1::bind( + &UseRequirement::requirement_met, _1, env, std::tr1::cref(id)))); + } + + virtual const std::string as_human_string() const + { + return join(_reqs.begin(), _reqs.end(), "; ", std::tr1::mem_fn(&UseRequirement::as_human_string)); + } + + virtual const std::string as_raw_string() const + { + return _raw; + } + + void add_requirement(const std::tr1::shared_ptr & req) + { + _reqs.push_back(req); + } + }; + + std::tr1::shared_ptr + parse_one_use_requirement(const std::string & s, std::string & flag, + const std::tr1::shared_ptr & id, const ELikeUseRequirementOptions & options) + { + if (flag.empty()) + throw ELikeUseRequirementError(s, "Invalid [] contents"); + + if ('=' == flag.at(flag.length() - 1)) + { + if ((! options[euro_allow_self_deps]) || (! id)) + throw ELikeUseRequirementError(s, "Cannot use [use=] here"); + + flag.erase(flag.length() - 1); + if (flag.empty()) + throw ELikeUseRequirementError(s, "Invalid [] contents"); + std::string::size_type not_position(options[euro_portage_syntax] ? 0 : flag.length() - 1); + if ('!' == flag.at(not_position)) + { + flag.erase(not_position, 1); + if (flag.empty()) + throw ELikeUseRequirementError(s, "Invalid [] contents"); + return make_shared_ptr(new NotEqualUseRequirement(UseFlagName(flag), id)); + } + else + return make_shared_ptr(new EqualUseRequirement(UseFlagName(flag), id)); + } + else if ('?' == flag.at(flag.length() - 1)) + { + if ((! options[euro_allow_self_deps]) || (! id)) + throw ELikeUseRequirementError(s, "Cannot use [use?] here"); + + flag.erase(flag.length() - 1); + if (flag.empty()) + throw ELikeUseRequirementError(s, "Invalid [] contents"); + std::string::size_type not_position(options[euro_portage_syntax] ? 0 : flag.length() - 1); + if ('!' == flag.at(not_position)) + { + flag.erase(not_position, 1); + if (flag.empty()) + throw ELikeUseRequirementError(s, "Invalid [] contents"); + if (options[euro_portage_syntax]) + return make_shared_ptr(new IfNotMineThenNotUseRequirement(UseFlagName(flag), id)); + else if ('-' == flag.at(0)) + { + flag.erase(0, 1); + if (flag.empty()) + throw ELikeUseRequirementError(s, "Invalid [] contents"); + + return make_shared_ptr(new IfNotMineThenNotUseRequirement(UseFlagName(flag), id)); + } + else + return make_shared_ptr(new IfNotMineThenUseRequirement(UseFlagName(flag), id)); + } + else + { + if (! options[euro_portage_syntax] && '-' == flag.at(0)) + { + flag.erase(0, 1); + if (flag.empty()) + throw ELikeUseRequirementError(s, "Invalid [] contents"); + + return make_shared_ptr(new IfMineThenNotUseRequirement(UseFlagName(flag), id)); + } + else + return make_shared_ptr(new IfMineThenUseRequirement(UseFlagName(flag), id)); + } + } + else if ('-' == flag.at(0)) + { + flag.erase(0, 1); + if (flag.empty()) + throw ELikeUseRequirementError(s, "Invalid [] contents"); + return make_shared_ptr(new DisabledUseRequirement(UseFlagName(flag))); + } + else + return make_shared_ptr(new EnabledUseRequirement(UseFlagName(flag))); + } } -const std::string -UseRequirement::as_raw_string() const +UseRequirement::UseRequirement(const UseFlagName & f) : + _name(f) { - return _raw; } -EnabledUseRequirement::EnabledUseRequirement(const std::string & s, const UseFlagName & n) : - UseRequirement(s, n) +EnabledUseRequirement::EnabledUseRequirement(const UseFlagName & n) : + UseRequirement(n) { } @@ -185,8 +297,8 @@ EnabledUseRequirement::as_human_string() const return "Flag '" + stringify(flag()) + "' enabled"; } -DisabledUseRequirement::DisabledUseRequirement(const std::string & s, const UseFlagName & n) : - UseRequirement(s, n) +DisabledUseRequirement::DisabledUseRequirement(const UseFlagName & n) : + UseRequirement(n) { } @@ -206,9 +318,8 @@ DisabledUseRequirement::as_human_string() const return "Flag '" + stringify(flag()) + "' disabled"; } -ConditionalUseRequirement::ConditionalUseRequirement(const std::string & s, - const UseFlagName & n, const std::tr1::shared_ptr & i) : - UseRequirement(s, n), +ConditionalUseRequirement::ConditionalUseRequirement(const UseFlagName & n, const std::tr1::shared_ptr & i) : + UseRequirement(n), _id(i) { } @@ -217,9 +328,9 @@ ConditionalUseRequirement::~ConditionalUseRequirement() { } -IfMineThenUseRequirement::IfMineThenUseRequirement(const std::string & s, +IfMineThenUseRequirement::IfMineThenUseRequirement( const UseFlagName & n, const std::tr1::shared_ptr & i) : - ConditionalUseRequirement(s, n, i) + ConditionalUseRequirement(n, i) { } @@ -239,9 +350,9 @@ IfMineThenUseRequirement::as_human_string() const return "Flag '" + stringify(flag()) + "' enabled if it is enabled for '" + stringify(*package_id()) + "'"; } -IfNotMineThenUseRequirement::IfNotMineThenUseRequirement(const std::string & s, +IfNotMineThenUseRequirement::IfNotMineThenUseRequirement( const UseFlagName & n, const std::tr1::shared_ptr & i) : - ConditionalUseRequirement(s, n, i) + ConditionalUseRequirement(n, i) { } @@ -261,9 +372,9 @@ IfNotMineThenUseRequirement::as_human_string() const return "Flag '" + stringify(flag()) + "' enabled if it is disabled for '" + stringify(*package_id()) + "'"; } -IfMineThenNotUseRequirement::IfMineThenNotUseRequirement(const std::string & s, +IfMineThenNotUseRequirement::IfMineThenNotUseRequirement( const UseFlagName & n, const std::tr1::shared_ptr & i) : - ConditionalUseRequirement(s, n, i) + ConditionalUseRequirement(n, i) { } @@ -283,9 +394,9 @@ IfMineThenNotUseRequirement::requirement_met(const Environment * const env, cons return ! env->query_use(flag(), *package_id()) || ! env->query_use(flag(), pkg); } -IfNotMineThenNotUseRequirement::IfNotMineThenNotUseRequirement(const std::string & s, +IfNotMineThenNotUseRequirement::IfNotMineThenNotUseRequirement( const UseFlagName & n, const std::tr1::shared_ptr & i) : - ConditionalUseRequirement(s, n, i) + ConditionalUseRequirement(n, i) { } @@ -305,9 +416,9 @@ IfNotMineThenNotUseRequirement::as_human_string() const return "Flag '" + stringify(flag()) + "' disabled if it is disabled for '" + stringify(*package_id()) + "'"; } -EqualUseRequirement::EqualUseRequirement(const std::string & s, +EqualUseRequirement::EqualUseRequirement( const UseFlagName & n, const std::tr1::shared_ptr & i) : - ConditionalUseRequirement(s, n, i) + ConditionalUseRequirement(n, i) { } @@ -327,9 +438,9 @@ EqualUseRequirement::as_human_string() const return "Flag '" + stringify(flag()) + "' enabled or disabled like it is for '" + stringify(*package_id()) + "'"; } -NotEqualUseRequirement::NotEqualUseRequirement(const std::string & s, +NotEqualUseRequirement::NotEqualUseRequirement( const UseFlagName & n, const std::tr1::shared_ptr & i) : - ConditionalUseRequirement(s, n, i) + ConditionalUseRequirement(n, i) { } @@ -360,71 +471,26 @@ paludis::parse_elike_use_requirement(const std::string & s, { Context context("When parsing use requirement '" + s + "':"); - std::string flag(s), raw_flag("[" + s + "]"); - if ('=' == flag.at(flag.length() - 1)) + std::tr1::shared_ptr result(new UseRequirements("[" + s + "]")); + if (options[euro_portage_syntax]) { - if ((! options[euro_allow_self_deps]) || (! id)) - throw ELikeUseRequirementError(s, "Cannot use [use=] here"); - - flag.erase(flag.length() - 1); - if (flag.empty()) - throw ELikeUseRequirementError(s, "Invalid [] contents"); - if ('!' == flag.at(flag.length() - 1)) + std::string::size_type pos(0); + for (;;) { - flag.erase(flag.length() - 1); - if (flag.empty()) - throw ELikeUseRequirementError(s, "Invalid [] contents"); - return make_shared_ptr(new NotEqualUseRequirement(raw_flag, UseFlagName(flag), id)); + std::string::size_type comma(s.find(',', pos)); + std::string flag(s.substr(pos, std::string::npos == comma ? comma : comma - pos)); + result->add_requirement(parse_one_use_requirement(s, flag, id, options)); + if (std::string::npos == comma) + break; + pos = comma + 1; } - else - return make_shared_ptr(new EqualUseRequirement(raw_flag, UseFlagName(flag), id)); } - else if ('?' == flag.at(flag.length() - 1)) - { - if ((! options[euro_allow_self_deps]) || (! id)) - throw ELikeUseRequirementError(s, "Cannot use [use?] here"); - - flag.erase(flag.length() - 1); - if (flag.empty()) - throw ELikeUseRequirementError(s, "Invalid [] contents"); - if ('!' == flag.at(flag.length() - 1)) - { - flag.erase(flag.length() - 1); - if (flag.empty()) - throw ELikeUseRequirementError(s, "Invalid [] contents"); - if ('-' == flag.at(0)) - { - flag.erase(0, 1); - if (flag.empty()) - throw ELikeUseRequirementError(s, "Invalid [] contents"); - - return make_shared_ptr(new IfNotMineThenNotUseRequirement(raw_flag, UseFlagName(flag), id)); - } - else - return make_shared_ptr(new IfNotMineThenUseRequirement(raw_flag, UseFlagName(flag), id)); - } - else - { - if ('-' == flag.at(0)) - { - flag.erase(0, 1); - if (flag.empty()) - throw ELikeUseRequirementError(s, "Invalid [] contents"); - - return make_shared_ptr(new IfMineThenNotUseRequirement(raw_flag, UseFlagName(flag), id)); - } - else - return make_shared_ptr(new IfMineThenUseRequirement(raw_flag, UseFlagName(flag), id)); - } - } - else if ('-' == flag.at(0)) + else { - flag.erase(0, 1); - if (flag.empty()) - throw ELikeUseRequirementError(s, "Invalid [] contents"); - return make_shared_ptr(new DisabledUseRequirement(raw_flag, UseFlagName(flag))); + std::string flag(s); + result->add_requirement(parse_one_use_requirement(s, flag, id, options)); } - else - return make_shared_ptr(new EnabledUseRequirement(raw_flag, UseFlagName(flag))); + + return result; } diff --git a/paludis/elike_use_requirement.se b/paludis/elike_use_requirement.se index e1c114a..4e61a01 100644 --- a/paludis/elike_use_requirement.se +++ b/paludis/elike_use_requirement.se @@ -7,5 +7,6 @@ make_enum_ELikeUseRequirementOption() want_destringify key euro_allow_self_deps "Allow self-dependent use deps" + key euro_portage_syntax "Parse using Portage syntax" } diff --git a/paludis/repositories/e/eapis/exheres-0.conf b/paludis/repositories/e/eapis/exheres-0.conf index af0c1bc..8c75f1e 100644 --- a/paludis/repositories/e/eapis/exheres-0.conf +++ b/paludis/repositories/e/eapis/exheres-0.conf @@ -5,8 +5,8 @@ exported_name = exheres-0 can_be_pbin = true -package_dep_spec_parse_options = allow_slot_deps allow_square_bracket_deps \ - allow_tilde_greater_deps strict_parsing \ +package_dep_spec_parse_options = allow_slot_deps allow_use_deps \ + allow_ranged_deps allow_tilde_greater_deps strict_parsing \ allow_slot_equal_deps allow_slot_star_deps dependency_spec_tree_parse_options = disallow_any_use uri_supports_arrow iuse_flag_parse_options = strict_parsing diff --git a/paludis/repositories/e/eapis/kdebuild-1.conf b/paludis/repositories/e/eapis/kdebuild-1.conf index 8d872e7..9c89cda 100644 --- a/paludis/repositories/e/eapis/kdebuild-1.conf +++ b/paludis/repositories/e/eapis/kdebuild-1.conf @@ -7,7 +7,7 @@ exported_name = kdebuild-1 can_be_pbin = false package_dep_spec_parse_options = allow_slot_deps allow_slot_deps allow_slot_equal_deps \ - allow_slot_star_deps allow_square_bracket_deps + allow_slot_star_deps allow_use_deps allow_ranged_deps ebuild_module_suffixes = kdebuild-1 1 0 utility_path_suffixes = kdebuild-1 1 0 dependency_spec_tree_parse_options = uri_supports_arrow diff --git a/paludis/repositories/e/eapis/paludis-1.conf b/paludis/repositories/e/eapis/paludis-1.conf index f242ec8..31b26c9 100644 --- a/paludis/repositories/e/eapis/paludis-1.conf +++ b/paludis/repositories/e/eapis/paludis-1.conf @@ -5,7 +5,7 @@ exported_name = paludis-1 can_be_pbin = true -package_dep_spec_parse_options = allow_slot_deps allow_square_bracket_deps \ +package_dep_spec_parse_options = allow_slot_deps allow_use_deps allow_ranged_deps \ allow_repository_deps allow_tilde_greater_deps strict_parsing \ allow_slot_equal_deps allow_slot_star_deps dependency_spec_tree_parse_options = disallow_any_use uri_supports_arrow diff --git a/paludis/repositories/fake/dep_parser.cc b/paludis/repositories/fake/dep_parser.cc index 389b40b..3aeb5b0 100644 --- a/paludis/repositories/fake/dep_parser.cc +++ b/paludis/repositories/fake/dep_parser.cc @@ -62,7 +62,7 @@ namespace { PackageDepSpec p(parse_elike_package_dep_spec(s, ELikePackageDepSpecOptions() + epdso_allow_slot_deps + epdso_allow_slot_star_deps + epdso_allow_slot_equal_deps + epdso_allow_repository_deps - + epdso_allow_square_bracket_deps + epdso_allow_tilde_greater_deps + + epdso_allow_use_deps + epdso_allow_ranged_deps + epdso_allow_tilde_greater_deps + epdso_strict_parsing, id)); (*h.begin())[k::add_handler()](make_shared_ptr(new TreeLeaf(make_shared_ptr(new PackageDepSpec(p))))); } @@ -77,7 +77,7 @@ namespace make_shared_ptr(new PackageDepSpec(parse_elike_package_dep_spec(s.substr(1), ELikePackageDepSpecOptions() + epdso_allow_slot_deps + epdso_allow_slot_star_deps + epdso_allow_slot_equal_deps + epdso_allow_repository_deps - + epdso_allow_square_bracket_deps + epdso_allow_tilde_greater_deps + + epdso_allow_use_deps + epdso_allow_ranged_deps + epdso_allow_tilde_greater_deps + epdso_strict_parsing, id))))); (*h.begin())[k::add_handler()](make_shared_ptr(new TreeLeaf(b))); } --- From git at git.pioto.org Sun Aug 3 13:56:37 2008 From: git at git.pioto.org (git at git.pioto.org) Date: Sun, 3 Aug 2008 13:56:37 -0400 (EDT) Subject: [paludis-commits] paludis.git (master) -- aa4c1ff by David Leverton Message-ID: <20080803175637.6D915160262@everglades.pioto.org> Module: paludis.git Branch: master Commit: aa4c1ffef6ab7968093b9223a8ed2271a204b79c URL: http://git.pioto.org/?p=paludis.git;a=commit;h=aa4c1ffef6ab7968093b9223a8ed2271a204b79c Author: David Leverton Committer: David Leverton Date: Sun Aug 3 17:17:01 2008 +0100 ---- Simplify the code. ---- paludis/elike_use_requirement.cc | 331 ++++++++++++-------------------------- 1 files changed, 106 insertions(+), 225 deletions(-) diff --git a/paludis/elike_use_requirement.cc b/paludis/elike_use_requirement.cc index 41a5c66..1c28350 100644 --- a/paludis/elike_use_requirement.cc +++ b/paludis/elike_use_requirement.cc @@ -33,13 +33,16 @@ using namespace paludis; namespace { - class PALUDIS_VISIBLE UseRequirement + class UseRequirement { private: const UseFlagName _name; public: - UseRequirement(const UseFlagName &); + UseRequirement(const UseFlagName & n) : + _name(n) + { + } virtual ~UseRequirement() { } const UseFlagName flag() const PALUDIS_ATTRIBUTE((warn_unused_result)) @@ -55,22 +58,38 @@ namespace public UseRequirement { public: - EnabledUseRequirement(const UseFlagName &); - ~EnabledUseRequirement(); + EnabledUseRequirement(const UseFlagName & n) : + UseRequirement(n) + { + } - virtual bool requirement_met(const Environment * const, const PackageID &) const PALUDIS_ATTRIBUTE((warn_unused_result)); - virtual const std::string as_human_string() const PALUDIS_ATTRIBUTE((warn_unused_result)); + virtual bool requirement_met(const Environment * const env, const PackageID & pkg) const + { + return env->query_use(flag(), pkg); + } + virtual const std::string as_human_string() const + { + return "Flag '" + stringify(flag()) + "' enabled"; + } }; class PALUDIS_VISIBLE DisabledUseRequirement : public UseRequirement { public: - DisabledUseRequirement(const UseFlagName &); - ~DisabledUseRequirement(); + DisabledUseRequirement(const UseFlagName & n) : + UseRequirement(n) + { + } - virtual bool requirement_met(const Environment * const, const PackageID &) const PALUDIS_ATTRIBUTE((warn_unused_result)); - virtual const std::string as_human_string() const PALUDIS_ATTRIBUTE((warn_unused_result)); + virtual bool requirement_met(const Environment * const env, const PackageID & pkg) const + { + return ! env->query_use(flag(), pkg); + } + virtual const std::string as_human_string() const + { + return "Flag '" + stringify(flag()) + "' disabled"; + } }; class PALUDIS_VISIBLE ConditionalUseRequirement : @@ -80,8 +99,11 @@ namespace const std::tr1::shared_ptr _id; public: - ConditionalUseRequirement(const UseFlagName &, const std::tr1::shared_ptr &); - ~ConditionalUseRequirement(); + ConditionalUseRequirement(const UseFlagName & n, const std::tr1::shared_ptr & i) : + UseRequirement(n), + _id(i) + { + } const std::tr1::shared_ptr package_id() const PALUDIS_ATTRIBUTE((warn_unused_result)) { @@ -93,66 +115,114 @@ namespace public ConditionalUseRequirement { public: - IfMineThenUseRequirement(const UseFlagName &, const std::tr1::shared_ptr &); - ~IfMineThenUseRequirement(); + IfMineThenUseRequirement(const UseFlagName & n, const std::tr1::shared_ptr & i) : + ConditionalUseRequirement(n, i) + { + } - virtual bool requirement_met(const Environment * const, const PackageID &) const PALUDIS_ATTRIBUTE((warn_unused_result)); - virtual const std::string as_human_string() const PALUDIS_ATTRIBUTE((warn_unused_result)); + virtual bool requirement_met(const Environment * const env, const PackageID & pkg) const + { + return ! env->query_use(flag(), *package_id()) || env->query_use(flag(), pkg); + } + virtual const std::string as_human_string() const + { + return "Flag '" + stringify(flag()) + "' enabled if it is enabled for '" + stringify(*package_id()) + "'"; + } }; class PALUDIS_VISIBLE IfNotMineThenUseRequirement : public ConditionalUseRequirement { public: - IfNotMineThenUseRequirement(const UseFlagName &, const std::tr1::shared_ptr &); - ~IfNotMineThenUseRequirement(); + IfNotMineThenUseRequirement(const UseFlagName & n, const std::tr1::shared_ptr & i) : + ConditionalUseRequirement(n, i) + { + } - virtual bool requirement_met(const Environment * const, const PackageID &) const PALUDIS_ATTRIBUTE((warn_unused_result)); - virtual const std::string as_human_string() const PALUDIS_ATTRIBUTE((warn_unused_result)); + virtual bool requirement_met(const Environment * const env, const PackageID & pkg) const + { + return env->query_use(flag(), *package_id()) || env->query_use(flag(), pkg); + } + virtual const std::string as_human_string() const + { + return "Flag '" + stringify(flag()) + "' enabled if it is disabled for '" + stringify(*package_id()) + "'"; + } }; class PALUDIS_VISIBLE IfMineThenNotUseRequirement : public ConditionalUseRequirement { public: - IfMineThenNotUseRequirement(const UseFlagName &, const std::tr1::shared_ptr &); - ~IfMineThenNotUseRequirement(); + IfMineThenNotUseRequirement(const UseFlagName & n, const std::tr1::shared_ptr & i) : + ConditionalUseRequirement(n, i) + { + } - virtual bool requirement_met(const Environment * const, const PackageID &) const PALUDIS_ATTRIBUTE((warn_unused_result)); - virtual const std::string as_human_string() const PALUDIS_ATTRIBUTE((warn_unused_result)); + virtual bool requirement_met(const Environment * const env, const PackageID & pkg) const + { + return ! env->query_use(flag(), *package_id()) || ! env->query_use(flag(), pkg); + } + virtual const std::string as_human_string() const + { + return "Flag '" + stringify(flag()) + "' disabled if it is enabled for '" + stringify(*package_id()) + "'"; + } }; class PALUDIS_VISIBLE IfNotMineThenNotUseRequirement : public ConditionalUseRequirement { public: - IfNotMineThenNotUseRequirement(const UseFlagName &, const std::tr1::shared_ptr &); - ~IfNotMineThenNotUseRequirement(); + IfNotMineThenNotUseRequirement(const UseFlagName & n, const std::tr1::shared_ptr & i) : + ConditionalUseRequirement(n, i) + { + } - virtual bool requirement_met(const Environment * const, const PackageID &) const PALUDIS_ATTRIBUTE((warn_unused_result)); - virtual const std::string as_human_string() const PALUDIS_ATTRIBUTE((warn_unused_result)); + virtual bool requirement_met(const Environment * const env, const PackageID & pkg) const + { + return env->query_use(flag(), *package_id()) || ! env->query_use(flag(), pkg); + } + virtual const std::string as_human_string() const + { + return "Flag '" + stringify(flag()) + "' disabled if it is disabled for '" + stringify(*package_id()) + "'"; + } }; class PALUDIS_VISIBLE EqualUseRequirement : public ConditionalUseRequirement { public: - EqualUseRequirement(const UseFlagName &, const std::tr1::shared_ptr &); - ~EqualUseRequirement(); + EqualUseRequirement(const UseFlagName & n, const std::tr1::shared_ptr & i) : + ConditionalUseRequirement(n, i) + { + } - virtual bool requirement_met(const Environment * const, const PackageID &) const PALUDIS_ATTRIBUTE((warn_unused_result)); - virtual const std::string as_human_string() const PALUDIS_ATTRIBUTE((warn_unused_result)); + virtual bool requirement_met(const Environment * const env, const PackageID & pkg) const + { + return env->query_use(flag(), pkg) == env->query_use(flag(), *package_id()); + } + virtual const std::string as_human_string() const + { + return "Flag '" + stringify(flag()) + "' enabled or disabled like it is for '" + stringify(*package_id()) + "'"; + } }; class PALUDIS_VISIBLE NotEqualUseRequirement : public ConditionalUseRequirement { public: - NotEqualUseRequirement(const UseFlagName &, const std::tr1::shared_ptr &); - ~NotEqualUseRequirement(); + NotEqualUseRequirement(const UseFlagName & n, const std::tr1::shared_ptr & i) : + ConditionalUseRequirement(n, i) + { + } - virtual bool requirement_met(const Environment * const, const PackageID &) const PALUDIS_ATTRIBUTE((warn_unused_result)); - virtual const std::string as_human_string() const PALUDIS_ATTRIBUTE((warn_unused_result)); + virtual bool requirement_met(const Environment * const env, const PackageID & pkg) const + { + return env->query_use(flag(), pkg) != env->query_use(flag(), *package_id()); + } + virtual const std::string as_human_string() const + { + return "Flag '" + stringify(flag()) + "' enabled or disabled opposite to how it is for '" + stringify(*package_id()) + "'"; + } }; class UseRequirements : @@ -271,195 +341,6 @@ namespace } } -UseRequirement::UseRequirement(const UseFlagName & f) : - _name(f) -{ -} - -EnabledUseRequirement::EnabledUseRequirement(const UseFlagName & n) : - UseRequirement(n) -{ -} - -EnabledUseRequirement::~EnabledUseRequirement() -{ -} - -bool -EnabledUseRequirement::requirement_met(const Environment * const env, const PackageID & pkg) const -{ - return env->query_use(flag(), pkg); -} - -const std::string -EnabledUseRequirement::as_human_string() const -{ - return "Flag '" + stringify(flag()) + "' enabled"; -} - -DisabledUseRequirement::DisabledUseRequirement(const UseFlagName & n) : - UseRequirement(n) -{ -} - -DisabledUseRequirement::~DisabledUseRequirement() -{ -} - -bool -DisabledUseRequirement::requirement_met(const Environment * const env, const PackageID & pkg) const -{ - return ! env->query_use(flag(), pkg); -} - -const std::string -DisabledUseRequirement::as_human_string() const -{ - return "Flag '" + stringify(flag()) + "' disabled"; -} - -ConditionalUseRequirement::ConditionalUseRequirement(const UseFlagName & n, const std::tr1::shared_ptr & i) : - UseRequirement(n), - _id(i) -{ -} - -ConditionalUseRequirement::~ConditionalUseRequirement() -{ -} - -IfMineThenUseRequirement::IfMineThenUseRequirement( - const UseFlagName & n, const std::tr1::shared_ptr & i) : - ConditionalUseRequirement(n, i) -{ -} - -IfMineThenUseRequirement::~IfMineThenUseRequirement() -{ -} - -bool -IfMineThenUseRequirement::requirement_met(const Environment * const env, const PackageID & pkg) const -{ - return ! env->query_use(flag(), *package_id()) || env->query_use(flag(), pkg); -} - -const std::string -IfMineThenUseRequirement::as_human_string() const -{ - return "Flag '" + stringify(flag()) + "' enabled if it is enabled for '" + stringify(*package_id()) + "'"; -} - -IfNotMineThenUseRequirement::IfNotMineThenUseRequirement( - const UseFlagName & n, const std::tr1::shared_ptr & i) : - ConditionalUseRequirement(n, i) -{ -} - -IfNotMineThenUseRequirement::~IfNotMineThenUseRequirement() -{ -} - -bool -IfNotMineThenUseRequirement::requirement_met(const Environment * const env, const PackageID & pkg) const -{ - return env->query_use(flag(), *package_id()) || env->query_use(flag(), pkg); -} - -const std::string -IfNotMineThenUseRequirement::as_human_string() const -{ - return "Flag '" + stringify(flag()) + "' enabled if it is disabled for '" + stringify(*package_id()) + "'"; -} - -IfMineThenNotUseRequirement::IfMineThenNotUseRequirement( - const UseFlagName & n, const std::tr1::shared_ptr & i) : - ConditionalUseRequirement(n, i) -{ -} - -IfMineThenNotUseRequirement::~IfMineThenNotUseRequirement() -{ -} - -const std::string -IfMineThenNotUseRequirement::as_human_string() const -{ - return "Flag '" + stringify(flag()) + "' disabled if it is enabled for '" + stringify(*package_id()) + "'"; -} - -bool -IfMineThenNotUseRequirement::requirement_met(const Environment * const env, const PackageID & pkg) const -{ - return ! env->query_use(flag(), *package_id()) || ! env->query_use(flag(), pkg); -} - -IfNotMineThenNotUseRequirement::IfNotMineThenNotUseRequirement( - const UseFlagName & n, const std::tr1::shared_ptr & i) : - ConditionalUseRequirement(n, i) -{ -} - -IfNotMineThenNotUseRequirement::~IfNotMineThenNotUseRequirement() -{ -} - -bool -IfNotMineThenNotUseRequirement::requirement_met(const Environment * const env, const PackageID & pkg) const -{ - return env->query_use(flag(), *package_id()) || ! env->query_use(flag(), pkg); -} - -const std::string -IfNotMineThenNotUseRequirement::as_human_string() const -{ - return "Flag '" + stringify(flag()) + "' disabled if it is disabled for '" + stringify(*package_id()) + "'"; -} - -EqualUseRequirement::EqualUseRequirement( - const UseFlagName & n, const std::tr1::shared_ptr & i) : - ConditionalUseRequirement(n, i) -{ -} - -EqualUseRequirement::~EqualUseRequirement() -{ -} - -bool -EqualUseRequirement::requirement_met(const Environment * const env, const PackageID & pkg) const -{ - return env->query_use(flag(), pkg) == env->query_use(flag(), *package_id()); -} - -const std::string -EqualUseRequirement::as_human_string() const -{ - return "Flag '" + stringify(flag()) + "' enabled or disabled like it is for '" + stringify(*package_id()) + "'"; -} - -NotEqualUseRequirement::NotEqualUseRequirement( - const UseFlagName & n, const std::tr1::shared_ptr & i) : - ConditionalUseRequirement(n, i) -{ -} - -NotEqualUseRequirement::~NotEqualUseRequirement() -{ -} - -bool -NotEqualUseRequirement::requirement_met(const Environment * const env, const PackageID & pkg) const -{ - return env->query_use(flag(), pkg) != env->query_use(flag(), *package_id()); -} - -const std::string -NotEqualUseRequirement::as_human_string() const -{ - return "Flag '" + stringify(flag()) + "' enabled or disabled opposite to how it is for '" + stringify(*package_id()) + "'"; -} - ELikeUseRequirementError::ELikeUseRequirementError(const std::string & s, const std::string & m) throw () : Exception("Error parsing use requirement '" + s + "': " + m) { --- From git at git.pioto.org Sun Aug 3 13:56:37 2008 From: git at git.pioto.org (git at git.pioto.org) Date: Sun, 3 Aug 2008 13:56:37 -0400 (EDT) Subject: [paludis-commits] paludis.git (master) -- dc48cc2 by David Leverton Message-ID: <20080803175637.A58EC1602C2@everglades.pioto.org> Module: paludis.git Branch: master Commit: dc48cc2a343a9b729c96b787d60aa87fcc63147b URL: http://git.pioto.org/?p=paludis.git;a=commit;h=dc48cc2a343a9b729c96b787d60aa87fcc63147b Author: David Leverton Committer: David Leverton Date: Sun Aug 3 18:08:32 2008 +0100 ---- Add a bunch of test cases for parse_elike_use_requirement. ---- .gitignore | 1 + paludis/elike_use_requirement_TEST.cc | 388 +++++++++++++++++++++++++++++++++ paludis/files.m4 | 2 +- 3 files changed, 390 insertions(+), 1 deletions(-) diff --git a/.gitignore b/.gitignore index f431cdf..5d67f8b 100644 --- a/.gitignore +++ b/.gitignore @@ -169,6 +169,7 @@ man-* /paludis/dep_list_TEST_blockers /paludis/dep_spec_TEST /paludis/elike_dep_parser_TEST +/paludis/elike_use_requirement_TEST /paludis/environments/adapted/adapted_environment_TEST /paludis/environments/no_config/no_config_environment_TEST /paludis/environments/paludis/paludis_environment_TEST diff --git a/paludis/elike_use_requirement_TEST.cc b/paludis/elike_use_requirement_TEST.cc new file mode 100644 index 0000000..62d9e5c --- /dev/null +++ b/paludis/elike_use_requirement_TEST.cc @@ -0,0 +1,388 @@ +/* vim: set sw=4 sts=4 et foldmethod=syntax : */ + +/* + * Copyright (c) 2008 David Leverton + * + * This file is part of the Paludis package manager. Paludis is free software; + * you can redistribute it and/or modify it under the terms of the GNU General + * Public License version 2, as published by the Free Software Foundation. + * + * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace paludis; +using namespace test; + +namespace test_cases +{ + struct SimpleUseRequirementsTest : TestCase + { + SimpleUseRequirementsTest() : TestCase("simple use requirements") { } + + void run() + { + TestEnvironment env; + std::tr1::shared_ptr fake(new FakeRepository(&env, RepositoryName("fake"))); + env.package_database()->add_repository(1, fake); + std::tr1::shared_ptr id(fake->add_version("cat", "pkg1", "1")); + id->iuse_key()->set_from_string("enabled disabled", IUseFlagParseOptions()); + + std::tr1::shared_ptr req1( + parse_elike_use_requirement("enabled", std::tr1::shared_ptr(), ELikeUseRequirementOptions())); + TEST_CHECK_EQUAL(req1->as_raw_string(), "[enabled]"); + TEST_CHECK_EQUAL(req1->as_human_string(), "Flag 'enabled' enabled"); + TEST_CHECK(req1->requirement_met(&env, *id)); + + std::tr1::shared_ptr req2( + parse_elike_use_requirement("disabled", std::tr1::shared_ptr(), ELikeUseRequirementOptions())); + TEST_CHECK_EQUAL(req2->as_raw_string(), "[disabled]"); + TEST_CHECK_EQUAL(req2->as_human_string(), "Flag 'disabled' enabled"); + TEST_CHECK(! req2->requirement_met(&env, *id)); + + std::tr1::shared_ptr req3( + parse_elike_use_requirement("-enabled", std::tr1::shared_ptr(), ELikeUseRequirementOptions())); + TEST_CHECK_EQUAL(req3->as_raw_string(), "[-enabled]"); + TEST_CHECK_EQUAL(req3->as_human_string(), "Flag 'enabled' disabled"); + TEST_CHECK(! req3->requirement_met(&env, *id)); + + std::tr1::shared_ptr req4( + parse_elike_use_requirement("-disabled", std::tr1::shared_ptr(), ELikeUseRequirementOptions())); + TEST_CHECK_EQUAL(req4->as_raw_string(), "[-disabled]"); + TEST_CHECK_EQUAL(req4->as_human_string(), "Flag 'disabled' disabled"); + TEST_CHECK(req4->requirement_met(&env, *id)); + } + } test_simple_use_requirements; + + struct SimpleUseRequirementsPortageSyntaxTest : TestCase + { + SimpleUseRequirementsPortageSyntaxTest() : TestCase("simple use requirements portage syntax") { } + + void run() + { + TestEnvironment env; + std::tr1::shared_ptr fake(new FakeRepository(&env, RepositoryName("fake"))); + env.package_database()->add_repository(1, fake); + std::tr1::shared_ptr id(fake->add_version("cat", "pkg1", "1")); + id->iuse_key()->set_from_string("enabled disabled", IUseFlagParseOptions()); + + std::tr1::shared_ptr req1( + parse_elike_use_requirement("enabled", std::tr1::shared_ptr(), ELikeUseRequirementOptions() + euro_portage_syntax)); + TEST_CHECK_EQUAL(req1->as_raw_string(), "[enabled]"); + TEST_CHECK_EQUAL(req1->as_human_string(), "Flag 'enabled' enabled"); + TEST_CHECK(req1->requirement_met(&env, *id)); + + std::tr1::shared_ptr req2( + parse_elike_use_requirement("disabled", std::tr1::shared_ptr(), ELikeUseRequirementOptions() + euro_portage_syntax)); + TEST_CHECK_EQUAL(req2->as_raw_string(), "[disabled]"); + TEST_CHECK_EQUAL(req2->as_human_string(), "Flag 'disabled' enabled"); + TEST_CHECK(! req2->requirement_met(&env, *id)); + + std::tr1::shared_ptr req3( + parse_elike_use_requirement("-enabled", std::tr1::shared_ptr(), ELikeUseRequirementOptions() + euro_portage_syntax)); + TEST_CHECK_EQUAL(req3->as_raw_string(), "[-enabled]"); + TEST_CHECK_EQUAL(req3->as_human_string(), "Flag 'enabled' disabled"); + TEST_CHECK(! req3->requirement_met(&env, *id)); + + std::tr1::shared_ptr req4( + parse_elike_use_requirement("-disabled", std::tr1::shared_ptr(), ELikeUseRequirementOptions() + euro_portage_syntax)); + TEST_CHECK_EQUAL(req4->as_raw_string(), "[-disabled]"); + TEST_CHECK_EQUAL(req4->as_human_string(), "Flag 'disabled' disabled"); + TEST_CHECK(req4->requirement_met(&env, *id)); + } + } test_simple_use_requirements_portage_syntax; + + struct MultipleUseRequirementsPortageSyntaxTest : TestCase + { + MultipleUseRequirementsPortageSyntaxTest() : TestCase("multiple use requirements portage syntax") { } + + void run() + { + TestEnvironment env; + std::tr1::shared_ptr fake(new FakeRepository(&env, RepositoryName("fake"))); + env.package_database()->add_repository(1, fake); + std::tr1::shared_ptr id(fake->add_version("cat", "pkg1", "1")); + id->iuse_key()->set_from_string("enabled disabled", IUseFlagParseOptions()); + + std::tr1::shared_ptr req1( + parse_elike_use_requirement("enabled,-disabled", std::tr1::shared_ptr(), ELikeUseRequirementOptions() + euro_portage_syntax)); + TEST_CHECK_EQUAL(req1->as_raw_string(), "[enabled,-disabled]"); + TEST_CHECK_EQUAL(req1->as_human_string(), "Flag 'enabled' enabled; Flag 'disabled' disabled"); + TEST_CHECK(req1->requirement_met(&env, *id)); + + std::tr1::shared_ptr req2( + parse_elike_use_requirement("enabled,disabled", std::tr1::shared_ptr(), ELikeUseRequirementOptions() + euro_portage_syntax)); + TEST_CHECK_EQUAL(req2->as_raw_string(), "[enabled,disabled]"); + TEST_CHECK_EQUAL(req2->as_human_string(), "Flag 'enabled' enabled; Flag 'disabled' enabled"); + TEST_CHECK(! req2->requirement_met(&env, *id)); + + std::tr1::shared_ptr req3( + parse_elike_use_requirement("-enabled,-disabled", std::tr1::shared_ptr(), ELikeUseRequirementOptions() + euro_portage_syntax)); + TEST_CHECK_EQUAL(req3->as_raw_string(), "[-enabled,-disabled]"); + TEST_CHECK_EQUAL(req3->as_human_string(), "Flag 'enabled' disabled; Flag 'disabled' disabled"); + TEST_CHECK(! req3->requirement_met(&env, *id)); + + std::tr1::shared_ptr req4( + parse_elike_use_requirement("enabled,-disabled,-enabled", std::tr1::shared_ptr(), ELikeUseRequirementOptions() + euro_portage_syntax)); + TEST_CHECK_EQUAL(req4->as_raw_string(), "[enabled,-disabled,-enabled]"); + TEST_CHECK_EQUAL(req4->as_human_string(), "Flag 'enabled' enabled; Flag 'disabled' disabled; Flag 'enabled' disabled"); + TEST_CHECK(! req4->requirement_met(&env, *id)); + + std::tr1::shared_ptr req5( + parse_elike_use_requirement("enabled,-disabled,enabled", std::tr1::shared_ptr(), ELikeUseRequirementOptions() + euro_portage_syntax)); + TEST_CHECK_EQUAL(req5->as_raw_string(), "[enabled,-disabled,enabled]"); + TEST_CHECK_EQUAL(req5->as_human_string(), "Flag 'enabled' enabled; Flag 'disabled' disabled; Flag 'enabled' enabled"); + TEST_CHECK(req5->requirement_met(&env, *id)); + } + } test_multiple_use_requirements_portage_syntax; + + struct ComplexUseRequirementsTest : TestCase + { + ComplexUseRequirementsTest() : TestCase("complex use requirements") { } + + void run() + { + TestEnvironment env; + std::tr1::shared_ptr fake(new FakeRepository(&env, RepositoryName("fake"))); + env.package_database()->add_repository(1, fake); + std::tr1::shared_ptr id(fake->add_version("cat", "enabled", "1")); + id->iuse_key()->set_from_string("pkgname", IUseFlagParseOptions()); + std::tr1::shared_ptr id2(fake->add_version("cat", "disabled", "1")); + id2->iuse_key()->set_from_string("pkgname", IUseFlagParseOptions()); + + std::tr1::shared_ptr req1( + parse_elike_use_requirement("pkgname?", id, ELikeUseRequirementOptions() + euro_allow_self_deps)); + TEST_CHECK_EQUAL(req1->as_raw_string(), "[pkgname?]"); + TEST_CHECK_EQUAL(req1->as_human_string(), "Flag 'pkgname' enabled if it is enabled for 'cat/enabled-1:0::fake'"); + TEST_CHECK(req1->requirement_met(&env, *id)); + TEST_CHECK(! req1->requirement_met(&env, *id2)); + + std::tr1::shared_ptr req2( + parse_elike_use_requirement("pkgname?", id2, ELikeUseRequirementOptions() + euro_allow_self_deps)); + TEST_CHECK_EQUAL(req2->as_raw_string(), "[pkgname?]"); + TEST_CHECK_EQUAL(req2->as_human_string(), "Flag 'pkgname' enabled if it is enabled for 'cat/disabled-1:0::fake'"); + TEST_CHECK(req2->requirement_met(&env, *id)); + TEST_CHECK(req2->requirement_met(&env, *id2)); + + std::tr1::shared_ptr req3( + parse_elike_use_requirement("-pkgname?", id, ELikeUseRequirementOptions() + euro_allow_self_deps)); + TEST_CHECK_EQUAL(req3->as_raw_string(), "[-pkgname?]"); + TEST_CHECK_EQUAL(req3->as_human_string(), "Flag 'pkgname' disabled if it is enabled for 'cat/enabled-1:0::fake'"); + TEST_CHECK(! req3->requirement_met(&env, *id)); + TEST_CHECK(req3->requirement_met(&env, *id2)); + + std::tr1::shared_ptr req4( + parse_elike_use_requirement("-pkgname?", id2, ELikeUseRequirementOptions() + euro_allow_self_deps)); + TEST_CHECK_EQUAL(req4->as_raw_string(), "[-pkgname?]"); + TEST_CHECK_EQUAL(req4->as_human_string(), "Flag 'pkgname' disabled if it is enabled for 'cat/disabled-1:0::fake'"); + TEST_CHECK(req4->requirement_met(&env, *id)); + TEST_CHECK(req4->requirement_met(&env, *id2)); + + std::tr1::shared_ptr req5( + parse_elike_use_requirement("pkgname!?", id, ELikeUseRequirementOptions() + euro_allow_self_deps)); + TEST_CHECK_EQUAL(req5->as_raw_string(), "[pkgname!?]"); + TEST_CHECK_EQUAL(req5->as_human_string(), "Flag 'pkgname' enabled if it is disabled for 'cat/enabled-1:0::fake'"); + TEST_CHECK(req5->requirement_met(&env, *id)); + TEST_CHECK(req5->requirement_met(&env, *id2)); + + std::tr1::shared_ptr req6( + parse_elike_use_requirement("pkgname!?", id2, ELikeUseRequirementOptions() + euro_allow_self_deps)); + TEST_CHECK_EQUAL(req6->as_raw_string(), "[pkgname!?]"); + TEST_CHECK_EQUAL(req6->as_human_string(), "Flag 'pkgname' enabled if it is disabled for 'cat/disabled-1:0::fake'"); + TEST_CHECK(req6->requirement_met(&env, *id)); + TEST_CHECK(! req6->requirement_met(&env, *id2)); + + std::tr1::shared_ptr req7( + parse_elike_use_requirement("-pkgname!?", id, ELikeUseRequirementOptions() + euro_allow_self_deps)); + TEST_CHECK_EQUAL(req7->as_raw_string(), "[-pkgname!?]"); + TEST_CHECK_EQUAL(req7->as_human_string(), "Flag 'pkgname' disabled if it is disabled for 'cat/enabled-1:0::fake'"); + TEST_CHECK(req7->requirement_met(&env, *id)); + TEST_CHECK(req7->requirement_met(&env, *id2)); + + std::tr1::shared_ptr req8( + parse_elike_use_requirement("-pkgname!?", id2, ELikeUseRequirementOptions() + euro_allow_self_deps)); + TEST_CHECK_EQUAL(req8->as_raw_string(), "[-pkgname!?]"); + TEST_CHECK_EQUAL(req8->as_human_string(), "Flag 'pkgname' disabled if it is disabled for 'cat/disabled-1:0::fake'"); + TEST_CHECK(! req8->requirement_met(&env, *id)); + TEST_CHECK(req8->requirement_met(&env, *id2)); + + std::tr1::shared_ptr req9( + parse_elike_use_requirement("pkgname=", id, ELikeUseRequirementOptions() + euro_allow_self_deps)); + TEST_CHECK_EQUAL(req9->as_raw_string(), "[pkgname=]"); + TEST_CHECK_EQUAL(req9->as_human_string(), "Flag 'pkgname' enabled or disabled like it is for 'cat/enabled-1:0::fake'"); + TEST_CHECK(req9->requirement_met(&env, *id)); + TEST_CHECK(! req9->requirement_met(&env, *id2)); + + std::tr1::shared_ptr req10( + parse_elike_use_requirement("pkgname=", id2, ELikeUseRequirementOptions() + euro_allow_self_deps)); + TEST_CHECK_EQUAL(req10->as_raw_string(), "[pkgname=]"); + TEST_CHECK_EQUAL(req10->as_human_string(), "Flag 'pkgname' enabled or disabled like it is for 'cat/disabled-1:0::fake'"); + TEST_CHECK(! req10->requirement_met(&env, *id)); + TEST_CHECK(req10->requirement_met(&env, *id2)); + + std::tr1::shared_ptr req11( + parse_elike_use_requirement("pkgname!=", id, ELikeUseRequirementOptions() + euro_allow_self_deps)); + TEST_CHECK_EQUAL(req11->as_raw_string(), "[pkgname!=]"); + TEST_CHECK_EQUAL(req11->as_human_string(), "Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/enabled-1:0::fake'"); + TEST_CHECK(! req11->requirement_met(&env, *id)); + TEST_CHECK(req11->requirement_met(&env, *id2)); + + std::tr1::shared_ptr req12( + parse_elike_use_requirement("pkgname!=", id2, ELikeUseRequirementOptions() + euro_allow_self_deps)); + TEST_CHECK_EQUAL(req12->as_raw_string(), "[pkgname!=]"); + TEST_CHECK_EQUAL(req12->as_human_string(), "Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/disabled-1:0::fake'"); + TEST_CHECK(req12->requirement_met(&env, *id)); + TEST_CHECK(! req12->requirement_met(&env, *id2)); + } + } test_complex_use_requirements; + + struct ComplexUseRequirementsPortageSyntaxTest : TestCase + { + ComplexUseRequirementsPortageSyntaxTest() : TestCase("complex use requirements portage syntax") { } + + void run() + { + TestEnvironment env; + std::tr1::shared_ptr fake(new FakeRepository(&env, RepositoryName("fake"))); + env.package_database()->add_repository(1, fake); + std::tr1::shared_ptr id(fake->add_version("cat", "enabled", "1")); + id->iuse_key()->set_from_string("pkgname", IUseFlagParseOptions()); + std::tr1::shared_ptr id2(fake->add_version("cat", "disabled", "1")); + id2->iuse_key()->set_from_string("pkgname", IUseFlagParseOptions()); + + std::tr1::shared_ptr req1( + parse_elike_use_requirement("pkgname?", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax)); + TEST_CHECK_EQUAL(req1->as_raw_string(), "[pkgname?]"); + TEST_CHECK_EQUAL(req1->as_human_string(), "Flag 'pkgname' enabled if it is enabled for 'cat/enabled-1:0::fake'"); + TEST_CHECK(req1->requirement_met(&env, *id)); + TEST_CHECK(! req1->requirement_met(&env, *id2)); + + std::tr1::shared_ptr req2( + parse_elike_use_requirement("pkgname?", id2, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax)); + TEST_CHECK_EQUAL(req2->as_raw_string(), "[pkgname?]"); + TEST_CHECK_EQUAL(req2->as_human_string(), "Flag 'pkgname' enabled if it is enabled for 'cat/disabled-1:0::fake'"); + TEST_CHECK(req2->requirement_met(&env, *id)); + TEST_CHECK(req2->requirement_met(&env, *id2)); + + std::tr1::shared_ptr req7( + parse_elike_use_requirement("!pkgname?", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax)); + TEST_CHECK_EQUAL(req7->as_raw_string(), "[!pkgname?]"); + TEST_CHECK_EQUAL(req7->as_human_string(), "Flag 'pkgname' disabled if it is disabled for 'cat/enabled-1:0::fake'"); + TEST_CHECK(req7->requirement_met(&env, *id)); + TEST_CHECK(req7->requirement_met(&env, *id2)); + + std::tr1::shared_ptr req8( + parse_elike_use_requirement("!pkgname?", id2, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax)); + TEST_CHECK_EQUAL(req8->as_raw_string(), "[!pkgname?]"); + TEST_CHECK_EQUAL(req8->as_human_string(), "Flag 'pkgname' disabled if it is disabled for 'cat/disabled-1:0::fake'"); + TEST_CHECK(! req8->requirement_met(&env, *id)); + TEST_CHECK(req8->requirement_met(&env, *id2)); + + std::tr1::shared_ptr req9( + parse_elike_use_requirement("pkgname=", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax)); + TEST_CHECK_EQUAL(req9->as_raw_string(), "[pkgname=]"); + TEST_CHECK_EQUAL(req9->as_human_string(), "Flag 'pkgname' enabled or disabled like it is for 'cat/enabled-1:0::fake'"); + TEST_CHECK(req9->requirement_met(&env, *id)); + TEST_CHECK(! req9->requirement_met(&env, *id2)); + + std::tr1::shared_ptr req10( + parse_elike_use_requirement("pkgname=", id2, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax)); + TEST_CHECK_EQUAL(req10->as_raw_string(), "[pkgname=]"); + TEST_CHECK_EQUAL(req10->as_human_string(), "Flag 'pkgname' enabled or disabled like it is for 'cat/disabled-1:0::fake'"); + TEST_CHECK(! req10->requirement_met(&env, *id)); + TEST_CHECK(req10->requirement_met(&env, *id2)); + + std::tr1::shared_ptr req11( + parse_elike_use_requirement("!pkgname=", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax)); + TEST_CHECK_EQUAL(req11->as_raw_string(), "[!pkgname=]"); + TEST_CHECK_EQUAL(req11->as_human_string(), "Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/enabled-1:0::fake'"); + TEST_CHECK(! req11->requirement_met(&env, *id)); + TEST_CHECK(req11->requirement_met(&env, *id2)); + + std::tr1::shared_ptr req12( + parse_elike_use_requirement("!pkgname=", id2, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax)); + TEST_CHECK_EQUAL(req12->as_raw_string(), "[!pkgname=]"); + TEST_CHECK_EQUAL(req12->as_human_string(), "Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/disabled-1:0::fake'"); + TEST_CHECK(req12->requirement_met(&env, *id)); + TEST_CHECK(! req12->requirement_met(&env, *id2)); + } + } test_complex_use_requirements_portage_syntax; + + struct MalformedUseRequirementsTest : TestCase + { + MalformedUseRequirementsTest() : TestCase("malformed use requirements") { } + + void run() + { + TestEnvironment env; + std::tr1::shared_ptr fake(new FakeRepository(&env, RepositoryName("fake"))); + env.package_database()->add_repository(1, fake); + std::tr1::shared_ptr id(fake->add_version("cat", "enabled", "1")); + id->iuse_key()->set_from_string("pkgname", IUseFlagParseOptions()); + + TEST_CHECK_THROWS(parse_elike_use_requirement("te/st", id, ELikeUseRequirementOptions() + euro_allow_self_deps), NameError); + + TEST_CHECK_THROWS(parse_elike_use_requirement("", id, ELikeUseRequirementOptions() + euro_allow_self_deps), ELikeUseRequirementError); + TEST_CHECK_THROWS(parse_elike_use_requirement("-", id, ELikeUseRequirementOptions() + euro_allow_self_deps), ELikeUseRequirementError); + TEST_CHECK_THROWS(parse_elike_use_requirement("?", id, ELikeUseRequirementOptions() + euro_allow_self_deps), ELikeUseRequirementError); + TEST_CHECK_THROWS(parse_elike_use_requirement("-?", id, ELikeUseRequirementOptions() + euro_allow_self_deps), ELikeUseRequirementError); + TEST_CHECK_THROWS(parse_elike_use_requirement("!?", id, ELikeUseRequirementOptions() + euro_allow_self_deps), ELikeUseRequirementError); + TEST_CHECK_THROWS(parse_elike_use_requirement("-!?", id, ELikeUseRequirementOptions() + euro_allow_self_deps), ELikeUseRequirementError); + TEST_CHECK_THROWS(parse_elike_use_requirement("=", id, ELikeUseRequirementOptions() + euro_allow_self_deps), ELikeUseRequirementError); + TEST_CHECK_THROWS(parse_elike_use_requirement("!=", id, ELikeUseRequirementOptions() + euro_allow_self_deps), ELikeUseRequirementError); + + TEST_CHECK_THROWS(parse_elike_use_requirement("!test?", id, ELikeUseRequirementOptions() + euro_allow_self_deps), NameError); + TEST_CHECK_THROWS(parse_elike_use_requirement("!test=", id, ELikeUseRequirementOptions() + euro_allow_self_deps), NameError); + TEST_CHECK_THROWS(parse_elike_use_requirement("test1,test2", id, ELikeUseRequirementOptions() + euro_allow_self_deps), NameError); + } + } test_malformed_use_requirements; + + struct MalformedUseRequirementsPortageSyntaxTest : TestCase + { + MalformedUseRequirementsPortageSyntaxTest() : TestCase("malformed use requirements portage syntax") { } + + void run() + { + TestEnvironment env; + std::tr1::shared_ptr fake(new FakeRepository(&env, RepositoryName("fake"))); + env.package_database()->add_repository(1, fake); + std::tr1::shared_ptr id(fake->add_version("cat", "enabled", "1")); + id->iuse_key()->set_from_string("pkgname", IUseFlagParseOptions()); + + TEST_CHECK_THROWS(parse_elike_use_requirement("te/st", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax), NameError); + + TEST_CHECK_THROWS(parse_elike_use_requirement("", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax), ELikeUseRequirementError); + TEST_CHECK_THROWS(parse_elike_use_requirement("-", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax), ELikeUseRequirementError); + TEST_CHECK_THROWS(parse_elike_use_requirement("?", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax), ELikeUseRequirementError); + TEST_CHECK_THROWS(parse_elike_use_requirement("!?", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax), ELikeUseRequirementError); + TEST_CHECK_THROWS(parse_elike_use_requirement("=", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax), ELikeUseRequirementError); + TEST_CHECK_THROWS(parse_elike_use_requirement("!=", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax), ELikeUseRequirementError); + + TEST_CHECK_THROWS(parse_elike_use_requirement(",", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax), ELikeUseRequirementError); + TEST_CHECK_THROWS(parse_elike_use_requirement("test,", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax), ELikeUseRequirementError); + TEST_CHECK_THROWS(parse_elike_use_requirement(",test", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax), ELikeUseRequirementError); + TEST_CHECK_THROWS(parse_elike_use_requirement("test,,test", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax), ELikeUseRequirementError); + + TEST_CHECK_THROWS(parse_elike_use_requirement("test!?", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax), NameError); + TEST_CHECK_THROWS(parse_elike_use_requirement("-test?", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax), NameError); + TEST_CHECK_THROWS(parse_elike_use_requirement("-test!?", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax), NameError); + TEST_CHECK_THROWS(parse_elike_use_requirement("test!=", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax), NameError); + } + } test_malformed_use_requirements_portage_syntax; +} + diff --git a/paludis/files.m4 b/paludis/files.m4 index 272fef7..1d584ba 100644 --- a/paludis/files.m4 +++ b/paludis/files.m4 @@ -26,7 +26,7 @@ add(`elike_dep_parser', `hh', `cc', `fwd', `test') add(`elike_conditional_dep_spec', `hh', `cc', `fwd') add(`elike_package_dep_spec', `hh', `cc', `fwd', `se') add(`elike_slot_requirement', `hh', `cc', `fwd') -add(`elike_use_requirement', `hh', `cc', `fwd', `se') +add(`elike_use_requirement', `hh', `cc', `fwd', `se', `test') add(`environment', `hh', `fwd', `cc') add(`environment_implementation', `hh', `cc') add(`environment_maker', `hh', `cc') --- From git at git.pioto.org Sun Aug 3 15:19:50 2008 From: git at git.pioto.org (git at git.pioto.org) Date: Sun, 3 Aug 2008 15:19:50 -0400 (EDT) Subject: [paludis-commits] paludis.git (master) -- 5c42e48 by David Leverton Message-ID: <20080803191950.C12751602BD@everglades.pioto.org> Module: paludis.git Branch: master Commit: 5c42e4800f4e6edd91dc6d8cdf54afb3d1fb34df URL: http://git.pioto.org/?p=paludis.git;a=commit;h=5c42e4800f4e6edd91dc6d8cdf54afb3d1fb34df Author: David Leverton Committer: David Leverton Date: Sun Aug 3 20:19:26 2008 +0100 ---- Fix GCC 4.3 compile. ---- paludis/elike_use_requirement.cc | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/paludis/elike_use_requirement.cc b/paludis/elike_use_requirement.cc index 1c28350..acac8eb 100644 --- a/paludis/elike_use_requirement.cc +++ b/paludis/elike_use_requirement.cc @@ -28,6 +28,7 @@ #include #include #include +#include using namespace paludis; --- From git at git.pioto.org Sun Aug 3 16:21:12 2008 From: git at git.pioto.org (git at git.pioto.org) Date: Sun, 3 Aug 2008 16:21:12 -0400 (EDT) Subject: [paludis-commits] paludis.git (master) -- 77be16f by Ciaran McCreesh Message-ID: <20080803202112.4B5B31602BE@everglades.pioto.org> Module: paludis.git Branch: master Commit: 77be16f5c2de2ebcd7ce78084755f83c522edc39 URL: http://git.pioto.org/?p=paludis.git;a=commit;h=77be16f5c2de2ebcd7ce78084755f83c522edc39 Author: Ciaran McCreesh Committer: Ciaran McCreesh Date: Tue Jul 29 21:47:08 2008 +0100 ---- Kill kc. Breaks python. ---- doc/api/cplusplus/examples/example_action.cc | 18 +- doc/api/cplusplus/examples/example_metadata_key.cc | 6 +- paludis/action-fwd.hh | 45 +-- paludis/action.cc | 5 +- paludis/action.hh | 57 ++ paludis/args/install_args_group.cc | 2 +- paludis/dep_list.cc | 9 +- paludis/distribution-fwd.hh | 31 - paludis/distribution.cc | 42 +- paludis/distribution.hh | 53 ++ paludis/elike_conditional_dep_spec.cc | 3 +- paludis/elike_dep_parser-fwd.hh | 18 +- paludis/elike_dep_parser.cc | 23 +- paludis/elike_dep_parser.hh | 30 + paludis/elike_dep_parser_TEST.cc | 80 ++-- paludis/elike_package_dep_spec-fwd.hh | 14 +- paludis/elike_package_dep_spec.cc | 49 +- paludis/elike_package_dep_spec.hh | 25 + paludis/environment_implementation.cc | 19 +- paludis/environment_maker.cc | 5 +- .../no_config/no_config_environment.cc | 25 +- paludis/environments/paludis/paludis_config.cc | 46 +- paludis/environments/paludis/paludis_config.hh | 19 +- .../environments/paludis/paludis_environment.cc | 14 +- paludis/environments/paludis/use_conf.cc | 4 +- .../environments/portage/portage_environment.cc | 10 +- paludis/hooker.cc | 8 +- paludis/install_task.cc | 32 +- paludis/mask-fwd.hh | 22 +- paludis/mask.hh | 24 + paludis/merger-fwd.hh | 21 +- paludis/merger.cc | 126 ++-- paludis/merger.hh | 32 +- paludis/merger_TEST.cc | 35 +- paludis/ndbam-fwd.hh | 19 +- paludis/ndbam.cc | 21 +- paludis/ndbam.hh | 23 + paludis/ndbam_merger.cc | 54 +- paludis/ndbam_merger.hh | 42 +- paludis/ndbam_unmerger.cc | 56 +- paludis/ndbam_unmerger.hh | 32 +- paludis/package_id.hh | 1 + paludis/report_task.cc | 4 +- .../repositories/cran/cran_installed_repository.cc | 36 +- paludis/repositories/cran/cran_repository.cc | 30 +- .../repositories/e/check_fetched_files_visitor.cc | 134 ++-- paludis/repositories/e/dep_parser.cc | 273 +++++---- paludis/repositories/e/e_installed_repository.cc | 89 ++-- .../repositories/e/e_installed_repository_id.cc | 3 +- paludis/repositories/e/e_key.cc | 24 +- paludis/repositories/e/e_repository.cc | 88 ++-- paludis/repositories/e/e_repository_TEST.cc | 88 ++-- paludis/repositories/e/e_repository_id.cc | 1 - paludis/repositories/e/e_repository_mask_file.cc | 5 +- paludis/repositories/e/e_repository_profile.cc | 5 +- paludis/repositories/e/e_repository_sets_TEST.cc | 8 +- paludis/repositories/e/e_stripper.cc | 22 +- paludis/repositories/e/e_stripper.hh | 24 +- paludis/repositories/e/eapi-fwd.hh | 2 - paludis/repositories/e/eapi.cc | 1 - paludis/repositories/e/ebuild.cc | 425 +++++++------- paludis/repositories/e/ebuild.hh | 219 ++++--- paludis/repositories/e/ebuild_entries.cc | 320 +++++----- paludis/repositories/e/ebuild_id.cc | 32 +- paludis/repositories/e/exndbam_repository.cc | 161 +++--- paludis/repositories/e/info_metadata_key.cc | 1 - paludis/repositories/e/make_ebuild_repository.cc | 17 +- paludis/repositories/e/qa/eapi_supported.cc | 1 - paludis/repositories/e/qa/fetches_key.cc | 2 +- paludis/repositories/e/qa/iuse_key.cc | 2 +- paludis/repositories/e/qa/spec_keys.cc | 6 +- paludis/repositories/e/qa/visibility.cc | 24 +- paludis/repositories/e/source_uri_finder.cc | 12 +- paludis/repositories/e/vdb_merger.cc | 54 +- paludis/repositories/e/vdb_merger.hh | 35 +- paludis/repositories/e/vdb_merger_TEST.cc | 20 +- paludis/repositories/e/vdb_repository.cc | 157 +++--- paludis/repositories/e/vdb_repository_TEST.cc | 101 ++-- paludis/repositories/e/vdb_unmerger.cc | 62 +- paludis/repositories/e/vdb_unmerger.hh | 29 +- paludis/repositories/e/vdb_unmerger_TEST.cc | 16 +- paludis/repositories/fake/dep_parser.cc | 231 ++++---- .../repositories/fake/fake_installed_repository.cc | 37 +- paludis/repositories/fake/fake_package_id.cc | 8 +- paludis/repositories/fake/fake_repository.cc | 69 ++- paludis/repositories/gems/gems_repository.cc | 30 +- .../repositories/gems/installed_gems_repository.cc | 30 +- paludis/repositories/gems/registration.cc | 5 +- paludis/repositories/unavailable/registration.cc | 15 +- paludis/repositories/unavailable/unavailable_id.cc | 19 +- paludis/repositories/unavailable/unavailable_id.hh | 37 +- .../unavailable/unavailable_repository.cc | 67 +- .../unavailable/unavailable_repository.hh | 24 +- .../unavailable/unavailable_repository_TEST.cc | 29 +- .../unavailable/unavailable_repository_file-fwd.hh | 28 +- .../unavailable/unavailable_repository_file.cc | 14 +- .../unavailable/unavailable_repository_store.cc | 44 +- paludis/repositories/unpackaged/installed_id.cc | 18 +- .../unpackaged/installed_repository.cc | 104 ++-- .../unpackaged/installed_repository_TEST.cc | 101 ++-- paludis/repositories/unpackaged/registration.cc | 24 +- paludis/repositories/unpackaged/unpackaged_id.cc | 36 +- .../unpackaged/unpackaged_repository.cc | 50 +- .../unpackaged/unpackaged_repository.hh | 41 +- .../unpackaged/unpackaged_repository_TEST.cc | 166 +++--- .../repositories/unpackaged/unpackaged_stripper.cc | 22 +- .../repositories/unpackaged/unpackaged_stripper.hh | 23 +- .../virtuals/installed_virtuals_repository.cc | 40 +- .../repositories/virtuals/virtuals_repository.cc | 46 +- .../virtuals/virtuals_repository_TEST.cc | 2 +- paludis/repository-fwd.hh | 87 +--- paludis/repository.hh | 112 ++++- paludis/stripper-fwd.hh | 11 +- paludis/stripper.cc | 15 +- paludis/stripper.hh | 17 + paludis/stripper_TEST.cc | 12 +- paludis/sync_task.cc | 2 +- paludis/syncer.cc | 17 +- paludis/syncer.hh | 34 +- paludis/uninstall_task.cc | 1 - paludis/unmerger.cc | 46 +- paludis/unmerger.hh | 20 +- paludis/user_dep_spec.cc | 25 +- paludis/util/files.m4 | 2 - paludis/util/kc-fwd.hh | 80 --- paludis/util/kc.hh | 646 -------------------- paludis/util/keys.hh | 201 ------ paludis/util/named_value-fwd.hh | 1 - paludis/util/named_value.hh | 6 + paludis/version_spec.cc | 128 +++-- python/action.cc | 65 ++- python/mask.cc | 9 +- python/paludis_python.hh | 17 +- ruby/action.cc | 80 ++-- ruby/metadata_key.cc | 7 +- ruby/paludis_ruby.cc | 1 - ruby/repository.cc | 92 ++-- src/clients/accerso/accerso.cc | 20 +- .../adjutrix/display_default_system_resolution.cc | 14 +- src/clients/adjutrix/downgrade_check.cc | 16 +- src/clients/adjutrix/find_insecure_packages.cc | 4 +- src/clients/adjutrix/find_unused_packages.cc | 2 +- src/clients/adjutrix/keywords_graph.cc | 4 +- src/clients/adjutrix/what_needs_keywording.cc | 2 +- .../gtkpaludis/libgtkpaludis/repository_buttons.cc | 2 +- .../gtkpaludis/libgtkpaludis/sets_list_model.cc | 4 +- .../gtkpaludis/libgtkpaludis/version_info_model.cc | 5 +- src/clients/paludis/applets.cc | 2 +- src/clients/paludis/list.cc | 4 +- src/clients/qualudis/qualudis.cc | 11 +- src/output/console_install_task.cc | 13 +- src/output/console_query_task.cc | 11 +- src/output/mask_displayer.cc | 5 +- 153 files changed, 3232 insertions(+), 3714 deletions(-) diff --git a/doc/api/cplusplus/examples/example_action.cc b/doc/api/cplusplus/examples/example_action.cc index 34576af..92ffd31 100644 --- a/doc/api/cplusplus/examples/example_action.cc +++ b/doc/api/cplusplus/examples/example_action.cc @@ -60,10 +60,10 @@ int main(int argc, char * argv[]) * creating a FetchAction, controlling whether safe resume is used * and whether unneeded (e.g. due to disabled USE flags) source * files should still be fetched. */ - FetchAction fetch_action(FetchActionOptions::named_create() - (k::fetch_unneeded(), false) - (k::safe_resume(), true) - ); + FetchAction fetch_action(make_named_values( + value_for(false), + value_for(true) + )); try { (*i)->perform_action(fetch_action); @@ -79,16 +79,16 @@ int main(int argc, char * argv[]) for (Sequence::ConstIterator f(e.failures()->begin()), f_end(e.failures()->end()) ; f != f_end ; ++f) { - cout << " * File '" << (*f)[k::target_file()] << "': "; + cout << " * File '" << f->target_file() << "': "; bool need_comma(false); - if ((*f)[k::requires_manual_fetching()]) + if (f->requires_manual_fetching()) { cout << "requires manual fetching"; need_comma = true; } - if ((*f)[k::failed_automatic_fetching()]) + if (f->failed_automatic_fetching()) { if (need_comma) cout << ", "; @@ -96,11 +96,11 @@ int main(int argc, char * argv[]) need_comma = true; } - if (! (*f)[k::failed_integrity_checks()].empty()) + if (! f->failed_integrity_checks().empty()) { if (need_comma) cout << ", "; - cout << "failed integrity checks: " << (*f)[k::failed_integrity_checks()]; + cout << "failed integrity checks: " << f->failed_integrity_checks(); need_comma = true; } } diff --git a/doc/api/cplusplus/examples/example_metadata_key.cc b/doc/api/cplusplus/examples/example_metadata_key.cc index 725e5f1..be7c3ec 100644 --- a/doc/api/cplusplus/examples/example_metadata_key.cc +++ b/doc/api/cplusplus/examples/example_metadata_key.cc @@ -113,13 +113,13 @@ namespace * can return a zero pointer. Other keys can't. */ if (key.value()) { - cout << indent << left << setw(30) << " Mask file:" << " " << (*key.value())[k::mask_file()] << endl; + cout << indent << left << setw(30) << " Mask file:" << " " << key.value()->mask_file() << endl; /* Comment looks best if it's outputted over multiple lines, * as that's how it tends to be stored in package.mask. */ cout << indent << left << setw(30) << " Comment:" << " "; bool first(true); - for (Sequence::ConstIterator i((*key.value())[k::comment()]->begin()), - i_end((*key.value())[k::comment()]->end()) ; + for (Sequence::ConstIterator i(key.value()->comment()->begin()), + i_end(key.value()->comment()->end()) ; i != i_end ; ++i) { if (! first) diff --git a/paludis/action-fwd.hh b/paludis/action-fwd.hh index ef58a1c..a3ec657 100644 --- a/paludis/action-fwd.hh +++ b/paludis/action-fwd.hh @@ -22,9 +22,6 @@ #include #include -#include -#include -#include #include /** \file @@ -59,46 +56,12 @@ namespace paludis class ConfigActionError; class InfoActionError; -#include - - /** - * Options for a FetchAction. - * - * \see FetchAction - * \ingroup g_actions - * \since 0.26 - */ - typedef kc::KeyedClass< - kc::Field, - kc::Field - > FetchActionOptions; + struct FetchActionOptions; + struct InstallActionOptions; - /** - * Options for an InstallAction. - * - * \see InstallAction - * \ingroup g_actions - * \since 0.26 - */ - typedef kc::KeyedClass< - kc::Field, - kc::Field, - kc::Field > - > InstallActionOptions; + struct FetchActionFailure; - /** - * A failed fetch action part. - * - * \see FetchActionError - * \ingroup g_actions - * \since 0.26 - */ - typedef kc::KeyedClass< - kc::Field, - kc::Field, - kc::Field, - kc::Field - > FetchActionFailure; +#include } diff --git a/paludis/action.cc b/paludis/action.cc index df63616..3b76783 100644 --- a/paludis/action.cc +++ b/paludis/action.cc @@ -23,7 +23,6 @@ #include #include #include -#include using namespace paludis; @@ -172,8 +171,8 @@ namespace void visit(const InstallAction & a) { s << "install to "; - if (a.options[k::destination()]) - s << a.options[k::destination()]->name(); + if (a.options.destination()) + s << a.options.destination()->name(); else s << "nowhere"; } diff --git a/paludis/action.hh b/paludis/action.hh index 3aa4c91..62796be 100644 --- a/paludis/action.hh +++ b/paludis/action.hh @@ -28,6 +28,8 @@ #include #include #include +#include +#include /** \file * Declarations for action-related classes. @@ -41,6 +43,61 @@ namespace paludis { + namespace n + { + struct checks; + struct debug_build; + struct destination; + struct failed_automatic_fetching; + struct failed_integrity_checks; + struct fetch_unneeded; + struct requires_manual_fetching; + struct safe_resume; + struct target_file; + } + + /** + * Options for a FetchAction. + * + * \see FetchAction + * \ingroup g_actions + * \since 0.30 + */ + struct FetchActionOptions + { + NamedValue fetch_unneeded; + NamedValue safe_resume; + }; + + /** + * Options for an InstallAction. + * + * \see InstallAction + * \ingroup g_actions + * \since 0.30 + */ + struct InstallActionOptions + { + NamedValue checks; + NamedValue debug_build; + NamedValue > destination; + }; + + /** + * A failed fetch action part. + * + * \see FetchActionError + * \ingroup g_actions + * \since 0.30 + */ + struct FetchActionFailure + { + NamedValue failed_automatic_fetching; + NamedValue failed_integrity_checks; + NamedValue requires_manual_fetching; + NamedValue target_file; + }; + /** * Types for visiting an action. * diff --git a/paludis/args/install_args_group.cc b/paludis/args/install_args_group.cc index 7730747..a7d30bf 100644 --- a/paludis/args/install_args_group.cc +++ b/paludis/args/install_args_group.cc @@ -95,7 +95,7 @@ InstallArgsGroup::destinations(Environment * env) const { std::tr1::shared_ptr repo(env->package_database()->fetch_repository( RepositoryName(*i))); - if ((*repo)[k::destination_interface()]) + if ((*repo).destination_interface()) d->insert(repo); else throw args::DoHelp("--destinations argument '" + *i + "' does not provide a destinations interface"); diff --git a/paludis/dep_list.cc b/paludis/dep_list.cc index a9a8b42..e5a734a 100644 --- a/paludis/dep_list.cc +++ b/paludis/dep_list.cc @@ -52,7 +52,6 @@ #include #include #include -#include #include #include @@ -1100,7 +1099,7 @@ DepList::add_package(const std::tr1::shared_ptr & p, std::tr1:: p->provide_key()->value()->accept(f); if (f.begin() != f.end() && ! (*DistributionData::get_instance()->distribution_from_string( - _imp->env->distribution()))[k::support_old_style_virtuals()]) + _imp->env->distribution())).support_old_style_virtuals()) throw DistributionConfigurationError("Package '" + stringify(*p) + "' has PROVIDEs, but this distribution " "does not support old style virtuals"); @@ -1125,7 +1124,7 @@ DepList::add_package(const std::tr1::shared_ptr & p, std::tr1:: our_merge_entry_post_position = _imp->merge_list.insert(next(our_merge_entry_post_position), DepListEntry(DepListEntry::create() .package_id((*_imp->env->package_database()->fetch_repository( - RepositoryName("virtuals")))[k::make_virtuals_interface()]->make_virtual_package_id( + RepositoryName("virtuals"))).make_virtuals_interface()->make_virtual_package_id( QualifiedPackageName((*i)->text()), p)) .generation(_imp->merge_list_generation) .state(dle_has_all_deps) @@ -1581,8 +1580,8 @@ DepList::find_destination(const PackageID & p, { for (DestinationsSet::ConstIterator d(dd->begin()), d_end(dd->end()) ; d != d_end ; ++d) - if ((**d)[k::destination_interface()]) - if ((**d)[k::destination_interface()]->is_suitable_destination_for(p)) + if ((**d).destination_interface()) + if ((**d).destination_interface()->is_suitable_destination_for(p)) return *d; throw NoDestinationError(p, dd); diff --git a/paludis/distribution-fwd.hh b/paludis/distribution-fwd.hh index fb7b802..7ffc9a5 100644 --- a/paludis/distribution-fwd.hh +++ b/paludis/distribution-fwd.hh @@ -26,43 +26,12 @@ * \ingroup g_dep_spec */ -#include -#include #include namespace paludis { class DistributionData; class DistributionConfigurationError; - - /** - * Information about a distribution. - * - * \see DistributionData - * \ingroup g_distribution - * \since 0.26 - * \nosubgrouping - */ - typedef kc::KeyedClass< - kc::Field, - kc::Field, - kc::Field, - kc::Field, - kc