mirror of
https://github.com/clearlinux/swupd-server.git
synced 2026-10-04 16:08:29 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5ecb58edff | ||
|
|
e3ca1cc566 | ||
|
|
330bede498 | ||
|
|
0fe32ce8fb | ||
|
|
31aec4684f |
@@ -111,6 +111,7 @@ dist_check_SCRIPTS = \
|
|||||||
test/functional/contentsize-across-versions-includes/test.bats \
|
test/functional/contentsize-across-versions-includes/test.bats \
|
||||||
test/functional/delete-no-version-bump/test.bats \
|
test/functional/delete-no-version-bump/test.bats \
|
||||||
test/functional/file-name-blacklisted/test.bats \
|
test/functional/file-name-blacklisted/test.bats \
|
||||||
|
test/functional/file-name-debuginfo/test.bats \
|
||||||
test/functional/format-no-decrement/test.bats \
|
test/functional/format-no-decrement/test.bats \
|
||||||
test/functional/full-run-delta/test.bats \
|
test/functional/full-run-delta/test.bats \
|
||||||
test/functional/full-run/test.bats \
|
test/functional/full-run/test.bats \
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
# Process this file with autoconf to produce a configure script.
|
# Process this file with autoconf to produce a configure script.
|
||||||
|
|
||||||
AC_PREREQ([2.66])
|
AC_PREREQ([2.66])
|
||||||
AC_INIT(swupd-server, 3.6.0, matthew.johnson@intel.com)
|
AC_INIT(swupd-server, 3.6.2, matthew.johnson@intel.com)
|
||||||
AM_INIT_AUTOMAKE([foreign -Wall -W subdir-objects])
|
AM_INIT_AUTOMAKE([foreign -Wall -W subdir-objects])
|
||||||
AM_SILENT_RULES([yes])
|
AM_SILENT_RULES([yes])
|
||||||
AC_PROG_CC
|
AC_PROG_CC
|
||||||
|
|||||||
@@ -175,7 +175,9 @@ extern void release_configuration_data(void);
|
|||||||
extern char *config_image_base(void);
|
extern char *config_image_base(void);
|
||||||
extern char *config_output_dir(void);
|
extern char *config_output_dir(void);
|
||||||
extern char *config_empty_dir(void);
|
extern char *config_empty_dir(void);
|
||||||
|
extern char *config_debuginfo_path(const char *path);
|
||||||
extern int config_initial_version(void);
|
extern int config_initial_version(void);
|
||||||
|
extern bool config_ban_debuginfo(void);
|
||||||
|
|
||||||
extern void read_current_version(char *filename);
|
extern void read_current_version(char *filename);
|
||||||
extern void write_new_version(char *filename, int version);
|
extern void write_new_version(char *filename, int version);
|
||||||
@@ -265,5 +267,6 @@ extern int system_argv_fd(char *const argv[], int newstdin, int newstdout, int n
|
|||||||
extern int system_argv_pipe(char *const argvp1[], int stdinp1, int stderrp1,
|
extern int system_argv_pipe(char *const argvp1[], int stdinp1, int stderrp1,
|
||||||
char *const argvp2[], int stdoutp2, int stderrp2);
|
char *const argvp2[], int stdoutp2, int stderrp2);
|
||||||
extern int num_threads(float scaling);
|
extern int num_threads(float scaling);
|
||||||
|
extern bool file_is_debuginfo(const char *path);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -2,3 +2,8 @@
|
|||||||
emptydir=/var/lib/update/empty/
|
emptydir=/var/lib/update/empty/
|
||||||
imagebase=/var/lib/update/image/
|
imagebase=/var/lib/update/image/
|
||||||
outputdir=/var/lib/update/www/
|
outputdir=/var/lib/update/www/
|
||||||
|
|
||||||
|
[Debuginfo]
|
||||||
|
banned=true
|
||||||
|
lib=/usr/lib/debug/
|
||||||
|
src=/usr/src/debug/
|
||||||
|
|||||||
@@ -314,6 +314,13 @@ static struct file *add_file(struct manifest *manifest,
|
|||||||
GError *err = NULL;
|
GError *err = NULL;
|
||||||
struct file *file;
|
struct file *file;
|
||||||
|
|
||||||
|
if (config_ban_debuginfo() && file_is_debuginfo(sub_filename)) {
|
||||||
|
printf("WARNING: File %s is banned ...skipping.\n", sub_filename);
|
||||||
|
free(sub_filename);
|
||||||
|
free(fullname);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (illegal_characters(entry_name)) {
|
if (illegal_characters(entry_name)) {
|
||||||
printf("WARNING: Filename %s includes illegal character(s) ...skipping.\n", sub_filename);
|
printf("WARNING: Filename %s includes illegal character(s) ...skipping.\n", sub_filename);
|
||||||
free(sub_filename);
|
free(sub_filename);
|
||||||
|
|||||||
@@ -67,6 +67,20 @@ int config_initial_version(void)
|
|||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool config_ban_debuginfo(void)
|
||||||
|
{
|
||||||
|
assert(keyfile != NULL);
|
||||||
|
|
||||||
|
return g_key_file_get_boolean(keyfile, "Debuginfo", "banned", NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
char *config_debuginfo_path(const char *comp)
|
||||||
|
{
|
||||||
|
assert(keyfile != NULL);
|
||||||
|
|
||||||
|
return g_key_file_get_value(keyfile, "Debuginfo", comp, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
bool read_configuration_file(char *filename)
|
bool read_configuration_file(char *filename)
|
||||||
{
|
{
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|||||||
@@ -309,3 +309,31 @@ int num_threads(float scaling)
|
|||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* This function is called when configuration specifies a ban on debuginfo files
|
||||||
|
* from manifests. Returns true if the passed file path matches the src or lib
|
||||||
|
* debuginfo configuration. */
|
||||||
|
bool file_is_debuginfo(const char *path)
|
||||||
|
{
|
||||||
|
bool ret = false;
|
||||||
|
char *lib;
|
||||||
|
char *src;
|
||||||
|
|
||||||
|
lib = config_debuginfo_path("lib");
|
||||||
|
src = config_debuginfo_path("src");
|
||||||
|
|
||||||
|
if (lib && (strncmp(path, lib, strlen(lib)) == 0)) {
|
||||||
|
ret = true;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (src && (strncmp(path, src, strlen(src)) == 0)) {
|
||||||
|
ret = true;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
out:
|
||||||
|
free(lib);
|
||||||
|
free(src);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1055,6 +1055,14 @@ int prune_manifest(struct manifest *manifest)
|
|||||||
// LOG(file, "Skipping deleted boot file in manifest write", "component %s", manifest->component);
|
// LOG(file, "Skipping deleted boot file in manifest write", "component %s", manifest->component);
|
||||||
manifest->files = g_list_delete_link(manifest->files, list);
|
manifest->files = g_list_delete_link(manifest->files, list);
|
||||||
manifest->count--;
|
manifest->count--;
|
||||||
|
} else if (config_ban_debuginfo() && file_is_debuginfo(file->filename)) {
|
||||||
|
/* The configuration option to ban debuginfo from the manifests was
|
||||||
|
* set in server.ini via the [Debuginfo][banned] option. Although
|
||||||
|
* debuginfo additions are banned via analyze_fs, prune it here
|
||||||
|
* to insure mistakenly included debuginfo from old versions is
|
||||||
|
* removed from the manifests. */
|
||||||
|
manifest->files = g_list_delete_link(manifest->files, list);
|
||||||
|
manifest->count--;
|
||||||
}
|
}
|
||||||
list = next;
|
list = next;
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -58,11 +58,11 @@ static void empty_pack_stage(int full, int from_version, int to_version, char *m
|
|||||||
// (re)create module/version/{delta,staged}
|
// (re)create module/version/{delta,staged}
|
||||||
string_or_die(&path, "%s/%s/%i_to_%i/delta", packstage_dir, module,
|
string_or_die(&path, "%s/%s/%i_to_%i/delta", packstage_dir, module,
|
||||||
from_version, to_version);
|
from_version, to_version);
|
||||||
g_mkdir_with_parents(path, S_IRWXU | S_IRWXG);
|
g_mkdir_with_parents(path, S_IRWXU);
|
||||||
free(path);
|
free(path);
|
||||||
string_or_die(&path, "%s/%s/%i_to_%i/staged", packstage_dir, module,
|
string_or_die(&path, "%s/%s/%i_to_%i/staged", packstage_dir, module,
|
||||||
from_version, to_version);
|
from_version, to_version);
|
||||||
g_mkdir_with_parents(path, S_IRWXU | S_IRWXG);
|
g_mkdir_with_parents(path, S_IRWXU);
|
||||||
free(path);
|
free(path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -79,7 +79,7 @@ static void explode_pack_stage(int from_version, int to_version, char *module)
|
|||||||
|
|
||||||
string_or_die(&path, "%s/%s/%i_to_%i/staged", packstage_dir, module,
|
string_or_die(&path, "%s/%s/%i_to_%i/staged", packstage_dir, module,
|
||||||
from_version, to_version);
|
from_version, to_version);
|
||||||
g_mkdir_with_parents(path, S_IRWXU | S_IRWXG);
|
g_mkdir_with_parents(path, S_IRWXU);
|
||||||
dir = opendir(path);
|
dir = opendir(path);
|
||||||
if (!dir) {
|
if (!dir) {
|
||||||
fprintf(stderr, "There are problems accessing %s, exiting\n", path);
|
fprintf(stderr, "There are problems accessing %s, exiting\n", path);
|
||||||
|
|||||||
+38
@@ -0,0 +1,38 @@
|
|||||||
|
#!/usr/bin/env bats
|
||||||
|
|
||||||
|
# common functions
|
||||||
|
load "../swupdlib"
|
||||||
|
|
||||||
|
setup() {
|
||||||
|
clean_test_dir
|
||||||
|
init_test_dir
|
||||||
|
|
||||||
|
init_server_ini
|
||||||
|
set_latest_ver 0
|
||||||
|
init_groups_ini os-core
|
||||||
|
init_groups_ini test-bundle
|
||||||
|
|
||||||
|
set_os_release 10 os-core
|
||||||
|
track_bundle 10 os-core
|
||||||
|
set_os_release 10 test-bundle
|
||||||
|
track_bundle 10 test-bundle
|
||||||
|
|
||||||
|
gen_file_plain 10 test-bundle "/usr/lib/debug/foo"
|
||||||
|
gen_file_plain 10 test-bundle "/usr/src/debug/bar"
|
||||||
|
gen_file_plain 10 test-bundle "/usr/bin/foobar"
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "debuginfo files pruned" {
|
||||||
|
run sudo sh -c "$CREATE_UPDATE --osversion 10 --statedir $DIR --format 3"
|
||||||
|
echo "$output"
|
||||||
|
# This should not be pruned
|
||||||
|
[[ 1 -eq $(grep '/usr/bin/foobar$' $DIR/www/10/Manifest.test-bundle | wc -l) ]]
|
||||||
|
[[ 1 -eq $(grep '/usr/lib/debug$' $DIR/www/10/Manifest.test-bundle | wc -l) ]]
|
||||||
|
[[ 1 -eq $(grep '/usr/src/debug$' $DIR/www/10/Manifest.test-bundle | wc -l) ]]
|
||||||
|
# These should be pruned
|
||||||
|
[[ 0 -eq $(grep '/usr/src/debug/bar$' $DIR/www/10/Manifest.test-bundle | wc -l) ]]
|
||||||
|
[[ 0 -eq $(grep '/usr/lib/debug/foo$' $DIR/www/10/Manifest.test-bundle | wc -l) ]]
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
# vi: ft=sh ts=8 sw=2 sts=2 et tw=80
|
||||||
@@ -40,6 +40,12 @@ setup() {
|
|||||||
[[ 1 -eq $(grep '/usr/share/clear/bundles$' $DIR/www/10/Manifest.os-core | wc -l) ]]
|
[[ 1 -eq $(grep '/usr/share/clear/bundles$' $DIR/www/10/Manifest.os-core | wc -l) ]]
|
||||||
[[ 4 -eq $(tar -tf $DIR/www/10/pack-test-bundle-from-0.tar | wc -l) ]]
|
[[ 4 -eq $(tar -tf $DIR/www/10/pack-test-bundle-from-0.tar | wc -l) ]]
|
||||||
[[ 5 -eq $(tar -tf $DIR/www/10/pack-os-core-from-0.tar | wc -l) ]]
|
[[ 5 -eq $(tar -tf $DIR/www/10/pack-os-core-from-0.tar | wc -l) ]]
|
||||||
|
|
||||||
|
# extract test-bundle pack to make sure staged and delta are created with the
|
||||||
|
# correct permissions
|
||||||
|
sudo tar -xf $DIR/www/10/pack-test-bundle-from-0.tar --directory $DIR/www/10/
|
||||||
|
[[ $(stat -c %a $DIR/www/10/staged) -eq 700 ]]
|
||||||
|
[[ $(stat -c %a $DIR/www/10/delta) -eq 700 ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
# vi: ft=sh ts=8 sw=2 sts=2 et tw=80
|
# vi: ft=sh ts=8 sw=2 sts=2 et tw=80
|
||||||
|
|||||||
Reference in New Issue
Block a user