Attachment 'upgrade-simple.patch'

Download

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

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.