Newer storage, such as UFS or NVMe disk, may not support the
default 512 sector size.
For these devices, the partition table and the partition offset
need to be aligned with sector size boundaries. The GPT partition
table is 34 sectors in length, so we can't have compatible disk images
between 512 and 4096 sector-size devices.
This patch introduces a major breakage with the {{ sector 64 }}
template.
At template processing, we can't guess the appropriate sector size
for the image since this value can be defined as a YAML header.
Instead of multiplying the sector number by the default 512 bytes
boundary, append a 's' suffix. This defers the work of computing
the value to the different Actions.
The 's' suffix is chosen to be compatible with parted (ImagePartition)
and support has been added to raw action.
Signed-off-by: Julien Massot <julien.massot@collabora.com>
Currently each action starts with LogStart(), adding some annoying
duplication. In addition we have a LogStart(), whereas there's no
end/stop equivalent.
Instead add the on-line log.Print() wihtin the debos action loop, just
prior to calling Run(). The same file deals with all the other pretty
logging.
v2: Drop pacman/pacstrap hunks
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
The origins hash table is inside the commonContext structure which is
shared by all Contexts. This mostly works correctly as most origins are
not specific to the recipe that's executed but to either the run or the
progress of a run. Such as "filesystem" or "artifacts".
However this is not the case for the "recipe" origin. To resolve that
add a helper function which returns the current context RecipeDir and
otherwise simply the respective value in the common Origins table.
Signed-off-by: Sjoerd Simons <sjoerd@collabora.com>
To be able to load recipe from directory not under main recipe
directory, new "recipe" action needs to be able overwrite some
properties, architecture and recipe path. But other properties
needs to be shared between actions, as some of them can change
their values.
To allow this, move shared properties in new CommonContext structure
and add to remaining properties a new pointer to the CommonContext.
Signed-off-by: Frédéric Danis <frederic.danis@collabora.com>
Dump Recipe structure in Recipe.Parse() method to allow to do it before
Verify() method is called for a given recipe or sub-recipe.
Sub-recipes are loaded by recipe action's Verify(). Dump of Recipe
structure can be done in Verify() or Parse() methods.
Doing it in Recipe.Parse() allows to have it done in one place.
Signed-off-by: Frédéric Danis <frederic.danis@collabora.com>
This action includes the recipe actions at the given path, and can
optionally overrides or adds new template variables.
To allow recipes to operate both stand-alone and when included, template
variable "included_recipe" is added and set to "true" to indicate that
the recipe is part of a longer chain.
This allows a recipe to skip the unpack step if it's not the first to be
executed or to optionally skip a pack action when it's not the last.
For compatibility, both the parent recipe and all included recipes have
to be for the same architecture.
Limitations of combined recipes are equivalent to limitations within a
single recipe (e.g. there can only be one image partition action).
Print-recipe option is saved in DebosContext to allow each "recipe action"
to print its source during Parse.
Signed-off-by: Frédéric Danis <frederic.danis@collabora.com>
This adds debos options:
- --print-recipe to print final recipe
- --dry-run to compose final recipe to build but without any real work
started
Signed-off-by: Frédéric Danis <frederic.danis@collabora.com>
This change makes debos read a predefined set of environment variables
from the host and propagates it to fakemachine. The set of environment
variables is defined by environ_vars on cmd/debos/debos.go. Currently
the list of environment variables is configured to the proxy environment
variables as documented here[1]:
http_proxy, https_proxy, ftp_proxy, rsync_proxy, all_proxy, no_proxy
While the elements of environ_vars are in lower case, for each element
both lower and upper case variants are probed on the host, and if found
propagated to fakemachine. So if the host has the environment variables
HTTP_PROXY and no_proxy defined, both will be propagated to fakemachine
respecting the case.
This patch also adds --environ-var and -e command line options that can
be used to specify, overwrite, and unset environment variables for
fakemachine with the syntax:
$ debos -e ENVIRONVAR:VALUE ...
To unset an enviroment variable, or in other words, to prevent an
environment variable to be propagated to fakemachine, use the same
syntax without a value. debos accept multiple -e simultaneously.
[1] - https://wiki.archlinux.org/index.php/proxy_settings
This change depends on:
8b7eea7096cd015771cf9862647b7cd04bb41904 - machine.go: Add support to
environment variables
on fakemachine repository.
Signed-off-by: Peter Senna Tschudin <peter.senna@collabora.com>
Cleanup logic for actions is reworked by this change:
- Cleanup() gets called only if the Run for an action was started and
in the same machine (host or fake) as Run has run
- Add new method PostMachineCleanup(). This method gets called for the
actions with Pre*Machine() method called. This method is always executed
on the host with user's permissions.
- Due to all the deferring both *Cleanup methods get called in reverse
order; Cleanup always happens first (either on host or fake).
- Add global variable "State" in DebosContext structure to represent the
current build state. This could be used for correct cleanup in Actions.
- Changed API for "Action" interface -- now all methods use the pointer
to context data instead of the copy to have a real context for deffered
calls.
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
After create partitions put a partition -> device mapping in the context
such that other actions can use that to allow the user to refer to
partition names in other actions.
Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Launch interactive shell in context of failed action for issues
investigation and debug.
Add options to debos:
--debug-shell -- to start a shell in case of any failure
--shell <path> -- use selected shell instead of default bash
Fixes#30
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Initially 'debos.go' contained a lot of additions and logical parts in
single file. So move logical parts from 'debos.go' to appropriate packages:
- 'debos' package: actions interface and filesystem addons
- 'recipe' package: logic of Yaml-based recipe parsing
Use correct imports, naming and syntax for splitted files.
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>