mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-22 07:03:38 +00:00
builder: add a mandatory 'arch' key in index files
Introduce a mandatory arch= key in all the entries of index files, to identify which architecture is each. Adapt the long and JSON list outputs to print also this new field. This introduces an incompatibility with index files created with virt-builder < 1.26, as they will be rejected until entries will have the arch= key added (which is ignored by older virt-builder, so adding it will not create backward-compatibility issues).
This commit is contained in:
@@ -27,6 +27,7 @@ and entry = {
|
|||||||
printable_name : string option; (* the name= field *)
|
printable_name : string option; (* the name= field *)
|
||||||
osinfo : string option;
|
osinfo : string option;
|
||||||
file_uri : string;
|
file_uri : string;
|
||||||
|
arch : string;
|
||||||
signature_uri : string option; (* deprecated, will be removed in 1.26 *)
|
signature_uri : string option; (* deprecated, will be removed in 1.26 *)
|
||||||
checksum_sha512 : string option;
|
checksum_sha512 : string option;
|
||||||
revision : int;
|
revision : int;
|
||||||
@@ -43,6 +44,7 @@ and entry = {
|
|||||||
|
|
||||||
let print_entry chan (name, { printable_name = printable_name;
|
let print_entry chan (name, { printable_name = printable_name;
|
||||||
file_uri = file_uri;
|
file_uri = file_uri;
|
||||||
|
arch = arch;
|
||||||
osinfo = osinfo;
|
osinfo = osinfo;
|
||||||
signature_uri = signature_uri;
|
signature_uri = signature_uri;
|
||||||
checksum_sha512 = checksum_sha512;
|
checksum_sha512 = checksum_sha512;
|
||||||
@@ -65,6 +67,7 @@ let print_entry chan (name, { printable_name = printable_name;
|
|||||||
| Some id -> fp "osinfo=%s\n" id
|
| Some id -> fp "osinfo=%s\n" id
|
||||||
);
|
);
|
||||||
fp "file=%s\n" file_uri;
|
fp "file=%s\n" file_uri;
|
||||||
|
fp "arch=%s\n" arch;
|
||||||
(match signature_uri with
|
(match signature_uri with
|
||||||
| None -> ()
|
| None -> ()
|
||||||
| Some uri -> fp "sig=%s\n" uri
|
| Some uri -> fp "sig=%s\n" uri
|
||||||
@@ -179,6 +182,11 @@ let get_index ~prog ~debug ~downloader ~sigchecker source =
|
|||||||
with Not_found ->
|
with Not_found ->
|
||||||
eprintf (f_"virt-builder: no 'file' (URI) entry for '%s'\n") n;
|
eprintf (f_"virt-builder: no 'file' (URI) entry for '%s'\n") n;
|
||||||
corrupt_file () in
|
corrupt_file () in
|
||||||
|
let arch =
|
||||||
|
try List.assoc ("arch", None) fields
|
||||||
|
with Not_found ->
|
||||||
|
eprintf (f_"virt-builder: no 'arch' entry for '%s'\n") n;
|
||||||
|
corrupt_file () in
|
||||||
let signature_uri =
|
let signature_uri =
|
||||||
try Some (make_absolute_uri (List.assoc ("sig", None) fields))
|
try Some (make_absolute_uri (List.assoc ("sig", None) fields))
|
||||||
with Not_found -> None in
|
with Not_found -> None in
|
||||||
@@ -245,6 +253,7 @@ let get_index ~prog ~debug ~downloader ~sigchecker source =
|
|||||||
let entry = { printable_name = printable_name;
|
let entry = { printable_name = printable_name;
|
||||||
osinfo = osinfo;
|
osinfo = osinfo;
|
||||||
file_uri = file_uri;
|
file_uri = file_uri;
|
||||||
|
arch = arch;
|
||||||
signature_uri = signature_uri;
|
signature_uri = signature_uri;
|
||||||
checksum_sha512 = checksum_sha512;
|
checksum_sha512 = checksum_sha512;
|
||||||
revision = revision;
|
revision = revision;
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ and entry = {
|
|||||||
printable_name : string option; (* the name= field *)
|
printable_name : string option; (* the name= field *)
|
||||||
osinfo : string option;
|
osinfo : string option;
|
||||||
file_uri : string;
|
file_uri : string;
|
||||||
|
arch : string;
|
||||||
signature_uri : string option; (* deprecated, will be removed in 1.26 *)
|
signature_uri : string option; (* deprecated, will be removed in 1.26 *)
|
||||||
checksum_sha512 : string option;
|
checksum_sha512 : string option;
|
||||||
revision : int;
|
revision : int;
|
||||||
|
|||||||
@@ -73,6 +73,7 @@ and list_entries_long ~sources index =
|
|||||||
|
|
||||||
List.iter (
|
List.iter (
|
||||||
fun (name, { Index_parser.printable_name = printable_name;
|
fun (name, { Index_parser.printable_name = printable_name;
|
||||||
|
arch = arch;
|
||||||
size = size;
|
size = size;
|
||||||
compressed_size = compressed_size;
|
compressed_size = compressed_size;
|
||||||
notes = notes;
|
notes = notes;
|
||||||
@@ -83,6 +84,7 @@ and list_entries_long ~sources index =
|
|||||||
| None -> ()
|
| None -> ()
|
||||||
| Some name -> printf "%-24s %s\n" (s_"Full name:") name;
|
| Some name -> printf "%-24s %s\n" (s_"Full name:") name;
|
||||||
);
|
);
|
||||||
|
printf "%-24s %s\n" (s_"Architecture:") arch;
|
||||||
printf "%-24s %s\n" (s_"Minimum/default size:") (human_size size);
|
printf "%-24s %s\n" (s_"Minimum/default size:") (human_size size);
|
||||||
(match compressed_size with
|
(match compressed_size with
|
||||||
| None -> ()
|
| None -> ()
|
||||||
@@ -168,6 +170,7 @@ and list_entries_json ~sources index =
|
|||||||
printf " \"templates\": [\n";
|
printf " \"templates\": [\n";
|
||||||
iteri (
|
iteri (
|
||||||
fun i (name, { Index_parser.printable_name = printable_name;
|
fun i (name, { Index_parser.printable_name = printable_name;
|
||||||
|
arch = arch;
|
||||||
size = size;
|
size = size;
|
||||||
compressed_size = compressed_size;
|
compressed_size = compressed_size;
|
||||||
notes = notes;
|
notes = notes;
|
||||||
@@ -175,6 +178,7 @@ and list_entries_json ~sources index =
|
|||||||
printf " {\n";
|
printf " {\n";
|
||||||
printf " \"os-version\": \"%s\",\n" name;
|
printf " \"os-version\": \"%s\",\n" name;
|
||||||
json_optional_printf_string "full-name" printable_name;
|
json_optional_printf_string "full-name" printable_name;
|
||||||
|
printf " \"arch\": \"%s\",\n" arch;
|
||||||
printf " \"size\": %Ld,\n" size;
|
printf " \"size\": %Ld,\n" size;
|
||||||
json_optional_printf_int64 "compressed-size" compressed_size;
|
json_optional_printf_int64 "compressed-size" compressed_size;
|
||||||
print_notes notes;
|
print_notes notes;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
[phony-debian]
|
[phony-debian]
|
||||||
name=Phony Debian
|
name=Phony Debian
|
||||||
|
arch=x86_64
|
||||||
file=debian.xz
|
file=debian.xz
|
||||||
format=raw
|
format=raw
|
||||||
size=536870912
|
size=536870912
|
||||||
@@ -9,6 +10,7 @@ notes=Phony Debian look-alike used for testing.
|
|||||||
|
|
||||||
[phony-fedora]
|
[phony-fedora]
|
||||||
name=Phony Fedora
|
name=Phony Fedora
|
||||||
|
arch=x86_64
|
||||||
file=fedora.xz
|
file=fedora.xz
|
||||||
format=raw
|
format=raw
|
||||||
size=1073741824
|
size=1073741824
|
||||||
@@ -18,6 +20,7 @@ notes=Phony Fedora look-alike used for testing.
|
|||||||
|
|
||||||
[phony-fedora-qcow2]
|
[phony-fedora-qcow2]
|
||||||
name=Phony Fedora qcow2
|
name=Phony Fedora qcow2
|
||||||
|
arch=x86_64
|
||||||
file=fedora.qcow2.xz
|
file=fedora.qcow2.xz
|
||||||
format=qcow2
|
format=qcow2
|
||||||
size=1073741824
|
size=1073741824
|
||||||
@@ -27,6 +30,7 @@ notes=Phony Fedora look-alike used for testing.
|
|||||||
|
|
||||||
[phony-fedora-qcow2-uncompressed]
|
[phony-fedora-qcow2-uncompressed]
|
||||||
name=Phony Fedora qcow2 uncompressed
|
name=Phony Fedora qcow2 uncompressed
|
||||||
|
arch=x86_64
|
||||||
file=fedora.qcow2
|
file=fedora.qcow2
|
||||||
format=qcow2
|
format=qcow2
|
||||||
size=1073741824
|
size=1073741824
|
||||||
@@ -36,6 +40,7 @@ notes=Phony Fedora look-alike used for testing.
|
|||||||
|
|
||||||
[phony-fedora-no-format]
|
[phony-fedora-no-format]
|
||||||
name=Phony Fedora
|
name=Phony Fedora
|
||||||
|
arch=x86_64
|
||||||
file=fedora.qcow2.xz
|
file=fedora.qcow2.xz
|
||||||
size=1073741824
|
size=1073741824
|
||||||
expand=/dev/sda2
|
expand=/dev/sda2
|
||||||
@@ -44,6 +49,7 @@ notes=Phony Fedora look-alike used for testing.
|
|||||||
|
|
||||||
[phony-ubuntu]
|
[phony-ubuntu]
|
||||||
name=Phony Ubuntu
|
name=Phony Ubuntu
|
||||||
|
arch=x86_64
|
||||||
file=ubuntu.xz
|
file=ubuntu.xz
|
||||||
format=raw
|
format=raw
|
||||||
size=536870912
|
size=536870912
|
||||||
@@ -52,6 +58,7 @@ notes=Phony Ubuntu look-alike used for testing.
|
|||||||
|
|
||||||
[phony-windows]
|
[phony-windows]
|
||||||
name=Phony Windows
|
name=Phony Windows
|
||||||
|
arch=x86_64
|
||||||
file=windows.xz
|
file=windows.xz
|
||||||
format=raw
|
format=raw
|
||||||
size=536870912
|
size=536870912
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ Fingerprint: F777 4FB1 AD07 4A7E 8C87 67EA 9173 8F73 E1B7 68A0
|
|||||||
|
|
||||||
os-version: phony-debian
|
os-version: phony-debian
|
||||||
Full name: Phony Debian
|
Full name: Phony Debian
|
||||||
|
Architecture: x86_64
|
||||||
Minimum/default size: 512.0M
|
Minimum/default size: 512.0M
|
||||||
|
|
||||||
Notes:
|
Notes:
|
||||||
@@ -54,6 +55,7 @@ Phony Debian look-alike used for testing.
|
|||||||
|
|
||||||
os-version: phony-fedora
|
os-version: phony-fedora
|
||||||
Full name: Phony Fedora
|
Full name: Phony Fedora
|
||||||
|
Architecture: x86_64
|
||||||
Minimum/default size: 1.0G
|
Minimum/default size: 1.0G
|
||||||
|
|
||||||
Notes:
|
Notes:
|
||||||
@@ -62,6 +64,7 @@ Phony Fedora look-alike used for testing.
|
|||||||
|
|
||||||
os-version: phony-fedora-qcow2
|
os-version: phony-fedora-qcow2
|
||||||
Full name: Phony Fedora qcow2
|
Full name: Phony Fedora qcow2
|
||||||
|
Architecture: x86_64
|
||||||
Minimum/default size: 1.0G
|
Minimum/default size: 1.0G
|
||||||
|
|
||||||
Notes:
|
Notes:
|
||||||
@@ -70,6 +73,7 @@ Phony Fedora look-alike used for testing.
|
|||||||
|
|
||||||
os-version: phony-fedora-qcow2-uncompressed
|
os-version: phony-fedora-qcow2-uncompressed
|
||||||
Full name: Phony Fedora qcow2 uncompressed
|
Full name: Phony Fedora qcow2 uncompressed
|
||||||
|
Architecture: x86_64
|
||||||
Minimum/default size: 1.0G
|
Minimum/default size: 1.0G
|
||||||
|
|
||||||
Notes:
|
Notes:
|
||||||
@@ -78,6 +82,7 @@ Phony Fedora look-alike used for testing.
|
|||||||
|
|
||||||
os-version: phony-fedora-no-format
|
os-version: phony-fedora-no-format
|
||||||
Full name: Phony Fedora
|
Full name: Phony Fedora
|
||||||
|
Architecture: x86_64
|
||||||
Minimum/default size: 1.0G
|
Minimum/default size: 1.0G
|
||||||
|
|
||||||
Notes:
|
Notes:
|
||||||
@@ -86,6 +91,7 @@ Phony Fedora look-alike used for testing.
|
|||||||
|
|
||||||
os-version: phony-ubuntu
|
os-version: phony-ubuntu
|
||||||
Full name: Phony Ubuntu
|
Full name: Phony Ubuntu
|
||||||
|
Architecture: x86_64
|
||||||
Minimum/default size: 512.0M
|
Minimum/default size: 512.0M
|
||||||
|
|
||||||
Notes:
|
Notes:
|
||||||
@@ -94,6 +100,7 @@ Phony Ubuntu look-alike used for testing.
|
|||||||
|
|
||||||
os-version: phony-windows
|
os-version: phony-windows
|
||||||
Full name: Phony Windows
|
Full name: Phony Windows
|
||||||
|
Architecture: x86_64
|
||||||
Minimum/default size: 512.0M
|
Minimum/default size: 512.0M
|
||||||
|
|
||||||
Notes:
|
Notes:
|
||||||
@@ -118,6 +125,7 @@ if [ "$json_list" != "{
|
|||||||
{
|
{
|
||||||
\"os-version\": \"phony-debian\",
|
\"os-version\": \"phony-debian\",
|
||||||
\"full-name\": \"Phony Debian\",
|
\"full-name\": \"Phony Debian\",
|
||||||
|
\"arch\": \"x86_64\",
|
||||||
\"size\": 536870912,
|
\"size\": 536870912,
|
||||||
\"notes\": {
|
\"notes\": {
|
||||||
\"C\": \"Phony Debian look-alike used for testing.\"
|
\"C\": \"Phony Debian look-alike used for testing.\"
|
||||||
@@ -127,6 +135,7 @@ if [ "$json_list" != "{
|
|||||||
{
|
{
|
||||||
\"os-version\": \"phony-fedora\",
|
\"os-version\": \"phony-fedora\",
|
||||||
\"full-name\": \"Phony Fedora\",
|
\"full-name\": \"Phony Fedora\",
|
||||||
|
\"arch\": \"x86_64\",
|
||||||
\"size\": 1073741824,
|
\"size\": 1073741824,
|
||||||
\"notes\": {
|
\"notes\": {
|
||||||
\"C\": \"Phony Fedora look-alike used for testing.\"
|
\"C\": \"Phony Fedora look-alike used for testing.\"
|
||||||
@@ -136,6 +145,7 @@ if [ "$json_list" != "{
|
|||||||
{
|
{
|
||||||
\"os-version\": \"phony-fedora-qcow2\",
|
\"os-version\": \"phony-fedora-qcow2\",
|
||||||
\"full-name\": \"Phony Fedora qcow2\",
|
\"full-name\": \"Phony Fedora qcow2\",
|
||||||
|
\"arch\": \"x86_64\",
|
||||||
\"size\": 1073741824,
|
\"size\": 1073741824,
|
||||||
\"notes\": {
|
\"notes\": {
|
||||||
\"C\": \"Phony Fedora look-alike used for testing.\"
|
\"C\": \"Phony Fedora look-alike used for testing.\"
|
||||||
@@ -145,6 +155,7 @@ if [ "$json_list" != "{
|
|||||||
{
|
{
|
||||||
\"os-version\": \"phony-fedora-qcow2-uncompressed\",
|
\"os-version\": \"phony-fedora-qcow2-uncompressed\",
|
||||||
\"full-name\": \"Phony Fedora qcow2 uncompressed\",
|
\"full-name\": \"Phony Fedora qcow2 uncompressed\",
|
||||||
|
\"arch\": \"x86_64\",
|
||||||
\"size\": 1073741824,
|
\"size\": 1073741824,
|
||||||
\"notes\": {
|
\"notes\": {
|
||||||
\"C\": \"Phony Fedora look-alike used for testing.\"
|
\"C\": \"Phony Fedora look-alike used for testing.\"
|
||||||
@@ -154,6 +165,7 @@ if [ "$json_list" != "{
|
|||||||
{
|
{
|
||||||
\"os-version\": \"phony-fedora-no-format\",
|
\"os-version\": \"phony-fedora-no-format\",
|
||||||
\"full-name\": \"Phony Fedora\",
|
\"full-name\": \"Phony Fedora\",
|
||||||
|
\"arch\": \"x86_64\",
|
||||||
\"size\": 1073741824,
|
\"size\": 1073741824,
|
||||||
\"notes\": {
|
\"notes\": {
|
||||||
\"C\": \"Phony Fedora look-alike used for testing.\"
|
\"C\": \"Phony Fedora look-alike used for testing.\"
|
||||||
@@ -163,6 +175,7 @@ if [ "$json_list" != "{
|
|||||||
{
|
{
|
||||||
\"os-version\": \"phony-ubuntu\",
|
\"os-version\": \"phony-ubuntu\",
|
||||||
\"full-name\": \"Phony Ubuntu\",
|
\"full-name\": \"Phony Ubuntu\",
|
||||||
|
\"arch\": \"x86_64\",
|
||||||
\"size\": 536870912,
|
\"size\": 536870912,
|
||||||
\"notes\": {
|
\"notes\": {
|
||||||
\"C\": \"Phony Ubuntu look-alike used for testing.\"
|
\"C\": \"Phony Ubuntu look-alike used for testing.\"
|
||||||
@@ -172,6 +185,7 @@ if [ "$json_list" != "{
|
|||||||
{
|
{
|
||||||
\"os-version\": \"phony-windows\",
|
\"os-version\": \"phony-windows\",
|
||||||
\"full-name\": \"Phony Windows\",
|
\"full-name\": \"Phony Windows\",
|
||||||
|
\"arch\": \"x86_64\",
|
||||||
\"size\": 536870912,
|
\"size\": 536870912,
|
||||||
\"notes\": {
|
\"notes\": {
|
||||||
\"C\": \"Phony Windows look-alike used for testing.\"
|
\"C\": \"Phony Windows look-alike used for testing.\"
|
||||||
|
|||||||
Reference in New Issue
Block a user