aboutsummaryrefslogtreecommitdiff
path: root/libs/project
Commit message (Collapse)AuthorAgeFilesLines
* Fix project usage actionAndrew Robbins2019-10-301-0/+11
| | | | | | | | | The project's scripts were never sourced before calling usage(), causing project_action() to fail. project_action_usage() should be used only when a project's scripts have not yet been sourced otherwise its call to project_include() would be redundant.
* libs/project: Perform project action in subshellAndrew Robbins2019-10-191-3/+5
| | | | | Whenever project_include() is called, it should be done within a subshell in order to avoid clobbering function definitions.
* libs/project: Simplify acting on dependenciesAndrew Robbins2019-10-191-20/+8
|
* Add dependency handlingAndrew Robbins2019-10-181-4/+101
| | | | | | | | | | | | Dependencies for any project can be determined by calling project_dependencies() with a given project and (optional) arguments. This is the function you will almost always want to call when you're wanting to collect a list of dependencies. The output of the topological sort is only one possible ordering of those dependencies. 'dependencies' files may now contain any number of spaces or tabs between each argument.
* libs/project: Call functions from any projectAndrew Robbins2019-10-161-4/+8
| | | | | | | | | | Helper functions, such as "arguments", provided by one project should be callable from another project for more flexibility. Metaprojects in particular could use this functionality. In order for this to work, project_include() is used to create the necessary environment separation (so defined functions are not clobbered by the helper function).
* libs/project: Invoke subshell in project_function_check()Andrew Robbins2019-07-211-7/+6
| | | | | | | Since we're doing a simple check to see if a function exists in a given project's scripts we should only source those files into a subshell (so any changes to the environment are discarded once the subshell exits).
* Add functions to safely apply patches to non-git sourcesAndrew Robbins2019-07-161-1/+12
| | | | | | project_sources_patch() is the equivalent to git_patch() when working with non-git sources. It should not be used with sources under a version control system.
* Avoid redundant patching when recursively patchingAndrew Robbins2019-07-161-1/+1
| | | | | | | | If a path is not supplied to project_sources_patch_recursive() or git_project_patch_recursive() then it will attempt to apply the set of patches located at $PROJECTS/$project/$PATCHES (the top-level patches directory) twice. Checking to see if $path is of non-zero length avoids this issue.
* libs/project: Complete project_sources_prepare()Andrew Robbins2019-07-161-10/+61
| | | | | | | | The method in which project sources are prepared from either extracted non-git source archives or sources under $PROJECTS/$project/$SOURCES are comparable to preparing git sources. This makes knowledge of the source preparation process mostly transferable across the build system regardless whether git is involved or not.
* libs/project: Remove extraneous newlines in header/footerAndrew Robbins2019-04-261-3/+3
| | | | The extra newlines make actions with no output look strange.
* libs/project: Print project_action() footer, alwaysAndrew Robbins2019-04-261-10/+15
| | | | | | | | | | | | Previously, the footer would not print if the project action failed due to 'set -e' still being in effect (the subshell would return with a non-zero exit code and exit immediately). The purpose of the subshell for the project action is to better separate the execution environment of the project from the library functions it calls. The test condition in the if-statement and its consequents were changed in order to be more concise and informative.
* libs/project: Modify output of project_blobs_path()Andrew Robbins2019-04-231-2/+0
| | | | | | project_blobs_ignore_path() prints nothing if a blobs-ignore file is not found for the given project and arguments (if any); this behavior should be the same for project_blobs_path()
* Respect blobs-ignore when removing blobsAndrew Robbins2019-04-231-0/+16
|
* libs/project: Avoid subshell in 'if' statementsAndrew Robbins2019-04-181-1/+7
| | | | | | | | | | | | | | | | | | | | The following will effectively disable any previous 'set -e': foo_fail() { ( set -e false true ) } if (set +e; foo_fail); then echo "foo_fail() failed, unsuccessfully" fi Creating a subshell within an 'if' statement makes 'set -e' non-functional.
* libs/project: Fail update check for git sourcesAndrew Robbins2019-04-181-1/+1
| | | | | | | "update" actions were failing ever since revision b7fcc477 for projects with git sources due to an error in project_update_check_git() not returning 1 when it determined that the project's sources was a git repo (to force an update, always).
* libs/project: Fail install check, properlyAndrew Robbins2019-04-151-2/+7
| | | | | If the $install_path directory does not exist or a file which should be present in the install directory isn't, fail.
* libs/project: Fail build check, properlyAndrew Robbins2019-04-151-1/+6
| | | | | If the $build_path directory does not exist or a file which should be present in the build directory isn't, fail.
* libs/project: Don't fail with project_action_checkAndrew Robbins2019-04-131-1/+3
| | | | | | | | | project_action_check() is there to avoid redundant actions from being performed (e.g., if SeaBIOS is already built, don't build it again). Since this is its primary purpose, we want to avoid erroring out when it returns with a non-zero return code. This addresses issue #614
* Merge branch 'libs-git' of and_who/libreboot into masterSwift Geek2019-03-291-13/+9
|\
| * libs/project: Execute project action in subshellAndrew Robbins2019-03-261-13/+9
| | | | | | | | | | | | | | | | Executing the project action within its own subshell makes it easy to abort the action with a simple "exit" while still allowing for the printing of the footer describing failure/success. Prevously, if "exit" were called in a project action the footer would not print.
* | let's prefer pre-incrementAndrew Robbins2019-03-281-2/+2
| | | | | | | | | | The "let" builtin returns 1 if it's given an argument that evaluates to zero.
* | libs/project: Set max loop iteration in for loopAndrew Robbins2019-03-281-9/+5
|/
* Rename and refactor diff_patch_file()Andrew Robbins2019-03-181-1/+1
| | | | | | The previous function, diff_patch_file, was more error-prone and fragile and did not take into consideration patching of more than one file at a time(!).
* Center tool/project output between header/footerAndrew Robbins2019-02-221-1/+1
| | | | Makes it easier to read when multiple terse actions are performed.
* Don't output header/footer to stderr unless necessaryAndrew Robbins2019-02-221-2/+3
|
* Add preliminary dependency handling supportAndrew Robbins2019-01-221-2/+73
| | | | | | | | | | | | | | Projects may now declare other projects it depends upon through the file "dependencies" located in a project's $CONFIGS directory. This file requires that each dependency listed, one per line, correspond to a project in the $PROJECTS directory; the dependency may be in any form accepted by the libreboot script, e.g: ./libreboot build $dependency Multiple dependencies files, one per target, are read provided they are located in target directories and those targets were included in the list of arguments passed to the libreboot script.
* Modify project_file_path() to return first matching pathAndrew Robbins2018-10-091-0/+2
| | | | | | project_file_path() now returns the first matching path rather than the last. This is necessary to allow splitting up configuration files for projects into "base" and "overriding" configs.
* Use project_sources_path() in archive creationAndrew Robbins2018-01-141-27/+4
| | | | | | | | | | | | Previously, the function 'project_release_sources_archive_path' assumed that a project's source files would always be located within "$root/$SOURCES" in a directory named after the project. However, this does not account for projects such as bucts whose source files are located in "$root/$PROJECTS/$project/sources". In order to address this, trivial changes were made to leverage project_sources_path() as it returns nearly all the information needed to create the path to the archive file.
* Remove unnecessary spaces in command substitutionsAndrew Robbins2017-10-281-61/+61
| | | | | | | | | This is likely one of the very last changes necessary to make the Libreboot build system more cohesive in appearance. Hopefully from this point forward it won't be as readily apparent as to who wrote which parts of the build system (i.e. won't look like a patchwork quilt any longer).
* Make use of Bash's '-n' operator for testsAndrew Robbins2017-10-281-18/+18
| | | | | | | | | | | | As an example, do this: [[ -n $revision ]] instead of this: ! [[ -z $revision ]] Makes the code easier to read.
* Replace usage of the '[' Bash builtin with '[['Andrew Robbins2017-10-281-48/+48
| | | | | | | | | | There's no benefit to using the POSIX-style '[' test builtin considering its '-a' and '-o' operators are unused in the Libreboot build system. Plus, '[[' is safer with respect to any containing file redirections (for example). Prior, both '[' and '[[' were used throughout the codebase--a disparity in usage which this change aims to eliminate.
* Modify fd copying in printf calls for readabilityAndrew Robbins2017-10-281-9/+9
|
* Remove braces from parameter expansionsAndrew Robbins2017-09-211-59/+59
| | | | | | * libs/project ditto
* Skip archive extraction if archive doesn't existAndrew Robbins2017-07-221-1/+1
|
* Remove unnecessary subshell groupingAndrew Robbins2017-07-221-5/+3
|
* Remove IFS binding masking a non-zero status codeAndrew Robbins2017-07-221-6/+3
| | | | | | | | | | | | | | In project_action_arguments_recursive(), IFS bindings needed to be reworked in order to avoid a situation where, for example, project_extract() would fail to extract source archives (because they didn't exist), returning a status code of 1 only for it to be masked by a rebinding of IFS--which would always succeed. ifs_save and IFS were made local variables in project_action_arguments_recursive() in order to avoid the need to rebind IFS after the for loop returns. This patch makes './libreboot sources <project>' functional.
* Create array PROJECT_ACTIONS_GENERIC_IGNORE_CHECKAndrew Robbins2017-07-211-0/+1
| | | | | | | Located in libs/project, this array's elements are compared with actions in PROJECTS_ACTIONS_GENERIC when libreboot_setup_project_actions() is called. This makes it simpler to add/remove actions which should/shouldn't have a corresponding check function in PROJECT_ACTIONS.
* Fix action 'update_check' erroring out erroneouslyAndrew Robbins2017-07-211-1/+1
|
* Add libreboot_setup_project_actions()Andrew Robbins2017-07-211-5/+0
| | | | | | | The added function is called after all files in libs/ have been sourced and provides the correct action sequence for 'test'. Importantly, this function avoids providing undefined 'usage_check' and 'clean_check' actions.
* Rename PROJECT_ACTIONS_FUNCTIONS to PROJECT_ACTIONSAndrew Robbins2017-07-201-2/+2
| | | | | | Original naming did not have the '_FUNCTIONS' suffix, which made it more clear as to the variable's purpose. This change reverts a previous rename of mine made erroneously.
* Change '.' to the more readable 'source' commandAndrew Robbins2017-07-171-2/+2
|
* Use "$*" instead of $@ when assigning as a stringAndrew Robbins2017-07-171-12/+12
| | | | | | The local variable 'arguments' always stores the positional parameters passed to it as a string, not an array of strings, so usage of "$*" makes more sense here instead of $@.
* Avoid checking previous exit codes indirectlyAndrew Robbins2017-07-171-7/+5
|
* Word-split PROJECTS_FORCE expansion (remove quotes)Andrew Robbins2017-07-171-1/+1
|
* Make explicit which directory 'find' should searchAndrew Robbins2017-07-171-2/+2
|
* Prevent 'read' from interpreting backslash escapesAndrew Robbins2017-07-171-11/+11
|
* Properly escape and quote regular expressionsAndrew Robbins2017-07-171-8/+8
|
* Rely less on word splitting by using arraysAndrew Robbins2017-07-141-5/+9
| | | | | | | Arrays are just a better idea for storing multiple strings than relying on word splitting. Consequently, several global variables in libs/* were switched to arrays and any references to said variables modified to expand to the arrays' elements.
* Enable 'extglob' and replace some brace expansionsAndrew Robbins2017-07-111-1/+1
| | | | | | | Replace brace expansions with extended globs in a couple of places where brace expansions were erroneously used in place of actual pattern matching. This avoids potential errors concerning nonexisting files when patching sources.
* Fix action text in './libreboot usage <project>'Andrew Robbins2017-07-091-25/+23
| | | | | | | | | | | | | | Apparently the name used in a 'for /name/ ...' loop rebinds any local variables (with the same name) with whatever /name/ is bound to in a way that persists even after the loop returns. The crux of the issue here is that a function's children can rebind the parent(s)' local variables just by using the same name as the variable in a for loop, which is surprising--and apparently undocumented--behavior. Use of a subshell group for encapsulating the for loops (See: project_usage_actions) mitigates the aforementioned issue. Closes issue: #244