aboutsummaryrefslogtreecommitdiff
path: root/libs
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'libs-git' of and_who/libreboot into masterSwift Geek2019-03-292-45/+78
|\
| * libs/git: Exit subshell upon "cd" failureAndrew Robbins2019-03-281-21/+33
| | | | | | | | | | | | If cd fails, nothing else should be done. This is to prevent a potentially destructive action from being performed on the Libreboot repository (if the script is executed from the same directory).
| * libs/git: Remove check from git_am() and git_apply()Andrew Robbins2019-03-281-6/+8
| | | | | | | | | | Having a specific function for checking whether a patch would apply isn't that useful if git_am and git_apply call it internally anyway.
| * libs/git: Commit only if any blobs were removedAndrew Robbins2019-03-271-1/+24
| | | | | | | | | | | | git_diff_check() was added for future use since it's complementary to git_diff_staged_check(). It could be used to check for a dirty worktree, for example.
| * libs/git: Fail if patching failsAndrew Robbins2019-03-271-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The recursive call in git_project_patch_recursive() is now performed last so that if a patching attempt fails, the calling functions won't attempt to apply more patches. The consequence of this change is that patches are applied in (nearly) opposite order from before. git_project_prepare_patch() is now called after git_project_prepare_blobs() so that if patching fails and the user chooses to perform additional project actions anyway, such as building, the project is already deblobbed and not a risk to their freedom. I had mistakenly reordered these function calls in a prior commit.
| * 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
|/
* libs/git: Remove unnecessary env invocationAndrew Robbins2019-03-231-2/+2
| | | | | LC_ALL is already set to "C.UTF-8" and exported if libfaketime path is given in libreboot.conf
* libs/git: Remove some unused variable definitionsAndrew Robbins2019-03-231-8/+0
|
* libs/git: Avoid checking exit codes indirectlyAndrew Robbins2019-03-231-35/+5
|
* libs/git: Simplify logic for operating on branchesAndrew Robbins2019-03-231-122/+76
| | | | | | | Previous patches made certain tests unnecessary due to the setting of $BRANCH_PREFIX in $branch. By adding the branch prefix right before it's actually needed we can retain the usefulness of those conditional tests.
* libs/git: Avoid some redundancies in git_patch()Andrew Robbins2019-03-181-19/+29
| | | | | | | | | The subshell, changing directory, and checking out was unecessary considering all of these are done within the functions called by git_patch() git_am() was added in order to mirror the same wrapper style as used by git_apply() and git_commit()
* libs/git: Move patching method logic to git_patch()Andrew Robbins2019-03-181-8/+13
| | | | | | | | | | | This simplifies git_project_patch_recursive() and provides a unified method for patching, regardless of the patch format (mailbox or diff). Logic is included for dealing with patching failures due to git_apply_check() not being enough to catch certain edge cases, such as 'git apply --check' returning 0 but a subsequent 'git apply' failing.
* libs/git: Add git_apply() and git_apply_check()Andrew Robbins2019-03-181-1/+33
| | | | | | | | | | Since changes from an applied diff need to be added to the index and committed (vs. mailbox files with the git_patch function) new functions were necessary to account for this difference. This also fixes a bug where diffs were applied but not committed, at minimum dirtying the work tree and potentially causing problems for any later patches.
* Rename and refactor diff_patch_file()Andrew Robbins2019-03-183-17/+6
| | | | | | 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(!).
* libs/git: Apply patches before removing blobsAndrew Robbins2019-03-131-1/+1
| | | | | | | | | Patching before removing blobs is cleaner since patches are applied against a freshly created and checked out branch at the specified revision. Applying patches first also seems to reduce the likelihood of failed patching attempts due to a nebulous error about files not matching the git index (but doesn't eliminate it). More debugging required.
* libs/git: Actually patch recursivelyAndrew Robbins2019-03-131-10/+10
| | | | | | | | | | | | | | | | Previously the only way patching would work is if for every target there existed a corresponding directory under $project/$PATCHES, e.g: "./libreboot update coreboot x200 8MiB corebootfb grub" would require the "grub" directory and its parents: "projects/coreboot/patches/x200/8MiB/corebootfb/grub" Now you only need target-specific patch directories if you need them; I believe this was the intended behavior. Superfluous quotes were removed for readability.
* libs/git: Create branch name based on argument listAndrew Robbins2019-03-121-18/+2
| | | | | | | | | | | | | | | | | | | | | There was a bug where only $project was used as the branch name due to some faulty logic which checked for the existence of a revision file before setting the variables "prepare_branch" and "prepare_path". The bug in this case was that prepare_branch would be set to the value of $branch in only the first iteration of the for loop since in almost all cases there is only one revision file that exists for a given project, regardless of the arguments provided. Explained another way, in order for the proper branch name to be used a revision file would have had to exist in every target directory. This was an issue because only one branch was ever operated on (named $project), meaning if actions were performed on many targets then only the last to run would be represented in the project's repository--making tracking down some bugs a bit harder. With this fixed we now create a branch for every possible project or tool configuration and leaves us with a log for each.
* libs/git: Prefix branch names with "libreboot-"Andrew Robbins2019-03-121-7/+8
| | | | | | | This is a slight mitigation against branch name collisions. More robust handling should be added in the future but this is simple enough and provides some clear indication which branches have been created by the build system.
* libs/git: Clean up after patch fails to applyAndrew Robbins2019-03-111-1/+2
| | | | | A patch failing to apply shouldn't leave the repository in such a state where manual intervention is necessary to reset it.
* Center tool/project output between header/footerAndrew Robbins2019-02-222-2/+2
| | | | Makes it easier to read when multiple terse actions are performed.
* Don't output header/footer to stderr unless necessaryAndrew Robbins2019-02-222-4/+7
|
* Add preliminary dependency handling supportAndrew Robbins2019-01-222-2/+74
| | | | | | | | | | | | | | 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.
* Consolidate R400/T400/T500/W500 Coreboot configsAndrew Robbins2018-10-081-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The goal here is to have fewer full configuration files. By consolidating the T400 board configs (and board variants such as the R400/T500/W500) into at most two base configs we can rely on separate target-specific configs (e.g., for different flash sizes) to override our default values given in projects/coreboot/configs/t400/config File contents of the new configs located at projects/coreboot/t400/variants/ are now supplied to make as command-line arguments, overriding the same configurations in the base config. The T400 file is included as an example of which configurations need to be overriden by a variant for a proper SMBIOS name to be used. Configs allowing for different ROM chip sizes other than the default are reimplemented in a subsequent commit. The following are no longer valid targets when building Coreboot: r400_16mb r400_8mb r400_4mb t400_16mb t400_8mb t400_4mb t500_16mb t500_8mb t500_4mb w500_16mb w500_8mb w500_4mb
* 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-284-96/+96
| | | | | | | | | 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-284-40/+40
| | | | | | | | | | | | 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-284-99/+99
| | | | | | | | | | 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.
* Replace '.' usage with Bash 'source' builtinAndrew Robbins2017-10-281-2/+2
| | | | | | | The source builtin provided by Bash is easier to read than '.' (a lone period). Conforming to POSIX wasn't and isn't a goal of the Libreboot build system and as such it's fine to deviate from the standard where it makes sense, such as now.
* Modify fd copying in printf calls for readabilityAndrew Robbins2017-10-283-21/+21
|
* Remove overlooked braces from parameter expansionsAndrew Robbins2017-09-221-1/+1
| | | | | | | | | | This is a continuation of the last set of commits removing braces from parameter expressions which do not require them. The main script was overlooked when applying the previous changes, which this commit aims to correct. Also, one parameter expansion in libs/common was corrected as it was overlooked as well.
* Remove braces from parameter expansionsAndrew Robbins2017-09-211-8/+8
| | | | | | * libs/tool ditto
* Remove braces from parameter expansionsAndrew Robbins2017-09-211-59/+59
| | | | | | * libs/project ditto
* Remove braces from parameter expansionsAndrew Robbins2017-09-211-10/+10
| | | | | | * libs/git ditto
* Remove braces from parameter expansionsAndrew Robbins2017-09-211-57/+57
| | | | | | | * libs/common Makes it easier to read as well as cutting down on performance hits caused by the use of braces in parameter expansions.
* Conditionally use wget or curl in download_wrapperAndrew Robbins2017-09-201-1/+15
|
* Add support for curl in download_wrapper functionAndrew Robbins2017-09-201-2/+10
|
* Declare array wget_options with local scopeAndrew Robbins2017-09-201-1/+1
|
* Quote elements of array wget_optionsAndrew Robbins2017-09-201-5/+5
| | | | Necessary to satiate shellcheck.
* Add function 'tool_arguments_targets' to libs/toolAndrew Robbins2017-09-141-0/+19
| | | | | | | | | This is essentially the same function from libs/project with only the prefix changed from 'project_' to 'tool_' and minor formatting changes. The function had to be added in order to allow for arguments to tool scripts, which the dependencies script will require.
* 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.
* Create array TOOL_ACTIONS_GENERIC_IGNORE_CHECKAndrew Robbins2017-07-211-0/+1
| | | | | | | Located in libs/tool, this array's elements are compared with actions in TOOLS_ACTIONS_GENERIC when libreboot_setup_tool_actions() is called. This makes it simpler to add/remove actions which should/shouldn't have a corresponding check function in TOOL_ACTIONS.
* Add libreboot_setup_tool_actions()Andrew Robbins2017-07-211-5/+0
| | | | | | | | | The added function is a complement to libreboot_setup_project_actions() which moves generation of the TOOL_ACTIONS array out of libs/tool and into the main script for greater malleability. Notably, the proper elements are now included in the array.
* Rename TOOL_ACTIONS_FUNCTIONS to TOOL_ACTIONSAndrew Robbins2017-07-211-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.
* Fix action 'update_check' erroring out erroneouslyAndrew Robbins2017-07-211-1/+1
|