pf-tools commit: r789 [ccaillet-guest] - in /branches/next-gen: lib/PFTools/ sbin/ templates/

parmelan-guest at users.alioth.debian.org parmelan-guest at users.alioth.debian.org
Thu Jul 29 11:59:54 UTC 2010


Author: ccaillet-guest
Date: Thu Jul 29 11:59:53 2010
New Revision: 789

URL: http://svn.debian.org/wsvn/pf-tools/?sc=1&rev=789
Log:
Partial commit

Added:
    branches/next-gen/templates/sources.list
      - copied unchanged from r788, branches/next-gen/templates/sources.list.tpl
    branches/next-gen/templates/standard-preseed
      - copied unchanged from r788, branches/next-gen/templates/standard-preseed.tpl
    branches/next-gen/templates/ubuntu-preseed
      - copied unchanged from r788, branches/next-gen/templates/ubuntu-preseed.tpl
    branches/next-gen/templates/ubuntu-sources.list
Removed:
    branches/next-gen/templates/sources.list.tpl
    branches/next-gen/templates/standard-preseed.tpl
    branches/next-gen/templates/ubuntu-preseed.tpl
Modified:
    branches/next-gen/lib/PFTools/Conf.pm
    branches/next-gen/sbin/mk_pxelinuxcfg
    branches/next-gen/sbin/mk_sourceslist

Modified: branches/next-gen/lib/PFTools/Conf.pm
URL: http://svn.debian.org/wsvn/pf-tools/branches/next-gen/lib/PFTools/Conf.pm?rev=789&op=diff
==============================================================================
--- branches/next-gen/lib/PFTools/Conf.pm (original)
+++ branches/next-gen/lib/PFTools/Conf.pm Thu Jul 29 11:59:53 2010
@@ -297,11 +297,19 @@
 	'command'	=> '',
 	'branche'	=> ''
 };
-$PF_CONFIG->{'templates'} = {
-	'debian_preseed'	=> 'standard-preseed',
-	'ubuntu_preseed'	=> 'ubuntu-preseed',
-	'debian_pxe'		=> 'standard-installer',
-	'ubuntu_pxe'		=> 'ubuntu-installer'
+$PF_CONFIG->{'debian'} = {
+	'preseed'			=> 'standard-preseed',
+	'pxe'				=> 'standard-installer',
+	'sources_list'		=> 'sources.list',
+	'default_sections'	=> 'main contrib non-free',
+	'custom-sections'	=> 'common'
+};
+$PF_CONFIG->{'ubuntu'} = {
+	'preseed'			=> 'ubuntu-preseed',
+	'pxe'				=> 'ubuntu-installer',
+	'sources_list'		=> 'ubuntu-sources.list',
+	'default_sections'	=> 'main universe restricted',
+	'custom-sections'	=> 'common'
 };
 $PF_CONFIG->{'regex'} = {
 	'hostname'	=> $HOST_CONFIG_REGEX,

Modified: branches/next-gen/sbin/mk_pxelinuxcfg
URL: http://svn.debian.org/wsvn/pf-tools/branches/next-gen/sbin/mk_pxelinuxcfg?rev=789&op=diff
==============================================================================
--- branches/next-gen/sbin/mk_pxelinuxcfg (original)
+++ branches/next-gen/sbin/mk_pxelinuxcfg Thu Jul 29 11:59:53 2010
@@ -261,8 +261,8 @@
 foreach my $hostclass ( @{$site_part->{'HOST'}->{'__hostclass_pxe'}} ) {
 	foreach my $host ( keys %{$host_part->{$hostclass}} ) {
 		my $mode			= $host_part->{$hostclass}->{$host}->{'deployment'}->{'mode'};
-		my $pxe_template	= $PF_CONFIG->{'path'}->{'templates_dir'}.'/'.$PF_CONFIG->{'templates'}->{$mode.'_pxe'};
-		my $preseed_tpl		= $PF_CONFIG->{'path'}->{'templates_dir'}.'/'.$PF_CONFIG->{'templates'}->{$mode.'_preseed'};
+		my $pxe_template	= $PF_CONFIG->{'path'}->{'templates_dir'}.'/'.$PF_CONFIG->{$mode}->{'pxe'};
+		my $preseed_tpl		= $PF_CONFIG->{'path'}->{'templates_dir'}.'/'.$PF_CONFIG->{$mode}->{'preseed'};
 		my $pxe_file = Mk_PXE_bootfile ( $host, $host_part->{$hostclass}->{$host}, $pxe_template, $preseed_tpl );
 	}
 }

Modified: branches/next-gen/sbin/mk_sourceslist
URL: http://svn.debian.org/wsvn/pf-tools/branches/next-gen/sbin/mk_sourceslist?rev=789&op=diff
==============================================================================
--- branches/next-gen/sbin/mk_sourceslist (original)
+++ branches/next-gen/sbin/mk_sourceslist Thu Jul 29 11:59:53 2010
@@ -34,8 +34,6 @@
 my $HELP		= 0 ;
 my $SRC 		= "" ;
 my $DST 		= "" ;
-my $TPL_DIR		= "/usr/share/pf-tools/templates/" ;
-my $DEFAULT_TPL	= "sources.list.tpl";
 my $TPL			= "" ;
 my $SECTIONS	= "common" ;
 my $HOST		= '' ;
@@ -75,6 +73,8 @@
 	-t | --tpl		Defines here where to find the sources.list template. If not defined
 				the program will use /usr/share/pf-tools/templates/sources.list.tpl
 
+	-a | --add		Defines here the list(comma-separated) of sections you want to add into custom repository
+
 	-b | --backports	Adds the backport repository from debian-backports
 
 	--host		Defines for which hostname you want to build the sources.list. This
@@ -85,7 +85,7 @@
 	
 	Sample use :
 	
-	$program -s GLOBAL:private-network -d /tmp/sources.list -h stream-tv00 stream
+	$program -s GLOBAL:private-network -d /tmp/sources.list -h stream-tv00 -a stream
 
 	This command generate the sources.list file on /tmp for stream-tv00 host and adds the
 	section stream to the custom packages repository
@@ -94,7 +94,7 @@
 }
 
 sub Mk_sourceslist ($$$$) {
-	my ( $ref_srv, $dst, $tpl, $sections ) = @_ ;
+	my ( $host_props, $dst, $tpl, $sections ) = @_ ;
 	
 	if ( ! open ( SOURCESTPL, $tpl ) ) {
 		warn "Unable to get sources.list template from file ".$tpl."\n" ;
@@ -103,27 +103,27 @@
 	my $sources_content = join '', <SOURCESTPL> ;
 	close ( SOURCESTPL ) ;
 
-	$sources_content =~ s/%DISTRIB%/$ref_srv->{'distrib'}/gs ;
-	my $dist_src	= $ref_srv->{'deploymode'} ;
-	$dist_src	=~ s/^(debian|ubuntu)-installer/$1/ ;
-
-	my $security = ( $dist_src eq 'debian' ) ? $ref_srv->{'distrib'}."/updates" : $ref_srv->{'distrib'}."-security" ;
-
-	$sources_content =~ s/%DISTSRC%/$dist_src/gs ;
-	$sources_content =~ s/%SECURITY%/$security/gs ;
-	$sources_content =~ s/%DEFAULT_SECTIONS%/$DEF_SECTIONS->{$dist_src}/gs ;
-	$sources_content =~ s/%CUSTOM_SECTIONS%/$sections/gs ;
+	my $tpl			= Template::Tiny->new ( TRIM => 1 );
+	my $mode		= $host_props->{'deployment'}->{'mode'};
+	$sources_subst	= {
+		'mode'				=> $host_props->{'deployment'}->{'mode'},
+		'distrib'			=> $host_props->{'deployment'}->{'distrib'},
+		'default_sections'	=> $PF_CONFIG->{$mode}->{'default_sections'},
+		'custom_sections'	=> $SECTIONS
+	};
+	$sources_content = $tpl->process ( \$sources_content, $sources_subst );
 
 	if ( $BACKPORTS ) {
 		my $back_src ;
 		my $back_sections ;
-		if ( $dist_src eq 'debian' ) {
-			$back_src = $dist_src."-backports" ;
+		if ( $mode eq 'debian' ) {
+			$back_src = $mode."-backports" ;
 		}
-		elsif ( $dist_src eq 'ubuntu' ) {
-			$back_src = $dist_src ;
+		elsif ( $mode eq 'ubuntu' ) {
+			$back_src = $mode ;
 		}
-		$sources_content .= "\ndeb http://mirrors.private/".$back_src." ".$ref_srv->{'distrib'}."-backports ".$DEF_SECTIONS->{$dist_src}."\n" ;
+		$sources_content .=
+			"\ndeb http://mirrors.private/".$back_src." ".$host_props->{'deployment'}->{'distrib'}."-backports ".$PF_CONFIG->{$mode}->{'default_sections'}."\n" ;
 	}
 
 	if ( ! open ( DST, ">".$dst ) ) {
@@ -141,6 +141,7 @@
 	's|src=s'	=> \$SRC,
 	'd|dst=s'	=> \$DST,
 	't|tpl=s'	=> \$TPL,
+	'a|add=s'	=> \$SECTIONS,
 	'b|backports'	=> \$BACKPORTS
 ) || die "Didn't grok options on CLI\n" ;
 
@@ -149,13 +150,17 @@
 	exit 0 ;
 }
 
+my $TPL_DIR		= "/usr/share/pf-tools/templates/" ;
+my $DEFAULT_TPL	= "sources.list.tpl";
+
+
 if ( $SRC eq "" || $DST eq "" ) {
 	warn "Source or/and destination are not defined : cannot build sources.list file\n" ;
 	Usage () ;
 	exit 1 ;
 }
 
-if ( @ARGV ) { $SECTIONS .= " ".join ( " ", @ARGV ) ; }
+$ADD_SECTIONS .= " ".join ( " ", @ARGV ) ; }
 
 my $PF_NET	= Init_lib_net ( Get_source ( $SRC ) ) ;
 

Added: branches/next-gen/templates/ubuntu-sources.list
URL: http://svn.debian.org/wsvn/pf-tools/branches/next-gen/templates/ubuntu-sources.list?rev=789&op=file
==============================================================================
--- branches/next-gen/templates/ubuntu-sources.list (added)
+++ branches/next-gen/templates/ubuntu-sources.list Thu Jul 29 11:59:53 2010
@@ -1,0 +1,8 @@
+# Generated by mk_sourceslist : DO NOT EDIT MANUALLY !
+# Except if you know what you're doing
+
+deb http://mirrors.private/[% mode %] [% distrib %] [% default_sections %]
+
+deb http://mirrors.private/[% mode %] [% distrib %]-security [% default_sections %]
+
+deb http://mirrors.private/[% mode %]-custom [% distrib %]-custom [% custom_sections %]




More information about the pf-tools-commits mailing list