aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-01-23 23:28:05 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-01-23 23:28:05 +0000
commitf8d72c52c94c1b57325ae56e49a05eb182f5e4a3 (patch)
tree6b4b69e582aa0c6be7d8bca303fffb12049028df
parent976241d2a2cff7ee70b3e81efa0540b7ab40312f (diff)
downloadpaludis-f8d72c52c94c1b57325ae56e49a05eb182f5e4a3.tar.gz
paludis-f8d72c52c94c1b57325ae56e49a05eb182f5e4a3.tar.xz
Allow options to be passed to syncers. From David Leverton. Fixes: ticket:35
-rw-r--r--ebuild/syncers/Makefile.am11
-rw-r--r--ebuild/syncers/docvs.in83
-rw-r--r--ebuild/syncers/dodarcs.in80
-rw-r--r--ebuild/syncers/dogit.in72
-rw-r--r--ebuild/syncers/dorsync.in69
-rw-r--r--ebuild/syncers/dosvn.in63
-rwxr-xr-xebuild/utils/dounpack18
-rw-r--r--paludis/repositories/nothing/nothing_repository.cc25
-rw-r--r--paludis/repositories/nothing/nothing_repository.sr2
-rw-r--r--paludis/repositories/portage/make_ebuild_repository.cc15
-rw-r--r--paludis/repositories/portage/portage_repository.cc4
-rw-r--r--paludis/repositories/portage/portage_repository_params.sr2
-rw-r--r--paludis/syncer.cc17
-rw-r--r--paludis/syncer.sr2
-rw-r--r--src/clients/paludis/applets.cc23
15 files changed, 397 insertions, 89 deletions
diff --git a/ebuild/syncers/Makefile.am b/ebuild/syncers/Makefile.am
index 591c133..d58c4f7 100644
--- a/ebuild/syncers/Makefile.am
+++ b/ebuild/syncers/Makefile.am
@@ -1,5 +1,5 @@
MAINTAINERCLEANFILES = Makefile.in
-CLEANFILES = *~ .keep docvs+ext docvs+pserver docvs+ssh dodarcs+http dodarcs+ssh dofile dogit dogit+http dogit+ssh dorsync dosvn dosvn+http dosvn+https dosvn+ssh
+CLEANFILES = *~ .keep docvs+ext docvs+pserver docvs+ssh dodarcs+http dodarcs+ssh dofile dogit dogit+http dogit+ssh dorsync dosvn dosvn+http dosvn+https dosvn+ssh dotar+file dotar+ftp dotar+http
SUBDIRS = .
.keep :
@@ -21,7 +21,10 @@ libexecprog_SCRIPTS = \
dosvn \
dosvn+http \
dosvn+https \
- dosvn+ssh
+ dosvn+ssh \
+ dotar+file \
+ dotar+ftp \
+ dotar+http
TESTS_ENVIRONMENT = env \
PALUDIS_EBUILD_DIR="$(srcdir)/paludis/syncers/" \
@@ -32,7 +35,7 @@ installusersyncersdir = $(datadir)/paludis/syncers
installusersyncers_DATA = .keep
TESTS =
-EXTRA_DIST = $(libexecprog_SCRIPTS) docvs.in dodarcs.in dogit.in dorsync.in dosvn.in
+EXTRA_DIST = $(libexecprog_SCRIPTS) docvs.in dodarcs.in dogit.in dorsync.in dosvn.in dotar.in
check_SCRIPTS =
check_PROGRAMS = $(TESTS)
@@ -49,6 +52,8 @@ dofile dorsync : dorsync.in
cat $? > $@
dosvn dosvn+http dosvn+https dosvn+ssh : dosvn.in
cat $? > $@
+dotar+file dotar+ftp dotar+http : dotar.in
+ cat $? > $@
built-sources : $(BUILT_SOURCES)
for s in `echo $(SUBDIRS) | tr -d .` ; do $(MAKE) -C $$s built-sources || exit 1 ; done
diff --git a/ebuild/syncers/docvs.in b/ebuild/syncers/docvs.in
index b2821fe..53d05f8 100644
--- a/ebuild/syncers/docvs.in
+++ b/ebuild/syncers/docvs.in
@@ -1,27 +1,84 @@
#!/bin/bash
-LOCAL="$1"
-REMOTE="$2"
+source "${PALUDIS_EBUILD_DIR}/echo_functions.bash"
-if [[ "${REMOTE}" == cvs+pserver* ]]; then
+LOCAL=
+REMOTE=
+
+CVS_OPTIONS=( )
+CVS_CHECKOUT_OPTIONS=( )
+
+while [[ $# -gt 0 ]]; do
+ case "${1}" in
+
+ --cvs-option=*)
+ CVS_OPTIONS+=( "${1#*=}" )
+ ;;
+
+ --cvs-checkout-option=*)
+ CVS_CHECKOUT_OPTIONS+=( "${1#*=}" )
+ ;;
+
+ --help)
+ PROTO="${0##*/do}"
+ if [[ "${PROTO}" == cvs+pserver || "${PROTO}" == cvs+ext || "${PROTO}" == cvs+ssh ]]; then
+ echo " URL syntax: ${PROTO}://[USERNAME[:PASSWORD]@]SERVER:/PATH:MODULE"
+ else
+ ewarn "URL syntax for ${PROTO} is unknown. This script will likely not work with the ${PROTO} protocol"
+ fi
+
+ echo " Options:"
+ echo " --cvs-option=OPTION Pass OPTION to cvs as a global option"
+ echo " --cvs-checkout-option=OPTION Pass OPTION to cvs checkout"
+ 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
+
+PSERVER=false
+SERVER="${REMOTE}"
+if [[ "${SERVER}" == cvs+pserver* ]]; then
PSERVER=true
- REMOTE=":pserver:${REMOTE:14}"
-elif [[ "${REMOTE}" == cvs+ssh* || "${REMOTE}" == cvs+ext* ]]; then
- PSERVER=false
- REMOTE=":ext:${REMOTE:10}"
+ SERVER=":pserver:${SERVER#cvs+pserver://}"
+elif [[ "${SERVER}" == cvs+ssh* || "${SERVER}" == cvs+ext* ]]; then
+ SERVER=":ext:${SERVER#cvs+???://}"
fi
-MODULE="${REMOTE##*:}"
-if [[ "${MODULE}" == "${REMOTE}" ]]; then
- source "${PALUDIS_EBUILD_DIR}/echo_functions.bash"
+MODULE="${SERVER##*:}"
+if [[ "${MODULE}" == "${SERVER}" ]]; then
eerror "'${REMOTE}' is not a valid URL for a CVS repository"
exit 1
fi
-REMOTE="${REMOTE%:*}"
+CVSROOT="${SERVER%:*}"
LOCAL=${LOCAL%/}
WORKING="${LOCAL%/*}"
[[ ! -d "${WORKING}" ]] && mkdir -p "${WORKING}"
-cd "${WORKING}" && ( ! ${PSERVER} || cvs -d "${REMOTE}" login ) &&
- cvs -d "${REMOTE}" checkout -P -d "${LOCAL##*/}" "${MODULE}"
+cd "${WORKING}" && ( ! ${PSERVER} || cvs "${CVS_OPTIONS[@]}" -d "${CVSROOT}" login ) &&
+ cvs -d "${CVSROOT}" "${CVS_OPTIONS[@]}" checkout -P -d "${LOCAL##*/}" "${CVS_CHECKOUT_OPTIONS[@]}" "${MODULE}"
diff --git a/ebuild/syncers/dodarcs.in b/ebuild/syncers/dodarcs.in
index 15e0b88..cca3245 100644
--- a/ebuild/syncers/dodarcs.in
+++ b/ebuild/syncers/dodarcs.in
@@ -1,24 +1,84 @@
#!/bin/bash
-LOCAL="$1"
-REMOTE="$2"
+source "${PALUDIS_EBUILD_DIR}/echo_functions.bash"
-if [[ "${REMOTE}" == darcs+ssh* ]]; then
- REMOTE="${REMOTE:12}"
-elif [[ "${REMOTE}" == darcs+* ]]; then
- REMOTE="${REMOTE:6}"
+LOCAL=
+REMOTE=
+
+DARCS_GET_OPTIONS=( )
+DARCS_PULL_OPTIONS=( )
+
+while [[ $# -gt 0 ]]; do
+ case "${1}" in
+
+ --darcs-get-option=*)
+ DARCS_GET_OPTIONS+=( "${1#*=}" )
+ ;;
+
+ --darcs-pull-option=*)
+ DARCS_PULL_OPTIONS+=( "${1#*=}" )
+ ;;
+
+ --help)
+ PROTO="${0##*/do}"
+ if [[ "${PROTO}" == darcs+ssh ]]; then
+ echo " URL syntax: darcs+ssh://[USERNAME[:PASSWORD]@]SERVER:/PATH"
+ elif [[ "${PROTO}" == darcs+http ]]; then
+ echo " URL syntax: darcs+http://[USERNAME[:PASSWORD]@]SERVER[:PORT]/PATH"
+ else
+ # darcs can handle any protocol as long as you define
+ # environment variables telling it how. The user can
+ # symlink/copy this syncer to enable support for other
+ # protocols, but we can't give them much help with the
+ # syntax....
+ PROTO="${PROTO#darcs+}"
+ echo " URL syntax: darcs+${PROTO}://[$( tr [:lower:] [:upper:] <<<"${PROTO}" )-URL]"
+ fi
+
+ echo " Options:"
+ echo " --darcs-get-option=OPTION Pass OPTION to darcs get"
+ echo " --darcs-pull-option=OPTION Pass OPTION to darcs pull"
+ 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#darcs+ssh://}"
+REMOTE="${REMOTE#darcs+}"
+
if [[ -d "${LOCAL}" && ! -d "${LOCAL}/_darcs" ]]; then
- source "${PALUDIS_EBUILD_DIR}/echo_functions.bash"
eerror "'${LOCAL}' exists but it is not a Darcs repository"
exit 1
fi
if [[ -d "${LOCAL}/_darcs" ]]; then
- cd "${LOCAL}" && darcs pull --all --set-scripts-executable "${REMOTE}"
+ cd "${LOCAL}" && darcs pull --all --set-scripts-executable "${DARCS_PULL_OPTIONS[@]}" "${REMOTE}"
else
- darcs get --partial --set-scripts-executable --repo-name="${LOCAL}" \
- "${REMOTE}"
+ darcs get --partial --set-scripts-executable "${DARCS_GET_OPTIONS[@]}" --repo-name="${LOCAL}" "${REMOTE}"
fi
diff --git a/ebuild/syncers/dogit.in b/ebuild/syncers/dogit.in
index 9ee055d..15b711e 100644
--- a/ebuild/syncers/dogit.in
+++ b/ebuild/syncers/dogit.in
@@ -1,19 +1,79 @@
#!/bin/bash
-LOCAL="$1"
-REMOTE="$2"
+source "${PALUDIS_EBUILD_DIR}/echo_functions.bash"
-[[ "${REMOTE}" == git+http* ]] && REMOTE="${REMOTE:4}"
+LOCAL=
+REMOTE=
+
+GIT_CLONE_OPTIONS=( )
+GIT_PULL_OPTIONS=( )
+
+while [[ $# -gt 0 ]]; do
+ case "${1}" in
+
+ --git-clone-option=*)
+ GIT_CLONE_OPTIONS+=( "${1#*=}" )
+ ;;
+
+ --git-pull-option=*)
+ GIT_PULL_OPTIONS+=( "${1#*=}" )
+ ;;
+
+ --help)
+ PROTO="${0##*/do}"
+ if [[ "${PROTO}" == git ]]; then
+ echo " URL syntax: git://SERVER/PATH"
+ elif [[ "${PROTO}" == git+ssh ]]; then
+ echo " URL syntax: git+ssh://[USERNAME[:PASSWORD]@]SERVER/PATH"
+ elif [[ "${PROTO}" == git+http ]]; then
+ echo " URL syntax: git+http://[USERNAME[:PASSWORD]@]SERVER[:PORT]/PATH"
+ else
+ ewarn "URL syntax for ${PROTO} is unknown. This script will likely not work with the ${PROTO} protocol"
+ fi
+
+ echo " Options:"
+ echo " --git-clone-option=OPTION Pass OPTION to git clone"
+ echo " --git-pull-option=OPTION Pass OPTION to git pull"
+ 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}" == git+http* ]] && REMOTE="${REMOTE#git+}"
if [[ -d "${LOCAL}" && ! -d "${LOCAL}/.git" ]]; then
- source "${PALUDIS_EBUILD_DIR}/echo_functions.bash"
eerror "'${LOCAL}' exists but it is not a Git repository"
exit 1
fi
if [[ -d "${LOCAL}/.git" ]]; then
- cd "${LOCAL}" && git pull
+ cd "${LOCAL}" && git pull "${GIT_PULL_OPTIONS[@]}"
else
- git clone "${REMOTE}" "${LOCAL}"
+ git clone "${GIT_CLONE_OPTIONS[@]}" "${REMOTE}" "${LOCAL}"
fi
diff --git a/ebuild/syncers/dorsync.in b/ebuild/syncers/dorsync.in
index f0ee64d..f66ba85 100644
--- a/ebuild/syncers/dorsync.in
+++ b/ebuild/syncers/dorsync.in
@@ -1,18 +1,71 @@
#!/bin/bash
-LOCAL="$1"
-REMOTE="$2"
-[[ "${REMOTE}" == file* ]] && REMOTE="${REMOTE:7}"
+source "${PALUDIS_EBUILD_DIR}/echo_functions.bash"
-if [[ -n "${PALUDIS_SYNC_EXCLUDE_FROM}" ]]; then
- EXCLUDE=( --exclude-from "${PALUDIS_SYNC_EXCLUDE_FROM}" )
-else
- EXCLUDE=( )
+LOCAL=
+REMOTE=
+
+RSYNC_OPTIONS=( )
+
+while [[ $# -gt 0 ]]; do
+ case "${1}" in
+
+ --exclude-from=*)
+ RSYNC_OPTIONS+=( --exclude-from "${1#*=}" )
+ ;;
+
+ --rsync-option=*)
+ RSYNC_OPTIONS+=( "${1#*=}" )
+ ;;
+
+ --help)
+ PROTO="${0##*/do}"
+ if [[ "${PROTO}" == rsync ]]; then
+ echo " URL syntax: ${PROTO}://[USERNAME@]SERVER[:PORT]/PATH"
+ elif [[ "${PROTO}" == file ]]; then
+ echo " URL syntax: file:///PATH"
+ else
+ ewarn "URL syntax for ${PROTO} is unknown. This script will likely not work with the ${PROTO} protocol"
+ fi
+
+ echo " Options:"
+ echo " --exclude-from=FILE Use FILE as a list of exclude patterns"
+ echo " --rsync-option=OPTION Pass OPTION to rsync"
+ 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#file://}"
+
rsync --recursive --links --safe-links --perms --times --compress --force \
--whole-file --delete --delete-after --stats --timeout=180 \
--exclude=/distfiles --exclude=/packages --exclude=/local \
- --exclude=/.cache --progress "${EXCLUDE[@]}" "${REMOTE}" "${LOCAL}/"
+ --exclude=/.cache --progress "${RSYNC_OPTIONS[@]}" "${REMOTE}" "${LOCAL}/"
diff --git a/ebuild/syncers/dosvn.in b/ebuild/syncers/dosvn.in
index a5484ad..0ee372f 100644
--- a/ebuild/syncers/dosvn.in
+++ b/ebuild/syncers/dosvn.in
@@ -1,10 +1,63 @@
#!/bin/bash
-LOCAL="$1"
-REMOTE="$2"
+source "${PALUDIS_EBUILD_DIR}/echo_functions.bash"
-[[ "${REMOTE}" == svn+http* || "${REMOTE}" == svn+https* ]] &&
- REMOTE="${REMOTE:4}"
+LOCAL=
+REMOTE=
-svn checkout "${REMOTE}" "${LOCAL}/"
+SVN_CHECKOUT_OPTIONS=( )
+
+while [[ $# -gt 0 ]]; do
+ case "${1}" in
+
+ --svn-checkout-option=*)
+ SVN_CHECKOUT_OPTIONS+=( "${1#*=}" )
+ ;;
+
+ --help)
+ PROTO="${0##*/do}"
+ if [[ "${PROTO}" == svn ]]; then
+ echo " URL syntax: svn://[USERNAME@]SERVER/PATH"
+ elif [[ "${PROTO}" == svn+ssh ]]; then
+ echo " URL syntax: svn+ssh://[USERNAME[:PASSWORD]@]SERVER:/PATH"
+ elif [[ "${PROTO}" == svn+http || "${PROTO}" == svn+https ]]; then
+ echo " URL syntax: ${PROTO}://[USERNAME[:PASSWORD]@]SERVER[:PORT]/PATH"
+ else
+ ewarn "URL syntax for ${PROTO} is unknown. This script will likely not work with the ${PROTO} protocol"
+ fi
+ echo " Options:"
+ echo " --svn-checkout-option=OPTION Pass OPTION to svn checkout"
+ 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}" == svn+http* ]] && REMOTE="${REMOTE#svn+}"
+
+svn checkout "${SVN_CHECKOUT_OPTIONS[@]}" "${REMOTE}" "${LOCAL}/"
diff --git a/ebuild/utils/dounpack b/ebuild/utils/dounpack
index e61f9ba..2af875f 100755
--- a/ebuild/utils/dounpack
+++ b/ebuild/utils/dounpack
@@ -34,18 +34,18 @@ unpack_one()
case "${x}" in
*.tar)
- echo tar xf "${1}" --no-same-owner 1>&2
- tar xf "${1}" --no-same-owner || die "Couldn't unpack ${1}"
+ echo tar xf "${1}" --no-same-owner "${TAR_OPTIONS[@]}" 1>&2
+ tar xf "${1}" --no-same-owner "${TAR_OPTIONS[@]}" || die "Couldn't unpack ${1}"
;;
*.tar.gz|*.tgz|*.tar.Z)
- echo tar zxf "${1}" --no-same-owner 1>&2
- tar zxf "${1}" --no-same-owner || die "Couldn't unpack ${1}"
+ echo tar zxf "${1}" --no-same-owner "${TAR_OPTIONS[@]}" 1>&2
+ tar zxf "${1}" --no-same-owner "${TAR_OPTIONS[@]}" || die "Couldn't unpack ${1}"
;;
*.tar.bz2|*.tbz2)
- echo tar jxf "${1}" --no-same-owner 1>&2
- tar jxf "${1}" --no-same-owner || die "Couldn't unpack ${1}"
+ echo tar jxf "${1}" --no-same-owner "${TAR_OPTIONS[@]}" 1>&2
+ tar jxf "${1}" --no-same-owner "${TAR_OPTIONS[@]}" || die "Couldn't unpack ${1}"
;;
*.zip|*.ZIP|*.jar)
@@ -94,6 +94,12 @@ if [[ "${1}" == "--binary" ]] ; then
shift
fi
+TAR_OPTIONS=( )
+while [[ "${1}" == --tar-option=* ]] ; do
+ TAR_OPTIONS+=( "${1#*=}" )
+ shift
+done
+
[[ -z "$@" ]] && die "No arguments given to unpack"
for x in "$@" ; do
diff --git a/paludis/repositories/nothing/nothing_repository.cc b/paludis/repositories/nothing/nothing_repository.cc
index 5c3b8ec..880afc6 100644
--- a/paludis/repositories/nothing/nothing_repository.cc
+++ b/paludis/repositories/nothing/nothing_repository.cc
@@ -59,8 +59,8 @@ namespace paludis
/// Sync URL
std::string sync;
- /// Sync exclude file
- std::string sync_exclude;
+ /// Sync options
+ std::string sync_options;
/// (Empty) provides map.
const std::map<QualifiedPackageName, QualifiedPackageName> provide_map;
@@ -79,7 +79,7 @@ namespace paludis
name(p.name),
location(p.location),
sync(p.sync),
- sync_exclude(p.sync_exclude),
+ sync_options(p.sync_options),
environment(p.environment)
{
}
@@ -111,7 +111,7 @@ NothingRepository::NothingRepository(const NothingRepositoryParams & p) try :
{
RepositoryInfoSection::Pointer config_info(new RepositoryInfoSection("Configuration information"));
config_info->add_kv("sync", _imp->sync);
- config_info->add_kv("sync_exclude", _imp->sync_exclude);
+ config_info->add_kv("sync_options", _imp->sync_options);
config_info->add_kv("location", stringify(_imp->location));
_info->add_section(config_info);
@@ -202,15 +202,24 @@ NothingRepository::make_nothing_repository(
throw NothingRepositoryConfigurationError("Key 'name' not specified or empty in '"
+ repo_file + "'");
- std::string sync_exclude;
+ std::string sync_options;
+ if (m->end() != m->find("sync_options"))
+ sync_options = m->find("sync_options")->second;
+
if (m->end() != m->find("sync_exclude"))
- sync_exclude = m->find("sync_exclude")->second;
+ {
+ Log::get_instance()->message(ll_warning, lc_no_context, "The sync_exclude key in '"
+ + repo_file + "' is deprecated in favour of sync_options = --exclude-from=");
+ if (! sync_options.empty())
+ sync_options += " ";
+ sync_options += "--exclude-from='" + m->find("sync_exclude")->second + "'";
+ }
return CountedPtr<Repository>(new NothingRepository(NothingRepositoryParams::create()
.name(name)
.location(location)
.sync(sync)
- .sync_exclude(sync_exclude)
+ .sync_options(sync_options)
.environment(env)));
}
@@ -238,7 +247,7 @@ NothingRepository::do_sync() const
.environment(_imp->environment)
.local(stringify(_imp->location))
.remote(_imp->sync));
- SyncOptions opts(_imp->sync_exclude);
+ SyncOptions opts(_imp->sync_options);
syncer.sync(opts);
return true;
diff --git a/paludis/repositories/nothing/nothing_repository.sr b/paludis/repositories/nothing/nothing_repository.sr
index a9067d7..c8d1e2d 100644
--- a/paludis/repositories/nothing/nothing_repository.sr
+++ b/paludis/repositories/nothing/nothing_repository.sr
@@ -6,7 +6,7 @@ make_class_NothingRepositoryParams()
key location FSEntry
key name std::string
key sync std::string
- key sync_exclude std::string
+ key sync_options std::string
key environment "const Environment *"
diff --git a/paludis/repositories/portage/make_ebuild_repository.cc b/paludis/repositories/portage/make_ebuild_repository.cc
index fdb69d0..56eec90 100644
--- a/paludis/repositories/portage/make_ebuild_repository.cc
+++ b/paludis/repositories/portage/make_ebuild_repository.cc
@@ -114,9 +114,18 @@ paludis::make_ebuild_repository(
if (m->end() != m->find("sync"))
sync = m->find("sync")->second;
- std::string sync_exclude;
+ std::string sync_options;
+ if (m->end() != m->find("sync_options"))
+ sync_options = m->find("sync_options")->second;
+
if (m->end() != m->find("sync_exclude"))
- sync_exclude = m->find("sync_exclude")->second;
+ {
+ Log::get_instance()->message(ll_warning, lc_no_context, "The sync_exclude key in '"
+ + repo_file + "' is deprecated in favour of sync_options = --exclude-from=");
+ if (! sync_options.empty())
+ sync_options += " ";
+ sync_options += "--exclude-from='" + m->find("sync_exclude")->second + "'";
+ }
std::string root;
if (m->end() == m->find("root") || ((root = m->find("root")->second)).empty())
@@ -141,7 +150,7 @@ paludis::make_ebuild_repository(
.setsdir(setsdir)
.newsdir(newsdir)
.sync(sync)
- .sync_exclude(sync_exclude)
+ .sync_options(sync_options)
.root(root)
.buildroot(buildroot)));
}
diff --git a/paludis/repositories/portage/portage_repository.cc b/paludis/repositories/portage/portage_repository.cc
index c870b54..d69e702 100644
--- a/paludis/repositories/portage/portage_repository.cc
+++ b/paludis/repositories/portage/portage_repository.cc
@@ -296,7 +296,7 @@ PortageRepository::PortageRepository(const PortageRepositoryParams & p) :
config_info->add_kv("root", stringify(_imp->params.root));
config_info->add_kv("buildroot", stringify(_imp->params.buildroot));
config_info->add_kv("sync", _imp->params.sync);
- config_info->add_kv("sync_exclude", _imp->params.sync_exclude);
+ config_info->add_kv("sync_options", _imp->params.sync_options);
_info->add_section(config_info);
}
@@ -793,7 +793,7 @@ PortageRepository::do_sync() const
.environment(_imp->params.environment)
.local(stringify(_imp->params.location))
.remote(*s));
- SyncOptions opts(_imp->params.sync_exclude);
+ SyncOptions opts(_imp->params.sync_options);
try
{
syncer.sync(opts);
diff --git a/paludis/repositories/portage/portage_repository_params.sr b/paludis/repositories/portage/portage_repository_params.sr
index cb926b5..8e17650 100644
--- a/paludis/repositories/portage/portage_repository_params.sr
+++ b/paludis/repositories/portage/portage_repository_params.sr
@@ -17,7 +17,7 @@ make_class_PortageRepositoryParams()
key securitydir FSEntry
key newsdir FSEntry
key sync std::string
- key sync_exclude std::string
+ key sync_options std::string
key root FSEntry
key buildroot FSEntry
diff --git a/paludis/syncer.cc b/paludis/syncer.cc
index 2e7bbe6..ba1545a 100644
--- a/paludis/syncer.cc
+++ b/paludis/syncer.cc
@@ -20,7 +20,6 @@
*/
#include "syncer.hh"
-#include <paludis/about.hh>
#include <paludis/environment.hh>
#include <paludis/util/fs_entry.hh>
#include <paludis/util/log.hh>
@@ -94,21 +93,9 @@ void
DefaultSyncer::sync(const SyncOptions & opts) const
{
- MakeEnvCommand cmd(make_env_command(stringify(_syncer) + " '" + _local + "' '" + _remote + "'")
- ("PKGMANAGER", PALUDIS_PACKAGE "-" + stringify(PALUDIS_VERSION_MAJOR) + "." +
- stringify(PALUDIS_VERSION_MINOR) + "." +
- stringify(PALUDIS_VERSION_MICRO) +
- (std::string(PALUDIS_SUBVERSION_REVISION).empty() ?
- std::string("") : "-r" + std::string(PALUDIS_SUBVERSION_REVISION)))
- ("PALUDIS_CONFIG_DIR", SYSCONFDIR "/paludis/")
- ("PALUDIS_BASHRC_FILES", _environment->bashrc_files())
- ("PALUDIS_HOOK_DIRS", _environment->hook_dirs())
+ MakeEnvCommand cmd(make_env_command(stringify(_syncer) + " " + opts.options + " '" + _local + "' '" + _remote + "'")
("PALUDIS_FETCHERS_DIRS", _environment->fetchers_dirs())
- ("PALUDIS_SYNCERS_DIRS", _environment->syncers_dirs())
- ("PALUDIS_COMMAND", _environment->paludis_command())
- ("PALUDIS_EBUILD_LOG_LEVEL", stringify(Log::get_instance()->log_level()))
- ("PALUDIS_EBUILD_DIR", getenv_with_default("PALUDIS_EBUILD_DIR", LIBEXECDIR "/paludis"))
- ("PALUDIS_SYNC_EXCLUDE_FROM", opts.exclude_from));
+ ("PALUDIS_EBUILD_DIR", getenv_with_default("PALUDIS_EBUILD_DIR", LIBEXECDIR "/paludis")));
if (run_command(cmd))
throw SyncFailedError(_local, _remote);
diff --git a/paludis/syncer.sr b/paludis/syncer.sr
index d2c45a4..bd27ac9 100644
--- a/paludis/syncer.sr
+++ b/paludis/syncer.sr
@@ -3,7 +3,7 @@
make_class_SyncOptions()
{
- key exclude_from std::string
+ key options std::string
doxygen_comment << "END"
/**
diff --git a/src/clients/paludis/applets.cc b/src/clients/paludis/applets.cc
index 17b578b..2972cd0 100644
--- a/src/clients/paludis/applets.cc
+++ b/src/clients/paludis/applets.cc
@@ -26,11 +26,13 @@
#include <paludis/util/log.hh>
#include <paludis/util/collection_concrete.hh>
#include <paludis/util/dir_iterator.hh>
+#include <paludis/util/system.hh>
#include <paludis/util/tokeniser.hh>
#include <paludis/environment/default/default_environment.hh>
#include <paludis/repositories/repository_maker.hh>
#include <string>
#include <set>
+#include <map>
/** \file
* Handle the --has-version, --best-version and various --list actions for the
@@ -187,9 +189,9 @@ int do_list_repository_formats()
int do_list_sync_protocols()
{
- std::set<std::string> keys;
-
+ std::map<std::string, std::string> syncers;
Environment * const env(DefaultEnvironment::get_instance());
+
std::list<std::string> syncers_dirs;
WhitespaceTokeniser::get_instance()->tokenise(env->syncers_dirs(),
std::back_inserter(syncers_dirs));
@@ -208,19 +210,26 @@ int do_list_sync_protocols()
0 == name.compare(0, 2, "do", 0, 2))
{
name.erase(0, 2);
- keys.insert(name);
+ if (syncers.find(name) == syncers.end())
+ syncers[name] = stringify(*f);
}
}
}
int return_code(1);
- if (! keys.empty())
+ if (! syncers.empty())
{
return_code = 0;
- for (std::set<std::string>::const_iterator k(keys.begin()), k_end(keys.end()) ;
- k != k_end ; ++k)
- std::cout << "* " << colour(cl_key_name, *k) << std::endl;
+ for (std::map<std::string, std::string>::const_iterator s(syncers.begin()), s_end(syncers.end()) ;
+ s != s_end ; ++s)
+ {
+ std::cout << "* " << colour(cl_key_name, s->first) << std::endl;
+ MakeEnvCommand cmd(make_env_command(s->second + " --help")
+ ("PALUDIS_FETCHERS_DIRS", env->fetchers_dirs())
+ ("PALUDIS_EBUILD_DIR", getenv_with_default("PALUDIS_EBUILD_DIR", LIBEXECDIR "/paludis")));
+ run_command(cmd);
+ }
}
return return_code;