Clarify function purpose with rename

The is_tracked_bundle function doesn't not accurately portray its
purpose, rename to is_installed_bundle as it is actually looking at
the installed content directory.
This commit is contained in:
William Douglas
2019-02-13 12:23:28 -08:00
committed by Otavio Pontes
parent 00d7c1b366
commit 44adf33ca3
4 changed files with 12 additions and 12 deletions
+7 -7
View File
@@ -113,10 +113,10 @@ free_out:
return ret;
}
/* Finds out whether bundle_name is tracked bundle on
/* Finds out whether bundle_name is installed bundle on
* current system.
*/
bool is_tracked_bundle(const char *bundle_name)
bool is_installed_bundle(const char *bundle_name)
{
struct stat statb;
char *filename = NULL;
@@ -294,7 +294,7 @@ enum swupd_code show_bundle_reqd_by(const char *bundle_name, bool server)
struct list *subs = NULL;
struct list *reqd_by = NULL;
if (!server && !is_tracked_bundle(bundle_name)) {
if (!server && !is_installed_bundle(bundle_name)) {
fprintf(stderr, "Error: Bundle \"%s\" does not seem to be installed\n", bundle_name);
fprintf(stderr, " try passing --all to check uninstalled bundles\n");
ret = SWUPD_BUNDLE_NOT_TRACKED;
@@ -537,7 +537,7 @@ enum swupd_code remove_bundles(char **bundles)
goto out_free_curl;
}
if (!is_tracked_bundle(bundle)) {
if (!is_installed_bundle(bundle)) {
fprintf(stderr, "Warning: Bundle \"%s\" is not installed, skipping it...\n", bundle);
ret = SWUPD_BUNDLE_NOT_TRACKED;
bad++;
@@ -717,7 +717,7 @@ int add_subscriptions(struct list *bundles, struct list **subs, struct manifest
}
free_manifest(manifest);
if (!find_all && is_tracked_bundle(bundle)) {
if (!find_all && is_installed_bundle(bundle)) {
continue;
}
@@ -757,10 +757,10 @@ static enum swupd_code install_bundles(struct list *bundles, struct list **subs,
char *bundle;
bundle = iter->data;
iter = iter->next;
if (is_tracked_bundle(bundle)) {
if (is_installed_bundle(bundle)) {
fprintf(stderr, "Warning: Bundle \"%s\" is already installed, skipping it...\n", bundle);
already_installed++;
/* track as installed since they tried to install it */
/* track as installed since the user tried to install */
track_installed(bundle);
}
/* warn the user if the bundle to be installed is experimental */
+1 -1
View File
@@ -537,7 +537,7 @@ static void set_untracked_manifest_files(struct manifest *manifest)
{
struct list *files;
if (!manifest || is_tracked_bundle(manifest->component)) {
if (!manifest || is_installed_bundle(manifest->component)) {
return;
}
+3 -3
View File
@@ -88,8 +88,8 @@ static void add_bundle_file_result(char *bundlename, char *filename, double scor
ON_NULL_ABORT(bundle);
results = list_append_data(results, bundle);
strncpy(bundle->bundle_name, bundlename, BUNDLE_NAME_MAXLEN - 1);
/* record if the bundle is tracked on the system */
bundle->is_tracked = is_tracked_bundle(bundlename);
/* record if the bundle is installed on the system */
bundle->is_tracked = is_installed_bundle(bundlename);
bundle->is_experimental = is_experimental;
}
@@ -216,7 +216,7 @@ static long calculate_size(char *bname, struct list *bundle_info, bool installed
*
* Otherwise only add the contentsize of bundles not already
* installed on the system. */
if (installed || !is_tracked_bundle(bname)) {
if (installed || !is_installed_bundle(bname)) {
size += bi->topsize;
bi->seen = true;
}
+1 -1
View File
@@ -364,7 +364,7 @@ struct list *free_bundle(struct list *item);
extern void create_and_append_subscription(struct list **subs, const char *component);
/* bundle.c */
extern bool is_tracked_bundle(const char *bundle_name);
extern bool is_installed_bundle(const char *bundle_name);
extern enum swupd_code remove_bundles(char **bundles);
extern enum swupd_code show_bundle_reqd_by(const char *bundle_name, bool server);
extern enum swupd_code show_included_bundles(char *bundle_name);