diff options
author | 2015-10-31 16:12:03 +0000 | |
---|---|---|
committer | 2015-11-05 17:37:26 +0000 | |
commit | c9bc47089a68beb4ffefb097bf1f15495e4c8ae2 (patch) | |
tree | a32b45a918aa2c1a97aee66bd5424a8e57850718 | |
parent | ea0ee08da746e4d924031bafca3e96e60b7599bd (diff) | |
download | paludis-c9bc47089a68beb4ffefb097bf1f15495e4c8ae2.tar.gz paludis-c9bc47089a68beb4ffefb097bf1f15495e4c8ae2.tar.xz |
EAPI 6 unpack has saner path handling
-rw-r--r-- | paludis/repositories/e/e_repository_TEST_5.cc | 36 | ||||
-rwxr-xr-x | paludis/repositories/e/e_repository_TEST_5_setup.sh | 81 | ||||
-rw-r--r-- | paludis/repositories/e/e_repository_TEST_6.cc | 36 | ||||
-rwxr-xr-x | paludis/repositories/e/e_repository_TEST_6_setup.sh | 81 | ||||
-rw-r--r-- | paludis/repositories/e/eapi.cc | 1 | ||||
-rw-r--r-- | paludis/repositories/e/eapi.hh | 2 | ||||
-rw-r--r-- | paludis/repositories/e/eapis/0.conf | 1 | ||||
-rw-r--r-- | paludis/repositories/e/eapis/6.conf | 2 | ||||
-rw-r--r-- | paludis/repositories/e/eapis/exheres-0.conf | 1 | ||||
-rw-r--r-- | paludis/repositories/e/eapis/paludis-1.conf | 1 | ||||
-rw-r--r-- | paludis/repositories/e/ebuild.cc | 2 | ||||
-rwxr-xr-x | paludis/repositories/e/ebuild/utils/unpack | 10 | ||||
-rw-r--r-- | paludis/syncers/dotar.in | 1 |
13 files changed, 254 insertions, 1 deletions
diff --git a/paludis/repositories/e/e_repository_TEST_5.cc b/paludis/repositories/e/e_repository_TEST_5.cc index 8d8581cc9..db96e03e1 100644 --- a/paludis/repositories/e/e_repository_TEST_5.cc +++ b/paludis/repositories/e/e_repository_TEST_5.cc @@ -222,6 +222,42 @@ TEST(ERepository, InstallEAPI5) EXPECT_EQ("5", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->parse_value()); id->perform_action(action); } + + { + const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( + PackageDepSpec(parse_user_package_dep_spec("=cat/unpack-bare-5", + &env, { })), nullptr, { }))]->last()); + ASSERT_TRUE(bool(id)); + EXPECT_EQ("5", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->parse_value()); + id->perform_action(action); + } + + { + const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( + PackageDepSpec(parse_user_package_dep_spec("=cat/unpack-dotslash-5", + &env, { })), nullptr, { }))]->last()); + ASSERT_TRUE(bool(id)); + EXPECT_EQ("5", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->parse_value()); + id->perform_action(action); + } + + { + const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( + PackageDepSpec(parse_user_package_dep_spec("=cat/unpack-absolute-5", + &env, { })), nullptr, { }))]->last()); + ASSERT_TRUE(bool(id)); + EXPECT_EQ("5", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->parse_value()); + EXPECT_THROW(id->perform_action(action), ActionFailedError); + } + + { + const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( + PackageDepSpec(parse_user_package_dep_spec("=cat/unpack-relative-5", + &env, { })), nullptr, { }))]->last()); + ASSERT_TRUE(bool(id)); + EXPECT_EQ("5", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->parse_value()); + EXPECT_THROW(id->perform_action(action), ActionFailedError); + } } TEST(ERepository, RequiredUse) diff --git a/paludis/repositories/e/e_repository_TEST_5_setup.sh b/paludis/repositories/e/e_repository_TEST_5_setup.sh index 53b9f84b7..debc4d817 100755 --- a/paludis/repositories/e/e_repository_TEST_5_setup.sh +++ b/paludis/repositories/e/e_repository_TEST_5_setup.sh @@ -13,6 +13,7 @@ mkdir -p build ln -s build symlinked_build mkdir -p distdir +gzip -c <<<test >distdir/test.gz mkdir -p repo/{profiles/profile,metadata,eclass} || exit 1 cd repo || exit 1 @@ -374,6 +375,86 @@ KEYWORDS="test" fail=( does/not/exist/* ) END +mkdir -p "cat/unpack-bare" || exit 1 +cat << 'END' > cat/unpack-bare/unpack-bare-5.ebuild || exit 1 +EAPI="5" +DESCRIPTION="The Description" +HOMEPAGE="http://example.com/" +SRC_URI="test.gz" +SLOT="0" +IUSE="" +LICENSE="GPL-2" +KEYWORDS="test" + +S=${WORKDIR} + +src_unpack() { + unpack test.gz + [[ $(< test) == test ]] || die +} +END + +mkdir -p "cat/unpack-dotslash" || exit 1 +cat << 'END' > cat/unpack-dotslash/unpack-dotslash-5.ebuild || exit 1 +EAPI="5" +DESCRIPTION="The Description" +HOMEPAGE="http://example.com/" +SRC_URI="" +SLOT="0" +IUSE="" +LICENSE="GPL-2" +KEYWORDS="test" + +S=${WORKDIR} + +src_unpack() { + gzip -c <<<test2 >test2.gz + unpack ./test2.gz + [[ $(< test2) == test2 ]] || die +} +END + +mkdir -p "cat/unpack-absolute" || exit 1 +cat << 'END' > cat/unpack-absolute/unpack-absolute-5.ebuild || exit 1 +EAPI="5" +DESCRIPTION="The Description" +HOMEPAGE="http://example.com/" +SRC_URI="" +SLOT="0" +IUSE="" +LICENSE="GPL-2" +KEYWORDS="test" + +S=${WORKDIR} + +src_unpack() { + gzip -c <<<test3 >test3.gz + [[ -e test3.gz ]] || return + unpack $(pwd)/test3.gz +} +END + +mkdir -p "cat/unpack-relative" || exit 1 +cat << 'END' > cat/unpack-relative/unpack-relative-5.ebuild || exit 1 +EAPI="5" +DESCRIPTION="The Description" +HOMEPAGE="http://example.com/" +SRC_URI="" +SLOT="0" +IUSE="" +LICENSE="GPL-2" +KEYWORDS="test" + +S=${WORKDIR} + +src_unpack() { + mkdir subdir + gzip -c <<<test4 >subdir/test4.gz + [[ -e subdir/test4.gz ]] || return + unpack subdir/test4.gz +} +END + mkdir -p "cat/subslots" || exit 1 cat << 'END' > cat/subslots/subslots-5.ebuild || exit 1 EAPI="5" diff --git a/paludis/repositories/e/e_repository_TEST_6.cc b/paludis/repositories/e/e_repository_TEST_6.cc index 99fb43d13..6c38703d1 100644 --- a/paludis/repositories/e/e_repository_TEST_6.cc +++ b/paludis/repositories/e/e_repository_TEST_6.cc @@ -149,5 +149,41 @@ TEST(ERepository, InstallEAPI6) EXPECT_EQ("6", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->parse_value()); id->perform_action(action); } + + { + const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( + PackageDepSpec(parse_user_package_dep_spec("=cat/unpack-bare-6", + &env, { })), nullptr, { }))]->last()); + ASSERT_TRUE(bool(id)); + EXPECT_EQ("6", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->parse_value()); + id->perform_action(action); + } + + { + const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( + PackageDepSpec(parse_user_package_dep_spec("=cat/unpack-dotslash-6", + &env, { })), nullptr, { }))]->last()); + ASSERT_TRUE(bool(id)); + EXPECT_EQ("6", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->parse_value()); + id->perform_action(action); + } + + { + const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( + PackageDepSpec(parse_user_package_dep_spec("=cat/unpack-absolute-6", + &env, { })), nullptr, { }))]->last()); + ASSERT_TRUE(bool(id)); + EXPECT_EQ("6", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->parse_value()); + id->perform_action(action); + } + + { + const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( + PackageDepSpec(parse_user_package_dep_spec("=cat/unpack-relative-6", + &env, { })), nullptr, { }))]->last()); + ASSERT_TRUE(bool(id)); + EXPECT_EQ("6", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->parse_value()); + id->perform_action(action); + } } diff --git a/paludis/repositories/e/e_repository_TEST_6_setup.sh b/paludis/repositories/e/e_repository_TEST_6_setup.sh index ef6e21215..8b61d87a9 100755 --- a/paludis/repositories/e/e_repository_TEST_6_setup.sh +++ b/paludis/repositories/e/e_repository_TEST_6_setup.sh @@ -13,6 +13,7 @@ mkdir -p build ln -s build symlinked_build mkdir -p distdir +gzip -c <<<test >distdir/test.gz mkdir -p repo/{profiles/profile,metadata,eclass} || exit 1 cd repo || exit 1 @@ -63,5 +64,85 @@ pkg_setup() { } END +mkdir -p "cat/unpack-bare" || exit 1 +cat << 'END' > cat/unpack-bare/unpack-bare-6.ebuild || exit 1 +EAPI="6" +DESCRIPTION="The Description" +HOMEPAGE="http://example.com/" +SRC_URI="test.gz" +SLOT="0" +IUSE="" +LICENSE="GPL-2" +KEYWORDS="test" + +S=${WORKDIR} + +src_unpack() { + unpack test.gz + [[ $(< test) == test ]] || die +} +END + +mkdir -p "cat/unpack-dotslash" || exit 1 +cat << 'END' > cat/unpack-dotslash/unpack-dotslash-6.ebuild || exit 1 +EAPI="6" +DESCRIPTION="The Description" +HOMEPAGE="http://example.com/" +SRC_URI="" +SLOT="0" +IUSE="" +LICENSE="GPL-2" +KEYWORDS="test" + +S=${WORKDIR} + +src_unpack() { + gzip -c <<<test2 >test2.gz + unpack ./test2.gz + [[ $(< test2) == test2 ]] || die +} +END + +mkdir -p "cat/unpack-absolute" || exit 1 +cat << 'END' > cat/unpack-absolute/unpack-absolute-6.ebuild || exit 1 +EAPI="6" +DESCRIPTION="The Description" +HOMEPAGE="http://example.com/" +SRC_URI="" +SLOT="0" +IUSE="" +LICENSE="GPL-2" +KEYWORDS="test" + +S=${WORKDIR} + +src_unpack() { + gzip -c <<<test3 >test3.gz + unpack $(pwd)/test3.gz + [[ $(< test3) == test3 ]] || die +} +END + +mkdir -p "cat/unpack-relative" || exit 1 +cat << 'END' > cat/unpack-relative/unpack-relative-6.ebuild || exit 1 +EAPI="6" +DESCRIPTION="The Description" +HOMEPAGE="http://example.com/" +SRC_URI="" +SLOT="0" +IUSE="" +LICENSE="GPL-2" +KEYWORDS="test" + +S=${WORKDIR} + +src_unpack() { + mkdir subdir + gzip -c <<<test4 >subdir/test4.gz + unpack subdir/test4.gz + [[ $(< test4) == test4 ]] || die +} +END + cd .. cd .. diff --git a/paludis/repositories/e/eapi.cc b/paludis/repositories/e/eapi.cc index 609225b87..2571fba6a 100644 --- a/paludis/repositories/e/eapi.cc +++ b/paludis/repositories/e/eapi.cc @@ -254,6 +254,7 @@ namespace n::econf_extra_options_help_dependent() = k.get("econf_extra_options_help_dependent"), n::failure_is_fatal() = destringify_key<bool>(k, "failure_is_fatal"), n::new_stdin() = destringify_key<bool>(k, "new_stdin"), + n::unpack_any_path() = destringify_key<bool>(k, "unpack_any_path"), n::unpack_fix_permissions() = destringify_key<bool>(k, "unpack_fix_permissions"), n::unpack_suffixes() = k.get("unpack_suffixes"), 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 dd3146018..9b666d1bd 100644 --- a/paludis/repositories/e/eapi.hh +++ b/paludis/repositories/e/eapi.hh @@ -207,6 +207,7 @@ namespace paludis typedef Name<struct name_supported> supported; typedef Name<struct name_system_implicit> system_implicit; typedef Name<struct name_tools_options> tools_options; + typedef Name<struct name_unpack_any_path> unpack_any_path; typedef Name<struct name_unpack_fix_permissions> unpack_fix_permissions; typedef Name<struct name_unpack_suffixes> unpack_suffixes; typedef Name<struct name_unpack_unrecognised_is_fatal> unpack_unrecognised_is_fatal; @@ -490,6 +491,7 @@ namespace paludis NamedValue<n::econf_extra_options_help_dependent, std::string> econf_extra_options_help_dependent; NamedValue<n::failure_is_fatal, bool> failure_is_fatal; NamedValue<n::new_stdin, bool> new_stdin; + NamedValue<n::unpack_any_path, bool> unpack_any_path; 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 29063e0e3..7194d310a 100644 --- a/paludis/repositories/e/eapis/0.conf +++ b/paludis/repositories/e/eapis/0.conf @@ -272,6 +272,7 @@ use_stable_mask_force = false unpack_unrecognised_is_fatal = false unpack_fix_permissions = true +unpack_any_path = false doman_lang_filenames = false doman_lang_filenames_overrides = false dodoc_r = false diff --git a/paludis/repositories/e/eapis/6.conf b/paludis/repositories/e/eapis/6.conf index f1ec505c0..af27f8dfb 100644 --- a/paludis/repositories/e/eapis/6.conf +++ b/paludis/repositories/e/eapis/6.conf @@ -11,3 +11,5 @@ utility_path_suffixes = 6 5 4 3 2 1 0 shell_options_global = failglob +unpack_any_path = true + diff --git a/paludis/repositories/e/eapis/exheres-0.conf b/paludis/repositories/e/eapis/exheres-0.conf index 06289dc41..0618d2ec8 100644 --- a/paludis/repositories/e/eapis/exheres-0.conf +++ b/paludis/repositories/e/eapis/exheres-0.conf @@ -349,6 +349,7 @@ use_stable_mask_force = false unpack_unrecognised_is_fatal = true unpack_fix_permissions = false +unpack_any_path = false doman_lang_filenames = true doman_lang_filenames_overrides = false dodoc_r = true diff --git a/paludis/repositories/e/eapis/paludis-1.conf b/paludis/repositories/e/eapis/paludis-1.conf index 46cf0820e..dc593e75b 100644 --- a/paludis/repositories/e/eapis/paludis-1.conf +++ b/paludis/repositories/e/eapis/paludis-1.conf @@ -271,6 +271,7 @@ use_stable_mask_force = false unpack_unrecognised_is_fatal = false unpack_fix_permissions = false +unpack_any_path = false doman_lang_filenames = true doman_lang_filenames_overrides = false dodoc_r = false diff --git a/paludis/repositories/e/ebuild.cc b/paludis/repositories/e/ebuild.cc index 593580ecc..0c2d7758b 100644 --- a/paludis/repositories/e/ebuild.cc +++ b/paludis/repositories/e/ebuild.cc @@ -243,6 +243,8 @@ EbuildCommand::operator() () params.package_id()->eapi()->supported()->tools_options()->unpack_unrecognised_is_fatal() ? "yes" : "") .setenv("PALUDIS_UNPACK_FIX_PERMISSIONS", params.package_id()->eapi()->supported()->tools_options()->unpack_fix_permissions() ? "yes" : "") + .setenv("PALUDIS_UNPACK_ANY_PATH", + params.package_id()->eapi()->supported()->tools_options()->unpack_any_path() ? "yes" : "") .setenv("PALUDIS_UNPACK_SUFFIXES", params.package_id()->eapi()->supported()->tools_options()->unpack_suffixes()) .setenv("PALUDIS_BEST_HAS_VERSION_HOST_ROOT", diff --git a/paludis/repositories/e/ebuild/utils/unpack b/paludis/repositories/e/ebuild/utils/unpack index 9f01d6ee5..3025685f9 100755 --- a/paludis/repositories/e/ebuild/utils/unpack +++ b/paludis/repositories/e/ebuild/utils/unpack @@ -169,7 +169,15 @@ done for x in "$@" ; do x=$(echo $x ) echo ">>> Unpacking ${x} to ${UNPACKTODIR}" - [[ "${x:0:2}" == "./" ]] || x="${UNPACKFROMDIR}/${x}" + if [[ ${x} != */* ]]; then + x=${UNPACKFROMDIR}/${x} + elif [[ ${x:0:2} == ./* ]]; then + : + elif [[ -n ${PALUDIS_UNPACK_ANY_PATH} ]]; then + : + else + die "Invalid path given to unpack: ${x}" + fi mkdir -p ${UNPACKTODIR} cd ${UNPACKTODIR} unpack_one "${x}" diff --git a/paludis/syncers/dotar.in b/paludis/syncers/dotar.in index 9ee4415bf..864dd55d4 100644 --- a/paludis/syncers/dotar.in +++ b/paludis/syncers/dotar.in @@ -178,6 +178,7 @@ 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= +export PALUDIS_UNPACK_ANY_PATH=yes export PATH="${PALUDIS_EBUILD_DIR}/utils:${PATH}" ( cd "${UNPACKDIR}" && unpack "${UNPACK_OPTIONS[@]}" "${TEMP}/${TARFILE}" ) || cleanup_and_exit $? |