mirror of
https://github.com/clearlinux/swupd-server.git
synced 2026-10-04 07:58:32 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8ac1869adf | ||
|
|
fde00265e2 | ||
|
|
25d3ef658d | ||
|
|
3cf2ade205 | ||
|
|
e814a73480 | ||
|
|
9d3a813859 | ||
|
|
5aa1bf9188 |
@@ -1,3 +1,12 @@
|
||||
With the release of mixer-tools v4.3.0 [1] the swupd-server project is
|
||||
deprecated. All functionality has been re-written into the mixer tool under
|
||||
the `mixer build update` command. All development done around creating update
|
||||
content consumed by swupd-client is now done in that project.
|
||||
|
||||
[1] https://github.com/clearlinux/mixer-tools
|
||||
|
||||
---
|
||||
|
||||
The swupd-server package provides a reference implementation of a software
|
||||
update server-side component that generates update content consumable by a
|
||||
software update client (swupd-client). Such content includes manifests that
|
||||
|
||||
+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.7.3, matthew.johnson@intel.com)
|
||||
AC_INIT(swupd-server, 3.7.5, matthew.johnson@intel.com)
|
||||
AM_INIT_AUTOMAKE([foreign -Wall -W subdir-objects])
|
||||
AM_SILENT_RULES([yes])
|
||||
AC_PROG_CC
|
||||
|
||||
+8
-1
@@ -45,6 +45,7 @@ static void runtime_state_heuristics(struct file *file)
|
||||
/* these are shipped directories that are not themselves state,
|
||||
* rather only their contents are state */
|
||||
if ((strcmp(file->filename, "/usr/src/debug") == 0) ||
|
||||
(strcmp(file->filename, "/usr/src/kernel") == 0) ||
|
||||
(strcmp(file->filename, "/dev") == 0) ||
|
||||
(strcmp(file->filename, "/home") == 0) ||
|
||||
(strcmp(file->filename, "/proc") == 0) ||
|
||||
@@ -56,6 +57,12 @@ static void runtime_state_heuristics(struct file *file)
|
||||
return;
|
||||
}
|
||||
|
||||
/* the contents of these directory are not state,
|
||||
* but it belongs to a state directory */
|
||||
if ((strncmp(file->filename, "/usr/src/kernel/", 16) == 0)) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* the contents of these directory are state, ideally this never
|
||||
* triggers if our package builds are clean */
|
||||
if ((strncmp(file->filename, "/dev/", 5) == 0) ||
|
||||
@@ -72,7 +79,7 @@ static void runtime_state_heuristics(struct file *file)
|
||||
return;
|
||||
}
|
||||
|
||||
/* these are commonly added directories for user customizatio,
|
||||
/* these are commonly added directories for user customization,
|
||||
* ideally this never triggers if our package builds are clean */
|
||||
if ((strncmp(file->filename, "/acct", 5) == 0) ||
|
||||
(strncmp(file->filename, "/cache", 6) == 0) ||
|
||||
|
||||
+9
-5
@@ -1037,12 +1037,16 @@ void clean_renames(struct manifest *manifest)
|
||||
list = g_list_first(manifest->files);
|
||||
while (list) {
|
||||
file = list->data;
|
||||
/* if the file is marked as deleted and renamed it is a
|
||||
* renamed-from file. If the rename_peer field is still NULL
|
||||
* then it has been orphaned. Mark these as deleted */
|
||||
if (file->is_deleted && file->is_rename && !file->rename_peer) {
|
||||
hash_set_zeros(file->hash);
|
||||
/* if a file is marked as a rename but has lost its rename_peer
|
||||
* it needs to be cleaned up */
|
||||
if (file->is_rename && !file->rename_peer) {
|
||||
/* no longer a rename */
|
||||
file->is_rename = 0;
|
||||
/* if the file is marked as deleted and renamed it is a
|
||||
* renamed-from file. Mark these as deleted now */
|
||||
if (file->is_deleted) {
|
||||
hash_set_zeros(file->hash);
|
||||
}
|
||||
}
|
||||
|
||||
list = g_list_next(list);
|
||||
|
||||
@@ -34,15 +34,19 @@ setup() {
|
||||
# /usr/lib/bar and /one will be renamed to /usr/lib/baz and /two
|
||||
gen_file_plain_with_content 10 test-bundle /usr/lib/bar "$(seq 100)"
|
||||
gen_file_plain_with_content 10 test-bundle /one "$(printf 'a%.0s' {1..200})"
|
||||
gen_file_plain_with_content 10 test-bundle /usr/lib/kernel/a "$(printf 'a%.0s' {1..210})"
|
||||
|
||||
gen_file_plain_with_content 20 test-bundle /usr/lib/baz "$(seq 100)"
|
||||
gen_file_plain_with_content 20 test-bundle /two "$(printf 'a%.0s' {1..200})"
|
||||
gen_file_plain_with_content 20 test-bundle /usr/lib/kernel/ab "$(printf 'a%.0s' {1..210})"
|
||||
|
||||
# different content just to make sure this works with delta renames as well as
|
||||
# direct renames
|
||||
gen_file_plain_with_content 30 test-bundle /usr/lib/foo "$(seq 100) new"
|
||||
gen_file_plain_with_content 30 test-bundle /usr/lib/kernel/abc "$(printf 'a%.0s' {1..210})"
|
||||
|
||||
gen_file_plain_with_content 40 test-bundle /usr/lib/foo "$(seq 100) new"
|
||||
gen_file_plain_with_content 40 test-bundle /usr/lib/kernel/abc "$(printf 'a%.0s' {1..210})"
|
||||
# new file to force manifest generation
|
||||
gen_file_plain_with_content 40 test-bundle /a "testfile"
|
||||
}
|
||||
@@ -68,11 +72,14 @@ setup() {
|
||||
# version 10: add files to 10
|
||||
[ 1 -eq $(grep $'F\.\.\.\t.*\t10\t/usr/lib/bar' $DIR/www/10/Manifest.test-bundle | wc -l) ]
|
||||
[ 1 -eq $(grep $'F\.\.\.\t.*\t10\t/one' $DIR/www/10/Manifest.test-bundle | wc -l) ]
|
||||
[ 1 -eq $(grep $'F\.b\.\t.*\t10\t/usr/lib/kernel/a' $DIR/www/10/Manifest.test-bundle | wc -l) ]
|
||||
# version 20: rename bar to baz and one to two
|
||||
[ 1 -eq $(grep $'\.d\.r\t.*\t20\t/one' $DIR/www/20/Manifest.test-bundle | wc -l) ]
|
||||
[ 1 -eq $(grep $'F\.\.r\t.*\t20\t/two' $DIR/www/20/Manifest.test-bundle | wc -l) ]
|
||||
[ 1 -eq $(grep $'\.d\.r\t.*\t20\t/usr/lib/bar' $DIR/www/20/Manifest.test-bundle | wc -l) ]
|
||||
[ 1 -eq $(grep $'F\.\.r\t.*\t20\t/usr/lib/baz' $DIR/www/20/Manifest.test-bundle | wc -l) ]
|
||||
[ 1 -eq $(grep $'\.gbr\t.*\t20\t/usr/lib/kernel/a' $DIR/www/20/Manifest.test-bundle | wc -l) ]
|
||||
[ 1 -eq $(grep $'F\.br\t.*\t20\t/usr/lib/kernel/ab' $DIR/www/20/Manifest.test-bundle | wc -l) ]
|
||||
# version 30: original renamed-from file (bar) is now orphaned and therefore
|
||||
# deleted, baz is now a renamed-from file and foo is a renamed-to file.
|
||||
# /two was deleted in this version, so both /one and /two should be marked as
|
||||
@@ -82,6 +89,8 @@ setup() {
|
||||
[ 1 -eq $(grep $'\.d\.\.\t0\{64\}\t20\t/usr/lib/bar' $DIR/www/30/Manifest.test-bundle | wc -l) ]
|
||||
[ 1 -eq $(grep $'\.d\.r\t.*\t30\t/usr/lib/baz' $DIR/www/30/Manifest.test-bundle | wc -l) ]
|
||||
[ 1 -eq $(grep $'F\.\.r\t.*\t30\t/usr/lib/foo' $DIR/www/30/Manifest.test-bundle | wc -l) ]
|
||||
[ 1 -eq $(grep $'\.gbr\t.*\t30\t/usr/lib/kernel/ab' $DIR/www/30/Manifest.test-bundle | wc -l) ]
|
||||
[ 1 -eq $(grep $'F\.br\t.*\t30\t/usr/lib/kernel/abc' $DIR/www/30/Manifest.test-bundle | wc -l) ]
|
||||
|
||||
# version 40: the existing rename from baz -> foo must persist while all
|
||||
# others remain deleted
|
||||
@@ -90,6 +99,7 @@ setup() {
|
||||
[ 1 -eq $(grep $'\.d\.\.\t0\{64\}\t20\t/usr/lib/bar' $DIR/www/40/Manifest.test-bundle | wc -l) ]
|
||||
[ 1 -eq $(grep $'\.d\.r\t.*\t30\t/usr/lib/baz' $DIR/www/40/Manifest.test-bundle | wc -l) ]
|
||||
[ 1 -eq $(grep $'F\.\.r\t.*\t30\t/usr/lib/foo' $DIR/www/40/Manifest.test-bundle | wc -l) ]
|
||||
[ 1 -eq $(grep $'F\.b\.\t.*\t30\t/usr/lib/kernel/abc' $DIR/www/40/Manifest.test-bundle | wc -l) ]
|
||||
}
|
||||
|
||||
# vi: ft=sh ts=8 sw=2 sts=2 et tw=80
|
||||
|
||||
@@ -47,7 +47,7 @@ gendataCs() {
|
||||
}
|
||||
|
||||
checkrenamed(){
|
||||
local flags sh1 ver name fromsha1="bad" tosha1
|
||||
local flags sha1 ver name fromsha1="bad" tosha1
|
||||
# Check that $1 is renamed to $2
|
||||
exec 9< $DIR/www/20/Manifest.test-bundle
|
||||
# skip the header
|
||||
@@ -58,11 +58,11 @@ checkrenamed(){
|
||||
while read -r -u9 flags sha1 ver name
|
||||
do
|
||||
case "$flags" in
|
||||
(?"dr"?) [ "$name" = "$1" ] && fromsha1=$sha1 ;;
|
||||
(?".r"?) [ "$name" = "$2" ] && tosha1=$sha1 ;;
|
||||
(?"d.r") [ "$name" = "$1" ] && fromsha1=$sha1 ;;
|
||||
(?"..r") [ "$name" = "$2" ] && tosha1=$sha1 ;;
|
||||
esac
|
||||
done
|
||||
if [ "$fromsh1" = "$tosha1" ] ; then return 0 ; else return 1 ; fi
|
||||
if [ "$fromsha1" = "$tosha1" ] ; then return 0 ; else return 1 ; fi
|
||||
}
|
||||
|
||||
# Guts of doing an update
|
||||
@@ -87,7 +87,7 @@ do_an_update() {
|
||||
gendataA 10 foo
|
||||
gendataA 20 bar
|
||||
do_an_update
|
||||
checkrenamed foo bar
|
||||
checkrenamed /foo /bar
|
||||
}
|
||||
|
||||
@test "ignore rename detection for small files" {
|
||||
@@ -142,8 +142,8 @@ do_an_update() {
|
||||
gendataA 20 bar
|
||||
gendataA 20 baz
|
||||
do_an_update
|
||||
checkrenamed foo bar
|
||||
checkrenamed foz baz
|
||||
checkrenamed /foo /bar
|
||||
checkrenamed /foz /baz
|
||||
}
|
||||
|
||||
@test "rename two files to two, one slightly different" {
|
||||
@@ -153,8 +153,8 @@ do_an_update() {
|
||||
gendataB 20 baz
|
||||
do_an_update
|
||||
# we don't actually know how the client we do this rename, but don't care
|
||||
checkrenamed foo bar
|
||||
checkrenamed foz baz
|
||||
checkrenamed /foo /bar
|
||||
checkrenamed /foz /baz
|
||||
}
|
||||
|
||||
@test "rename two files to two, each pair slightly different" {
|
||||
@@ -163,8 +163,8 @@ do_an_update() {
|
||||
gendataA 20 bar
|
||||
gendataB 20 baz
|
||||
do_an_update
|
||||
checkrenamed foo bar
|
||||
checkrenamed foz baz
|
||||
checkrenamed /foo /bar
|
||||
checkrenamed /foz /baz
|
||||
}
|
||||
|
||||
@test "rename two files to two, one very different" {
|
||||
@@ -183,9 +183,9 @@ do_an_update() {
|
||||
gendataA 20 bar
|
||||
gendataCs 20 baz
|
||||
do_an_update
|
||||
run checkrenamed foo bar
|
||||
run checkrenamed /foo /bar
|
||||
if [ $status -eq 1 ] ; then
|
||||
checkrenamed foz bar
|
||||
checkrenamed /foz /bar
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user