Support exvolatile
This commit is contained in:
parent
baba6b5218
commit
038b4de8fa
@ -1,7 +1,7 @@
|
||||
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2010, 2011 Ciaran McCreesh
|
||||
* Copyright (c) 2010, 2011, 2013 Ciaran McCreesh
|
||||
*
|
||||
* 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
|
||||
@ -203,7 +203,8 @@ paludis::erepository::do_fetch_action(
|
||||
n::root() = "/",
|
||||
n::sandbox() = phase->option("sandbox"),
|
||||
n::sydbox() = phase->option("sydbox"),
|
||||
n::userpriv() = phase->option("userpriv") && userpriv_ok
|
||||
n::userpriv() = phase->option("userpriv") && userpriv_ok,
|
||||
n::volatile_files() = nullptr
|
||||
));
|
||||
|
||||
EbuildFetchExtraCommand fetch_extra_cmd(command_params, make_named_values<EbuildFetchExtraCommandParams>(
|
||||
@ -251,7 +252,8 @@ paludis::erepository::do_fetch_action(
|
||||
n::root() = "/",
|
||||
n::sandbox() = phase->option("sandbox"),
|
||||
n::sydbox() = phase->option("sydbox"),
|
||||
n::userpriv() = phase->option("userpriv") && userpriv_ok
|
||||
n::userpriv() = phase->option("userpriv") && userpriv_ok,
|
||||
n::volatile_files() = nullptr
|
||||
));
|
||||
|
||||
EbuildNoFetchCommand nofetch_cmd(command_params,
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2010, 2011 Ciaran McCreesh
|
||||
* Copyright (c) 2010, 2011, 2013 Ciaran McCreesh
|
||||
*
|
||||
* 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
|
||||
@ -112,7 +112,8 @@ paludis::erepository::do_info_action(
|
||||
n::root() = stringify(env->preferred_root_key()->parse_value()),
|
||||
n::sandbox() = phase->option("sandbox"),
|
||||
n::sydbox() = phase->option("sydbox"),
|
||||
n::userpriv() = phase->option("userpriv") && userpriv_ok
|
||||
n::userpriv() = phase->option("userpriv") && userpriv_ok,
|
||||
n::volatile_files() = nullptr
|
||||
));
|
||||
|
||||
EbuildInfoCommandParams info_params(
|
||||
|
@ -218,6 +218,7 @@ paludis::erepository::do_install_action(
|
||||
auto parts(std::make_shared<Partitioning>());
|
||||
auto choices(id->choices_key()->parse_value());
|
||||
auto work_choice(choices->find_by_name_with_prefix(ELikeWorkChoiceValue::canonical_name_with_prefix()));
|
||||
auto volatile_files(std::make_shared<FSPathSet>());
|
||||
|
||||
EAPIPhases phases(id->eapi()->supported()->ebuild_phases()->ebuild_install());
|
||||
for (EAPIPhases::ConstIterator phase(phases.begin_phases()), phase_end(phases.end_phases()) ;
|
||||
@ -279,7 +280,7 @@ paludis::erepository::do_install_action(
|
||||
n::check() = phase->option("check_merge"),
|
||||
n::environment_file() = package_builddir / "temp" / "loadsaveenv",
|
||||
n::image_dir() = package_builddir / "image",
|
||||
n::is_volatile() = [] (const FSPath &) { return false; },
|
||||
n::is_volatile() = [&] (const FSPath & f) { return volatile_files->end() != volatile_files->find(f); },
|
||||
n::merged_entries() = merged_entries,
|
||||
n::options() = id->eapi()->supported()->merger_options() | extra_merger_options,
|
||||
n::output_manager() = output_manager,
|
||||
@ -390,7 +391,8 @@ paludis::erepository::do_install_action(
|
||||
"/",
|
||||
n::sandbox() = phase->option("sandbox"),
|
||||
n::sydbox() = phase->option("sydbox"),
|
||||
n::userpriv() = phase->option("userpriv") && userpriv_ok
|
||||
n::userpriv() = phase->option("userpriv") && userpriv_ok,
|
||||
n::volatile_files() = volatile_files
|
||||
));
|
||||
|
||||
EbuildInstallCommandParams install_params(
|
||||
@ -453,7 +455,8 @@ paludis::erepository::do_install_action(
|
||||
"/",
|
||||
n::sandbox() = tidyup_phase->option("sandbox"),
|
||||
n::sydbox() = tidyup_phase->option("sydbox"),
|
||||
n::userpriv() = tidyup_phase->option("userpriv") && userpriv_ok
|
||||
n::userpriv() = tidyup_phase->option("userpriv") && userpriv_ok,
|
||||
n::volatile_files() = volatile_files
|
||||
));
|
||||
|
||||
EbuildInstallCommandParams tidyup_install_params(
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2010, 2011 Ciaran McCreesh
|
||||
* Copyright (c) 2010, 2011, 2013 Ciaran McCreesh
|
||||
*
|
||||
* 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
|
||||
@ -130,7 +130,8 @@ paludis::erepository::do_pretend_action(
|
||||
"/",
|
||||
n::sandbox() = phase->option("sandbox"),
|
||||
n::sydbox() = phase->option("sydbox"),
|
||||
n::userpriv() = phase->option("userpriv") && userpriv_ok
|
||||
n::userpriv() = phase->option("userpriv") && userpriv_ok,
|
||||
n::volatile_files() = nullptr
|
||||
));
|
||||
|
||||
EbuildBadOptionsCommand bad_options_cmd(command_params,
|
||||
@ -197,7 +198,8 @@ paludis::erepository::do_pretend_action(
|
||||
"/",
|
||||
n::sandbox() = phase->option("sandbox"),
|
||||
n::sydbox() = phase->option("sydbox"),
|
||||
n::userpriv() = phase->option("userpriv") && userpriv_ok
|
||||
n::userpriv() = phase->option("userpriv") && userpriv_ok,
|
||||
n::volatile_files() = nullptr
|
||||
));
|
||||
|
||||
EbuildBadOptionsCommand bad_options_cmd(command_params,
|
||||
@ -262,7 +264,8 @@ paludis::erepository::do_pretend_action(
|
||||
"/",
|
||||
n::sandbox() = phase->option("sandbox"),
|
||||
n::sydbox() = phase->option("sydbox"),
|
||||
n::userpriv() = phase->option("userpriv") && userpriv_ok
|
||||
n::userpriv() = phase->option("userpriv") && userpriv_ok,
|
||||
n::volatile_files() = nullptr
|
||||
));
|
||||
|
||||
EbuildPretendCommand pretend_cmd(command_params,
|
||||
|
@ -237,7 +237,8 @@ EInstalledRepository::perform_config(
|
||||
n::root() = stringify(_imp->params.root()),
|
||||
n::sandbox() = phase->option("sandbox"),
|
||||
n::sydbox() = phase->option("sydbox"),
|
||||
n::userpriv() = phase->option("userpriv")
|
||||
n::userpriv() = phase->option("userpriv"),
|
||||
n::volatile_files() = nullptr
|
||||
),
|
||||
|
||||
make_named_values<EbuildConfigCommandParams>(
|
||||
@ -346,7 +347,8 @@ EInstalledRepository::perform_info(
|
||||
n::root() = stringify(_imp->params.root()),
|
||||
n::sandbox() = phase->option("sandbox"),
|
||||
n::sydbox() = phase->option("sydbox"),
|
||||
n::userpriv() = phase->option("userpriv")
|
||||
n::userpriv() = phase->option("userpriv"),
|
||||
n::volatile_files() = nullptr
|
||||
),
|
||||
|
||||
make_named_values<EbuildInfoCommandParams>(
|
||||
|
@ -1720,7 +1720,8 @@ ERepository::get_environment_variable(
|
||||
n::root() = "/",
|
||||
n::sandbox() = phases.begin_phases()->option("sandbox"),
|
||||
n::sydbox() = phases.begin_phases()->option("sydbox"),
|
||||
n::userpriv() = phases.begin_phases()->option("userpriv") && userpriv_ok
|
||||
n::userpriv() = phases.begin_phases()->option("userpriv") && userpriv_ok,
|
||||
n::volatile_files() = nullptr
|
||||
),
|
||||
|
||||
var);
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006, 2007, 2008, 2009, 2010, 2011 Ciaran McCreesh
|
||||
* Copyright (c) 2006, 2007, 2008, 2009, 2010, 2011, 2013 Ciaran McCreesh
|
||||
*
|
||||
* 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
|
||||
@ -633,6 +633,16 @@ TEST(ERepository, ReallyInstallExheres0)
|
||||
n::want_phase() = &want_all_phases
|
||||
));
|
||||
|
||||
UninstallAction uninstall_action(make_named_values<UninstallActionOptions>(
|
||||
n::config_protect() = "",
|
||||
n::if_for_install_id() = nullptr,
|
||||
n::ignore_for_unmerge() = [] (const FSPath &) { return false; },
|
||||
n::is_overwrite() = false,
|
||||
n::make_output_manager() = &make_standard_output_manager,
|
||||
n::override_contents() = nullptr,
|
||||
n::want_phase() = &want_all_phases
|
||||
));
|
||||
|
||||
{
|
||||
const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
|
||||
PackageDepSpec(parse_user_package_dep_spec("=cat/exdirectory-phase-1",
|
||||
@ -656,5 +666,20 @@ TEST(ERepository, ReallyInstallExheres0)
|
||||
ASSERT_TRUE(bool(id));
|
||||
id->perform_action(action);
|
||||
}
|
||||
|
||||
{
|
||||
const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
|
||||
PackageDepSpec(parse_user_package_dep_spec("=cat/exvolatile-1",
|
||||
&env, { })), nullptr, { }))]->last());
|
||||
ASSERT_TRUE(bool(id));
|
||||
id->perform_action(action);
|
||||
|
||||
i_repo->invalidate();
|
||||
const std::shared_ptr<const PackageID> uninstall_id(*env[selection::RequireExactlyOne(generator::Matches(
|
||||
PackageDepSpec(parse_user_package_dep_spec("=cat/exvolatile-1::installed",
|
||||
&env, { })), nullptr, { }))]->last());
|
||||
ASSERT_TRUE(bool(uninstall_id));
|
||||
uninstall_id->perform_action(uninstall_action);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1205,6 +1205,56 @@ src_install() {
|
||||
EOT
|
||||
}
|
||||
END
|
||||
mkdir -p "packages/cat/exvolatile"
|
||||
cat <<'END' > packages/cat/exvolatile/exvolatile-1.ebuild || exit 1
|
||||
DESCRIPTION="The Long Description"
|
||||
SUMMARY="The Short Description"
|
||||
HOMEPAGE="http://example.com/"
|
||||
DOWNLOADS=""
|
||||
SLOT="0"
|
||||
MYOPTIONS="spork"
|
||||
LICENCES="GPL-2"
|
||||
PLATFORMS="test"
|
||||
WORK="${WORKBASE}"
|
||||
|
||||
src_install() {
|
||||
insinto /var
|
||||
hereins first <<EOT
|
||||
EOT
|
||||
hereins second <<EOT
|
||||
EOT
|
||||
hereins third <<EOT
|
||||
EOT
|
||||
hereins fourth <<EOT
|
||||
EOT
|
||||
dosym first /var/symfirst
|
||||
dosym second /var/symsecond
|
||||
dosym third /var/symthird
|
||||
dosym fourth /var/symfourth
|
||||
}
|
||||
|
||||
pkg_setup() {
|
||||
exvolatile /var/first /var/second /var/symfirst /var/symsecond
|
||||
}
|
||||
|
||||
pkg_postinst() {
|
||||
echo a monkey stole my broccoli > ${ROOT}/var/second
|
||||
echo there is a weasel in my stew > ${ROOT}/var/fourth
|
||||
ln -sf /dev/null ${ROOT}/var/symsecond
|
||||
ln -sf /dev/null ${ROOT}/var/symfourth
|
||||
}
|
||||
|
||||
pkg_postrm() {
|
||||
[[ -f ${ROOT}/var/first ]] && die "first should be removed"
|
||||
[[ -f ${ROOT}/var/second ]] && die "second should be removed"
|
||||
[[ -f ${ROOT}/var/third ]] && die "third should be removed"
|
||||
[[ -f ${ROOT}/var/fourth ]] || die "fourth shouldn't be removed"
|
||||
[[ -L ${ROOT}/var/symfirst ]] && die "symfirst should be removed"
|
||||
[[ -L ${ROOT}/var/symsecond ]] && die "symsecond should be removed"
|
||||
[[ -L ${ROOT}/var/symthird ]] && die "symthird should be removed"
|
||||
[[ -L ${ROOT}/var/symfourth ]] || die "symfourth shouldn't be removed"
|
||||
}
|
||||
END
|
||||
|
||||
cd ..
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006, 2007, 2008, 2009, 2010, 2011 Ciaran McCreesh
|
||||
* Copyright (c) 2006, 2007, 2008, 2009, 2010, 2011, 2013 Ciaran McCreesh
|
||||
*
|
||||
* 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
|
||||
@ -151,6 +151,7 @@ EbuildCommand::operator() ()
|
||||
params.package_id(),
|
||||
params.permitted_directories(),
|
||||
params.parts(),
|
||||
params.volatile_files(),
|
||||
in_metadata_generation(), _1,
|
||||
params.maybe_output_manager()));
|
||||
|
||||
@ -1066,6 +1067,7 @@ WriteVDBEntryCommand::operator() ()
|
||||
params.environment(),
|
||||
params.package_id(),
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr, false, _1,
|
||||
params.maybe_output_manager()));
|
||||
|
||||
@ -1330,7 +1332,9 @@ WriteBinaryEbuildCommand::operator() ()
|
||||
params.environment(),
|
||||
params.package_id(),
|
||||
nullptr,
|
||||
nullptr, false, _1,
|
||||
nullptr,
|
||||
nullptr,
|
||||
false, _1,
|
||||
params.maybe_output_manager()));
|
||||
|
||||
if (! params.package_id()->eapi()->supported()->ebuild_metadata_variables()->scm_revision()->name().empty())
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006, 2007, 2008, 2009, 2010, 2011 Ciaran McCreesh
|
||||
* Copyright (c) 2006, 2007, 2008, 2009, 2010, 2011, 2013 Ciaran McCreesh
|
||||
*
|
||||
* 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
|
||||
@ -104,6 +104,7 @@ namespace paludis
|
||||
typedef Name<struct name_use_expand> use_expand;
|
||||
typedef Name<struct name_use_expand_hidden> use_expand_hidden;
|
||||
typedef Name<struct name_userpriv> userpriv;
|
||||
typedef Name<struct name_volatile_files> volatile_files;
|
||||
}
|
||||
|
||||
namespace erepository
|
||||
@ -140,6 +141,7 @@ namespace paludis
|
||||
NamedValue<n::sandbox, bool> sandbox;
|
||||
NamedValue<n::sydbox, bool> sydbox;
|
||||
NamedValue<n::userpriv, bool> userpriv;
|
||||
NamedValue<n::volatile_files, std::shared_ptr<FSPathSet> > volatile_files;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
# vim: set sw=4 sts=4 et :
|
||||
|
||||
# Copyright (c) 2006, 2007, 2008, 2010, 2011 Ciaran McCreesh
|
||||
# Copyright (c) 2006, 2007, 2008, 2010, 2011, 2013 Ciaran McCreesh
|
||||
#
|
||||
# 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
|
||||
@ -54,3 +54,14 @@ expart()
|
||||
paludis_pipe_command PARTITION "$EAPI" "$@" >/dev/null
|
||||
}
|
||||
|
||||
exvolatile()
|
||||
{
|
||||
[[ "${!PALUDIS_EBUILD_PHASE_VAR}" == "setup" ]] || \
|
||||
die "exvolatile must be called in pkg_setup"
|
||||
|
||||
local x
|
||||
for x in "$@"; do
|
||||
paludis_pipe_command VOLATILE "$EAPI" "$x" >/dev/null
|
||||
done
|
||||
}
|
||||
|
||||
|
@ -322,7 +322,8 @@ EbuildID::need_non_xml_keys_added() const
|
||||
n::root() = "/",
|
||||
n::sandbox() = phases.begin_phases()->option("sandbox"),
|
||||
n::sydbox() = phases.begin_phases()->option("sydbox"),
|
||||
n::userpriv() = phases.begin_phases()->option("userpriv")
|
||||
n::userpriv() = phases.begin_phases()->option("userpriv"),
|
||||
n::volatile_files() = nullptr
|
||||
));
|
||||
|
||||
if (! cmd())
|
||||
|
@ -679,7 +679,8 @@ ExndbamRepository::perform_uninstall(
|
||||
n::root() = stringify(_imp->params.root()),
|
||||
n::sandbox() = phase->option("sandbox"),
|
||||
n::sydbox() = phase->option("sydbox"),
|
||||
n::userpriv() = phase->option("userpriv")
|
||||
n::userpriv() = phase->option("userpriv"),
|
||||
n::volatile_files() = nullptr
|
||||
));
|
||||
|
||||
EbuildUninstallCommandParams uninstall_params(
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007, 2008, 2009, 2010, 2011, 2012 Ciaran McCreesh
|
||||
* Copyright (c) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Ciaran McCreesh
|
||||
* Copyright (c) 2009 Ingmar Vanhassel
|
||||
* Copyright (c) 2013 Saleem Abdulrasool <compnerd@compnerd.org>
|
||||
*
|
||||
@ -183,6 +183,7 @@ paludis::erepository::pipe_command_handler(const Environment * const environment
|
||||
const std::shared_ptr<const ERepositoryID> & package_id,
|
||||
const std::shared_ptr<PermittedDirectories> & maybe_permitted_directories,
|
||||
const std::shared_ptr<Partitioning> & maybe_partitioning,
|
||||
const std::shared_ptr<FSPathSet> & maybe_volatiles,
|
||||
bool in_metadata_generation,
|
||||
const std::string & s, const std::shared_ptr<OutputManager> & maybe_output_manager)
|
||||
{
|
||||
@ -639,6 +640,43 @@ paludis::erepository::pipe_command_handler(const Environment * const environment
|
||||
"when trying to create partition";
|
||||
}
|
||||
}
|
||||
else if (tokens[0] == "VOLATILE")
|
||||
{
|
||||
auto eapi = EAPIData::get_instance()->eapi_from_string(tokens[1]);
|
||||
if (! eapi->supported())
|
||||
return "EPARTITION EAPI " + tokens[1] + " unsupported";
|
||||
|
||||
if (tokens.size() != 3)
|
||||
{
|
||||
Log::get_instance()->message("e.pipe_commands.volatile.bad", ll_warning, lc_context)
|
||||
<< "Got bad VOLATILE pipe command";
|
||||
return "Ebad VOLATILE command";
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if (! maybe_volatiles)
|
||||
{
|
||||
Log::get_instance()->message("e.pipe_commands.partitioning.unsupported", ll_warning, lc_context)
|
||||
<< "volatile files not supported here";
|
||||
return "EVOLATILE not supported here";
|
||||
}
|
||||
|
||||
if (0 != tokens[2].compare(0, 1, "/", 0, 1)) {
|
||||
Log::get_instance()->message("e.pipe_commands.partitioning.bad", ll_warning, lc_context)
|
||||
<< "Badly formatted volatile path '" + tokens[2] + "'";
|
||||
return "EVOLATILE path '" + tokens[2] + "' is not an absolute path";
|
||||
}
|
||||
maybe_volatiles->insert(FSPath(tokens[2]));
|
||||
|
||||
return "O0;";
|
||||
}
|
||||
catch (const Exception & e)
|
||||
{
|
||||
return "Egot error '" + e.message() + "' (" + e.what() + ") "
|
||||
"when trying to create volatile";
|
||||
}
|
||||
}
|
||||
else if (tokens[0] == "REWRITE_VAR")
|
||||
{
|
||||
if (tokens.size() < 4)
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008, 2009, 2010, 2011 Ciaran McCreesh
|
||||
* Copyright (c) 2008, 2009, 2010, 2011, 2013 Ciaran McCreesh
|
||||
*
|
||||
* 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
|
||||
@ -21,6 +21,7 @@
|
||||
#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_PIPE_COMMAND_HANDLER_HH 1
|
||||
|
||||
#include <paludis/repositories/e/permitted_directories-fwd.hh>
|
||||
#include <paludis/util/fs_path-fwd.hh>
|
||||
#include <paludis/environment-fwd.hh>
|
||||
#include <paludis/package_id-fwd.hh>
|
||||
#include <paludis/output_manager-fwd.hh>
|
||||
@ -38,6 +39,7 @@ namespace paludis
|
||||
const std::shared_ptr<const ERepositoryID> &,
|
||||
const std::shared_ptr<PermittedDirectories> &,
|
||||
const std::shared_ptr<Partitioning> &,
|
||||
const std::shared_ptr<FSPathSet> &,
|
||||
bool in_metadata_generation,
|
||||
const std::string & s,
|
||||
const std::shared_ptr<OutputManager> & maybe_output_manager);
|
||||
|
@ -512,7 +512,8 @@ VDBRepository::perform_uninstall(
|
||||
n::root() = stringify(_imp->params.root()),
|
||||
n::sandbox() = phase->option("sandbox"),
|
||||
n::sydbox() = phase->option("sydbox"),
|
||||
n::userpriv() = phase->option("userpriv")
|
||||
n::userpriv() = phase->option("userpriv"),
|
||||
n::volatile_files() = nullptr
|
||||
));
|
||||
|
||||
EbuildUninstallCommandParams uninstall_params(make_named_values<EbuildUninstallCommandParams>(
|
||||
|
Loading…
Reference in New Issue
Block a user