[Buildd-tools-devel] [Patch] sbuild fixup with filesystem union directory schroot + Bug#520755 fix
Jan-Marek Glogowski
glogow at fbihome.de
Thu Mar 26 21:31:52 UTC 2009
Hi
This is just the announced sbuild fix. The patch contains:
* Clarify sbuild-createchroot error message.
* Request non-localized schroot info for parsing.
* Extract new "Directory" key from schroot info and clarify path
priorities.
Regards,
Jan-Marek Glogowski
-------------- next part --------------
diff --git a/bin/Makefile.am b/bin/Makefile.am
index 37c8bda..33781a3 100644
--- a/bin/Makefile.am
+++ b/bin/Makefile.am
@@ -64,9 +64,9 @@ EXTRA_DIST = \
install-exec-hook:
# Links for compatibility.
- $(MKDIR_P) "$(DESTDIR)$(sbuildlibexecdir)"
- $(MKDIR_P) "$(DESTDIR)$(wblibexecdir)"
- $(MKDIR_P) "$(DESTDIR)$(localstatedir)/lib/wanna-build"
+ $(mkinstalldirs) "$(DESTDIR)$(sbuildlibexecdir)"
+ $(mkinstalldirs) "$(DESTDIR)$(wblibexecdir)"
+ $(mkinstalldirs) "$(DESTDIR)$(localstatedir)/lib/wanna-build"
ln -sf "$(bindir)/wanna-build-catdb" "$(DESTDIR)$(bindir)/wanna-build-catgdbm"
ln -sf "$(bindir)/wanna-build-catdb" "$(DESTDIR)$(bindir)/wanna-build-catmldbm"
diff --git a/bin/sbuild-createchroot b/bin/sbuild-createchroot
index bfbcb3d..2ef7514 100755
--- a/bin/sbuild-createchroot
+++ b/bin/sbuild-createchroot
@@ -215,18 +215,19 @@ if (! -d "$Sbuild::Sysconfig::paths{'SBUILD_SYSCONF_DIR'}/chroot") {
my $chrootlink = "$Sbuild::Sysconfig::paths{'SBUILD_SYSCONF_DIR'}/chroot/$chrootname";
if (-l $chrootlink) {
unlink($chrootlink) or die "Can't unlink $chrootlink: $!";
-} else {
+} elsif (-e $chrootlink) {
print STDERR "E: Can't remove $chrootlink: not a symbolic link\n";
+ $chrootlink = undef;
}
-if (! -f $chrootlink) {
+if (defined $chrootlink) {
if (symlink($target, $chrootlink)) {
print "I: sudo chroot configuration linked as $Sbuild::Sysconfig::paths{'SBUILD_SYSCONF_DIR'}/chroot/$chrootname.\n";
} else {
print STDERR "E: Failed to symlink $target to $chrootlink: $!\n";
}
} else {
- print "W: Failed to symlink $target to $chrootlink: \n"
+ print "W: Failed to symlink $target to $chrootlink: file already exists\n";
}
if (! -d "$target/build") {
diff --git a/lib/Sbuild/ChrootInfoSchroot.pm b/lib/Sbuild/ChrootInfoSchroot.pm
index 1094f27..47758e5 100644
--- a/lib/Sbuild/ChrootInfoSchroot.pm
+++ b/lib/Sbuild/ChrootInfoSchroot.pm
@@ -53,25 +53,39 @@ sub get_info {
my %tmp = ('Priority' => 0,
'Location' => "",
'Session Purged' => 0);
+
+ # Path <- Mount Location <- Directory <- Location (deprecated)
+ my @location_matches = (
+ '^\s*Path:?\s+(.+)$',
+ '^\s*Mount Location:?\s+(.+)$',
+ '^\s*Directory:?\s+(.+)$',
+ '^\s*Location:?\s+(.+)$'
+ );
+ my $location_priority = 1 + scalar @location_matches;
+
+ my $env_lang = $ENV{'LANG'};
+ $ENV{'LANG'} = 'C';
open CHROOT_DATA, '-|', $self->get_conf('SCHROOT'), '--info', '--chroot', $chroot
or die 'Can\'t run ' . $self->get_conf('SCHROOT') . ' to get chroot data';
+ $ENV{'LANG'} = $env_lang;
+
while (<CHROOT_DATA>) {
chomp;
if (/^\s*Type:?\s+(.*)$/) {
$chroot_type = $1;
}
- if (/^\s*Location:?\s+(.*)$/ &&
- $tmp{'Location'} eq "") {
- $tmp{'Location'} = $1;
- }
- if (/^\s*Mount Location:?\s+(.*)$/ &&
- $tmp{'Location'} eq "") {
- $tmp{'Location'} = $1;
- }
- # Path takes priority over Location and Mount Location.
- if (/^\s*Path:?\s+(.*)$/) {
- $tmp{'Location'} = $1;
+
+ # Get the "best" location
+ my $priority = 0;
+ foreach my $match (@location_matches) {
+ last if( $priority == $location_priority );
+ if ($_ =~ /${match}/) {
+ $tmp{'Location'} = $1;
+ $location_priority = $priority;
+ }
+ $priority++;
}
+
if (/^\s*Priority:?\s+(\d+)$/) {
$tmp{'Priority'} = $1;
}
More information about the Buildd-tools-devel
mailing list