Skip to main content

MakefileAction

Enum MakefileAction 

Source
pub enum MakefileAction {
Show 13 variants ReplaceRecipe { file: PathBuf, target: String, recipe: String, new_recipe: String, }, RemoveRecipe { file: PathBuf, target: String, recipe: String, }, SetVariable { file: PathBuf, name: String, value: String, }, SetVariableOperator { file: PathBuf, name: String, operator: String, }, RemoveVariable { file: PathBuf, name: String, }, RemoveRule { file: PathBuf, target: String, }, RemovePhonyTarget { file: PathBuf, target: String, }, RenameRuleTarget { file: PathBuf, from_target: String, to_target: String, }, AddRule { file: PathBuf, target: String, prerequisites: Vec<String>, }, AddPhonyTarget { file: PathBuf, target: String, }, AddInclude { file: PathBuf, path: String, }, ReplaceVariableWithInclude { file: PathBuf, name: String, path: String, }, InsertIncludeBeforeVariable { file: PathBuf, path: String, before_variable: String, },
}
Expand description

Edits to a Makefile (typically debian/rules).

Recipes are addressed by their exact current text (including leading indentation). This avoids index drift when multiple recipe edits target the same rule.

Variants§

§

ReplaceRecipe

Replace the first recipe whose text exactly matches recipe in the rule whose primary target is target. A no-op if no rule or recipe matches.

Fields

§file: PathBuf

File to edit, relative to the package root.

§target: String

Primary target of the rule containing the recipe.

§recipe: String

Current recipe text, matched verbatim (including indentation).

§new_recipe: String

Replacement recipe text. The applier preserves the original recipe’s leading whitespace if new_recipe doesn’t start with whitespace itself.

§

RemoveRecipe

Remove the first recipe whose text exactly matches recipe from the rule whose primary target is target. A no-op if no rule or recipe matches.

Fields

§file: PathBuf

File to edit, relative to the package root.

§target: String

Primary target of the rule containing the recipe.

§recipe: String

Recipe text, matched verbatim (including indentation).

§

SetVariable

Replace the value of the first variable definition for name. A no-op if no such variable exists.

Fields

§file: PathBuf

File to edit, relative to the package root.

§name: String

Variable name (matched exactly).

§value: String

New right-hand side, verbatim (no quoting applied).

§

SetVariableOperator

Change the assignment operator on the first variable definition for name (e.g. := to ?=). A no-op if no such variable exists or it already uses operator.

Fields

§file: PathBuf

File to edit, relative to the package root.

§name: String

Variable name (matched exactly).

§operator: String

New assignment operator (=, :=, ?=, +=).

§

RemoveVariable

Remove the first variable definition for name. A no-op if no such variable exists.

Fields

§file: PathBuf

File to edit, relative to the package root.

§name: String

Variable name (matched exactly).

§

RemoveRule

Remove the first rule whose primary target is target. A no-op if no such rule exists.

Fields

§file: PathBuf

File to edit, relative to the package root.

§target: String

Primary target of the rule to remove.

§

RemovePhonyTarget

Remove target from the prerequisites of the .PHONY rule. If .PHONY becomes empty, the rule itself is removed. A no-op if the target is not listed.

Fields

§file: PathBuf

File to edit, relative to the package root.

§target: String

Target name to remove from .PHONY.

§

RenameRuleTarget

Rename a target on the first rule that has it. A no-op if no rule has the old target.

Fields

§file: PathBuf

File to edit, relative to the package root.

§from_target: String

Old target name (matched exactly after trimming).

§to_target: String

New target name.

§

AddRule

Append a new rule with target and the given (possibly empty) prerequisites. The applier does not check for an existing rule — detectors must guard against duplicates themselves.

Fields

§file: PathBuf

File to edit, relative to the package root.

§target: String

Target name for the new rule.

§prerequisites: Vec<String>

Prerequisite targets (in order).

§

AddPhonyTarget

Add target to the prerequisites of the .PHONY rule. A no-op if .PHONY already lists target. If no .PHONY rule exists, the applier creates one.

Fields

§file: PathBuf

File to edit, relative to the package root.

§target: String

Target name to add to .PHONY.

§

AddInclude

Add an include <path> directive. A no-op if the file is already included.

Fields

§file: PathBuf

File to edit, relative to the package root.

§path: String

Path to include (e.g. /usr/share/dpkg/pkg-info.mk).

§

ReplaceVariableWithInclude

Replace the first variable definition for name with an include <path> directive. A no-op if the variable doesn’t exist or path is already included. Used to migrate DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH) and friends to a single include /usr/share/dpkg/architecture.mk, keeping the include in the variable’s old position.

Fields

§file: PathBuf

File to edit, relative to the package root.

§name: String

Variable name to replace (matched exactly).

§path: String

Path to include in place of the variable.

§

InsertIncludeBeforeVariable

Insert include <path> immediately before the first variable definition whose name is before_variable. A no-op if the variable doesn’t exist or path is already included.

Fields

§file: PathBuf

File to edit, relative to the package root.

§path: String

Path to include.

§before_variable: String

Variable name to anchor the insertion against.

Trait Implementations§

Source§

impl Clone for MakefileAction

Source§

fn clone(&self) -> MakefileAction

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for MakefileAction

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for MakefileAction

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for MakefileAction

Source§

impl PartialEq for MakefileAction

Source§

fn eq(&self, other: &MakefileAction) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for MakefileAction

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for MakefileAction

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Ungil for T
where T: Send,

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more