18 Commits
Author SHA1 Message Date
William Douglas 4054c4c5e5 Mass lint cleanups
Two left over that are logic changes to be addressed in the next
commit.

Signed-off-by: William Douglas <william.douglas@intel.com>
2024-01-26 11:22:43 -08:00
Ashlesha Atrey f6dcd44f21 Implement logging for mixer
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
2020-04-30 13:57:58 -07:00
John Akre fa62440e85 Write mixbundles file once for resolved bundle set
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>
2020-02-25 14:30:14 -08:00
Reagan Lopez 1cb0a99126 Introduce new export flag in bundle manifests
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>
2020-02-21 11:15:17 -08:00
Reagan Lopez bed9ee845e Make bundle messages consistent
Signed-off-by: Reagan Lopez <reagan.lopez@intel.com>
2020-02-14 15:41:54 -08:00
Ashlesha Atrey 1f21b261e7 Add --local flag in mixer bundle create command
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>
2020-02-04 15:12:04 -08:00
John Akre fb47eee2fb Add content keyword to bundle definition file
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>
2020-01-31 13:54:12 -08:00
Reagan Lopez 34be3ae698 Remove redundant params from methods
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>
2019-11-07 17:18:37 +01:00
Reagan Lopez 874ee1dfad Introduces option for upstream bundles url
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>
2019-11-07 17:18:37 +01:00
Rodrigo Chiossi 01e6ca3e43 lint: Fix errors identified by golangci-lint
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>
2019-09-19 16:57:37 +02:00
Castulo Martinez ba8b02cb9c Support "optional" (also-add) bundles in manifests
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>
2019-07-15 18:23:52 +02:00
Reagan Lopez 8297cfc991 bundles: Add valid bundles and skip invalid ones
`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>
2018-11-27 10:13:37 -08:00
Matthew Johnson a8aec55670 builder: improve isLocalBundle checks based on testing
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>
2018-11-21 14:07:37 -08:00
Matthew Johnson 1d90131733 builder: read upstream-bundles from mix workspace
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>
2018-11-21 14:07:37 -08:00
Reagan Lopez a9b249da53 bundles: Change bundle edit to bundle create
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>
2018-11-20 10:54:38 -08:00
Reagan Lopez 7b6d4c22b5 bundles: Remove editor option for bundle edit
`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>
2018-11-20 10:54:38 -08:00
Reagan Lopez ade5ff736d bundles: Ignore name validation for bundle list
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>
2018-11-12 11:45:57 -08:00
Matthew Johnson ef52b7339e builder: break functions out into smaller files
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>
2018-10-23 13:32:05 -07:00