diff --git a/docs/recipe_file.md b/docs/recipe_file.md index 2902b382..eb7e9189 100644 --- a/docs/recipe_file.md +++ b/docs/recipe_file.md @@ -184,16 +184,19 @@ source: git_depth: -1 # Defaults to -1/not shallow ``` -The git_url can also be a relative path to the recipe directory. +The `git_url` can also be a relative path to the recipe directory. ```yaml source: git_url: ../../bsdiff4/.git git_rev: 1.1.4 git_depth: -1 # Defaults to -1/not shallow + lfs: true # defaults to false ``` -Note: `git_rev` may not be available within commit depth range, consider avoiding use of both simultaneously. +Note: `git_rev` may not be available within commit depth range, consider avoiding use of both simultaneously. + +When you want to use git-lfs, you need to set `lfs: true`. This will also pull the lfs files from the repository. #### Source from hg @@ -224,16 +227,18 @@ source is copied to the work directory before building. ```yaml source: path: ../src + use_gitignore: false # (defaults to true) ``` If the local path is a git or svn repository, you get the corresponding environment variables defined in your build environment. The only practical -difference between git_url or hg_url and path as source arguments is that -git_url and hg_url would be clones of a repository, while path would be a copy +difference between `git_url` or `hg_url` and path as source arguments is that +`git_url` and `hg_url` would be clones of a repository, while path would be a copy of the repository. Using path allows you to build packages with unstaged and -uncommitted changes in the working directory. git_url can build only up to the +uncommitted changes in the working directory. `git_url` can build only up to the latest commit. - +By default, all files in the local path that are ignored by git are also ignored by rattler-build. +You can disable this behavior by setting `use_gitignore` to `false`. #### Patches diff --git a/examples/ros-humble-turtlebot4-msgs/recipe.yaml b/examples/ros-humble-turtlebot4-msgs/recipe.yaml index 02086b82..4223e889 100644 --- a/examples/ros-humble-turtlebot4-msgs/recipe.yaml +++ b/examples/ros-humble-turtlebot4-msgs/recipe.yaml @@ -8,7 +8,6 @@ source: git_url: https://github.com/ros2-gbp/turtlebot4-release.git git_rev: release/humble/turtlebot4_msgs/1.0.3-1 folder: ros-humble-turtlebot4-msgs/src/work - use_gitignore: true build: script: diff --git a/src/recipe/parser/source.rs b/src/recipe/parser/source.rs index bce9bf13..aeacf526 100644 --- a/src/recipe/parser/source.rs +++ b/src/recipe/parser/source.rs @@ -109,8 +109,6 @@ pub struct GitSource { folder: Option, /// Optionally request the lfs pull in git source lfs: bool, - /// Whether to use the `.gitignore` file in the source directory, defaults to `false`. - use_gitignore: bool, } impl GitSource { @@ -122,7 +120,6 @@ impl GitSource { patches: Vec, folder: Option, lfs: bool, - use_gitignore: bool, ) -> Self { Self { url, @@ -131,7 +128,6 @@ impl GitSource { patches, folder, lfs, - use_gitignore, } } @@ -164,11 +160,6 @@ impl GitSource { pub const fn lfs(&self) -> bool { self.lfs } - - /// Whether to use the `.gitignore` file in the source directory. Defaults to `false`. - pub const fn use_gitignore(&self) -> bool { - self.use_gitignore - } } impl TryConvertNode for RenderedMappingNode { @@ -179,7 +170,6 @@ impl TryConvertNode for RenderedMappingNode { let mut patches = Vec::new(); let mut folder = None; let mut lfs = false; - let mut use_gitignore = false; // TODO: is there a better place for this error? // raising the error during parsing allows us to suggest fixes in future @@ -224,14 +214,11 @@ impl TryConvertNode for RenderedMappingNode { "lfs" => { lfs = v.try_convert("lfs")?; } - "use_gitignore" => { - use_gitignore = v.try_convert("use_gitignore")?; - } _ => { return Err(_partialerror!( *k.span(), ErrorKind::InvalidField(k.as_str().to_owned().into()), - help = "valid fields for git `source` are `git_url`, `git_rev`, `git_depth`, `patches`, `lfs`, `folder` and `use_gitignore`" + help = "valid fields for git `source` are `git_url`, `git_rev`, `git_depth`, `patches`, `lfs` and `folder`" )) } } @@ -254,7 +241,6 @@ impl TryConvertNode for RenderedMappingNode { patches, folder, lfs, - use_gitignore, }) } } @@ -366,7 +352,7 @@ impl TryConvertNode for RenderedMappingNode { return Err(_partialerror!( *key.span(), ErrorKind::InvalidField(invalid_key.to_owned().into()), - help = "valid fields for URL `source` are `url`, `sha256`, `md5`, `patches`, `file_name`, `folder` and `use_gitignore`" + help = "valid fields for URL `source` are `url`, `sha256`, `md5`, `patches`, `file_name` and `folder`" )) } } @@ -461,7 +447,7 @@ impl TryConvertNode for RenderedMappingNode { return Err(_partialerror!( *key.span(), ErrorKind::InvalidField(invalid_key.to_string().into()), - help = "valid fields for path `source` are `path`, `patches` and `folder`" + help = "valid fields for path `source` are `path`, `patches`, `folder` and `use_gitignore`" )) } } diff --git a/src/source/git_source.rs b/src/source/git_source.rs index dc41b25a..19de85b6 100644 --- a/src/source/git_source.rs +++ b/src/source/git_source.rs @@ -255,7 +255,6 @@ mod tests { vec![], None, false, - false, ), "rattler-build", ), @@ -271,7 +270,6 @@ mod tests { vec![], None, false, - false, ), "rattler-build", ), @@ -287,7 +285,6 @@ mod tests { vec![], None, false, - false, ), "rattler-build", ), @@ -299,7 +296,6 @@ mod tests { vec![], None, false, - false, ), "rattler-build", ), diff --git a/src/source/mod.rs b/src/source/mod.rs index 8701f0dc..be412d1b 100644 --- a/src/source/mod.rs +++ b/src/source/mod.rs @@ -83,7 +83,7 @@ pub async fn fetch_sources( work_dir.to_path_buf() }; crate::source::copy_dir::CopyDir::new(&result, &dest_dir) - .use_gitignore(src.use_gitignore()) + .use_gitignore(false) .run()?; if !src.patches().is_empty() { patch::apply_patches(src.patches(), work_dir, recipe_dir)?;