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

[debian-devel:07779] Re: Mini Debian System (Re: 1 CD Debian)



From: yochi@debian.or.jp
Subject: [debian-devel:07777] Re: Mini Debian System (Re: 1 CD Debian)
Date: Mon, 8 Mar 1999 16:29:43 +0900

> やなぎはらです。
> 
> > はったです。
> > 
> > > >> あれ? これって、今あるパッケージセレクションを
> > > >> 利用したら、ツールを簡単に作れるような気がしちゃったんですけど〜。~
> > > 
> > >  と、思うんです。だから、これ + αでできちゃうのではないかと。
> > 
> > パッケージセレクション用のファイルさえあれば、そのファイルに含まれてる
> > パッケージが依存したパッケージも含めて 1 CD に入れちゃう仕組みは私のと
> > ころにあります。
> 
> その仕組み、どんなふうになってます?

慣れない perl だし汎用性もまったく考慮してないので、その筋の人が見たら
気絶するのかもしれませんが、添付しときます。
パッケージのリストが吐き出されるので、それと Package とを参照して
Slink-jp の一枚目にパッケージファイルを入れてます。 
# master ファイルにJP パッケージが入ってないので、必要そうな JP パッケー
# ジは直接記述してあります。
#!/usr/bin/perl -w 
# $Id: debdep,v 1.5 1999/02/28 02:14:00 hattas Exp hattas $
# $Log: debdep,v $
# Revision 1.5  1999/02/28 02:14:00  hattas
# prepare using pkg-order.
#
# Revision 1.4  1999/02/16 08:35:28  hattas
# master(for pkgsel).
#
# Revision 1.3  1999/02/10 05:05:09  hattas
# Releas Version.
#
# Revision 1.2  1999/02/09 16:54:43  hattas
# Non Stop Version.
#

# %real_pkg -- for detect virtual-package, other arch or non-free
# @dep_set -- records dependecy.
# @pkg_set -- contains a package set to be included standard selection.
# %pkg_set -- for check which package is included @pkg_set.

# Read !!
$master_file="master";
$basedir="/home/ftp/debian";
$basedir_jp="/home/ftp/debian-jp";
$basedir_non_us="/home/ftp/debian-non-US";

@packfiles = (
	"$basedir/dists/slink/main/binary-i386/Packages",
	"$basedir/dists/slink/contrib/binary-i386/Packages",
	"$basedir/dists/slink/non-free/binary-i386/Packages",
	"$basedir_jp/dists/slink-jp/main/binary-i386/Packages",
	"$basedir_jp/dists/slink-jp/contrib/binary-i386/Packages",
	"$basedir_jp/dists/slink-jp/non-free/binary-i386/Packages",
	"$basedir_non_us/dists/slink/non-US/binary-i386/Packages");

foreach $packs (@packfiles) {
	open PACKAGE, "<$packs" || die "can't open $packs";
	while (<PACKAGE>) {
		chomp;
		if (/^Package: /) {
			s///;
			s/ //;
			$pkg_name = $_;
			$real_pkg{$pkg_name} = 1;
#			s/\+/\\\+/g;
#			s/\./\\\./g;
#			$pkg_src{$pkg_name} = $_;
		}
#		if (/^Depends: / || /^Recommends: / || /^Suggests: /) {
		if (/^Depends: / || /^Recommends: /) {
			s///;
			s/\([^\)]+\)//g;
			s/ //g;
			s/\|/,/g;
			foreach $dep_pkg_name (split /,/, $_) {
				$dep_set_element = $pkg_name . " " . $dep_pkg_name;
				push @dep_set, $dep_set_element;
			}
		}
		if (/^Priority: /) {
			s///;
			tr/A-Z/a-z/;
			if (($_ eq 'reqired' || $_ eq 'important' || $_ eq 'standard')
				&& (! defined $pkg_set{$pkg_name})) {
				push @pkg_set, $pkg_name;
				$pkg_set{$pkg_name} = 1;
				# print "add $pkg_name to list.\n";
			}
			$pkg_priority{$pkg_name} = $_;
		}
		if (/^Section: /) {
			s///;
			if ($_ eq 'base' && (! defined $pkg_set{$pkg_name})) {
				push @pkg_set, $pkg_name;
				$pkg_set{$pkg_name} = 1;
				# print "add $pkg_name to list.\n";
			}
		}
#		if (/^source: /) {
#			s///;
#			push @source_set, $_ . " " . $pkg_name;
#			s/\+/\\\+/g;
#			s/\./\\\./g;
#			$pkg_src{$pkg_name} = $_;
#		}
		if (/^Provides: /) {
			s///;
			s/ //g;
			foreach $provide_pkg_name (split /,/, $_) {
				$provide_set_element = $provide_pkg_name . " " . $pkg_name;
				push @provide_set, $provide_set_element;
			}
		}
	}
	close PACKAGE;
}

@jpadd_packages = (
	"afterstep-i18n",
	"auctex-ja",
	"bug-ja",
	"chimera2-ja",
	"doc-debian-ja",
	"doc-linux-ja",
	"emacs20-dl",
	"fvwm2-ja",
	"fvwm95-ja",
	"grep-ja",
	"sed-ja",
	"gawk-ja",
	"jgroff",
	"gs-ja",
	"jed-ja",
	"jeddoc-ja",
	"jless",
	"libwcsmbs",
	"wcsmbs-locale-ja",
	"lynx-ja",
	"man-db-ja",
	"manpages-ja",
	"jnethack",
	"nvi-m17n",
	"tcl7.6-ja",
	"tcl8.0-ja",
	"tcl8.0-ja-dev",
	"platex-base",
	"jtex-base",
	"jtex-bin",
	"dvi2ps-j",
	"tk4.2-ja",
	"tk8.0-ja",
	"tk8.0-ja-dev",
	"tkdesk-ja",
	"xmanpages-ja",
	"kinput2",
	"canna",
	"wnn",
	"xwnmo",
	"skk"
);

foreach (@jpadd_packages) {
	if (! defined $pkg_set{$_}) {
		push @pkg_set, $_;
		$pkg_set{$_} = 1;
		# print "add $_ to list.\n";
	}
}

# Read pkgsel list.
open MASTER, "$master_file";
while (<MASTER>) {
	chomp;
	if (/^[+.0-9a-z-]+: /) {
		s/: .*$//;
		if (! defined $pkg_set{$_}) {
			push @pkg_set, $_;
			$pkg_set{$_} = 1;
			# print "add $_ to list.\n";
		}
	}
}
close MASTER;

# Add depend or recommend or suggest packages(virtual packages too)
while (@pkg_set_sv ne @pkg_set) {
	@pkg_set_sv = @pkg_set;
	foreach (@pkg_set_sv) {
		$pkg_name = $_;
		if (! defined $pkg_chk{$pkg_name}) {
			$pkg_chk{$pkg_name} = 1;
#			if (defined $pkg_src{$pkg_name}) {
#				foreach (grep /^$pkg_src{$pkg_name} /, @source_set) {
#					$source = $_;
#					$source =~ s/$pkg_src{$pkg_name} //;
#					if (! defined $pkg_set{$source}) {
#						push @pkg_set, $source;
#						$pkg_set{$source} = 1;
#						# print "add $element to list.\n";
#					}
#				}
#			}
			$pkg_name =~ s/\+/\\\+/g;
			foreach (grep /^$pkg_name /, @dep_set) {
				$element = $_;
				$element =~ s/^$pkg_name //;
				if (! defined $pkg_set{$element}) {
					push @pkg_set, $element;
					$pkg_set{$element} = 1;
					# print "add $element to list.\n";
				}
				$element =~ s/\+/\\\+/g;
				$element =~ s/\./\\\./g;
				foreach (grep /^$element /, @provide_set) {
					$provide = $_;
					$provide =~ s/^$element //;
					if (! defined $pkg_set{$provide} && $pkg_priority{$provide} ne 'extra') {
						push @pkg_set, $provide;
						$pkg_set{$provide} = 1;
						# print "add $provide to list.\n";
					}
				}
			}
		}
	}
}

# print out standaed selection (removing virtual or so)
$i = 1;
foreach (sort @pkg_set) {
	if (defined $real_pkg{$_}) {
		print "$_\n";
		$i++;
	} else {
		# print "$_ is a virtual package. so skip.\n";
	}
}