Rev 1 | Details | Compare with Previous | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 1 | magnus | 1 | package DebPool::Config; |
| 2 | |||
| 3 | ### |
||
| 4 | # |
||
| 5 | # DebPool::Config - Module for handling config options |
||
| 6 | # |
||
| 7 | # Copyright 2003-2004 Joel Aelwyn. All rights reserved. |
||
| 8 | # |
||
| 9 | # Redistribution and use in source and binary forms, with or without |
||
| 10 | # modification, are permitted provided that the following conditions |
||
| 11 | # are met: |
||
| 12 | # 1. Redistributions of source code must retain the above copyright |
||
| 13 | # notice, this list of conditions and the following disclaimer. |
||
| 14 | # 2. Redistributions in binary form must reproduce the above copyright |
||
| 15 | # notice, this list of conditions and the following disclaimer in the |
||
| 16 | # documentation and/or other materials provided with the distribution. |
||
| 17 | # 3. Neither the name of the Author nor the names of any contributors |
||
| 18 | # may be used to endorse or promote products derived from this software |
||
| 19 | # without specific prior written permission. |
||
| 20 | # |
||
| 21 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |
||
| 22 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
||
| 23 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
||
| 24 | # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
||
| 25 | # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
||
| 26 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
||
| 27 | # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
||
| 28 | # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
||
| 29 | # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
||
| 30 | # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
||
| 31 | # SUCH DAMAGE. |
||
| 32 | # |
||
| 33 | # $Id: Config.pm 38 2005-01-20 21:33:31Z joel $ |
||
| 34 | # |
||
| 35 | ### |
||
| 36 | |||
| 37 | =head1 NAME |
||
| 38 | |||
| 39 | DebPool::Config - configuration file format for debpool |
||
| 40 | |||
| 41 | =cut |
||
| 42 | |||
| 43 | =head1 SYNOPSIS |
||
| 44 | |||
| 45 | package DebPool::Config; |
||
| 46 | |||
| 47 | %Options = ( |
||
| 48 | 'option1' => value1, |
||
| 49 | 'option2' => value2, |
||
| 50 | ... |
||
| 51 | ); |
||
| 52 | |||
| 53 | 1; |
||
| 54 | |||
| 55 | =cut |
||
| 56 | |||
| 57 | =head1 DESCRIPTION |
||
| 58 | |||
| 59 | The DebPool::Config file is normally found in three places; |
||
| 60 | F</usr/share/debpool/Config.pm>, F</etc/debpool/Config.pm>, and |
||
| 61 | F<$HOME/.debpool/Config.pm> (in ascending order of precedence); |
||
| 62 | further locations can also be specified on the command line with the |
||
| 63 | '--config=<file>' option, which overrides all of these (and is, in turn, |
||
| 64 | overridden by any command line options). Also of note is the --nodefault |
||
| 65 | option, which prevents any attempt at loading the default (system and user) |
||
| 66 | config files. |
||
| 67 | |||
| 68 | The config files in /etc/debpool and $HOME/.debpool are not required to be |
||
| 69 | full Perl modules, though they must still declare a package namespace of |
||
| 70 | 'DebPool::Config' and return a true value. |
||
| 71 | |||
| 72 | =cut |
||
| 73 | |||
| 74 | # We use 'our', so we must have at least Perl 5.6 |
||
| 75 | |||
| 76 | require 5.006_000; |
||
| 77 | |||
| 78 | # Always good ideas. |
||
| 79 | |||
| 80 | use strict; |
||
| 81 | use warnings; |
||
| 82 | |||
| 83 | ### Module setup |
||
| 84 | |||
| 85 | BEGIN { |
||
| 86 | use Exporter (); |
||
| 87 | our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS); |
||
| 88 | |||
| 89 | # Version checking |
||
| 90 | $VERSION = '0.1.5'; |
||
| 91 | |||
| 92 | @ISA = qw(Exporter); |
||
| 93 | |||
| 94 | @EXPORT = qw( |
||
| 95 | ); |
||
| 96 | |||
| 97 | @EXPORT_OK = qw( |
||
| 98 | %Options |
||
| 99 | %OptionDefs |
||
| 100 | &Clean_Options |
||
| 101 | &Load_Default_Configs |
||
| 102 | &Load_Minimal_Configs |
||
| 103 | &Load_File_Configs |
||
| 104 | &Override_Configs |
||
| 105 | ); |
||
| 106 | |||
| 107 | %EXPORT_TAGS = ( |
||
| 108 | 'functions' => [qw(&Clean_Options &Load_Default_Configs |
||
| 109 | &Load_Minimal_Configs &Load_File_Configs |
||
| 110 | &Override_Configs)], |
||
| 111 | 'vars' => [qw(%Options %OptionDefs)], |
||
| 112 | ); |
||
| 113 | } |
||
| 114 | |||
| 115 | ### Exported package globals |
||
| 116 | |||
| 117 | # The core of everything this package is about. |
||
| 118 | |||
| 119 | our(%Options); |
||
| 120 | our(%OptionDefs); |
||
| 121 | |||
| 122 | ### Non-exported package globals |
||
| 123 | |||
| 124 | # Thread-safe? What's that? Package global error value. We don't export |
||
| 125 | # this directly, because it would conflict with other modules. |
||
| 126 | |||
| 127 | our($Error); |
||
| 128 | |||
| 129 | ### File lexicals |
||
| 130 | |||
| 131 | # None |
||
| 132 | |||
| 133 | ### Constant functions |
||
| 134 | |||
| 135 | # None |
||
| 136 | |||
| 137 | ### Meaningful functions |
||
| 138 | |||
| 139 | # Load_Default_Configs |
||
| 140 | # |
||
| 141 | # Loads the internal default values into %Options via |
||
| 142 | # Load_Internal_Configs, then 'require's config files from the default |
||
| 143 | # locations. It would be nice if we could log errors, but we can't safely |
||
| 144 | # load the logging module until we have all the configs in place. Catch-22. |
||
| 145 | |||
| 146 | sub Load_Default_Configs { |
||
| 147 | Load_Internal_Configs(); |
||
| 148 | |||
| 149 | if (-r '/etc/debpool/Config.pm') { |
||
| 150 | require '/etc/debpool/Config.pm'; # System defaults |
||
| 151 | } |
||
| 152 | |||
| 153 | if (-r "$ENV{'HOME'}/.debpool/Config.pm") { |
||
| 154 | require "$ENV{'HOME'}/.debpool/Config.pm"; # User defaults |
||
| 155 | } |
||
| 156 | } |
||
| 157 | |||
| 158 | # Load_Minimal_Configs |
||
| 159 | # |
||
| 160 | # Loads only the minimum configs necessary to be able to do parsing - |
||
| 161 | # that is, populate %OptionDefs. However, for sanity sake in documenting |
||
| 162 | # things, this has a side effect of also loading %Options, so we clear it |
||
| 163 | # afterwards. |
||
| 164 | |||
| 165 | sub Load_Minimal_Configs { |
||
| 166 | Load_Internal_Configs(); |
||
| 167 | |||
| 168 | undef(%Options); |
||
| 169 | } |
||
| 170 | |||
| 171 | # Load_File_Configs($file) |
||
| 172 | # |
||
| 173 | # Loads configuration data from $file. We don't check for readability; if |
||
| 174 | # the user is insane enough to ask for a non-existant file, just die and |
||
| 175 | # tell them that they're stupid. Note: if this routine is called while a |
||
| 176 | # lockfile is held, it won't clean that up if we die. |
||
| 177 | |||
| 178 | sub Load_File_Configs { |
||
| 179 | require "$_[0]"; |
||
| 180 | } |
||
| 181 | |||
| 182 | # Override_Configs($override_hashref) |
||
| 183 | # |
||
| 184 | # Overrides current values in %Options (whatever those might be) with the |
||
| 185 | # values in the hash. Does not destroy unnamed values. |
||
| 186 | |||
| 187 | sub Override_Configs { |
||
| 188 | my($hashref) = @_; |
||
| 189 | my($key); |
||
| 190 | |||
| 191 | foreach $key (keys(%{$hashref})) { |
||
| 192 | $Options{$key} = $hashref->{$key}; |
||
| 193 | } |
||
| 194 | } |
||
| 195 | |||
| 196 | # Clean_Options() |
||
| 197 | # |
||
| 198 | # Does some cleanup of $Options for sanity sake; also generates some |
||
| 199 | # auto-calculated values. |
||
| 200 | |||
| 201 | sub Clean_Options { |
||
| 202 | # Clean up the architectures field; 'source' should always be present, |
||
| 203 | # 'all' should never be. Simplest way to manage this is a throwaway |
||
| 204 | # hash. This should maybe live somewhere else, but I'm not sure where. |
||
| 205 | |||
| 206 | my(%dummy); |
||
| 207 | my($dummykey); |
||
| 208 | my(@newarch); |
||
| 209 | |||
| 210 | foreach $dummykey (@{$Options{'archs'}}) { |
||
| 211 | $dummy{$dummykey} = 1; |
||
| 212 | } |
||
| 213 | |||
| 214 | $dummy{'all'} = undef; |
||
| 215 | $dummy{'source'} = 1; |
||
| 216 | |||
| 217 | foreach $dummykey (keys(%dummy)) { |
||
| 218 | if ($dummy{$dummykey}) { |
||
| 219 | push(@newarch, $dummykey); |
||
| 220 | } |
||
| 221 | } |
||
| 222 | |||
| 223 | $Options{'archs'} = \@newarch; |
||
| 224 | |||
| 225 | # Generate 'realdists' from %Options{'dists'} - these are the 'real' |
||
| 226 | # (non-alias) distribution values. |
||
| 227 | |||
| 228 | %dummy = (); |
||
| 229 | |||
| 230 | foreach $dummykey (values(%{$Options{'dists'}})) { |
||
| 231 | $dummy{$dummykey} = 1; |
||
| 232 | } |
||
| 233 | |||
| 234 | my(@realdists) = keys(%dummy); |
||
| 235 | $Options{'realdists'} = \@realdists; |
||
| 236 | |||
| 237 | # Also generate a reverse-lookup table of real -> alias; in the case |
||
| 238 | # of multiple aliases, the first one encountered wins (one of them has |
||
| 239 | # to, and making it consistant and first means you can have multiple |
||
| 240 | # aliases in a sensible order). |
||
| 241 | |||
| 242 | my(%reverse) = (); |
||
| 243 | foreach $dummykey (keys(%{$Options{'dists'}})) { |
||
| 244 | my($real) = $Options{'dists'}->{$dummykey}; |
||
| 245 | if (!defined($reverse{$real})) { |
||
| 246 | $reverse{$real} = $dummykey; |
||
| 247 | } |
||
| 248 | } |
||
| 249 | |||
| 250 | $Options{'reverse_dists'} = \%reverse; |
||
| 251 | |||
| 252 | # Enable releases if we have all of the pieces. |
||
| 253 | if (defined($Options{'release_origin'}) |
||
| 254 | && defined($Options{'release_label'}) && |
||
| 255 | defined($Options{'release_description'})) { $Options{'do_release'} = 1; |
||
| 256 | } else { $Options{'do_release'} = 0; } |
||
| 257 | |||
| 258 | # If rebuild-all is present, turn on various rebuild options. |
||
| 259 | |||
| 260 | if ($Options{'rebuild-all'}) { |
||
| 261 | $Options{'rebuild-files'} = 1; |
||
| 262 | $Options{'rebuild-dbs'} = 1; |
||
| 263 | } |
||
| 264 | } |
||
| 265 | |||
| 266 | # Load_Internal_Configs() |
||
| 267 | # |
||
| 268 | # Loads %Options with basic default values. |
||
| 269 | |||
| 270 | sub Load_Internal_Configs { |
||
| 271 | =head1 OPTIONS |
||
| 272 | |||
| 273 | =head2 File/Directory configuration |
||
| 274 | |||
| 275 | These config values determine what directories various parts of the archive |
||
| 276 | are put in, and what permissions those directories have, as well as the |
||
| 277 | default permissions for files. |
||
| 278 | |||
| 279 | NOTE: While debpool will attempt to create db_dir, dists_dir, incoming_dir, |
||
| 280 | installed_dir, pool_dir, and reject_dir if they do not exist, it will *not* |
||
| 281 | attempt to do this for archive_dir. |
||
| 282 | |||
| 283 | WARNING: If you redefine archive_dir and you want the other four entries to |
||
| 284 | reflect this by incorporating the new value, you *MUST* redefine them here |
||
| 285 | (even if you simply use the default value of 'archive_dir'/<dirname>) so |
||
| 286 | that they use the new definition of archive_dir. |
||
| 287 | |||
| 288 | =over 4 |
||
| 289 | |||
| 290 | =item B<archive_dir> => I<archive directory> |
||
| 291 | |||
| 292 | Base directory of the archive. This is never used directly; however, it |
||
| 293 | is normally used to construct relative paths for dists_dir, incoming_dir, |
||
| 294 | installed_dir, pool_dir, and reject_dir. |
||
| 295 | |||
| 296 | WARNING: See the section documentation for important details about |
||
| 297 | redefining this value. |
||
| 298 | |||
| 299 | Default value: '/var/cache/debpool' |
||
| 300 | |||
| 301 | =cut |
||
| 302 | |||
| 303 | $Options{'archive_dir'} = '/var/cache/debpool'; |
||
| 304 | $OptionDefs{'archive_dir'} = 'archive_dir=s'; |
||
| 305 | |||
| 306 | =item B<db_dir> => I<dists directory> |
||
| 307 | |||
| 308 | DB directory, where the database files for each distribution are kept. |
||
| 309 | |||
| 310 | Default value: "$Options{'archive_dir'}/db" |
||
| 311 | |||
| 312 | =cut |
||
| 313 | |||
| 314 | $Options{'db_dir'} = "$Options{'archive_dir'}/db"; |
||
| 315 | $OptionDefs{'db_dir'} = 'db_dir=s'; |
||
| 316 | |||
| 317 | =item B<db_dir_mode> = I<permissions (octal)> |
||
| 318 | |||
| 319 | Permissions for db_dir. |
||
| 320 | |||
| 321 | Default value: 0750 |
||
| 322 | |||
| 323 | =cut |
||
| 324 | |||
| 325 | $Options{'db_dir_mode'} = 0750; |
||
| 326 | $OptionDefs{'db_dir_mode'} = 'db_dir_mode=i'; |
||
| 327 | |||
| 328 | =item B<db_file_mode> = I<permissions (octal)> |
||
| 329 | |||
| 330 | Permissions for database files in db_dir. |
||
| 331 | |||
| 332 | Default value: 0640 |
||
| 333 | |||
| 334 | =cut |
||
| 335 | |||
| 336 | $Options{'db_file_mode'} = 0640; |
||
| 337 | $OptionDefs{'db_file_mode'} = 'db_file_mode=i'; |
||
| 338 | |||
| 339 | =item B<dists_dir> => I<dists directory> |
||
| 340 | |||
| 341 | Dists directory, where distribution files (F<{Packages,Sources}{,.gz}> live. |
||
| 342 | |||
| 343 | Default value: "$Options{'archive_dir'}/dists" |
||
| 344 | |||
| 345 | =cut |
||
| 346 | |||
| 347 | $Options{'dists_dir'} = "$Options{'archive_dir'}/dists"; |
||
| 348 | $OptionDefs{'dists_dir'} = 'dists_dir=s'; |
||
| 349 | |||
| 350 | =item B<dists_dir_mode> = I<permissions (octal)> |
||
| 351 | |||
| 352 | Permissions for dists_dir and all of it's subdirectories. |
||
| 353 | |||
| 354 | Default value: 0755 |
||
| 355 | |||
| 356 | =cut |
||
| 357 | |||
| 358 | $Options{'dists_dir_mode'} = 0755; |
||
| 359 | $OptionDefs{'dists_dir_mode'} = 'dists_dir_mode=i'; |
||
| 360 | |||
| 361 | =item B<dists_file_mode> = I<permissions (octal)> |
||
| 362 | |||
| 363 | Permissions for distribution files ({Packages,Sources}{,.gz}. |
||
| 364 | |||
| 365 | Default value: 0644 |
||
| 366 | |||
| 367 | =cut |
||
| 368 | |||
| 369 | $Options{'dists_file_mode'} = 0644; |
||
| 370 | $OptionDefs{'dists_file_mode'} = 'dists_file_mode=i'; |
||
| 371 | |||
| 372 | =item B<incoming_dir> => I<incoming directory> |
||
| 373 | |||
| 374 | Incoming directory, where new packages are uploaded. |
||
| 375 | |||
| 376 | Default value: "$Options{'archive_dir'}/incoming"; |
||
| 377 | |||
| 378 | =cut |
||
| 379 | |||
| 380 | $Options{'incoming_dir'} = "$Options{'archive_dir'}/incoming"; |
||
| 381 | $OptionDefs{'incoming_dir'} = 'incoming_dir=s'; |
||
| 382 | |||
| 383 | =item B<incoming_dir_mode> = I<permissions (octal)> |
||
| 384 | |||
| 385 | Permissions for incoming_dir. Should have the sticky bit set if you want a |
||
| 386 | system archive. |
||
| 387 | |||
| 388 | Default value: 01775 |
||
| 389 | |||
| 390 | =cut |
||
| 391 | |||
| 392 | $Options{'incoming_dir_mode'} = 01775; |
||
| 393 | $OptionDefs{'incoming_dir_mode'} = 'incoming_dir_mode=i'; |
||
| 394 | |||
| 395 | =item B<installed_dir> => I<installed directory> |
||
| 396 | |||
| 397 | Incoming directory, where new packages are uploaded. |
||
| 398 | |||
| 399 | Default value: "$Options{'archive_dir'}/installed"; |
||
| 400 | |||
| 401 | =cut |
||
| 402 | |||
| 403 | $Options{'installed_dir'} = "$Options{'archive_dir'}/installed"; |
||
| 404 | $OptionDefs{'installed_dir'} = 'installed_dir=s'; |
||
| 405 | |||
| 406 | =item B<installed_dir_mode> = I<permissions (octal)> |
||
| 407 | |||
| 408 | Permissions for installed_dir. Should have the sticky bit set if you want a |
||
| 409 | system archive. |
||
| 410 | |||
| 411 | Default value: 0755 |
||
| 412 | |||
| 413 | =cut |
||
| 414 | |||
| 415 | $Options{'installed_dir_mode'} = 0755; |
||
| 416 | $OptionDefs{'installed_dir_mode'} = 'installed_dir_mode=i'; |
||
| 417 | |||
| 418 | =item B<installed_file_mode> = I<permissions (octal)> |
||
| 419 | |||
| 420 | Permissions for installed Changes files. |
||
| 421 | |||
| 422 | Default value: 0644 |
||
| 423 | |||
| 424 | =cut |
||
| 425 | |||
| 426 | $Options{'installed_file_mode'} = 0644; |
||
| 427 | $OptionDefs{'installed_file_mode'} = 'installed_file_mode=i'; |
||
| 428 | |||
| 429 | =item B<pool_dir> => I<pool directory> |
||
| 430 | |||
| 431 | Pool directory where all .deb files are stored after being accepted. Normally |
||
| 432 | this is constructed as a relative path from archive_dir. |
||
| 433 | |||
| 434 | Default value: "$Options{'archive_dir'}/pool" |
||
| 435 | |||
| 436 | =cut |
||
| 437 | |||
| 438 | $Options{'pool_dir'} = "$Options{'archive_dir'}/pool"; |
||
| 439 | $OptionDefs{'pool_dir'} = 'pool_dir=s'; |
||
| 440 | |||
| 441 | =item B<pool_dir_mode> = I<permissions (octal)> |
||
| 442 | |||
| 443 | Permissions for pool_dir and all of it's subdirectories. |
||
| 444 | |||
| 445 | Default value: 0755 |
||
| 446 | |||
| 447 | =cut |
||
| 448 | |||
| 449 | $Options{'pool_dir_mode'} = 0755; |
||
| 450 | $OptionDefs{'pool_dir_mode'} = 'pool_dir_mode=i'; |
||
| 451 | |||
| 452 | =item B<pool_file_mode> = I<permissions (octal)> |
||
| 453 | |||
| 454 | Permissions for files installed into the pool area (orig.tar.gz, tar.gz, |
||
| 455 | diff.gz, dsc, deb). |
||
| 456 | |||
| 457 | Default value: 0644 |
||
| 458 | |||
| 459 | =cut |
||
| 460 | |||
| 461 | $Options{'pool_file_mode'} = 0644; |
||
| 462 | $OptionDefs{'pool_file_mode'} = 'pool_file_mode=i'; |
||
| 463 | |||
| 464 | =item B<reject_dir> => I<reject directory> |
||
| 465 | |||
| 466 | Reject directory, where rejected packages are placed. |
||
| 467 | |||
| 468 | Default value: "$Options{'archive_dir'}/reject" |
||
| 469 | |||
| 470 | =cut |
||
| 471 | |||
| 472 | $Options{'reject_dir'} = "$Options{'archive_dir'}/reject"; |
||
| 473 | $OptionDefs{'reject_dir'} = 'reject_dir=s'; |
||
| 474 | |||
| 475 | =item B<reject_dir_mode> = I<permissions (octal)> |
||
| 476 | |||
| 477 | Permissions for reject_dir. |
||
| 478 | |||
| 479 | Default value: 0750 |
||
| 480 | |||
| 481 | =cut |
||
| 482 | |||
| 483 | $Options{'reject_dir_mode'} = 0750; |
||
| 484 | $OptionDefs{'reject_dir_mode'} = 'reject_dir_mode=i'; |
||
| 485 | |||
| 486 | =item B<reject_file_mode> = I<permissions (octal)> |
||
| 487 | |||
| 488 | Permissions for rejected package files. |
||
| 489 | |||
| 490 | Default value: 0640 |
||
| 491 | |||
| 492 | =cut |
||
| 493 | |||
| 494 | $Options{'reject_file_mode'} = 0640; |
||
| 495 | $OptionDefs{'reject_file_mode'} = 'reject_file_mode=i'; |
||
| 496 | |||
| 497 | =item B<lock_file> => I<lockfile> |
||
| 498 | |||
| 499 | Location of the lockfile to use when running. |
||
| 500 | |||
| 501 | Default value: "$Options{'archive_dir'}/.lock" |
||
| 502 | |||
| 503 | =cut |
||
| 504 | |||
| 505 | $Options{'lock_file'} = "$Options{'archive_dir'}/.lock"; |
||
| 506 | $OptionDefs{'lock_file'} = 'lock_file=s'; |
||
| 507 | |||
| 508 | =item B<compress_dists> = I<boolean> |
||
| 509 | |||
| 510 | This determines whether or not compressed versions of the distribution |
||
| 511 | files (Packages.gz, Sources.gz) are generated. Note that enabling this |
||
| 512 | introduces a dependancy on gzip. |
||
| 513 | |||
| 514 | =cut |
||
| 515 | |||
| 516 | $Options{'compress_dists'} = 0; |
||
| 517 | $OptionDefs{'compress_dists'} = 'compress_dists!'; |
||
| 518 | |||
| 519 | =back |
||
| 520 | |||
| 521 | =cut |
||
| 522 | |||
| 523 | =head2 Archive configuration |
||
| 524 | |||
| 525 | These values control which distributions, components, and architectures the |
||
| 526 | archive will support. |
||
| 527 | |||
| 528 | =over 4 |
||
| 529 | |||
| 530 | =item B<dists> => I<hash of distribution names and codenames> |
||
| 531 | |||
| 532 | A hashref pointing to a hash with entries for all distributions we will |
||
| 533 | accept packages for, and what the current codename for each distribution |
||
| 534 | is. Note that it is acceptable for more than one distribution to point to a |
||
| 535 | given codename (for example, when frozen is active); however, this has some |
||
| 536 | strange (and non-deterministic) consequences for Release files. |
||
| 537 | |||
| 538 | Default value: |
||
| 539 | |||
| 540 | { 'stable' => 'woody', |
||
| 541 | 'testing' => 'sarge', |
||
| 542 | 'unstable' => 'sid', |
||
| 543 | 'experimental' => 'experimental' } |
||
| 544 | |||
| 545 | =cut |
||
| 546 | |||
| 547 | $Options{'dists'} = { |
||
| 548 | 'stable' => 'woody', |
||
| 549 | 'testing' => 'sarge', |
||
| 550 | 'unstable' => 'sid', |
||
| 551 | 'experimental' => 'experimental' |
||
| 552 | }; |
||
| 553 | $OptionDefs{'dists'} = 'dists=s%'; |
||
| 554 | |||
| 555 | =item B<virtual_dists> => I<hash of virtual distribution names and targets> |
||
| 556 | |||
| 557 | A hashref pointing to a hash with entries for all 'virtual' distributions |
||
| 558 | we will accept packages for, and what distribution it should be treated |
||
| 559 | as. It is acceptable for more than one virtual distribution to point to a |
||
| 560 | given target. Note that unlike 'dists' entries, symlinks pointing from the |
||
| 561 | virtual name to the real name will not be created, and no attempt is made |
||
| 562 | to use these names in reverse processes (such as Release files); however, |
||
| 563 | virtual distributions may target any name ("unstable") or codename ("sid") |
||
| 564 | which appears in the 'dists' hash. |
||
| 565 | |||
| 566 | Default value: |
||
| 567 | |||
| 568 | { |
||
| 569 | } |
||
| 570 | |||
| 571 | Exsample value: |
||
| 572 | |||
| 573 | { 'unstable-hostname' => 'unstable', |
||
| 574 | 'testing-hostname' => 'sarge', |
||
| 575 | } |
||
| 576 | |||
| 577 | =cut |
||
| 578 | |||
| 579 | $Options{'virtual_dists'} = { |
||
| 580 | }; |
||
| 581 | |||
| 582 | =item B<sections> => I<array of section names> |
||
| 583 | |||
| 584 | An arrayref pointing to an array which lists all sections we will accept |
||
| 585 | packages for. Typically, these will be drawn from the set 'main', |
||
| 586 | 'contrib', 'non-free', 'experimental', 'alien', and 'local' (at least on |
||
| 587 | the author's systems). |
||
| 588 | |||
| 589 | Default value: [ 'main', 'contrib', 'non-free' ] |
||
| 590 | |||
| 591 | =cut |
||
| 592 | |||
| 593 | $Options{'sections'} = [ 'main', 'contrib', 'non-free' ]; |
||
| 594 | $OptionDefs{'sections'} = 'sections=s@'; |
||
| 595 | |||
| 596 | =item B<archs> => I<array of architecture names> |
||
| 597 | |||
| 598 | An arrayref pointing to an array which lists all architectures we will |
||
| 599 | accept packages for. Note that 'source' will always be present, and 'all' |
||
| 600 | will be silently ignored (uploads for Arch: all will still work, but the |
||
| 601 | listings appear in arch-specific Packages files). |
||
| 602 | |||
| 603 | Default value: [ 'i386' ] |
||
| 604 | |||
| 605 | =back |
||
| 606 | |||
| 607 | =cut |
||
| 608 | |||
| 609 | $Options{'archs'} = [ 'i386' ]; |
||
| 610 | $OptionDefs{'archs'} = 'archs=s@'; |
||
| 611 | |||
| 612 | =head2 Release configuration |
||
| 613 | |||
| 614 | If all of the variables below are defined (release_origin, release_label, |
||
| 615 | and release_description), Release files will be generated for each |
||
| 616 | distribution directory. |
||
| 617 | |||
| 618 | Please note that enabling Release files will introduce a dependancy on the |
||
| 619 | packages 'libdigest-md5-perl' and 'libdigest-sha1-perl'. |
||
| 620 | |||
| 621 | See also: sign_release |
||
| 622 | |||
| 623 | =over 4 |
||
| 624 | |||
| 625 | =cut |
||
| 626 | |||
| 627 | =item B<release_origin> => I<origin tag> |
||
| 628 | |||
| 629 | A string to be used for the Origin tag in the Release file. |
||
| 630 | |||
| 631 | Default value: undef |
||
| 632 | |||
| 633 | =cut |
||
| 634 | |||
| 635 | $Options{'release_origin'} = undef; |
||
| 636 | $OptionDefs{'release_origin'} = 'release_origin=s'; |
||
| 637 | |||
| 638 | =item B<release_label> => I<label tag> |
||
| 639 | |||
| 640 | A string to be used for the Label tag in the Release file. |
||
| 641 | |||
| 642 | Default value: undef |
||
| 643 | |||
| 644 | =cut |
||
| 645 | |||
| 646 | $Options{'release_label'} = undef; |
||
| 647 | $OptionDefs{'release_label'} = 'release_label=s'; |
||
| 648 | |||
| 649 | =item B<release_description> => I<description tag> |
||
| 650 | |||
| 651 | A string to be used for the Description tag in the Release file. (Note that |
||
| 652 | this should be a single line.) |
||
| 653 | |||
| 654 | Default value: undef |
||
| 655 | |||
| 656 | =cut |
||
| 657 | |||
| 658 | $Options{'release_description'} = undef; |
||
| 659 | $OptionDefs{'release_description'} = 'release_description=s'; |
||
| 660 | |||
| 661 | =item B<release_noauto> = <array of NonAutomatic release names> |
||
| 662 | |||
| 663 | An array of release names which should be tagged with 'NonAutomatic: yes' |
||
| 664 | in their Release files. This tag will keep APT from ever automatically |
||
| 665 | selecting a package from that archive as an installation candidate. |
||
| 666 | |||
| 667 | Default value: [ 'experimental' ] |
||
| 668 | |||
| 669 | =cut |
||
| 670 | |||
| 671 | $Options{'release_noauto'} = [ |
||
| 672 | 'experimental', |
||
| 673 | ]; |
||
| 674 | |||
| 675 | =back |
||
| 676 | |||
| 677 | =cut |
||
| 678 | |||
| 679 | =head2 Signature configuration |
||
| 680 | |||
| 681 | Please note that enabling any of these options will cause a dependancy on |
||
| 682 | the 'gnupg' package. See F</usr/share/doc/debpool/README.GnuPG> for more |
||
| 683 | information. |
||
| 684 | |||
| 685 | =over 4 |
||
| 686 | |||
| 687 | =item B<require_sigs_debs> = I<boolean> |
||
| 688 | |||
| 689 | If true, packages will be rejected unless their package files (.deb) |
||
| 690 | are GPG-signed with a recognized key found one of the keyrings listed |
||
| 691 | in 'gpg_keyrings'. These can be signed with the tools in the 'debsigs' |
||
| 692 | package. |
||
| 693 | |||
| 694 | Default value: 0 (false) |
||
| 695 | |||
| 696 | See also: gpg_keyrings |
||
| 697 | |||
| 698 | =cut |
||
| 699 | |||
| 700 | $Options{'require_sigs_debs'} = 0; |
||
| 701 | $OptionDefs{'require_sigs_debs'} = 'require_sigs_debs!'; |
||
| 702 | |||
| 703 | =item B<require_sigs_meta> = I<boolean> |
||
| 704 | |||
| 705 | If true, packages will be rejected unless their meta-files (.changes and |
||
| 706 | .dsc) are GPG-signed with a recognized key found one of the keyrings listed |
||
| 707 | in 'gpg_keyrings'. These are the files normally signed by the 'debsign' |
||
| 708 | utility in devscripts package. |
||
| 709 | |||
| 710 | Default value: 0 (false) |
||
| 711 | |||
| 712 | See also: gpg_keyrings |
||
| 713 | |||
| 714 | =cut |
||
| 715 | |||
| 716 | $Options{'require_sigs_meta'} = 0; |
||
| 717 | $OptionDefs{'require_sigs_meta'} = 'require_sigs_meta!'; |
||
| 718 | |||
| 719 | =item B<sign_release> = I<boolean> |
||
| 720 | |||
| 721 | If true, generated Release files with be GPG-signed with the key specified |
||
| 722 | in 'gpg_sign_key'. |
||
| 723 | |||
| 724 | Note that this will have no effect unless 'gpg_sign_key' is also defined at |
||
| 725 | some point. |
||
| 726 | |||
| 727 | Default value: 0 (false) |
||
| 728 | |||
| 729 | See also: L<"Release configuration">, gpg_sign_key |
||
| 730 | |||
| 731 | =cut |
||
| 732 | |||
| 733 | $Options{'sign_release'} = 0; |
||
| 734 | $OptionDefs{'sign_release'} = 'sign_release!'; |
||
| 735 | |||
| 736 | =back |
||
| 737 | |||
| 738 | =cut |
||
| 739 | |||
| 740 | =head2 GnuPG configuration |
||
| 741 | |||
| 742 | These values will only be used if the use of GnuPG is triggered in some |
||
| 743 | fashion (such as any of the values in L<"Signature configuration"> being |
||
| 744 | enabled) , and thus do not (in themselves) trigger a dependancy on GnuPG. |
||
| 745 | Please see F</usr/share/doc/debpool/README.GnuPG> for more information. |
||
| 746 | |||
| 747 | =over 4 |
||
| 748 | |||
| 749 | =item B<gpg_bin> = I<GnuPG binary> |
||
| 750 | |||
| 751 | This is used to specify the GnuPG binary to run. |
||
| 752 | |||
| 753 | Default value: '/usr/bin/gpg' |
||
| 754 | |||
| 755 | =cut |
||
| 756 | |||
| 757 | $Options{'gpg_bin'} = '/usr/bin/gpg'; |
||
| 758 | $OptionDefs{'gpg_bin'} = 'gpg_bin=s'; |
||
| 759 | |||
| 760 | =item B<gpg_home> = I<GnuPG homedir> |
||
| 761 | |||
| 762 | This is used to specify the GnuPG homedir (via the --homedir option). |
||
| 763 | |||
| 764 | Default value: '/home/user/.gnupg' |
||
| 765 | |||
| 766 | =cut |
||
| 767 | |||
| 768 | $Options{'gpg_home'} = '/home/user/.gnupg'; |
||
| 769 | $OptionDefs{'gpg_home'} = 'gpg_home=s'; |
||
| 770 | |||
| 771 | =item B<gpg_keyrings> = I<array of keyring filenames> |
||
| 772 | |||
| 773 | An arrayref pointing to an array which lists all of the GPG keyrings that |
||
| 774 | hold keys for approved uploaders. Note that this will have no effect unless |
||
| 775 | at least one of 'require_sigs_debs' or 'require_sigs_meta' is enabled. |
||
| 776 | |||
| 777 | Default value: [ 'uploaders.gpg' ] |
||
| 778 | |||
| 779 | See also: require_sigs_debs, require_sigs_meta |
||
| 780 | |||
| 781 | =cut |
||
| 782 | |||
| 783 | $Options{'gpg_keyrings'} = [ 'uploaders.gpg' ]; |
||
| 784 | $OptionDefs{'gpg_keyrings'} = 'gpg_keyrings=s@'; |
||
| 785 | |||
| 786 | =item B<gpg_sign_key> = I<signature keyID> |
||
| 787 | |||
| 788 | A string which contains the ID of the key which we will sign Release files |
||
| 789 | with. Note that this will have no effect unless 'sign_release' is true. |
||
| 790 | |||
| 791 | Default value: undef |
||
| 792 | |||
| 793 | See also: sign_release |
||
| 794 | |||
| 795 | =cut |
||
| 796 | |||
| 797 | $Options{'gpg_sign_key'} = undef; |
||
| 798 | $OptionDefs{'gpg_sign_key'} = 'gpg_sign_key=s'; |
||
| 799 | |||
| 800 | =item B<gpg_passfile> = I<passphrase file> |
||
| 801 | |||
| 802 | This specifies the name of the file from which we read the GnuPG passphrase |
||
| 803 | for the key listed in gpg_sign_key. Note that it will have no effect unless |
||
| 804 | 'sign_release' is true and 'gpg_sign_key' is defined. |
||
| 805 | |||
| 806 | Default value: '/home/user/.gnupg/passphrase'; |
||
| 807 | |||
| 808 | See also: sign_release, gpg_sign_key |
||
| 809 | |||
| 810 | =cut |
||
| 811 | |||
| 812 | $Options{'gpg_passfile'} = '/home/user/.gnupg/passphrase'; |
||
| 813 | $OptionDefs{'gpg_passfile'} = 'gpg_passfile=s'; |
||
| 814 | |||
| 815 | =back |
||
| 816 | |||
| 817 | =head2 Logging configuration |
||
| 818 | |||
| 819 | These are values which control the logging system. |
||
| 820 | |||
| 821 | =over 4 |
||
| 822 | |||
| 823 | =item B<log_file> = I<filename> |
||
| 824 | |||
| 825 | If this option is defined, logging output will be sent to the filename |
||
| 826 | specified. Note that an undefined value is considered an explicit request |
||
| 827 | to log nothing. |
||
| 828 | |||
| 829 | =cut |
||
| 830 | |||
| 831 | $Options{'log_file'} = '/home/user/.debpool/DebPool.log'; |
||
| 832 | $OptionDefs{'log_file'} = 'log_file=s'; |
||
| 833 | |||
| 834 | =head2 Misc. configuration |
||
| 835 | |||
| 836 | These are values which don't particularly fit into any of the other |
||
| 837 | sections. |
||
| 838 | |||
| 839 | =over 4 |
||
| 840 | |||
| 841 | =item B<daemon> = I<boolean> |
||
| 842 | |||
| 843 | This determines whether debpool runs as a daemon (never exiting except on |
||
| 844 | fatal errors, rescanning the Incoming directory periodically), or on a |
||
| 845 | single-run basis. True values cause debpool to run as a daemon. |
||
| 846 | |||
| 847 | Default value: 0 (false) |
||
| 848 | |||
| 849 | =cut |
||
| 850 | |||
| 851 | $Options{'daemon'} = 0; |
||
| 852 | $OptionDefs{'daemon'} = 'daemon!'; |
||
| 853 | |||
| 854 | =item B<sleep> = I<delay> |
||
| 855 | |||
| 856 | This option determines how long the daemon sleeps for, between each |
||
| 857 | processing run. Note that signals (such as SIGHUP, SIGINT, or SIGTERM) |
||
| 858 | will force the daemon to wake up before this expires, so don't worry about |
||
| 859 | setting it too long. |
||
| 860 | |||
| 861 | Default value: 300 (5 minutes) |
||
| 862 | |||
| 863 | =cut |
||
| 864 | |||
| 865 | $Options{'sleep'} = 300; |
||
| 866 | $OptionDefs{'sleep'} = 'sleep=i'; |
||
| 867 | |||
| 868 | =item B<rollback> = I<boolean> |
||
| 869 | |||
| 870 | This determines whether older packages in the incoming queue are allowed |
||
| 871 | to replace newer versions already in the archive (roll back the archive |
||
| 872 | version). |
||
| 873 | |||
| 874 | Default value: 0 (false) |
||
| 875 | |||
| 876 | =cut |
||
| 877 | |||
| 878 | $Options{'rollback'} = 0; |
||
| 879 | $OptionDefs{'rollback'} = 'rollback!'; |
||
| 880 | |||
| 881 | =item B<rebuild-files> = I<boolean> |
||
| 882 | |||
| 883 | This option can be set in configfiles, but is more commonly used from the |
||
| 884 | commandline; if set, it forces all of the distribution files (Packages and |
||
| 885 | Sources) to be rebuilt, whether or not they need it. This should almost |
||
| 886 | never be used in conjunction with the daemon option. |
||
| 887 | |||
| 888 | Default value: 0 (false) |
||
| 889 | |||
| 890 | =cut |
||
| 891 | |||
| 892 | $Options{'rebuild-files'} = 0; |
||
| 893 | $OptionDefs{'rebuild-files'} = 'rebuild-files!'; |
||
| 894 | |||
| 895 | =item B<rebuild-dbs> = I<boolean> |
||
| 896 | |||
| 897 | This option should not be set in configfiles, only used from the |
||
| 898 | commandline; if set, it forces all of the metadata files to be rebuilt from |
||
| 899 | scratch. It should, of course, also not be used with the daemon option. |
||
| 900 | |||
| 901 | WARNING: This feature is not yet implemented, and will (silently) fail to |
||
| 902 | do anything, at this time. It will be implemented in a future version. |
||
| 903 | |||
| 904 | Default value: 0 (false) |
||
| 905 | |||
| 906 | =cut |
||
| 907 | |||
| 908 | $Options{'rebuild-dbs'} = 0; |
||
| 909 | $OptionDefs{'rebuild-dbs'} = 'rebuild-dbs!'; |
||
| 910 | |||
| 911 | =item B<rebuild-all> = I<boolean> |
||
| 912 | |||
| 913 | This option should not be set in configfiles, only used from the |
||
| 914 | commandline; if set, it is equivalent to turning on all other rebuild |
||
| 915 | options (currently --rebuild-files and --rebuild-dbs). |
||
| 916 | |||
| 917 | WARNING: This feature depends on rebuild-dbs, which is not yet implemented; |
||
| 918 | only the --rebuild-files section will be triggered. |
||
| 919 | |||
| 920 | Default value: 0 (false) |
||
| 921 | |||
| 922 | =cut |
||
| 923 | |||
| 924 | $Options{'rebuild-all'} = 0; |
||
| 925 | $OptionDefs{'rebuild-all'} = 'rebuild-all!'; |
||
| 926 | |||
| 927 | =item B<config> = I<configfile> |
||
| 928 | |||
| 929 | This is a special option that should not be put into configfiles; it is |
||
| 930 | intended only for command-line use. It may be issued multiple times; each |
||
| 931 | time it is used, it will add the named config file to the list which |
||
| 932 | DebPool will load (later config files override earlier ones, in case of any |
||
| 933 | conflicts). |
||
| 934 | |||
| 935 | Default value: N/A |
||
| 936 | |||
| 937 | =back |
||
| 938 | |||
| 939 | =cut |
||
| 940 | } |
||
| 941 | |||
| 942 | END {} |
||
| 943 | |||
| 944 | 1; |
||
| 945 | |||
| 946 | __END__ |
||
| 947 | |||
| 948 | =head1 CAVEATS |
||
| 949 | |||
| 950 | Command line options will override all Config.pm declarations. |
||
| 951 | |||
| 952 | =cut |
||
| 953 | |||
| 954 | =head1 SEE ALSO |
||
| 955 | |||
| 956 | L<debpool(1)> |
||
| 957 | |||
| 958 | =cut |
||
| 959 | |||
| 960 | =head1 AUTHOR |
||
| 961 | |||
| 962 | Joel Baker <fenton@debian.org> |
||
| 963 | |||
| 964 | =cut |
||
| 965 | |||
| 966 | # vim:set tabstop=4 expandtab: |