[Cdd-commits] r251 - cdd/trunk/cdd

Andreas Tille debian-custom@lists.debian.org
Wed, 14 Jul 2004 05:58:07 -0600


Author: tille
Date: Wed Jul 14 05:58:07 2004
New Revision: 251

Modified:
   cdd/trunk/cdd/cdd-gen-control
   cdd/trunk/cdd/cdd-install-helper
Log:
Cope with alternatives and versions in Depends.  It is not yet checked whether the
version is available.  (volunteers?)


Modified: cdd/trunk/cdd/cdd-gen-control
==============================================================================
--- cdd/trunk/cdd/cdd-gen-control	(original)
+++ cdd/trunk/cdd/cdd-gen-control	Wed Jul 14 05:58:07 2004
@@ -264,24 +264,41 @@
     my $packages;
     for $packages (split(/\s*,\s*/, $pkgstring)) {
 	print "E: double comma?: $_\n" if ($packages =~ /^\s*$/ && $debug);
+	my $package_w_version;
 	my $package;
-	for $package (split(/\s*\|\s*/, $packages)) {
+	my $pkg_ok = 0;
+	for $package_w_version (split(/\s*\|\s*/, $packages)) {
+	    $package_w_version =~ /^([^ ]+)\s*\(*.*$/ ;
+	    $package = $1 ;
 	    print STDERR "Loading pkg '$package'\n" if $debug;
-	    if ($package =~ /^-(.+)$/) {
-		$excluded{$1} = 1;
-	    } elsif ( !exists $available{$package} ) {
-		if ( !exists $missing{$package}) {
-		    $missing{$package} = 1;
-		}
-		push(@missinglist, $package);
-	    } elsif ( ! $included{$package} ) {
-		push(@pkglist, $package);
-
-		push(@wanted, $package);
+	    # if one package string was found accept the whole combination
+	    # of alternatives or versioned depends
+	    # The available veriosn numbers will currently not be checked.
+	    # I'll leave this task to those who need this feature ;-) (at)
+	    if ( exists $available{$package} ) {
+		push(@pkglist, $packages);
+		# push(@wanted, $packages);
 		$included{$package} = 1;
-	    } else {
-		push(@pkglist, $package);
-		# already included, no need to add it to the wanted list again
+		$pkg_ok = 1;
+		last;
+	    }
+	}
+	if ( ! $pkg_ok ) {
+	    for $package_w_version (split(/\s*\|\s*/, $packages)) {
+		$package_w_version =~ /^([^ ]+)\s+\(.*$/ ;
+		$package = $1 ;
+		print STDERR "Analyzing pkg '$package' in detail\n" if $debug;
+		if ($package =~ /^-(.+)$/) {
+		    $excluded{$1} = 1;
+		} elsif ( !exists $available{$package} ) {
+		    if ( !exists $missing{$package}) {
+			$missing{$package} = 1;
+		    }
+		    push(@missinglist, $package_w_version);
+		} elsif ( ! $included{$package} ) {
+		    push(@wanted, $package_w_version);
+		    $included{$package} = 1;
+		}
 	    }
 	}
     }

Modified: cdd/trunk/cdd/cdd-install-helper
==============================================================================
--- cdd/trunk/cdd/cdd-install-helper	(original)
+++ cdd/trunk/cdd/cdd-install-helper	Wed Jul 14 05:58:07 2004
@@ -62,12 +62,6 @@
     sed -e "s/#CDD#/${cdd}/g" \
         -e "s/#PKG#/${cdd}-${pkg}/g" \
        /usr/share/cdd/templates/postrm >> debian/"$cdd"-"$pkg".postrm
-
-    # Now add the versioned dependencies on the #CDD#-common package
-    mv debian/control debian/control.bak
-    sed -e "/^Package: ${cdd}-${pkg}/{;N;N;N;s/\(Package: ${cdd}-${pkg}\n.*Depends: .*\)\(\n\)/\1, $cdd-common $version\2/;}" \
-           debian/control.bak >  debian/control
-    rm -f debian/control.bak
 done
 
 # if common/common exists use this as general helper script