Implement the logging package for mixer.
A common log file can be set for all the mixer commands in the
builder.conf. E.g. `mixer config set Mixer.LOG <filepath>`
The log file and level can also be set for individual mixer
commands using the `--log` and `--log-level` flags respectively.
The various log levels are:
ERROR (1), WARNING (2), INFO (3), DEBUG (4) and VERBOSE (5).
Default log level is 4.
Fixes#666
Signed-off-by: Ashlesha Atrey ashlesha.atrey@intel.com
When resolving the full mix bundle set, the mixbundles file is now
updated once with the finalized set of bundles. Previously, the
mixbundles file was written many times with intermediate results which
scaled poorly when building with many bundles.
Fixes#724
Signed-off-by: John Akre <john.w.akre@intel.com>
By default, files with the prefix "/bin/", "/usr/bin/" and "/usr/local/bin/"
will have a new export flag "x" in the 4th byte of the flag section of the
bundle Manifest.
The user can override this by using a new keyword "un-export()" in
the bundle definition file.
E.g. un-export(/usr/bin/file2)
Note: The export flag is at a bundle-file level and hence does not get
written to the Full manifest.
Fixes#708
Includes bat tests for the export flag feature.
Also, adds an entry for the content-chroot tests to Travis.
Signed-off-by: Reagan Lopez <reagan.lopez@intel.com>
Passing '--local' with mixer bundle create will skip
the upstream check and create a new empty local bundle
if it does not already exist.
fixes#713
Signed-off-by: Ashlesha Atrey <ashlesha.atrey@intel.com>
The content keyword in the bundle definition file specifies the path to
a chroot whose file contents will be added to the bundle's manifest.
Ex: content(/path)
Signed-off-by: John Akre <john.w.akre@intel.com>
In getUpstreamBundles(),
- Remove the prune param as it is always true. Fixes#624
- Remove the version param as it is available in the method.
In getUpstreamBundlesPath(),
- Remove the version param as it is available in the method.
Also, remove the need for downloadUpstreamBundles() method by including
its code in getUpstreamBundles().
Signed-off-by: Reagan Lopez <reagan.lopez@intel.com>
Currently, the bundle defintions are downloaded from the default
clr-bundles repo https://github.com/clearlinux/clr-bundles/archive/.
The user can now specify a different upstream bundles url using a mixer init flag or mixer
config parameter.
E.g. mixer init --upstream-bundles-url=https://github.com/reaganlo/clr-bundles/archive/
E.g. mixer config set Swupd.UPSTREAM_BUNDLES_URL https://github.com/reaganlo/clr-bundles/archive/
Since there is a tight coupling between the --upstream-version and bundles
repo, the user should ensure that the bundles repo has the same structure as the
clr-bundles repo and the tar.gz files should be named after an upstream
version. i.e. If the mix is based on an upstream-version 31300, the bundles repo
should have a file 31300.tar.gz
Fixes#614
Note: Setting this value using `mixer config set` will only update it in builder.conf.
It does not fetch the upstream bundles. A dedicated command for that purpose
will have to be implemented instead.
Signed-off-by: Reagan Lopez <reagan.lopez@intel.com>
golangci-lint identified a couple errors that were not found by
gometalinter. This patch fixes the detected errors.
Signed-off-by: Rodrigo Chiossi <rodrigo.chiossi@intel.com>
An optional bundle is similar to the required bundles
(included bundles) but have a couple of differences.
- Optional bundles will be installed by default when the main
bundle that includes them is installed.
- Users will have the option to skip the installation of optional
bundles by using the flag --skip-optional/-o with bundle-add.
- Optional bundles can be removed from the system even if the
main bundle that installed them is still in the system.
From the perspective of Mixer a bundle will be considered as
optional whenever it is marked as also-add in the bundle spec
file. E.g. also-add(lib-openssl). And it should be added as
"also-add: <optional bundle>" in the bundle's manifest.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
`bundle add` will now add valid bundles and skip only the invalid ones,
thereby fixing issue #489.
Signed-off-by: Reagan Lopez <reagan.lopez@intel.com>
Some testcases showed these checks were incomplete and not handling
corner cases. Improve the logic of these checks to comply with the new
tests.
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
Instead of requiring upstream bundles be read from a child directory
under where mixer is currently run read them from underneath the mixer
workspace (builder.Config.Mixer.VersionPath) the same way local-bundles
is handled.
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
With the removal of the editor feature in `bundle edit`,
the term `edit` is not relevant anymore. Hence, changing it to `create`.
In order to prevent breakage of existing use-cases,
`edit` is aliased to `create`and `--suppress-editor` is made hidden and deprecated.
Signed-off-by: Reagan Lopez <reagan.lopez@intel.com>
`bundle edit` will no longer open the editor. It will just create new bundles or copy existing bundles.
This command will locate the bundle by first looking in local-bundles, and then in upstream-bundles.
If the bundle is only found upstream, the bundle file will be copied to the local-bundles directory.
If the bundle is not found anywhere, a blank template will be created with the correct name.
This commit also fixes issue #448 and increases test coverage for `bundle validate`.
Signed-off-by: Reagan Lopez <reagan.lopez@intel.com>
Currently, as part of `bundle list`, all the bundle names are read
and validated. As a result, `bundle list` fails if an invalid
bundle exists even if it is not added to the mix. This commit removes
bundle name validation as part of `bundle list` thereby fixing #461.
Signed-off-by: Reagan Lopez <reagan.lopez@intel.com>
Fixes#391
This patch greatly improves code readability by breaking up the goliath
builder.go into several new files containing similar functionality. Now
builder.go only contains the top-level build functions, constructors,
and types.
This patch contains no code functionality changes, the code is simply
moved around.
The builder.go file has been split out as follows:
* builder.go: contains all the top-level commands accessible via the
commandline, such as BuildBundles, BuildUpdate, BuildImage etc. along
with the type and const definitions.
* bundle_control.go: contains the mixer bundle * top-level commands and
all the helpers that are used only by this functionality.
* bundle_validate.go: contains the bundle validation functions.
* bundles.go: added getClosestAncestorOwner to this file as it was the
only file using this function (plus one reference in builder.go by the
top-level BuildBundles).
* deltapacks.go: contains the internal function createDeltaPacks used by
exported function in builder.go.
* repo_control.go: contains the dnf configuration controlling functions
such as AddRepo, SetURLRepo, etc. Ideally this will eventually be
moved to the config package.
* helpers.go: contains generic helper functions used by several files in
the builder package.
* init.go: contains the functions to initialize the mix via mixer
init.
* metadata.go: contains various metadata getters and setters for reading
and updating versions, formats, and metadata files.
* update.go: contains the internal functions used by mixer build update.
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>