26 Commits
Author SHA1 Message Date
Patrick McCarty fa124fb19e Release v3.1.0
This release adds support for bsdtar (compile-time option), enables
parallel building of delta packs with pack_maker.sh, adds an initial
functional test suite, and addresses a few bugs:

- Makes parallel pack generation more robust when building packs for
  multiple versions simultaneously.

- Fixes basic_creator.sh to work properly on first run.

- Removes an unneeded -a option passed to tar, and fixes tar argument
  ordering (files always after options).

- Makes hash calculation always account for xattrs, since swupd-client
  unconditionally accounts for them.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
v3.1.0
2016-03-17 12:48:56 -07:00
Patrick McCarty 3d4e172c22 Update the gitignore
Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-03-17 12:33:25 -07:00
Patrick McCarty 115a7f444e Add missing free() for a memory allocation
Even though swupd_make_pack will exit immediately in the event this
error occurs, calling free() here will be needed if the error handling
ever changes (e.g. returning from the function instead of exiting).

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-03-17 12:24:44 -07:00
Patrick McCarty 5ba47aa150 test: add basic checks to ensure packs have been created
Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-03-17 12:22:33 -07:00
Patrick McCarty 4e6fb28d0a Improve parallel pack generation
Because pack generation is a time-consuming task, running this task in
parallel is preferable.

However, if we are generating two or more packs with the same "from"
version at the same time, the multiple jobs will use the same pack
staging directory, leading to corruption.

My solution for now is to use a staging dir with a name derived from
both "from" and "to" versions so that there are no collisions.

A long-term fix will be to implement some kind of locking mechanism to
prevent *identical* packs from being generated simultaneously, but for
now, using more unique staging directories will improve the situation.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-03-17 11:58:49 -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 5acb4c394c test: set latest.version to new value in the latest test
The latest.version file should generally be updated after the most
recent build completes, so bump it to 10 after the build completes for
version 10 in this test.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-03-08 22:37:56 -08:00
Patrick McCarty 6ba28bc7a9 Add a functional test that creates delta packs
Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-03-08 22:23:59 -08:00
Patrick McCarty e653bdd50a Add initial functional test suite
The test suite uses BATS to emit TAP and the Automake TAP driver to
consume the output.

Most of the tests are basic, and full-run.bats creates a minimal update
using autogenerated chroot content.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-03-08 21:28:15 -08:00
Patrick McCarty 1cf0b2b316 Validate argument counts immediately after option parsing
Similar to how swupd_create_update handles argc/argv, swupd_make_pack
and swupd_make_fullfiles should validate the argument count before
checking for root privileges, etc.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-03-08 20:00:28 -08:00
Dmitry Rozhkov 71e2abe1af Always use xattrs when calculating file hashes
Currently swupd-client includes xattrs to hash sums of all files.
Therefore in order to avoid relaxing security and to prevent
`swupd verify` from reporting hash mismatches for updated files
it's better to include xattrs to hashes for all files.

Signed-off-by: Dmitry Rozhkov <dmitry.rozhkov@linux.intel.com>
2016-03-08 14:00:31 -08: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 eef6afe2f1 Prepare for running clang-format
Some of the existing comments cause clang-format to reformat them
strangely, so modify them to something more expected by the tool.

Also, the tool may decide to "join" several lines of concatenated string
literals if a line begins with a macro string literal. That's not
wanted, so fix up that case too.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-03-03 08:39:11 -08:00
Patrick McCarty 71ced644d7 Add clang-format style file
Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-03-03 08:39:11 -08:00
Patrick McCarty 1b4f0a7a3b Correctly set formatstaging/latest on first run
On first run, the formatstaging/latest does not exist, so make sure we
create it and initialize it properly.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-03-02 15:43:58 -08:00
Patrick McCarty d3004e6a9e Fix a shell syntax error
Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-03-02 15:43:28 -08:00
Patrick McCarty 101c91c681 Read latest.version after creating groups.ini
The mk_groups_ini.sh script instantiates the latest.version file on
first run, so make sure we read contents after that point.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-03-02 15:42:12 -08:00
Patrick McCarty afa886e6a8 Fix error reporting for incorrect minversion
Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-03-02 15:13:13 -08:00
Patrick McCarty 8911378049 Substitute correct values for installed server.ini
In case the user overrides UPDATEDIR in the environment, make sure the
installed server.ini reflects the overridden value.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-03-02 08:28:55 -08:00
Patrick McCarty f2330266b8 Build packs in parallel in pack_maker.sh
The necessary waits needed for the backgrounded processes is already
implemented, so simply throw swupd_make_pack processes into the
background for faster build times.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-03-02 08:20:09 -08:00
Patrick McCarty 27271d3d2b Use --statedir in the builder scripts
Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-03-02 08:11:07 -08:00
Patrick McCarty 26892177e6 Align variable default values in builder scripts
Also, make some of the variables overridable in the environment.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-03-02 08:09:07 -08:00
Patrick McCarty 2bb1136607 Add code coverage support
Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-02-29 13:21:28 -08:00
Dmitry Rozhkov 39ed685be2 Clean up tar commands: always put files after options
Unify tar commands to have files enumerated always at the end of
the commands. This would follow the scheme used in tar's man page
and simplify adoption of other tar implementation should the need
arise.

Signed-off-by: Dmitry Rozhkov <dmitry.rozhkov@linux.intel.com>
2016-02-24 12:44:12 -08:00
Dmitry Rozhkov d024492a20 Clean up tar options: drop -a for the extract mode.
The -a option is not needed for the extract mode since tar
auto-detects compression type from file format.

Signed-off-by: Dmitry Rozhkov <dmitry.rozhkov@linux.intel.com>
2016-02-24 12:43:41 -08:00
Patrick McCarty 6c438ca96f Initial commit
Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
v3.0.0
2016-02-24 10:00:31 -08:00