aboutsummaryrefslogtreecommitdiff
path: root/libs/git
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* Respect blobs-ignore when removing blobsAndrew Robbins2019-04-231-8/+2
|
* 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/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-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(!).
* 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.
* Remove unnecessary spaces in command substitutionsAndrew Robbins2017-10-281-17/+17
| | | | | | | | | 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-16/+16
| | | | | | | | | | | | 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-29/+29
| | | | | | | | | | 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.
* Remove braces from parameter expansionsAndrew Robbins2017-09-211-10/+10
| | | | | | * libs/git ditto
* 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.
* Vars TAR_XZ,ASC,SHA256SUM renamed for generality.Andrew Robbins2017-06-251-2/+2
| | | | | Will help facilitate sane code when handling: archive formats, checksum file extensions, signature formats.
* Replaced '#!/bin/bash' w/ '#!/usr/bin/env bash'Andrew Robbins2017-06-231-1/+1
| | | | | This is mainly useful for being able to run these scripts on BSDs. And for users who use a Bash not installed to /bin.
* Remove unnecessary 'env' invocation from printf.Andrew Robbins2017-06-231-2/+2
| | | | | This reverts part of pull request #217 which called the 'env' binary for each printf invocation.
* Fixed printf calls & replaced 'echo' w/ printf.Andrew Robbins2017-06-231-2/+2
| | | | | | | | | All printf calls should now be properly formatted; prior, the format specifier string was erroneously used for both the format specifiers and the string to be printed. 'env' is now used to locate the printf binary so as to avoid potentially using a shell builtin. Lastly, all calls to 'echo' within the new build system have been replaced with printf for consistency/portability purposes.
* Improved handling of filenames in archive creationAndrew Robbins2017-06-221-3/+3
| | | | | | | | Filenames listed in DOTTARFILES are now NUL terminated so that any with strange characters, such as a newline, do not negatively affect archive creation. DOTRNDSEED file which stores the random seed to be used by GCC during compilation is now included in the list of files to be archived. Cleaned up functions related to archive creation.
* Patching now works. bucts can be patched & built.Andrew Robbins2017-05-311-18/+18
| | | | | | | | | Modified the function git_project_patch_recursive (in libs/git) to enable patching with diff files, which uses the new function diff_patch_file located in libs/common. A generic action script for bucts is in projects/bucts/. Install/revision/target files are in projects/bucts/configs/. bucts' merge into the new build system should be nearly, if not already, complete.
* libs: git: Check that blobs path is a valid filePaul Kocialkowski2017-01-151-1/+1
| | | | Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
* libs: git: Checkout with -B to allow recreating branchesPaul Kocialkowski2017-01-151-1/+1
| | | | Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
* Paper build system initial import into LibrebootPaul Kocialkowski2017-01-151-0/+634
This is the initial import of the Paper build system into Libreboot. It was written as a flexible and painless replacement for the Libreboot build system, allowing to support many different configurations. It currently only supports the following CrOS devices: * Chromebook 13 CB5-311 (nyan big) * Chromebook 14 (nyan blaze) * Chromebook 11 (HiSense) (veyron jerry) * Chromebit CS10 (veyron mickey) * Chromebook Flip C100PA (veyron minnie) * Chromebook C201PA (veyron speedy) The build system also supports building various tools and provides various scripts to ease the installation on CrOS devices. Signed-off-by: Paul Kocialkowski <contact@paulk.fr>