aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-02-10 21:53:31 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-02-10 21:53:31 +0000
commit00ab2c16fd886082b3184b9046d331067b325d5c (patch)
treef4ec5501717bf86ce6f044bd4619bda742072efe
parentd1f6eca2de5bdecaea357131391224b349846f04 (diff)
parentdf7b85671449a10ca41f9fbe6a1fffa3f1a1fc82 (diff)
downloadpaludis-00ab2c16fd886082b3184b9046d331067b325d5c.tar.gz
paludis-00ab2c16fd886082b3184b9046d331067b325d5c.tar.xz
Merge commit 'git-pioto-org/master' into logging
-rw-r--r--paludis/repositories/e/eapi.cc1
-rw-r--r--paludis/repositories/e/eapi.hh2
-rw-r--r--paludis/repositories/e/eapis/0.conf2
-rw-r--r--paludis/repositories/e/eapis/exheres-0.conf2
-rw-r--r--paludis/repositories/e/eapis/paludis-1.conf2
-rw-r--r--paludis/repositories/e/ebuild.cc2
-rwxr-xr-xpaludis/repositories/e/ebuild/utils/unpack154
-rw-r--r--paludis/repositories/e/exndbam_repository.cc23
-rw-r--r--paludis/repositories/e/vdb_repository.cc21
-rw-r--r--paludis/syncers/dotar.in3
-rw-r--r--paludis/util/safe_ifstream_TEST.cc7
-rw-r--r--paludis/util/safe_ofstream_TEST.cc7
12 files changed, 157 insertions, 69 deletions
diff --git a/paludis/repositories/e/eapi.cc b/paludis/repositories/e/eapi.cc
index f9af526..4139b36 100644
--- a/paludis/repositories/e/eapi.cc
+++ b/paludis/repositories/e/eapi.cc
@@ -207,6 +207,7 @@ namespace
value_for<n::dosym_mkdir>(destringify_key<bool>(k, "dosym_mkdir")),
value_for<n::failure_is_fatal>(destringify_key<bool>(k, "failure_is_fatal")),
value_for<n::unpack_fix_permissions>(destringify_key<bool>(k, "unpack_fix_permissions")),
+ value_for<n::unpack_suffixes>(k.get("unpack_suffixes")),
value_for<n::unpack_unrecognised_is_fatal>(destringify_key<bool>(k, "unpack_unrecognised_is_fatal"))
)));
}
diff --git a/paludis/repositories/e/eapi.hh b/paludis/repositories/e/eapi.hh
index f1bd57e..254c2e7 100644
--- a/paludis/repositories/e/eapi.hh
+++ b/paludis/repositories/e/eapi.hh
@@ -147,6 +147,7 @@ namespace paludis
struct supported;
struct tools_options;
struct unpack_fix_permissions;
+ struct unpack_suffixes;
struct unpack_unrecognised_is_fatal;
struct upstream_changelog;
struct upstream_documentation;
@@ -369,6 +370,7 @@ namespace paludis
NamedValue<n::dosym_mkdir, bool> dosym_mkdir;
NamedValue<n::failure_is_fatal, bool> failure_is_fatal;
NamedValue<n::unpack_fix_permissions, bool> unpack_fix_permissions;
+ NamedValue<n::unpack_suffixes, std::string> unpack_suffixes;
NamedValue<n::unpack_unrecognised_is_fatal, bool> unpack_unrecognised_is_fatal;
};
diff --git a/paludis/repositories/e/eapis/0.conf b/paludis/repositories/e/eapis/0.conf
index 6ee7489..103bf1e 100644
--- a/paludis/repositories/e/eapis/0.conf
+++ b/paludis/repositories/e/eapis/0.conf
@@ -255,3 +255,5 @@ doman_lang_filenames = false
dosym_mkdir = true
failure_is_fatal = false
+unpack_suffixes = tar tar.gz,tgz,tar.Z tar.bz2,tbz2,tbz zip,ZIP,jar gz,Z,z bz2 rar,RAR lha,LHa,LHA,lzh a,deb tar.lzma lzma 7z,7Z
+
diff --git a/paludis/repositories/e/eapis/exheres-0.conf b/paludis/repositories/e/eapis/exheres-0.conf
index e079ebf..e71229f 100644
--- a/paludis/repositories/e/eapis/exheres-0.conf
+++ b/paludis/repositories/e/eapis/exheres-0.conf
@@ -294,6 +294,8 @@ doman_lang_filenames = true
dosym_mkdir = false
failure_is_fatal = true
+unpack_suffixes = tar tar.gz,tgz,tar.Z tar.bz2,tbz2,tbz zip,ZIP,jar gz,Z,z bz2 rar,RAR lha,LHa,LHA,lzh a,deb tar.lzma lzma 7z,7Z tar.xz xz
+
annotations_myoptions_description = description
annotations_myoptions_requires = requires
annotations_myoptions_number_selected = number-selected
diff --git a/paludis/repositories/e/eapis/paludis-1.conf b/paludis/repositories/e/eapis/paludis-1.conf
index 989c572..dbf298f 100644
--- a/paludis/repositories/e/eapis/paludis-1.conf
+++ b/paludis/repositories/e/eapis/paludis-1.conf
@@ -268,3 +268,5 @@ doman_lang_filenames = true
dosym_mkdir = false
failure_is_fatal = false
+unpack_suffixes = tar tar.gz,tgz,tar.Z tar.bz2,tbz2,tbz zip,ZIP,jar gz,Z,z bz2 rar,RAR lha,LHa,LHA,lzh a,deb tar.lzma lzma 7z,7Z tar.xz xz
+
diff --git a/paludis/repositories/e/ebuild.cc b/paludis/repositories/e/ebuild.cc
index 77b1180..115100f 100644
--- a/paludis/repositories/e/ebuild.cc
+++ b/paludis/repositories/e/ebuild.cc
@@ -191,6 +191,8 @@ EbuildCommand::operator() ()
params.package_id()->eapi()->supported()->tools_options()->unpack_unrecognised_is_fatal() ? "yes" : "")
.with_setenv("PALUDIS_UNPACK_FIX_PERMISSIONS",
params.package_id()->eapi()->supported()->tools_options()->unpack_fix_permissions() ? "yes" : "")
+ .with_setenv("PALUDIS_UNPACK_SUFFIXES",
+ params.package_id()->eapi()->supported()->tools_options()->unpack_suffixes())
.with_setenv("PALUDIS_DOMAN_LANG_FILENAMES",
params.package_id()->eapi()->supported()->tools_options()->doman_lang_filenames() ? "yes" : "")
.with_setenv("PALUDIS_DOSYM_NO_MKDIR",
diff --git a/paludis/repositories/e/ebuild/utils/unpack b/paludis/repositories/e/ebuild/utils/unpack
index 486c850..45ff590 100755
--- a/paludis/repositories/e/ebuild/utils/unpack
+++ b/paludis/repositories/e/ebuild/utils/unpack
@@ -36,92 +36,110 @@ assert()
[[ -z "${_pipestatus//[ 0]/}" ]] || die "$@: $_pipestatus"
}
-unpack_one()
-{
- [[ -z "$1" ]] && die "Bad argument for unpack_one"
- [[ -e "$1" ]] || die "${1} doesn't exist"
+unpack_tar() {
+ echo tar xf "${1}" --no-same-owner "${TAR_OPTIONS[@]}" 1>&2
+ tar xf "${1}" --no-same-owner "${TAR_OPTIONS[@]}"
+}
- if [[ -n "${UNPACKONLY}" ]] ; then
- case "${x}" in
- *.tar.bz2|*.tbz2|*.tbz)
- ;;
+unpack_tar.gz() {
+ echo tar zxf "${1}" --no-same-owner "${TAR_OPTIONS[@]}" 1>&2
+ tar zxf "${1}" --no-same-owner "${TAR_OPTIONS[@]}"
+}
- *)
- die "Can't use --only with ${x}"
- ;;
- esac
- fi
+unpack_tar.bz2() {
+ echo tar jxf "${1}" --no-same-owner "${TAR_OPTIONS[@]}" "${UNPACKONLY}" 1>&2
+ tar jxf "${1}" --no-same-owner "${TAR_OPTIONS[@]}" "${UNPACKONLY}"
+}
- case "${x}" in
- *.tar)
- echo tar xf "${1}" --no-same-owner "${TAR_OPTIONS[@]}" 1>&2
- tar xf "${1}" --no-same-owner "${TAR_OPTIONS[@]}" || die "Couldn't unpack ${1}"
- ;;
+unpack_zip() {
+ echo unzip -qo "${1}" 1>&2
+ unzip -qo "${1}"
+}
- *.tar.gz|*.tgz|*.tar.Z)
- echo tar zxf "${1}" --no-same-owner "${TAR_OPTIONS[@]}" 1>&2
- tar zxf "${1}" --no-same-owner "${TAR_OPTIONS[@]}" || die "Couldn't unpack ${1}"
- ;;
+unpack_gz() {
+ echo gzip -dc "${1}" \> "${UNPACKTODIR}/$(basename "${1%.*}" )" 1>&2
+ gzip -dc "${1}" > "${UNPACKTODIR}/$(basename "${1%.*}" )"
+}
- *.tar.bz2|*.tbz2|*.tbz)
- echo tar jxf "${1}" --no-same-owner "${TAR_OPTIONS[@]}" ${UNPACKONLY} 1>&2
- tar jxf "${1}" --no-same-owner "${TAR_OPTIONS[@]}" ${UNPACKONLY} || die "Couldn't unpack ${1}"
- ;;
+unpack_bz2() {
+ echo bzip2 -dc "${1}" \> "${UNPACKTODIR}/$(basename "${1%.*}" )" 1>&2
+ bzip2 -dc "${1}" > "${UNPACKTODIR}/$(basename "${1%.*}" )" || die "Couldn't unpack ${1}"
+}
- *.zip|*.ZIP|*.jar)
- echo unzip -qo "${1}" 1>&2
- unzip -qo "${1}" || die "Couldn't unpack ${1}"
- ;;
+unpack_rar() {
+ echo unrar x -idq "${1}" 1>&2
+ unrar x -idq "${1}"
+}
- *.gz|*.Z|*.z)
- echo gzip -dc "${1}" > ${UNPACKTODIR}/$(basename "${1%.*}" ) 1>&2
- gzip -dc "${1}" > ${UNPACKTODIR}/$(basename "${1%.*}" ) || die "Couldn't unpack ${1}"
- ;;
+unpack_lha() {
+ echo lha xfq "${1}" 1>&2
+ lha xfq "${1}"
+}
- *.bz2)
- echo bzip2 -dc "${1}" > ${UNPACKTODIR}/$(basename "${1%.*}" ) 1>&2
- bzip2 -dc "${1}" > ${UNPACKTODIR}/$(basename "${1%.*}" ) || die "Couldn't unpack ${1}"
- ;;
+unpack_a() {
+ echo ar x "${1}" 1>&2
+ ar x "${1}" 1>&2
+}
- *.rar|*.RAR)
- echo unrar x -idq "${1}" 1>&2
- unrar x -idq "${1}" || die "Couldn't unpack ${1}"
- ;;
+unpack_tar.lzma() {
+ echo lzma -dc "${1}" \| tar xf - --no-same-owner "${TAR_OPTIONS[@]}"
+ lzma -dc "${1}" | tar xf - --no-same-owner "${TAR_OPTIONS[@]}"
+ assert "Couldn't unpack ${1}"
+}
- *.LHa|*.LHA|*.lha|*.lzh)
- echo lha xqf "${1}" 1>&2
- lha xqf "${1}" || die "Couldn't unpack ${1}"
- ;;
+unpack_lzma() {
+ echo lzma -dc "${1}" \> "${UNPACKTODIR}/$(basename "${1%.*}" )" 1>&2
+ lzma -dc "${1}" > "${UNPACKTODIR}/$(basename "${1%.*}" )"
+}
- *.a|*.deb)
- echo ar x "${1}" 1>&2
- ar x "${1}" 1>&2
- ;;
+unpack_7z() {
+ echo 7z x -y "${1}"
+ 7z x -y "${1}"
+}
- *.tar.lzma)
- echo lzma -dc "${1}" \| tar xf - --no-same-owner "${TAR_OPTIONS[@]}"
- lzma -dc "${1}" | tar xf - --no-same-owner "${TAR_OPTIONS[@]}"
- assert "Couldn't unpack ${1}"
- ;;
+unpack_tar.xz() {
+ echo xz -dc "${1}" \| tar xf - --no-same-owner "${TAR_OPTIONS[@]}"
+ xz -dc "${1}" | tar xf - --no-same-owner "${TAR_OPTIONS[@]}"
+ assert "Couldn't unpack ${1}"
+}
+
+unpack_xz() {
+ echo xz -dc "${1}" \> "${UNPACKTODIR}/$(basename "${1%.*}" )" 1>&2
+ xz -dc "${1}" > "${UNPACKTODIR}/$(basename "${1%.*}" )"
+}
+
+unpack_one()
+{
+ [[ -z ${1} ]] && die "Bad argument for unpack_one"
+ [[ -e ${1} ]] || die "${1} doesn't exist"
- *.lzma)
- echo lzma -dc "${1}" > ${UNPACKTODIR}/$(basename "${1%.*}" ) 1>&2
- lzma -dc "${1}" > ${UNPACKTODIR}/$(basename "${1%.*}" ) || die "Couldn't unpack ${1}"
+ if [[ -n "${UNPACKONLY}" ]] ; then
+ case ${1} in
+ *.tar.bz2|*.tbz2|*.tbz)
;;
- *.7z|*.7Z)
- echo 7z x -y "${1}"
- 7z x -y "${1}" || die "Couldn't unpack ${1}"
+ *)
+ die "Can't use --only with ${x}"
;;
+ esac
+ fi
- *)
- if [[ -n "${PALUDIS_UNPACK_UNRECOGNISED_IS_FATAL}" ]] ; then
- die "Don't know how to unpack ${x}"
- else
- echo "Skipping unpack for ${1}"
+ local group split suffix
+ for group in ${PALUDIS_UNPACK_SUFFIXES}; do
+ split=( $(IFS=,; echo ${group} ) )
+ for suffix in ${split[@]}; do
+ if [[ ${1} == *.${suffix} ]]; then
+ unpack_${split[0]} "${1}" || die "Couldn't unpack ${1}"
+ return
fi
- ;;
- esac
+ done
+ done
+
+ if [[ -n "${PALUDIS_UNPACK_UNRECOGNISED_IS_FATAL}" ]] ; then
+ die "Don't know how to unpack ${x}"
+ else
+ echo "Skipping unpack for ${1}"
+ fi
}
export UNPACKFROMDIR="${!PALUDIS_UNPACK_FROM_VAR}"
diff --git a/paludis/repositories/e/exndbam_repository.cc b/paludis/repositories/e/exndbam_repository.cc
index f6f187c..93f55ec 100644
--- a/paludis/repositories/e/exndbam_repository.cc
+++ b/paludis/repositories/e/exndbam_repository.cc
@@ -354,13 +354,23 @@ ExndbamRepository::merge(const MergeParams & m)
/* load CONFIG_PROTECT, CONFIG_PROTECT_MASK back */
std::string config_protect, config_protect_mask;
+ try
{
SafeIFStream c(target_ver_dir / "CONFIG_PROTECT");
config_protect = std::string((std::istreambuf_iterator<char>(c)), std::istreambuf_iterator<char>());
+ }
+ catch (const SafeIFStreamError &)
+ {
+ }
+ try
+ {
SafeIFStream c_m(target_ver_dir / "CONFIG_PROTECT_MASK");
config_protect_mask = std::string((std::istreambuf_iterator<char>(c_m)), std::istreambuf_iterator<char>());
}
+ catch (const SafeIFStreamError &)
+ {
+ }
NDBAMMerger merger(
make_named_values<NDBAMMergerParams>(
@@ -449,15 +459,26 @@ ExndbamRepository::perform_uninstall(const std::tr1::shared_ptr<const ERepositor
{
/* load CONFIG_PROTECT, CONFIG_PROTECT_MASK from vdb, supplement with env */
std::string config_protect, config_protect_mask;
+
+ try
{
SafeIFStream c(ver_dir / "CONFIG_PROTECT");
config_protect = std::string((std::istreambuf_iterator<char>(c)), std::istreambuf_iterator<char>()) +
- " " + getenv_with_default("CONFIG_PROTECT", "");
+ " " + getenv_with_default("CONFIG_PROTECT", "");
+ }
+ catch (const SafeIFStreamError &)
+ {
+ }
+ try
+ {
SafeIFStream c_m(ver_dir / "CONFIG_PROTECT_MASK");
config_protect_mask = std::string((std::istreambuf_iterator<char>(c_m)), std::istreambuf_iterator<char>()) +
" " + getenv_with_default("CONFIG_PROTECT_MASK", "");
}
+ catch (const SafeIFStreamError &)
+ {
+ }
std::string final_config_protect(config_protect + " " + merge_config_protect);
diff --git a/paludis/repositories/e/vdb_repository.cc b/paludis/repositories/e/vdb_repository.cc
index dd4058f..ab6c67c 100644
--- a/paludis/repositories/e/vdb_repository.cc
+++ b/paludis/repositories/e/vdb_repository.cc
@@ -408,15 +408,26 @@ VDBRepository::perform_uninstall(const std::tr1::shared_ptr<const ERepositoryID>
{
/* load CONFIG_PROTECT, CONFIG_PROTECT_MASK from vdb, supplement with env */
std::string config_protect, config_protect_mask;
+
+ try
{
SafeIFStream c(pkg_dir / "CONFIG_PROTECT");
config_protect = std::string((std::istreambuf_iterator<char>(c)), std::istreambuf_iterator<char>()) +
" " + getenv_with_default("CONFIG_PROTECT", "");
+ }
+ catch (const SafeIFStreamError &)
+ {
+ }
+ try
+ {
SafeIFStream c_m(pkg_dir / "CONFIG_PROTECT_MASK");
config_protect_mask = std::string((std::istreambuf_iterator<char>(c_m)), std::istreambuf_iterator<char>()) +
" " + getenv_with_default("CONFIG_PROTECT_MASK", "");
}
+ catch (const SafeIFStreamError &)
+ {
+ }
std::string final_config_protect(config_protect + " " + merge_config_protect);
@@ -827,13 +838,23 @@ VDBRepository::merge(const MergeParams & m)
/* load CONFIG_PROTECT, CONFIG_PROTECT_MASK from vdb */
std::string config_protect, config_protect_mask;
+ try
{
SafeIFStream c(tmp_vdb_dir / "CONFIG_PROTECT");
config_protect = std::string((std::istreambuf_iterator<char>(c)), std::istreambuf_iterator<char>());
+ }
+ catch (const SafeIFStreamError &)
+ {
+ }
+ try
+ {
SafeIFStream c_m(tmp_vdb_dir / "CONFIG_PROTECT_MASK");
config_protect_mask = std::string((std::istreambuf_iterator<char>(c_m)), std::istreambuf_iterator<char>());
}
+ catch (const SafeIFStreamError &)
+ {
+ }
FSEntry vdb_dir(_imp->params.location());
vdb_dir /= stringify(m.package_id()->name().category());
diff --git a/paludis/syncers/dotar.in b/paludis/syncers/dotar.in
index 45e6f4d..40b112c 100644
--- a/paludis/syncers/dotar.in
+++ b/paludis/syncers/dotar.in
@@ -143,6 +143,9 @@ TARFILE="${URL##*/}"
UNPACKDIR="${TEMP}/repository"
mkdir "${UNPACKDIR}"
+export PALUDIS_UNPACK_SUFFIXES="tar tar.gz,tgz,tar.Z tar.bz2,tbz2,tbz zip,ZIP,jar rar,RAR lha,LHa,LHA,lzh a,deb tar.lzma 7z,7Z tar.xz"
+export PALUDIS_UNPACK_UNRECOGNISED_IS_FATAL=yes
+export PALUDIS_UNPACK_FIX_PERMISSIONS=
( cd "${UNPACKDIR}" && "${PALUDIS_EBUILD_DIR}/utils/unpack" \
"${UNPACK_OPTIONS[@]}" "${TEMP}/${TARFILE}" ) || exit $?
diff --git a/paludis/util/safe_ifstream_TEST.cc b/paludis/util/safe_ifstream_TEST.cc
index ab3ed17..8456b51 100644
--- a/paludis/util/safe_ifstream_TEST.cc
+++ b/paludis/util/safe_ifstream_TEST.cc
@@ -21,6 +21,8 @@
#include <paludis/util/fs_entry.hh>
#include <test/test_runner.hh>
#include <test/test_framework.hh>
+#include <unistd.h>
+#include <sys/types.h>
using namespace test;
using namespace paludis;
@@ -85,6 +87,11 @@ namespace test_cases
{
ExistingPermTest() : TestCase("existing unreadable file") { }
+ bool skip() const
+ {
+ return 0 == getuid();
+ }
+
void run()
{
TEST_CHECK_THROWS(SafeIFStream(FSEntry::cwd() / "safe_ifstream_TEST_dir" / "existing_perm"), SafeIFStreamError);
diff --git a/paludis/util/safe_ofstream_TEST.cc b/paludis/util/safe_ofstream_TEST.cc
index 720d823..739d0f4 100644
--- a/paludis/util/safe_ofstream_TEST.cc
+++ b/paludis/util/safe_ofstream_TEST.cc
@@ -21,6 +21,8 @@
#include <paludis/util/fs_entry.hh>
#include <test/test_runner.hh>
#include <test/test_framework.hh>
+#include <unistd.h>
+#include <sys/types.h>
using namespace test;
using namespace paludis;
@@ -105,6 +107,11 @@ namespace test_cases
TEST_CHECK_THROWS(SafeOFStream(FSEntry::cwd() / "safe_ofstream_TEST_dir" / "existing_perm"), SafeOFStreamError);
}
+ bool skip() const
+ {
+ return 0 == getuid();
+ }
+
bool repeatable() const
{
return false;