10 Commits

Author SHA1 Message Date
Patrick McCarty cb2706fb72 Move removal of old deleted files to a new function
Since removing of all of the matching deleted files between a build with
an older manifest format and current needs to happen *after*
match_manifests() finishes accounting for new and deleted entries in the
manifests, simply move the logic into a separate function to be called
after match_manifests().

Because one or more file deletions should trigger a fresh bundle manifest
creation, account for the return value of this new function in addition
to the result of manifest pruning and whether any bundle includes were
changed. Since "os-core" is treated specially, and it's expected to
contain changed files for every build, only the non-"os-core" bundle
manifests need the trigger.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-04-05 21:03:23 -07:00
Patrick McCarty 90c976fdaf Require the -F option for swupd_create_update
To decrease chances of specifying an incorrect format number, since the
default is a hardcoded value "3", always require the user to pass the -F
option to swupd_create_update.

In the future, it would be nice to read the default value from a config
file, with the -F option overriding the value.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-04-04 14:18:15 -07:00
Tim Pepper 3b43313c9e Compare current format versus prior format in manifest match
To better support a workflow for incrementing the format on the command
line, it's useful to have the format be an integer instead of a string.
When reading a manifest (ie: old manifest) we can read that into struct
manifest.  Then when building a new manifest we can compare against the
prior manifest's format.  If the format incremented, we can prune files
previously marked as deleted in the old manifest so they no longer
appear in the new manifest.

This is beneficial because a file that has a version number in its name
will repeatedly be deleted and replaced by a new similar file.  Over
time this leads to manifests getting bigger and bigger because they
retain the entire history of all file names which ever existed, even if
a huge number of them are and have been for a long time marked as
deleted.

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
2016-04-04 14:18:10 -07:00
William Douglas 9b05b06a9b Fix manifests not detecting include changes
When deciding if a new manifest should be generated for a new version,
the included manifests were not being used to detect a manifest
change. This caused manifests that had new includes: lines in the new
version to not be generated resulting in files from the included
manifest to be missed when adding/updating that bundle.

The fix was to compare includes: lines from the current and previous
manifest versions for differences and generate new manifests when that
was the case. In order to compare manifests duplicate includes: lines
are not allowed and previously os-core could be added multiple times to
a manifest because it was always added. This change also added detection
for os-core before automatically adding it to a bundle.
2016-03-31 18:45:33 +00:00
William Douglas 9b8b1d5359 Make the subtract_manifests function include-aware
When subtracting a manifest from another, all the included manifests
also will need to be subtracted from the original. To do this build up a
unique list of all manifests included (directly or indirectly) from the
manifest being subtracted from.

With that in place, this gives an opportunity to provide the
functionality of subtracting all included manifests from the main
manifest by calling subtract_manifests(A, A);
2016-03-24 21:17:56 +00:00
William Douglas 0dcad76694 Add field for expressing included bundles 2016-03-24 21:17:56 +00:00
Patrick McCarty f27d0cf03a Capture logs for every binary
To capture all information that is logged, change init_log() to make
every log file name unique, and add a call to swupd_make_fullfiles to
enable logging.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-03-22 17:04:17 -07:00
Dmitry Rozhkov d6153973fe Add compatibility with libarchive's bsdtar command
Since GNU tar fails to extract files with xattrs preserved when
Integrity Measurement Architecture (IMA) is enabled some vendors
may choose to install libarchive-based tar (bsdtar) on their embedded
devices, so the swupd server needs to be able to create archives
in its format.

This patch adds one compile-time options --enable-bsdtar that is used
to enable/disable GNU tar specific options. Also it harmonizes
the command strings to be compatible with both GNU tar and bsdtar.
Particularly it
- changes --exclude pattern from '%s'/* to more explicit '%s/?*' because
  bsdtar's pattern matching is greedier than in tar: it uses tcsh's
  globbing where '*' can be anything including the null string and the
  original pattern would include the directory itself;
- OS file names are escaped with leading ./ to avoid collisions with
  file names starting with @ which has special meaning in bsdtar.

Signed-off-by: Dmitry Rozhkov <dmitry.rozhkov@linux.intel.com>
2016-03-09 13:13:02 +02:00
Patrick McCarty 3044d8c51b Initial run of clang-format
Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-03-03 08:39:11 -08:00
Patrick McCarty 6c438ca96f Initial commit
Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-02-24 10:00:31 -08:00