[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#447427: /etc/dpkg-cross/archtable.d/*



OK, I've got a possible implementation for this bug:
dpkg-cross: please support wrong architecture

> We don't need to disable this check if the correct dpkg foo-table
> entries are added for the desired arch, right?
> 
> So once dpkg-architecture et al. all behave as planned, all that
> remains is to have a 'proper' way to extend those tables for any
> 'unofficial' archs that people require.

> So I think what we need here is for dpkg tools to also read
> from any foo-table.* files that exist in /usr/share/dpkg/.
> Then you can add these custom arch definitions in ostable.myarch
> etc. where they won't get stomped by dpkg updates, and enable
> them to be provided by a separate package that 'defines' the
> new arch that is desired in a fairly well defined way.

> It shouldn't be too hard to add support for this to dpkg, and
> it has been discussed on #emdebian to a reasonable state of
> consensus among the participants.  If no-one else has a better
> suggestion, and Neil and the dpkg maintainers like it, I think
> this is the way we should go on this.

The actual implementation would work with:

$ cat /etc/dpkg-cross/archtable.d/archtable.default
# This is the default list of architectures that differ
# between dpkg-cross and dpkg.
# Other files can be added to this directory using the same
# syntax. Lines starting with # are comments and are ignored.
# Additionally, content after # on any line is also ignored
# as long as the rest of the line is valid syntax.
# Syntax is 'key: value'
# key cannot be quoted, value can be quoted.

armeb: armeb-linux-gnueabi
hurd-i386: i386-gnu        #XXX This differs from dpkg-architecture
s390x: 's390-linux-gnu'      #XXX This differs from dpkg-architecture
openbsd-i386: 'i386-openbsd' #XXX This differs from dpkg-architecture
freebsd-i386: 'i386-freebsd' #XXX This differs from dpkg-architecture
darwin-i386: 'i386-darwin',   #XXX This differs from dpkg-architecture
win32-i386: 'i386-cygwin'

$


A package or a user could then drop a suitable file in that directory.

The contents of any file in that directory are then added to %archtable.

I think this could be manageable within dpkg as well as dpkg-cross.

The static %archtable definition would be replaced by:

$arch_dir = '/etc/dpkg-cross/archtable.d/';
%archtable = ();
opendir (ARCHDIR, $arch_dir)
	or carp "Unable to read $arch_dir: $!\n";
my @pathfiles=grep(!/^\.\.?$/, readdir ARCHDIR);
closedir (ARCHDIR);
foreach my $file (@pathfiles)
{
	next if (-d "${arch_dir}$file");
	my $conf = Config::Auto::parse("${arch_dir}$file", format => "colon");
	foreach my $p (sort keys (%$conf))
	{
		$p =~ s/'//g;
		if (not defined ($conf->{$p}))
		{
			carp "syntax error for $p in ${arch_dir}$file\n";
			next;
		}
		my $line = (ref($conf->{$p}) eq 'ARRAY') ?
			join (' ', @{$conf->{$p}}) : $conf->{$p};
		$line =~ s/\#.*$//;
		$line =~ s/'//g;
		$line =~ s/"//g;
		$archtable{$p} = $line;
	}
}


-- 


Neil Williams
=============
http://www.data-freedom.org/
http://www.nosoftwarepatents.com/
http://www.linux.codehelp.co.uk/

Attachment: pgptpe4g9TdSp.pgp
Description: PGP signature


Reply to: