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

Re: multistrap on ubuntu



+++ Neil Williams [2010-08-26 07:21 +0100]:
> On Wed, 25 Aug 2010 23:19:35 +0100
> Neil Williams <codehelp@debian.org> wrote:
> 
> > On Fri, 20 Aug 2010 02:30:45 +0100
> > Wookey <wookey@wookware.org> wrote:
> > 
> > > 2) Multistrap does not deal correctly with 'flat' source URLs, as
> > > produced by apt-ftparchive.
> 
> Please test current SVN which implements - at least logically - the
> correct method for supporting this type of source.

Ooh, that is _so_ much nicer than my patch. (I never said I was any
good at perl :-)

It was nearly right. Bit of reversed logic, coupld of places extra to
check so as not to try and use null suites, and it turns out that my
regexp for the flat URL patterns was insufficient in the presence of
[arch=foo] qualifiers on the line and URLs ending in '/', so I
improved that. 

I haven't done extensive testing but what testing I have done
works fine now. This is what has gone into Ubuntu as 2.1.6ubuntu2,
even though it is pretty-much 2.1.7-pre (so
that when 2.1.7 is released at some point an ubuntu eventually syncs
 things will move forward as expected).

I've checked those fixes in but here is the patch too:

Index: multistrap
===================================================================
--- multistrap	(revision 7389)
+++ multistrap	(working copy)
@@ -247,9 +247,9 @@
 		open (SOURCES, ">>${dir}etc/apt/sources.list.d/multistrap-${aptsrc}.list") 
 			or die _g("Cannot open sources list"). $!;
 		$mirror = $sources{$aptsrc};
-		$suite = (exists $flatfile{$aptsrc}) ? $suites{$aptsrc} : "";
-		$component = (defined $components{$aptsrc}) ? $components{$aptsrc}
-			: (exists $flatfile{$aptsrc}) ? "" : "main";
+		$suite = (exists $flatfile{$aptsrc}) ? "" : $suites{$aptsrc};
+		$component = (exists $flatfile{$aptsrc}) ? "" 
+			: (defined $components{$aptsrc}) ? $components{$aptsrc} : "main";
 		if (defined $mirror and defined $suite) {
 			print SOURCES "deb $mirror $suite $component\n";
 			print SOURCES "deb-src $mirror $suite $component\n" if (not defined $omitdebsrc{$aptsrc});
@@ -285,8 +285,10 @@
 $config_str .= " -o Apt::Install-Recommends=false";
 $config_str .= " -o Dir=$dir";
 $config_str .= " -o Dir::Etc=${dir}${etcdir}";
-$sourcesname = "sources.list.d/multistrap.sources.list";
-$config_str .= " -o Dir::Etc::SourceList=${dir}${etcdir}$sourcesname";
+if (defined $deflist) {
+	$sourcesname = "sources.list.d/multistrap.sources.list";
+        $config_str .= " -o Dir::Etc::SourceList=${dir}${etcdir}$sourcesname";
+}
 $config_str .= " -o Dir::State=${dir}${libdir}";
 $config_str .= " -o Dir::State::Status=${dir}${dpkgdir}status";
 $config_str .= " -o Dir::Cache=${dir}${cachedir}";
@@ -311,7 +313,7 @@
 		my @long=split (/ /, $packages{$sect});
 		foreach my $l (@long) {
 			chomp ($l);
-			if (defined $explicit_suite) {
+			if (defined $explicit_suite and $suites{$sect}) {
 				# instruct apt to get packages from the specified
 				# suites (when the package exists in more than one).
 				$str .= " $l/$suites{$sect}" if ((defined $l) and ($l !~ /^\s*$/));
@@ -373,7 +375,7 @@
 		open (SOURCES, ">>${dir}etc/apt/sources.list.d/multistrap-${aptsrc}.list") 
 			or die _g("Cannot open sources list"). $!;
 		$mirror = $sources{$aptsrc};
-		$suite = (exists $flatfile{$aptsrc}) ? $suites{$aptsrc} : "";
+		$suite = (exists $flatfile{$aptsrc}) ? "" : $suites{$aptsrc};
 		$component = (defined $components{$aptsrc}) ? $components{$aptsrc}
 			: (exists $flatfile{$aptsrc}) ? "" : "main";
 		if (defined $mirror and defined $suite) {
@@ -852,7 +854,8 @@
 		} else {
 			$sources{$section}=$keys{$section}{'source'} if (not exists $source{$section});
 			# don't set suite or component if URL is of apt-ftparchive trailing-slash form
-			$flatfile{$section}++ if (($sources{$section} =~ /.* .*\/$/));
+		        # regexp is: optional string in '[]', string without '[' or ']', string ending in '/'
+			$flatfile{$section}++ if (($sources{$section} =~ /^(\[.*\] )*[^\[\]]+ .+\/$/));
 			$packages{$section}=$keys{$section}{'packages'} if (not exists $packages{$section});
 			$suites{$section}=$keys{$section}{'suite'}
 				if (not exists $suites{$section} and not exists $flatfile{$section});


> > A patch for flatfile support also needs to patch the POD content to
> > document the behaviour.
> 
> Feel free to commit changes to the pod/multistrap file for this.

OK. I'll do that in a mo too.


Wookey
-- 
Principal hats:  Linaro, Emdebian, Wookware, Balloonboard, ARM
http://wookware.org/


Reply to: