mirror of
https://github.com/clearlinux/swupd-server.git
synced 2026-10-04 07:58:32 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
51c0bf2007 | ||
|
|
f27d0cf03a | ||
|
|
08fb540678 | ||
|
|
2355295023 | ||
|
|
1aed8c3d4d |
+1
-1
@@ -2,7 +2,7 @@
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ([2.66])
|
||||
AC_INIT(swupd-server, 3.1.0, timothy.c.pepper@linux.intel.com)
|
||||
AC_INIT(swupd-server, 3.1.2, timothy.c.pepper@linux.intel.com)
|
||||
AM_INIT_AUTOMAKE([foreign -Wall -W subdir-objects])
|
||||
AM_SILENT_RULES([yes])
|
||||
AC_PROG_CC
|
||||
|
||||
+1
-1
@@ -222,7 +222,7 @@ extern void populate_file_struct(struct file *file, char *filename);
|
||||
extern void download_exta_base_content(void);
|
||||
|
||||
extern char *get_elapsed_time(struct timeval *t1, struct timeval *t2);
|
||||
extern void init_log(int version);
|
||||
extern void init_log(const char *prefix, const char *bundle, int start, int end);
|
||||
extern void init_log_stdout(void);
|
||||
extern void close_log(int version, int exit_status);
|
||||
extern void __log_message(struct file *file, char *msg, char *filename, int linenr, const char *fmt, ...);
|
||||
|
||||
@@ -38,11 +38,12 @@ static FILE *logfile;
|
||||
|
||||
static struct timeval start_time;
|
||||
|
||||
void init_log(int version)
|
||||
void init_log(const char *prefix, const char *bundle, int start, int end)
|
||||
{
|
||||
char filename[4096];
|
||||
sprintf(filename, "swupd-server.log.%i", version);
|
||||
char *filename;
|
||||
string_or_die(&filename, "%s%s-from-%i-to-%i.log", prefix, bundle, start, end);
|
||||
logfile = fopen(filename, "w");
|
||||
free(filename);
|
||||
gettimeofday(&start_time, NULL);
|
||||
}
|
||||
void init_log_stdout(void)
|
||||
|
||||
+1
-1
@@ -274,7 +274,7 @@ int main(int argc, char **argv)
|
||||
populate_dirs(newversion);
|
||||
|
||||
printf("Next version is %i \n", newversion);
|
||||
init_log(newversion);
|
||||
init_log("swupd-create-update", "", current_version, newversion);
|
||||
|
||||
gettimeofday(&previous_time, NULL);
|
||||
|
||||
|
||||
@@ -113,6 +113,8 @@ int main(int argc, char **argv)
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
init_log("swupd-make-fullfiles", "", 0, version);
|
||||
|
||||
manifest = manifest_from_file(version, "full");
|
||||
create_fullfiles(manifest);
|
||||
|
||||
|
||||
+2
-4
@@ -116,10 +116,6 @@ int main(int argc, char **argv)
|
||||
banner();
|
||||
check_root();
|
||||
|
||||
/* FIXME: should use "end_version" not "0" and a unique filename
|
||||
init_log(0);
|
||||
*/
|
||||
|
||||
/* Initilize the crypto signature module */
|
||||
if (!signature_initialize()) {
|
||||
printf("Can't initialize the crypto signature module!\n");
|
||||
@@ -141,6 +137,8 @@ int main(int argc, char **argv)
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
init_log("swupd-make-pack-", module, start_version, end_version);
|
||||
|
||||
printf("Making pack-%s %i to %li\n", module, start_version, end_version);
|
||||
|
||||
pack = calloc(1, sizeof(struct packdata));
|
||||
|
||||
+3
-6
@@ -546,15 +546,12 @@ void subtract_manifests(struct manifest *m1, struct manifest *m2)
|
||||
if (file1->is_deleted == file2->is_deleted && file1->is_file == file2->is_file) {
|
||||
m1->files = g_list_delete_link(m1->files, todel);
|
||||
m1->count--;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (ret < 0) {
|
||||
} else if (ret < 0) {
|
||||
list1 = g_list_next(list1);
|
||||
continue;
|
||||
} else {
|
||||
list2 = g_list_next(list2);
|
||||
}
|
||||
list2 = g_list_next(list2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+55
-12
@@ -168,21 +168,44 @@ static void make_pack_full_files(struct packdata *pack)
|
||||
item = g_list_next(item);
|
||||
if ((!file->peer || file->peer->is_deleted) && !file->is_deleted && !file->rename_peer) {
|
||||
char *from, *to;
|
||||
char *fullfrom, *fullto;
|
||||
|
||||
/* hardlink each file that is in <end> but not in <X> */
|
||||
string_or_die(&fullfrom, "%s/%i/full/%s", image_dir, file->last_change, file->filename);
|
||||
string_or_die(&fullto, "%s/%s/%i_to_%i/staged/%s", packstage_dir,
|
||||
pack->module, pack->from, pack->to, file->hash);
|
||||
string_or_die(&from, "%s/%i/files/%s.tar", staging_dir, file->last_change, file->hash);
|
||||
string_or_die(&to, "%s/%s/%i_to_%i/staged/%s.tar", packstage_dir,
|
||||
pack->module, pack->from, pack->to, file->hash);
|
||||
ret = link(from, to);
|
||||
if (ret) {
|
||||
if (errno != EEXIST) {
|
||||
LOG(NULL, "Failure to link", "%s to %s (%s) %i", from, to, strerror(errno), errno);
|
||||
|
||||
ret = -1;
|
||||
errno = 0;
|
||||
|
||||
/* Prefer to hardlink uncompressed files (excluding
|
||||
* directories) first, and fall back to the compressed
|
||||
* versions if the hardlink fails.
|
||||
*/
|
||||
if (!file->is_dir) {
|
||||
ret = link(fullfrom, fullto);
|
||||
if (ret && errno != EEXIST) {
|
||||
LOG(NULL, "Failure to link for fullfile pack", "%s to %s (%s) %i", fullfrom, fullto, strerror(errno), errno);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
if (ret) {
|
||||
ret = link(from, to);
|
||||
if (ret && errno != EEXIST) {
|
||||
LOG(NULL, "Failure to link for fullfile pack", "%s to %s (%s) %i", from, to, strerror(errno), errno);
|
||||
}
|
||||
}
|
||||
|
||||
if (ret == 0) {
|
||||
pack->fullcount++;
|
||||
}
|
||||
|
||||
free(from);
|
||||
free(to);
|
||||
free(fullfrom);
|
||||
free(fullto);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -321,7 +344,7 @@ static int make_final_pack(struct packdata *pack)
|
||||
item = g_list_first(pack->end_manifest->files);
|
||||
|
||||
while (item) {
|
||||
char *from, *to, *tarfrom, *tarto;
|
||||
char *from, *to, *tarfrom, *tarto, *fullfrom, *fullto;
|
||||
struct stat stat_delta, stat_tar;
|
||||
|
||||
file = item->data;
|
||||
@@ -344,6 +367,9 @@ static int make_final_pack(struct packdata *pack)
|
||||
file->last_change, file->hash);
|
||||
string_or_die(&tarto, "%s/%s/%i_to_%i/staged/%s.tar", packstage_dir,
|
||||
pack->module, pack->from, pack->to, file->hash);
|
||||
string_or_die(&fullfrom, "%s/%i/full/%s", image_dir, file->last_change, file->filename);
|
||||
string_or_die(&fullto, "%s/%s/%i_to_%i/staged/%s", packstage_dir,
|
||||
pack->module, pack->from, pack->to, file->hash);
|
||||
|
||||
ret = stat(from, &stat_delta);
|
||||
if (ret) {
|
||||
@@ -375,13 +401,28 @@ static int make_final_pack(struct packdata *pack)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* include full file in pack */
|
||||
ret = link(tarfrom, tarto);
|
||||
if (ret) {
|
||||
if (errno != EEXIST) {
|
||||
LOG(NULL, "Failure to link", "%s to %s (%s) %i\n", tarfrom, tarto, strerror(errno), errno);
|
||||
ret = -1;
|
||||
errno = 0;
|
||||
|
||||
/* Prefer to hardlink uncompressed files (excluding
|
||||
* directories) first, and fall back to the compressed
|
||||
* versions if the hardlink fails.
|
||||
*/
|
||||
if (!file->is_dir) {
|
||||
ret = link(fullfrom, fullto);
|
||||
if (ret && errno != EEXIST) {
|
||||
LOG(NULL, "Failure to link for final pack", "%s to %s (%s) %i\n", fullfrom, fullto, strerror(errno), errno);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
|
||||
if (ret) {
|
||||
ret = link(tarfrom, tarto);
|
||||
if (ret && errno != EEXIST) {
|
||||
LOG(NULL, "Failure to link for final pack", "%s to %s (%s) %i\n", tarfrom, tarto, strerror(errno), errno);
|
||||
}
|
||||
}
|
||||
|
||||
if (ret == 0) {
|
||||
pack->fullcount++;
|
||||
}
|
||||
}
|
||||
@@ -390,6 +431,8 @@ static int make_final_pack(struct packdata *pack)
|
||||
free(to);
|
||||
free(tarfrom);
|
||||
free(tarto);
|
||||
free(fullfrom);
|
||||
free(fullto);
|
||||
}
|
||||
|
||||
if (pack->fullcount > 0) {
|
||||
|
||||
Reference in New Issue
Block a user