Re: error when compiling libguestfs on Ubuntu 9.04
by Richard W.M. Jones
On Sat, Jul 25, 2009 at 01:28:29AM +0900, Jun Koi wrote:
> hi Richard,
>
> i am trying libguestfs 1.0.64, and have below errors at "make" step:
>
> make[2]: Entering directory
> `/home/quynh/projects/libguestfs/libguestfs-1.0.64/appliance'
> mv initramfs.fedora-11.i686.img initramfs.fedora-11.i686.img.bak
> mv: cannot stat `initramfs.fedora-11.i686.img': No such file or directory
> make[2]: [../initramfs/fakeroot.log] Error 1 (ignored)
> mv vmlinuz.fedora-11.i686 vmlinuz.fedora-11.i686.bak
> mv: cannot stat `vmlinuz.fedora-11.i686': No such file or directory
> make[2]: [../initramfs/fakeroot.log] Error 1 (ignored)
> if ! bash make.sh; then rm -f ../initramfs/fakeroot.log; exit 1; fi
> + '[' DEBIAN = REDHAT ']'
> + '[' DEBIAN = DEBIAN ']'
> + cd ../appliance
> + debirf make -n debian
> Loading profile 'debian'...
> Cannot read keyring '/usr/share/keyrings/debian-archive-keyring.gpg'
> for debootstrap verification.
> make[2]: *** [../initramfs/fakeroot.log] Error 1
> make[2]: Leaving directory
> `/home/quynh/projects/libguestfs/libguestfs-1.0.64/appliance'
> make[1]: *** [all-recursive] Error 1
> make[1]: Leaving directory `/home/quynh/projects/libguestfs/libguestfs-1.0.64'
> make: *** [all] Error 2
>
>
> It is on Ubuntu 9.04.
>
> How can I fix this problem?
By asking Guido :-)
It looks like it needs a few small fixes to paths for Ubuntu.
Rich.
--
Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones
Read my programming blog: http://rwmj.wordpress.com
Fedora now supports 75 OCaml packages (the OPEN alternative to F#)
http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora
15 years, 4 months
[PATCH] Make read-only optional in mount_operating_system()
by Matthew Booth
---
perl/lib/Sys/Guestfs/Lib.pm | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/perl/lib/Sys/Guestfs/Lib.pm b/perl/lib/Sys/Guestfs/Lib.pm
index 5d48ba8..00a9bdb 100644
--- a/perl/lib/Sys/Guestfs/Lib.pm
+++ b/perl/lib/Sys/Guestfs/Lib.pm
@@ -1067,14 +1067,22 @@ sub mount_operating_system
local $_;
my $g = shift;
my $os = shift;
+ my $ro = shift; # Read-only?
+
+ $ro = 1 unless(defined($ro)); # ro defaults to 1 if unspecified
my $mounts = $os->{mounts};
# Have to mount / first. Luckily '/' is early in the ASCII
# character set, so this should be OK.
foreach (sort keys %$mounts) {
- $g->mount_ro ($mounts->{$_}, $_)
- if $_ ne "swap" && $_ ne "none" && ($_ eq '/' || $g->is_dir ($_));
+ if($_ ne "swap" && $_ ne "none" && ($_ eq '/' || $g->is_dir ($_))) {
+ if($ro) {
+ $g->mount_ro ($mounts->{$_}, $_)
+ } else {
+ $g->mount ($mounts->{$_}, $_)
+ }
+ }
}
}
--
1.6.2.5
15 years, 4 months
[PATCH] Split $os->{version} into $os->{major_version} and $os->{minor_version}
by Matthew Booth
---
inspector/virt-inspector.pl | 7 ++++-
perl/lib/Sys/Guestfs/Lib.pm | 50 +++++++++++++++++++++++++++++++------------
2 files changed, 41 insertions(+), 16 deletions(-)
diff --git a/inspector/virt-inspector.pl b/inspector/virt-inspector.pl
index 09edbae..9148a48 100755
--- a/inspector/virt-inspector.pl
+++ b/inspector/virt-inspector.pl
@@ -357,7 +357,9 @@ sub output_text_os
print $os->{os}, " " if exists $os->{os};
print $os->{distro}, " " if exists $os->{distro};
- print $os->{version}, " " if exists $os->{version};
+ print $os->{major_version} if exists $os->{major_version};
+ print ".", $os->{minor_version} if exists $os->{minor_version};
+ print " ";
print "on ", $os->{root_device}, ":\n";
print __" Mountpoints:\n";
@@ -448,7 +450,8 @@ sub output_xml_os
foreach ( [ "name" => "os" ],
[ "distro" => "distro" ],
- [ "version" => "version" ],
+ [ "major_version" => "major_version" ],
+ [ "minor_version" => "minor_version" ],
[ "package_format" => "package_format" ],
[ "package_management" => "package_management" ],
[ "root" => "root_device" ] ) {
diff --git a/perl/lib/Sys/Guestfs/Lib.pm b/perl/lib/Sys/Guestfs/Lib.pm
index a581def..5d48ba8 100644
--- a/perl/lib/Sys/Guestfs/Lib.pm
+++ b/perl/lib/Sys/Guestfs/Lib.pm
@@ -489,10 +489,15 @@ The package format used by the guest distribution. One of: "rpm", "dpkg".
The package management tool used by the guest distribution. One of: "rhn",
"yum", "apt".
-=item osversion
+=item os_major_version
(For root partitions only).
-Operating system version.
+Operating system major version number.
+
+=item os_minor_version
+
+(For root partitions only).
+Operating system minor version number.
=item fstab
@@ -619,13 +624,15 @@ sub _check_linux_root
my $r = shift;
# Look into /etc to see if we recognise the operating system.
- if ($g->is_file ("/etc/redhat-release")) {
+ # N.B. don't use $g->is_file here, because it might be a symlink
+ if ($g->exists ("/etc/redhat-release")) {
$r->{package_format} = "rpm";
$_ = $g->cat ("/etc/redhat-release");
- if (/Fedora release (\d+\.\d+)/) {
+ if (/Fedora release (\d+)(?:\.(\d+))?/) {
$r->{osdistro} = "fedora";
- $r->{osversion} = "$1";
+ $r->{os_major_version} = "$1";
+ $r->{os_minor_version} = "$2" if(defined($2));
$r->{package_management} = "yum";
}
@@ -650,16 +657,23 @@ sub _check_linux_root
else { die };
if (/$distro.*release (\d+).*Update (\d+)/) {
- $r->{osversion} = "$1.$2";
+ $r->{os_major_version} = "$1";
+ $r->{os_minor_version} = "$2";
}
- elsif (/$distro.*release (\d+(?:\.(?:\d+))?)/) {
- $r->{osversion} = "$1";
+ elsif (/$distro.*release (\d+)(?:\.(\d+))?/) {
+ $r->{os_major_version} = "$1";
+
+ if(defined($2)) {
+ $r->{os_minor_version} = "$2";
+ } else {
+ $r->{os_minor_version} = "0";
+ }
}
# Package management in RHEL changed in version 5
if ($r->{osdistro} eq "rhel") {
- if ($r->{osversion} >= 5) {
+ if ($r->{os_major_version} >= 5) {
$r->{package_management} = "yum";
} else {
$r->{package_management} = "rhn";
@@ -675,9 +689,10 @@ sub _check_linux_root
$r->{package_management} = "apt";
$_ = $g->cat ("/etc/debian_version");
- if (/(\d+\.\d+)/) {
+ if (/(\d+)\.(\d+)/) {
$r->{osdistro} = "debian";
- $r->{osversion} = "$1";
+ $r->{os_major_version} = "$1";
+ $r->{os_minor_version} = "$2";
} else {
$r->{osdistro} = "debian";
}
@@ -866,9 +881,13 @@ Operating system type, eg. "linux", "windows".
Operating system distribution, eg. "debian".
-=item version
+=item major_version
+
+Operating system major version, eg. "4".
+
+=item minor_version
-Operating system version, eg. "4.0".
+Operating system minor version, eg "3".
=item root
@@ -934,7 +953,10 @@ sub _get_os_version
$r->{os} = $r->{root}->{fsos} if exists $r->{root}->{fsos};
$r->{distro} = $r->{root}->{osdistro} if exists $r->{root}->{osdistro};
- $r->{version} = $r->{root}->{osversion} if exists $r->{root}->{osversion};
+ $r->{major_version} = $r->{root}->{os_major_version}
+ if exists $r->{root}->{os_major_version};
+ $r->{minor_version} = $r->{root}->{os_minor_version}
+ if exists $r->{root}->{os_minor_version};
$r->{package_format} = $r->{root}->{package_format}
if exists $r->{root}->{package_format};
$r->{package_management} = $r->{root}->{package_management}
--
1.6.2.5
15 years, 4 months
[PATCH] Replace 'distrofamily' with feature tags
by Matthew Booth
It turns out that the distribution hierarchy is not as reliable concept as you
might think. This patch removes distrofamily again.
Instead of distrofamily, we will add feature tags. This patch adds 2 feature
tags for Linux distributions:
package_format (eg rpm/dpkg)
package_management (eg rhn/yum/apt)
This change is reflected in the output of virt-inspector
---
inspector/virt-inspector.pl | 4 ++--
perl/lib/Sys/Guestfs/Lib.pm | 39 ++++++++++++++++++++++++++++++---------
2 files changed, 32 insertions(+), 11 deletions(-)
diff --git a/inspector/virt-inspector.pl b/inspector/virt-inspector.pl
index 5f612e3..cd53bcb 100755
--- a/inspector/virt-inspector.pl
+++ b/inspector/virt-inspector.pl
@@ -353,7 +353,6 @@ sub output_text_os
print $os->{os}, " " if exists $os->{os};
print $os->{distro}, " " if exists $os->{distro};
print $os->{version}, " " if exists $os->{version};
- print "(".$os->{distrofamily}." family)", " " if exists $os->{distrofamily};
print "on ", $os->{root_device}, ":\n";
print __" Mountpoints:\n";
@@ -444,8 +443,9 @@ sub output_xml_os
foreach ( [ "name" => "os" ],
[ "distro" => "distro" ],
- [ "distrofamily" => "distrofamily" ],
[ "version" => "version" ],
+ [ "package_format" => "package_format" ],
+ [ "package_management" => "package_management" ],
[ "root" => "root_device" ] ) {
$xml->dataElement($_->[0], $os->{$_->[1]}) if exists $os->{$_->[1]};
}
diff --git a/perl/lib/Sys/Guestfs/Lib.pm b/perl/lib/Sys/Guestfs/Lib.pm
index df3bbe1..f084090 100644
--- a/perl/lib/Sys/Guestfs/Lib.pm
+++ b/perl/lib/Sys/Guestfs/Lib.pm
@@ -478,10 +478,16 @@ Filesystem content, if we could determine it. One of: "linux-grub",
Operating system distribution. One of: "fedora", "rhel", "centos",
"scientific", "debian".
-=item osdistrofamily
+=item package_format
(For Linux root partitions only)
-Operating system distribution family. One of: "redhat", "debian".
+The package format used by the guest distribution. One of: "rpm", "dpkg".
+
+=item package_management
+
+(For Linux root partitions only)
+The package management tool used by the guest distribution. One of: "rhn",
+"yum", "apt".
=item osversion
@@ -614,12 +620,13 @@ sub _check_linux_root
# Look into /etc to see if we recognise the operating system.
if ($g->is_file ("/etc/redhat-release")) {
- $r->{osdistrofamily} = "redhat";
+ $r->{package_format} = "rpm";
$_ = $g->cat ("/etc/redhat-release");
if (/Fedora release (\d+\.\d+)/) {
$r->{osdistro} = "fedora";
- $r->{osversion} = "$1"
+ $r->{osversion} = "$1";
+ $r->{package_management} = "yum";
}
elsif (/(Red Hat Enterprise Linux|CentOS|Scientific Linux)/) {
@@ -631,10 +638,12 @@ sub _check_linux_root
elsif($distro eq "CentOS") {
$r->{osdistro} = "centos";
+ $r->{package_management} = "yum";
}
elsif($distro eq "Scientific Linux") {
$r->{osdistro} = "scientific";
+ $r->{package_management} = "yum";
}
# Shouldn't be possible
@@ -647,13 +656,23 @@ sub _check_linux_root
elsif (/$distro.*release (\d+(?:\.(?:\d+))?)/) {
$r->{osversion} = "$1";
}
+
+ # Package management in RHEL changed in version 5
+ if ($r->{osdistro} eq "rhel") {
+ if ($r->{osversion} >= 5) {
+ $r->{package_management} = "yum";
+ } else {
+ $r->{package_management} = "rhn";
+ }
+ }
}
else {
$r->{osdistro} = "redhat-based";
}
} elsif ($g->is_file ("/etc/debian_version")) {
- $r->{osdistrofamily} = "debian";
+ $r->{package_format} = "dpkg";
+ $r->{package_management} = "apt";
$_ = $g->cat ("/etc/debian_version");
if (/(\d+\.\d+)/) {
@@ -915,9 +934,11 @@ sub _get_os_version
$r->{os} = $r->{root}->{fsos} if exists $r->{root}->{fsos};
$r->{distro} = $r->{root}->{osdistro} if exists $r->{root}->{osdistro};
- $r->{distrofamily} = $r->{root}->{osdistrofamily}
- if exists $r->{root}->{osdistrofamily};
$r->{version} = $r->{root}->{osversion} if exists $r->{root}->{osversion};
+ $r->{package_format} = $r->{root}->{package_format}
+ if exists $r->{root}->{package_format};
+ $r->{package_management} = $r->{root}->{package_management}
+ if exists $r->{root}->{package_management};
}
sub _assign_mount_points
@@ -1097,8 +1118,8 @@ sub _check_for_applications
my $osn = $os->{os};
if ($osn eq "linux") {
- my $family = $os->{distrofamily};
- if (defined $family && $family eq "redhat") {
+ my $package_format = $os->{package_format};
+ if (defined $package_format && $package_format eq "rpm") {
my @lines = $g->command_lines
(["rpm",
"-q", "-a",
--
1.6.2.5
15 years, 4 months
[PATCH] Differentiate 'distro' and 'distrofamily' in Sys::Guestfs::Lib
by Matthew Booth
Change distro in the output formally known as virt-inspector to reflect the
actual distro. Possible values are now: fedora, rhel, centos, scientific,
debian.
Add new distrofamily entry which is one of: redhat, debian. Currently all
distros except 'debian' are in the redhat family.
This allows you to, for example, select a RHEL/CentOS/Scientific Linux specific
kernel for installation rather than assuming they're all the same.
---
perl/lib/Sys/Guestfs/Lib.pm | 58 ++++++++++++++++++++++++++++++++++---------
1 files changed, 46 insertions(+), 12 deletions(-)
diff --git a/perl/lib/Sys/Guestfs/Lib.pm b/perl/lib/Sys/Guestfs/Lib.pm
index 925c494..df3bbe1 100644
--- a/perl/lib/Sys/Guestfs/Lib.pm
+++ b/perl/lib/Sys/Guestfs/Lib.pm
@@ -475,8 +475,13 @@ Filesystem content, if we could determine it. One of: "linux-grub",
=item osdistro
(For Linux root partitions only).
-Operating system distribution. One of: "fedora", "redhat",
-"debian".
+Operating system distribution. One of: "fedora", "rhel", "centos",
+"scientific", "debian".
+
+=item osdistrofamily
+
+(For Linux root partitions only)
+Operating system distribution family. One of: "redhat", "debian".
=item osversion
@@ -609,20 +614,47 @@ sub _check_linux_root
# Look into /etc to see if we recognise the operating system.
if ($g->is_file ("/etc/redhat-release")) {
+ $r->{osdistrofamily} = "redhat";
+
$_ = $g->cat ("/etc/redhat-release");
if (/Fedora release (\d+\.\d+)/) {
$r->{osdistro} = "fedora";
$r->{osversion} = "$1"
- } elsif (/(Red Hat Enterprise Linux|CentOS|Scientific Linux).*release (\d+).*Update (\d+)/) {
- $r->{osdistro} = "redhat";
- $r->{osversion} = "$2.$3";
- } elsif (/(Red Hat Enterprise Linux|CentOS|Scientific Linux).*release (\d+(?:\.(\d+))?)/) {
- $r->{osdistro} = "redhat";
- $r->{osversion} = "$2";
- } else {
- $r->{osdistro} = "redhat";
+ }
+
+ elsif (/(Red Hat Enterprise Linux|CentOS|Scientific Linux)/) {
+ my $distro = $1;
+
+ if($distro eq "Red Hat Enterprise Linux") {
+ $r->{osdistro} = "rhel";
+ }
+
+ elsif($distro eq "CentOS") {
+ $r->{osdistro} = "centos";
+ }
+
+ elsif($distro eq "Scientific Linux") {
+ $r->{osdistro} = "scientific";
+ }
+
+ # Shouldn't be possible
+ else { die };
+
+ if (/$distro.*release (\d+).*Update (\d+)/) {
+ $r->{osversion} = "$1.$2";
+ }
+
+ elsif (/$distro.*release (\d+(?:\.(?:\d+))?)/) {
+ $r->{osversion} = "$1";
+ }
+ }
+
+ else {
+ $r->{osdistro} = "redhat-based";
}
} elsif ($g->is_file ("/etc/debian_version")) {
+ $r->{osdistrofamily} = "debian";
+
$_ = $g->cat ("/etc/debian_version");
if (/(\d+\.\d+)/) {
$r->{osdistro} = "debian";
@@ -883,6 +915,8 @@ sub _get_os_version
$r->{os} = $r->{root}->{fsos} if exists $r->{root}->{fsos};
$r->{distro} = $r->{root}->{osdistro} if exists $r->{root}->{osdistro};
+ $r->{distrofamily} = $r->{root}->{osdistrofamily}
+ if exists $r->{root}->{osdistrofamily};
$r->{version} = $r->{root}->{osversion} if exists $r->{root}->{osversion};
}
@@ -1063,8 +1097,8 @@ sub _check_for_applications
my $osn = $os->{os};
if ($osn eq "linux") {
- my $distro = $os->{distro};
- if (defined $distro && ($distro eq "redhat" || $distro eq "fedora")) {
+ my $family = $os->{distrofamily};
+ if (defined $family && $family eq "redhat") {
my @lines = $g->command_lines
(["rpm",
"-q", "-a",
--
1.6.2.5
15 years, 4 months