pf-tools commit: r652 [ccaillet-guest] - in /trunk: debian/changelog sbin/mk_sourceslist

parmelan-guest at users.alioth.debian.org parmelan-guest at users.alioth.debian.org
Wed Oct 8 09:59:53 UTC 2008


Author: ccaillet-guest
Date: Wed Oct  8 09:59:53 2008
New Revision: 652

URL: http://svn.debian.org/wsvn/pf-tools/?sc=1&rev=652
Log:
* Forward port r650 for mk_sourceslist from 0.33-stable branch 
* Avoid a possible warning on mk_sourceslist 

Modified:
    trunk/debian/changelog
    trunk/sbin/mk_sourceslist

Modified: trunk/debian/changelog
URL: http://svn.debian.org/wsvn/pf-tools/trunk/debian/changelog?rev=652&op=diff
==============================================================================
--- trunk/debian/changelog (original)
+++ trunk/debian/changelog Wed Oct  8 09:59:53 2008
@@ -8,8 +8,10 @@
   * Transfering hardcoded value from mk_pxelinuxcfg to template
     standard-installer for defining preseed server 
   * Factorizing host properties with Get_Host_Props on Net.pm
-
- -- Christophe Caillet <quadchris at free.fr>  Fri, 26 Sep 2008 16:51:11 +0200
+  * Forward port r650 for mk_sourceslist from 0.33-stable branch 
+  * Avoid a possible warning on mk_sourceslist 
+
+ -- Christophe Caillet <quadchris at free.fr>  Wed, 08 Oct 2008 11:57:18 +0200
 
 pf-tools (0.33.1-1) unstable; urgency=low
 

Modified: trunk/sbin/mk_sourceslist
URL: http://svn.debian.org/wsvn/pf-tools/trunk/sbin/mk_sourceslist?rev=652&op=diff
==============================================================================
--- trunk/sbin/mk_sourceslist (original)
+++ trunk/sbin/mk_sourceslist Wed Oct  8 09:59:53 2008
@@ -37,6 +37,7 @@
 my $TPL		= "/usr/share/pf-tools/templates/sources.list.tpl" ;
 my $SECTIONS	= "common" ;
 my $HOST	= `/bin/hostname -s 2>>/dev/null` ;
+my $BACKPORTS	= 0 ;
 
 my $DEF_SECTIONS = {} ;
 $DEF_SECTIONS->{'debian'}	= "main contrib non-free" ;
@@ -57,20 +58,22 @@
 $program - version $version
 
 Synopsis : $program [-h|--help] [-s|--src <private-network source] [-d|--dst <sources.list dest>]
-		[ -t|--tpl <sources.list template>] [--host <hostname>] [[section] [section]]
+		[ -t|--tpl <sources.list template>] [-b|--backports] [--host <hostname>] [[section] [section]]
 
 	This tool permits to build the sources.list file according to distribution defined
 	in private-network file from PF-Tools configuration. It can also add some sections
 	to custom repository
 
-	-h | --help	Displays this message and exits
+	-h | --help		Displays this message and exits
 
-	-s | --src	Defines here where to find the private-network file
+	-s | --src		Defines here where to find the private-network file
 
-	-d | --dst	Defines here where to build the sources.list file
+	-d | --dst		Defines here where to build the sources.list file
 
-	-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
+	-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
+
+	-b | --backports	Adds the backport repository from debian-backports
 
 	--host		Defines for which hostname you want to build the sources.list. This
 			option is mainly for debugging
@@ -100,14 +103,28 @@
 
 	$sources_content =~ s/%DISTRIB%/$ref_srv->{'distrib'}/gs ;
 	my $dist_src	= $ref_srv->{'deploymode'} ;
-	$dist_src	=~ s/^(debian|ubuntu)-installer$/$1/ ;
+	$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 ;
+
+	if ( $BACKPORTS ) {
+		my $back_src ;
+		my $back_sections ;
+		if ( $dist_src eq 'debian' ) {
+			$back_src = $dist_src."-backports" ;
+			$back_sections = "main contrib non-free" ;
+		}
+		elsif ( $dist_src eq 'ubuntu' ) {
+			$back_src = $dist_src ;
+			$back_sections = "main universe restricted multiverse" ;
+		}
+		$sources_content .= "\ndeb http://mirrors.private/".$back_src." ".$ref_srv->{'distrib'}."-backports ".$back_sections."\n" ;
+	}
 
 	if ( ! open ( DST, ">".$dst ) ) {
 		warn "Unable to open destination's sources.list ".$dst."\n" ;
@@ -123,7 +140,8 @@
 	'host=s'	=> \$HOST,
 	's|src=s'	=> \$SRC,
 	'd|dst=s'	=> \$DST,
-	't|tpl=s'	=> \$TPL
+	't|tpl=s'	=> \$TPL,
+	'b|backports'	=> \$BACKPORTS
 ) || die "Didn't grok options on CLI\n" ;
 
 if ( $HELP ) {
@@ -140,10 +158,8 @@
 if ( @ARGV ) { $SECTIONS .= " ".join ( " ", @ARGV ) ; }
 
 my $PF_NET	= Init_lib_net ( Get_source ( $SRC ) ) ;
-$HOST		=~ /^(([^\-]{4})-)?([^\d]+)(([\d]+)([a-z]*))?$/ ;
-my ( $popname, $hosttype ) = ( $1, $3 ) ;
-my $key ;
-( defined $popname ) ? $key = $1.$3 : $key = $3 ;
-my $SRV		= $PF_NET->{'SERVERS'}->{'BY_NAME'}->{$key}->{'SRVLIST'}->{$HOST} ;
+$HOST		=~ /^(([^\-]{4})-)?([^\d]+)(([\d]*)([a-z]*))?$/ ;
+my $hosttype	= ( defined $1 ) ? $1.$3 : $3 ;
+my $SRV		= $PF_NET->{'SERVERS'}->{'BY_NAME'}->{$hosttype}->{'SRVLIST'}->{$HOST} ;
 
 Mk_sourceslist ( $SRV, $DST, $TPL, $SECTIONS ) ;




More information about the pf-tools-commits mailing list