85 Commits
Author SHA1 Message Date
William Douglas a471a64111 Update helloworld test release version to current
Signed-off-by: William Douglas <william.douglas@intel.com>
2021-10-15 11:04:17 -07:00
Reagan Lopez 0c913eec00 Refactor logging for consistent messages
Signed-off-by: Reagan Lopez <reagan.lopez@intel.com>
2020-05-01 16:48:19 -07: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
Reagan Lopez 710c4486a4 Remove the mixin feature
Now mixer has the ability to support 3rd party content, which makes the
need for mixin obsolete.

Signed-off-by: Reagan Lopez <reagan.lopez@intel.com>
2020-04-06 15:22:14 -07:00
Reagan Lopez 56f9f42084 Update package version in bat test
Update the version of the helloworld package used in one of the bat
tests.

Signed-off-by: Reagan Lopez <reagan.lopez@intel.com>
2020-04-06 04:29:46 -07:00
Reagan Lopez c983a6ea8f CI: Replace Travis with GitHub Actions
Signed-off-by: Reagan Lopez <reagan.lopez@intel.com>
2020-04-06 04:06:32 -07:00
Reagan Lopez 75b4def4d2 Fix permission issue in bat test
Signed-off-by: Reagan Lopez <reagan.lopez@intel.com>
2020-03-27 16:29:53 -07:00
John Akre bfc02ef322 Set file perms after creating the dest file
When calling the copyFileWithFlags function with the preserveSrc flag
set, file permissions must be set after creating the destination file
and setting the file owner. This is necessary because umask can prevent
newly created files from acquiring the source file's permissions and
file ownership changes can impact the setuid/setgid permissions.

Similarly directory permissions are set after creating the directory to
avoid unexpected permission behavior caused by umask.

Signed-off-by: John Akre <john.w.akre@intel.com>
2020-03-03 16:23:41 -08:00
John Akre 60dcf63ce2 Preserve file ownership when using content chroots
When using content chroots, file uid/gid values should be preserved when
copying them to the full chroot.

Fixes #727

Signed-off-by: John Akre <john.w.akre@intel.com>
2020-02-25 17:29:39 -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
John Akre 7931f5346d bat: Add content chroot test
Signed-off-by: John Akre <john.w.akre@intel.com>
2020-01-31 13:54:12 -08:00
John Akre 0fdf014167 Always clean mix workspace before building bundles
Existing image and output directories for the current mix version will
be removed when building a mix. This prevents mixer from building on top
of directories contaminated by a prior mix.

Fixes #669

Signed-off-by: John Akre <john.w.akre@intel.com>
2020-01-31 13:46:14 -08:00
Ashlesha Atrey f23d5ed335 Add BUILD_ID field in os-release file
BUILD_ID field in os-release file specifies the upstream Clear
Linux version from which the mix is being created.
If upstream Clear Linux is not found, BUILD_ID is empty.

fixes #706

Signed-off-by: Ashlesha Atrey <ashlesha.atrey@intel.com>
2020-01-28 16:35:27 -08:00
John Akre b7e8f5939f bat: test upstream-format bundle deletion
Validate that upstream and local bundles are correctly deleted when
crossing an upstream format as a downstream mix.

Signed-off-by: John Akre <john.w.akre@intel.com>
2020-01-10 13:57:16 -08:00
Reagan Lopez 8aac35f881 repo: Handle rpms in repo sub directories
Currently, for repos with "file" baseurl scheme, mixer expects the
rpms to be directly within the baseurl path.
But it is possible that rpms can be in sub directories within the repo baseurl.

In order to handle this, if an rpm is not found directly within the repo baseurl,
run repoquery to determine the actual location of the rpm.
This is expensive and it is recommended that rpms are stored directly
within the repo baseurl.

Includes a bat test.
Fixes #674

Signed-off-by: Reagan Lopez <reagan.lopez@intel.com>
2019-12-19 12:04:03 -08:00
John Akre 7acd3550ef bat: Remove MCA error string check
Signed-off-by: John Akre <john.w.akre@intel.com>
2019-12-19 11:40:16 -08:00
Mark D Horn 86c3459378 builder: use clr-installer for image generation
Switch from ister.py to clr-installer for generating OS images.

Will migrate existing ister JSON file if it exist.

Both ISO generate and Raw Image retention enabled by default.

Signed-off-by: Mark D Horn <mark.d.horn@intel.com>
2019-11-22 23:29:49 +00:00
Rodrigo Chiossi e30862038d bats: test config conversion on custom path
Test converting a config when the `--config` flag is used.

Signed-off-by: Rodrigo Chiossi <rodrigo.chiossi@intel.com>
2019-11-13 00:59:06 +01:00
Rodrigo Chiossi fcc39d1094 config: Remove docker image path
Docker image path is no longer used since built in docker support was
removed.

Signed-off-by: Rodrigo Chiossi <rodrigo.chiossi@intel.com>
2019-11-08 17:09:06 +01:00
Rodrigo Chiossi 1bf26901e7 cmd: Remove all uses of deprecated flag --native
Delete all instances of --native from the code.

Signed-off-by: Rodrigo Chiossi <rodrigo.chiossi@intel.com>
2019-11-08 17:09:06 +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 e9909408a1 fullfiles: Add user configured compression list
This patch allows users to configure the compression methods that will
be used for fullfiles creation. The compression method can be set in the
Swupd.COMPRESSION property in builder.conf. Instead of enabling all
methods as previosly, xz is the only method that comes enabled by
default.

Note: internal gzip is still used for Link and Directory fullfile
creation.

Signed-off-by: Rodrigo Chiossi <rodrigo.chiossi@intel.com>
2019-11-05 15:23:22 +00:00
Ashlesha Atrey 49f51fccb3 Added test case for generating delta packs with missing files
Added testcase for generating deltapacks with missing files for
different versions. If file is missing, delta pack for that
bundle should be ignored as delta pack generation is optional.

Signed-off-by: Ashlesha Atrey <ashlesha.atrey@intel.com>
2019-10-07 17:35:31 +02:00
John Akre 4e853f65ee MCA: Minor statistics reporting improvements
The following minor statistics reporting changes were added to improve
statistics readability:

* Add colons to the added/deleted package sections
* Add space between '|' character and bundle name

Signed-off-by: John Akre <john.w.akre@intel.com>
2019-07-05 16:05:35 +02:00
John Akre f873574712 MCA: Support repo/baseurl overrides for from and to versions
In some cases a single DNF config file is not sufficient to correctly
download packages for the mix versions specified by the from and to
flags. The --from-repo-url and --to-repo-url flags were added to
temporarily override the baseurl value for the specified repo in the DNF
config when downloading packages for the from and to versions respectively.
Multiple instances of these flags can be used to override additional
repo/baseurl pairs. An example flag format is shown below:

--from-repo-url <repo>=<URL>
--to-repo-url <repo>=<URL>

Signed-off-by: John Akre <john.w.akre@intel.com>
2019-07-02 00:00:50 +02:00
Rodrigo Chiossi b04762f782 cmd: skip format bump check
When doing manual format bumps, the upstream version for +20 needs to be
updated to the upstream version in the new format, but since the format
differs, the build will fail.
This PR adds a new flag to `mixer versions update` and to `mixer build`
subcommands that allows this check to be skipped.

Signed-off-by: Rodrigo Chiossi <rodrigo.chiossi@intel.com>
2019-05-14 16:56:38 +02:00
John Akre cda8f817e9 swupd: Remove directories from contentsize calculation
Directories can be installed with inconsistent sizes. To make mixes
reproducible, the size of directories is omitted from the contentsize
calculation.

Signed-off-by: John Akre <john.w.akre@intel.com>
2019-05-10 05:53:20 +02:00
John Akre 137a505904 MCA: Return nonzero value when errors are detected
Signed-off-by: John Akre <john.w.akre@intel.com>
2019-05-09 19:40:26 +02:00
John Akre 64bc5f1031 MCA: Skip RPM download when bundle has no packages
When a bundle has no packages, there is no need to attempt to download
them.

Signed-off-by: John Akre <john.w.akre@intel.com>
2019-05-09 19:40:26 +02:00
John Akre a2304e5b3a Add test for clean build
Adds bat test to verify that builds with the clean flag succeed.

Signed-off-by: John Akre <john.w.akre@intel.com>
2019-04-25 18:23:40 +02:00
John Akre 608a9dbc76 Add PREVIOUS_MIX_VERSION field to mixer.state
The mixer.state file now tracks the previous mix version with the
PREVIOUS_MIX_VERSION field. When this value is not set, it will default
to the LAST_VER or 0 when LAST_VER is invalid.

Format bumps create an important exception for the value of
PREVIOUS_MIX_VERSION. During a format bump, PREVIOUS_MIX_VERSION will be
overridden by the LAST_VER which will prevent PREVIOUS_MIX_VERSION from
altering format bump behavior.

Additionally, the mixer.state version was incremented and tests for
state file version conversions were added.

Signed-off-by: John Akre <john.w.akre@intel.com>
2019-04-25 18:23:40 +02:00
John Akre 3924a30793 MCA: Add tests
Adds bat tests to validate MCA error and package statistics reporting.

Signed-off-by: John Akre <john.w.akre@intel.com>
2019-04-19 01:09:16 +02:00
sweeaun 0f7f998b42 config: Allow OS identification customization after review
1. Remove original config backup in bats test
2. Improve custom os-release file content reading operation

Signed-off-by: sweeaun <swee.aun.khor@intel.com>
2019-04-11 16:27:37 +02:00
sweeaun 5c777c5701 config: Allow customize os-release file used in Mixer
New param added in builder.conf Mixer section to support
    customize os-release file.

    Example to specify modified os-release file path in Mixer section:
    [Mixer]
    OS_RELEASE_PATH = "/tmp/modified-os-release"

    Note: Either use empty string or do not specify the OS_RELEASE_PATH indicated
    Mixer to use default os-release file.

Signed-off-by: sweeaun <swee.aun.khor@intel.com>
2019-04-11 16:27:37 +02:00
Rodrigo Chiossi 7b8ba4c573 bat: Fix bundle count
The bundle validation count only needs to account for the bundles that
have been directly added to the mix. With the fragmentation of the
default bundles into smaller bundles that are used as includes, the test
must ignore the included bundles and just count the ones that were
directly added.

Signed-off-by: Rodrigo Chiossi <rodrigo.chiossi@intel.com>
2019-02-26 19:40:31 +01:00
William Douglas 623c60999b Enable create Manifest deltas in mixer
swupd-server used to support building bsdiff based deltas of manifest
files. This change adds that ability back for bundle manifests with
the 'mixer build delta-manifests' command.
2019-02-12 13:17:59 -02:00
John Akre db9f24ec0d Increase Clear repo default timeout
Since the default Clear repo mirror changed to the cdn, dnf timeouts
occur more frequently. Increasing the timeout to 45 seconds from the
default timeout of 30 seconds.

Signed-off-by: John Akre <john.w.akre@intel.com>
2019-01-29 01:05:22 +01:00
Otavio Pontes 0c9200fb8c Use cdn to download content on mixer
Use cdn instead of download.clearlinux.org as the standard upstream URL,
because it's more reliable. Other usages of download.clearlinux.org were
also changed with the exception of version number downloads. Downloading
version numbers from download.clearlinux.org is still preferred because
we don't need to be concerned with caching.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-01-24 01:10:48 +01:00
Rodrigo Chiossi 857fea2b2e bat: Fix bundle test
Version 27310 of clearlinux included os-core-webproxy as dependency of
os-core-update. This adds one extra bundle to the default bundle list.
Since bundle tests will count the number of lines in the output for
validation, this extra default bundle must be accounted for.

Signed-off-by: Rodrigo Chiossi <rodrigo.chiossi@intel.com>
2019-01-18 18:30:54 +01:00
John Akre 4270d9185d mixin: prevent removal of clear repo
The clear repo is mandatory for mixin. This change prevents mixin from
removing the clear repo.

Fixes #326

Signed-off-by: John Akre <john.w.akre@intel.com>
2018-11-29 15:49:20 -08: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
Reagan Lopez 7992b45eaa Refactored the tests for bundle commands
- Reordered the tests to reduce code change impacts
- Added more test coverage for `bundle remove`

Signed-off-by: Reagan Lopez <reagan.lopez@intel.com>
2018-11-20 10:54:38 -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
Tudor Marcu 2f547c9010 Add bat test for updating mixver offline
Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2018-11-16 15:05:38 -08:00
Matthew Johnson b839630c3d bat: remove unnecessary numbering system
There is no reason to number these tests as bat does not respect the
numbering system and it was obnoxious to try to keep collisions from
happening and keep the descriptions up-to-date.

Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2018-11-14 16:29:44 -08:00
Matthew Johnson 4174344b22 bat: update to use new mixer-mixversion-update function
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2018-11-14 16:29:44 -08:00
Matthew Johnson 711e2a8e7b bat: renumber conflicting tests
We had three 09-* tests, renumber them so we can prove we actually know
how to count when people look at our test directory.

Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2018-11-14 16:29:44 -08:00
Matthew Johnson b538ec1c3a test that no delta-packs created over format bumps
Add a bat test that creates a format bump then attempts to create delta
packs over that format bump. Make sure that the delta packs are not
created and that they are not even attempted to be created.

Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2018-11-14 15:44:25 -08:00
Reagan Lopez b45ec080aa bundles: Build image with default ister template
This commit fulfills enhancement #58. When building an image without providing a template,
if the default image template is not present in the mix directory, mixer will do the following:
 - Copy image template from ister template "/usr/share/defaults/ister/release-image-config.json".
 - Update image template with the bundle list from "mixbundles" file.
   In case the "mixbundles" file is empty or not present, use ister template as is.
 - Inform the user about the above steps.
 - Continue the existing build process.

Signed-off-by: Reagan Lopez <reagan.lopez@intel.com>
2018-11-13 15:26:39 -08:00