There is a bug in the code that causes swupd bundle-add <TAB><TAB>
to list regular bundle names as well as iterative manifest names.
This commit fixes the issue by removing the iterative manifests from
the list of results.
Closes#906
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
Documentation coverage on src/lib is now 100% and the goal is to eventually
reach that for everything on src/.
Also improve some documention on headers.
Add command docs-coverage on Makefile and run that on travis builds. For not only enforcing
a 100% coverage on headers inside src/lib/
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
Documentation coverage on src/lib is now 100% and the goal is to eventually
reach that for everything on src/.
Also improve some documention on headers.
We can declare the scruct in a header file and define it in a source file so
we can avoid using void pointers for the handle. It's a better approach because
compilers can trigger errors if we use a different type.
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
The json tests had been disabled because they were unstable. This issue
was fixed in a previous commit, so these tests should be enabled again.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
This commit makes use of the swupd_progress_callback() function to
report progress downloading fullfiles based on how much data we have
downloaded vs the number of files downloaded. This callback will only be
used when the number of files to be downloaded are less than MAX_FILES,
calculating the total download size can be very costly if the files are
too many. If the files to be downloaded are more than MAX_FILES we will
fallback to reporting download progress based on file count as before.
When installing bundles or doing updates, swupd creates a list of files
that need to be downloaded. This list may contain files that were
already downloaded via packages and it often does. These files are then
skipped at the moment of downloading them since they are already in the
system. This causes a misleading output that shows the user that
fullfiles will be downloaded when they are actually not.
This commit filters the list of fullfiles to be downloaded to only
contain those ones that actually need to be downloaded.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
This commit makes use of the swupd_progress_callback() function to
report progress downloading packs based on how much data we have
downloaded vs the number of files downloaded.
This commit also fixes a bug in the download_subscribed_packs function.
Swupd was not downloading the correct pack for bundles not installed in
the system that had been recently added as dependency of another
installed bundle.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
When swupd reports progress of content it needs, it does so by counting
how many files it needs to download (fullfiles or packs) and how many it
has already downloaded. This gives a rough estimate of what is the
progress of the overall download, but it can also be very misleading
since some files may be very different in size compared to others. This
is specially true when talking about packs, one pack could be a couple
of megabytes big while another one could be a few hundred megabytes.
This commit adds a curl callback that can be used to report download
progress periodically based on how many bytes have been downloaded vs
how many bytes have to be downloaded in total, giving the ability to report
progress accurately.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
If OCSP is enabled in the certificate and key usage is set as critical we
need to use OCSP to check if the certificate was revoked. As OCSP isn't
supported on swupd, just abort the operation.
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
Local variables should be kept local and been freed in local context.
Don't keep them global unless used out of context.
Also adding parameter for CRL. So it's now enabled on signature, but not
used on swupd.
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
Take this global check from signature module. Users of signature checker
should worry if you are or aren't going to check the siganure. Module should
always check that.
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
At first I assumed that all tarballs would have a trailing '/' for directories
and this isn't true. But we can't assume that we won't have a trailing '/'. So
archives_check_single_file_tarball() is now ignoring trailing '/' when comparing
files. That is the same behavior of the function that
archives_check_single_file_tarball() replaced.
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
When we enabled signature check by default we introduced one bug in configure that
was not setting the correct cert path when the flag --enable-signature-verification
was omitted. That wasn't triggered by our tests because we use an alternative signature.
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
We can't append the path_prefix parameter in the file name because it's not
part of the file name. Also uses run_command() instead of system().
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
Disabling json tests that checks for progress because tests are unstable.
If we have any minor changes in the code that could affect how curl is called
we could have different progress reports and because of that we would have false
negatives.
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
Note that we don't need to use run_command() (fork + exec) because
we don't need to handle any output on swupd. We can just replace current
process with the new swupd execution.
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
The --json-output flag can be enabled for every swupd command.
This commit converts it to be a global flag, and enables it in every
swupd command.
Closes#869
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
Reimplement search file to print output in search time instead of saving
everything to be printed later. This makes search a lot faster and reduce
the memory footprint of this function.
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>