Attachment 'upgrade-minimal.patch'

Download

   1 Index: approx-dev/debian/approx.install
   2 ===================================================================
   3 --- approx-dev.orig/debian/approx.install	2009-04-17 14:19:19.000000000 +0200
   4 +++ approx-dev/debian/approx.install	2009-04-27 14:00:12.000000000 +0200
   5 @@ -3,3 +3,5 @@
   6  approx-update	usr/sbin
   7  approx-import	usr/sbin
   8  etc/approx.conf	etc/approx
   9 +debian/config-model/Approx.pm usr/share/perl5/Config/Model
  10 +debian/config-model/model/Approx.pl usr/share/perl5/Config/Model/models
  11 Index: approx-dev/debian/approx.postinst
  12 ===================================================================
  13 --- approx-dev.orig/debian/approx.postinst	2009-04-17 14:19:19.000000000 +0200
  14 +++ approx-dev/debian/approx.postinst	2009-04-24 13:46:16.000000000 +0200
  15 @@ -34,4 +34,13 @@
  16      fi
  17  fi
  18  
  19 +# upgrade user configuration if needed
  20 +# FIXME: upgrade requiring user interaction are not handled
  21 +
  22 +if [ -e /etc/approx/approx.cds ] ; then
  23 +    # should remove approx.cds, let's move it to /tmp for debugging
  24 +    config-edit -model Approx -load /etc/approx/approx.cds -ui none \
  25 +	&& mv /etc/approx/approx.cds /tmp
  26 +fi
  27 +
  28  #DEBHELPER#
  29 Index: approx-dev/debian/approx.prerm
  30 ===================================================================
  31 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
  32 +++ approx-dev/debian/approx.prerm	2009-04-24 14:26:25.000000000 +0200
  33 @@ -0,0 +1,18 @@
  34 +#!/bin/sh -e
  35 +
  36 +cds_file=/etc/approx/approx.cds
  37 +cfg_file=/etc/approx/approx.conf
  38 +
  39 +case "$1" in
  40 +    remove)
  41 +	if [ -e $cds_file ] ; then
  42 +	    rm -rf $cds_file ;
  43 +	fi
  44 +	;;
  45 +    *)
  46 +	if [ -e $cfg_file ] ; then
  47 +	    config-edit -model Approx -dump /etc/approx/approx.cds || true
  48 +	fi
  49 +	;;
  50 +esac
  51 +
  52 Index: approx-dev/debian/config-model/Approx.pm
  53 ===================================================================
  54 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
  55 +++ approx-dev/debian/config-model/Approx.pm	2009-04-27 14:07:29.000000000 +0200
  56 @@ -0,0 +1,90 @@
  57 +#    Copyright (c) 2009 Dominique Dumont.
  58 +#
  59 +#    This file is part of Config-Model-Approx.
  60 +#
  61 +#    Config-Model-Approx is free software; you can redistribute it and/or
  62 +#    modify it under the terms of the GNU Lesser Public License as
  63 +#    published by the Free Software Foundation; either version 2.1 of
  64 +#    the License, or (at your option) any later version.
  65 +#
  66 +#    Config-Model-Approx is distributed in the hope that it will be useful,
  67 +#    but WITHOUT ANY WARRANTY; without even the implied warranty of
  68 +#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  69 +#    Lesser Public License for more details.
  70 +#
  71 +#    You should have received a copy of the GNU Lesser Public License
  72 +#    along with Config-Model; if not, write to the Free Software
  73 +#    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  74 +
  75 +package Config::Model::Approx ;
  76 +
  77 +use strict ;
  78 +use warnings ;
  79 +
  80 +use Carp ;
  81 +use Log::Log4perl;
  82 +use File::Copy ;
  83 +use File::Path ;
  84 +
  85 +use vars qw($VERSION)  ;
  86 +
  87 +$VERSION = '1.001' ;
  88 +
  89 +my $logger = Log::Log4perl::get_logger(__PACKAGE__);
  90 +
  91 +sub read {
  92 +    # keys are object , root,  config_dir, io_handle, file
  93 +    my %args = @_ ;
  94 +
  95 +    $logger->info("loading config file $args{file}") if defined $args{file};
  96 +
  97 +    foreach ($args{io_handle}->getlines) {
  98 +	chomp;
  99 +	s/#.*//;
 100 +	s/\s+/=/; # translate file in string loadable by C::M::Loader
 101 +	next unless $_;
 102 +	my $load = s/^\$// ? $_ : "distributions:".$_;
 103 +	$args{object}->load($load) ;
 104 +    }
 105 +
 106 +    return 1;
 107 +}
 108 +
 109 +sub write {
 110 +    my %args = @_ ;
 111 +
 112 +    $logger->info("writing config file $args{file}");
 113 +    my $node = $args{object} ;
 114 +    my $ioh  = $args{io_handle} ;
 115 +
 116 +    $ioh->print("# This file was written by Config::Model with Approx model\n");
 117 +    $ioh->print("# You may modify the content of this file. Configuration \n");
 118 +    $ioh->print("# modification will be preserved. Modification in the comments\n");
 119 +    $ioh->print("# will be discarded\n\n");
 120 +
 121 +    # Using Config::Model::ObjTreeScanner would be overkill
 122 +    foreach my $elt ($node->get_element_name) {
 123 +	next if $elt eq 'distributions';
 124 +
 125 +	# write some documentation in comments
 126 +	$ioh->print("# $elt:", $node->get_help(summary => $elt));
 127 +	my $built_in = $node->fetch_element($elt) -> fetch('built_in') ;
 128 +	$ioh->print(" ($built_in)") if defined $built_in;
 129 +	$ioh->print("\n") ;
 130 +
 131 +	# write value
 132 +	my $v = $node->grab_value($elt) ;
 133 +	$ioh->printf("\$%-10s %s\n",$elt,$v) if defined $v ;
 134 +	$ioh->print("\n") ;
 135 +    }
 136 +
 137 +    my $h = $node->fetch_element('distributions') ;
 138 +    $ioh->print("# ", $node->get_help(summary => 'distributions'),"\n");
 139 +    foreach my $dname ($h->get_all_indexes) {
 140 +	$ioh->printf("%-10s %s\n",$dname,
 141 +		     $node->grab_value("distributions:$dname")
 142 +		    ) ;
 143 +    }
 144 +    return 1;
 145 +
 146 +}
 147 Index: approx-dev/debian/control
 148 ===================================================================
 149 --- approx-dev.orig/debian/control	2009-04-17 14:19:19.000000000 +0200
 150 +++ approx-dev/debian/control	2009-04-23 13:31:41.000000000 +0200
 151 @@ -12,7 +12,7 @@
 152  
 153  Package: approx
 154  Architecture: any
 155 -Depends: ${shlibs:Depends}, ${misc:Depends}, ${F:OCamlDeps}, lsb-base (>= 3.2), adduser, bzip2, curl, openbsd-inetd | inet-superserver, update-inetd
 156 +Depends: ${shlibs:Depends}, ${misc:Depends}, ${F:OCamlDeps}, lsb-base (>= 3.2), adduser, bzip2, curl, openbsd-inetd | inet-superserver, update-inetd, libconfig-model-perl (>= 0.635)
 157  Description: caching proxy server for Debian archive files
 158   Approx is an HTTP-based Debian archive server.
 159   It fetches packages from remote repositories on demand,
 160 Index: approx-dev/debian/config-model/model/Approx.pl
 161 ===================================================================
 162 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
 163 +++ approx-dev/debian/config-model/model/Approx.pl	2009-04-27 14:02:17.000000000 +0200
 164 @@ -0,0 +1,106 @@
 165 +[
 166 +          {
 167 +            'read_config' => [
 168 +                               {
 169 +                                 'file' => 'approx.conf',
 170 +                                 'backend' => 'custom',
 171 +                                 'class' => 'Config::Model::Approx',
 172 +                                 'config_dir' => '/etc/approx'
 173 +                               }
 174 +                             ],
 175 +            'name' => 'Approx',
 176 +            'element' => [
 177 +                           'max_rate',
 178 +                           {
 179 +                             'value_type' => 'uniline',
 180 +                             'summary' => 'maximum download rate from remote repositories',
 181 +                             'type' => 'leaf',
 182 +                             'description' => "Specifies the maximum download rate from remote repositories, in bytes per second (default: unlimited). The value may be suf\x{2010} fixed with \"K\", \"M\", or \"G\" to indicate kilobytes, megabytes, or gigabytes per second, respectively."
 183 +                           },
 184 +                           'max_redirects',
 185 +                           {
 186 +                             'value_type' => 'integer',
 187 +                             'summary' => 'maximum number of HTTP redirections',
 188 +                             'built_in' => '5',
 189 +                             'type' => 'leaf',
 190 +                             'description' => 'Specifies the maximum number of HTTP redirections that will be followed when downloading a remote file'
 191 +                           },
 192 +                           'user',
 193 +                           {
 194 +                             'value_type' => 'uniline',
 195 +                             'summary' => 'user that owns the files in the approx cache',
 196 +                             'built_in' => 'approx',
 197 +                             'type' => 'leaf'
 198 +                           },
 199 +                           'group',
 200 +                           {
 201 +                             'value_type' => 'uniline',
 202 +                             'summary' => 'group that owns the files in the approx cache',
 203 +                             'built_in' => 'approx',
 204 +                             'type' => 'leaf'
 205 +                           },
 206 +                           'syslog',
 207 +                           {
 208 +                             'value_type' => 'uniline',
 209 +                             'summary' => 'syslog(3) facility to use when logging',
 210 +                             'built_in' => 'daemon',
 211 +                             'type' => 'leaf'
 212 +                           },
 213 +                           'pdiffs',
 214 +                           {
 215 +                             'value_type' => 'boolean',
 216 +                             'summary' => 'support IndexFile diffs',
 217 +                             'built_in' => '1',
 218 +                             'type' => 'leaf'
 219 +                           },
 220 +                           'offline',
 221 +                           {
 222 +                             'value_type' => 'boolean',
 223 +                             'summary' => 'use cached files when offline',
 224 +                             'built_in' => '0',
 225 +                             'type' => 'leaf',
 226 +                             'description' => 'Specifies whether to deliver (possibly out-of-date) cached files when they cannot be downloaded from remote repositories'
 227 +                           },
 228 +                           'max_wait',
 229 +                           {
 230 +                             'value_type' => 'integer',
 231 +                             'summary' => 'max wait for concurrent file download',
 232 +                             'built_in' => '10',
 233 +                             'type' => 'leaf',
 234 +                             'description' => 'Specifies how many seconds an approx(8) process will wait for a concurrent download of a file to complete, before attempting to download the file itself'
 235 +                           },
 236 +                           'verbose',
 237 +                           {
 238 +                             'value_type' => 'boolean',
 239 +                             'built_in' => '0',
 240 +                             'type' => 'leaf',
 241 +                             'description' => 'Specifies whether informational messages should be printed in the log'
 242 +                           },
 243 +                           'debug',
 244 +                           {
 245 +                             'value_type' => 'boolean',
 246 +                             'built_in' => '0',
 247 +                             'type' => 'leaf',
 248 +                             'description' => 'Specifies whether debug messages should be printed in the log'
 249 +                           },
 250 +                           'distributions',
 251 +                           {
 252 +                             'cargo' => {
 253 +                                          'value_type' => 'uniline',
 254 +                                          'type' => 'leaf'
 255 +                                        },
 256 +                             'summary' => 'remote repositories',
 257 +                             'type' => 'hash',
 258 +                             'description' => 'The other name/value pairs are used to map distribution names to remote repositories. For example,
 259 +
 260 +  debian     =>   http://ftp.debian.org/debian
 261 +  security   =>   http://security.debian.org/debian-security
 262 +
 263 +Use the distribution name as the key of the hash element and the URL as the value
 264 +',
 265 +                             'index_type' => 'string'
 266 +                           }
 267 +                         ]
 268 +          }
 269 +        ]
 270 +;
 271 

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2009-10-06 12:55:28, 9.4 KB) [[attachment:approx-add-model.patch]]
  • [get | view] (2009-10-06 12:45:14, 1.1 KB) [[attachment:approx-simple.patch]]
  • [get | view] (2009-09-14 12:31:18, 1.9 KB) [[attachment:dh-cm-upgrade.patch]]
  • [get | view] (2009-04-24 12:23:11, 17.4 KB) [[attachment:gui.png]]
  • [get | view] (2009-04-27 12:27:19, 11.1 KB) [[attachment:upgrade-minimal.patch]]
  • [get | view] (2009-06-30 16:49:45, 10.4 KB) [[attachment:upgrade-simple.patch]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.