~ubuntu-branches/ubuntu/trusty/schroot/trusty

« back to all changes in this revision

Viewing changes to sbuild/sbuild-chroot.h

  • Committer: Bazaar Package Importer
  • Author(s): Roger Leigh
  • Date: 2010-07-06 23:34:30 UTC
  • mfrom: (1.1.24 upstream) (2.2.9 sid)
  • Revision ID: james.westby@ubuntu.com-20100706233430-0xhzqj6105yuyvb1
* New upstream stable release.
* Use standards version 3.9.0.
* Correctly distribute profile conffiles (Closes: #588247).  Thanks
  to Mario Holbe.
* Update it and zh_CN translations.  Thanks to Vincenzo Campanella
  and Ji ZhengYu.

Show diffs side-by-side

added added

removed removed

Lines of Context:
62
62
        SESSION_PURGE   = 1 << 2  ///< The chroot should be purged.
63
63
      };
64
64
 
 
65
    /// Message verbosity
 
66
    enum verbosity
 
67
      {
 
68
        VERBOSITY_QUIET,  ///< Only print essential messages.
 
69
        VERBOSITY_NORMAL, ///< Print messages (the default).
 
70
        VERBOSITY_VERBOSE ///< Print all messages.
 
71
      };
 
72
 
65
73
    /// Error codes.
66
74
    enum error_code
67
75
      {
68
 
        CHROOT_CREATE,   ///< Chroot creation failed.
69
 
        CHROOT_DEVICE,   ///< Chroot device name not set.
70
 
        CHROOT_TYPE,     ///< Unknown chroot type.
71
 
        DEVICE_ABS,      ///< Device must have an absolute path.
72
 
        DEVICE_LOCK,     ///< Failed to lock device.
73
 
        DEVICE_NOTBLOCK, ///< File is not a block device.
74
 
        DEVICE_UNLOCK,   ///< Failed to unlock device.
75
 
        DIRECTORY_ABS,   ///< Directory must have an absolute path.
76
 
        FACET_INVALID,   ///< Attempt to add object which is not a facet.
77
 
        FACET_PRESENT,   ///< Attempt to add facet which is already in use.
78
 
        FILE_ABS,        ///< File must have an absolute path.
79
 
        FILE_LOCK,       ///< Failed to acquire lock.
80
 
        FILE_NOTREG,     ///< File is not a regular file.
81
 
        FILE_OWNER,      ///< File is not owned by user root.
82
 
        FILE_PERMS,      ///< File has write permissions for others.
83
 
        FILE_UNLOCK,     ///< Failed to discard lock.
84
 
        LOCATION_ABS,    ///< Location must have an absolute path.
85
 
        SESSION_UNLINK,  ///< Failed to unlink session file.
86
 
        SESSION_WRITE    ///< Failed to write session file.
 
76
        CHROOT_CREATE,    ///< Chroot creation failed.
 
77
        CHROOT_DEVICE,    ///< Chroot device name not set.
 
78
        CHROOT_TYPE,      ///< Unknown chroot type.
 
79
        DEVICE_ABS,       ///< Device must have an absolute path.
 
80
        DEVICE_LOCK,      ///< Failed to lock device.
 
81
        DEVICE_NOTBLOCK,  ///< File is not a block device.
 
82
        DEVICE_UNLOCK,    ///< Failed to unlock device.
 
83
        DIRECTORY_ABS,    ///< Directory must have an absolute path.
 
84
        FACET_INVALID,    ///< Attempt to add object which is not a facet.
 
85
        FACET_PRESENT,    ///< Attempt to add facet which is already in use.
 
86
        FILE_ABS,         ///< File must have an absolute path.
 
87
        FILE_LOCK,        ///< Failed to acquire lock.
 
88
        FILE_NOTREG,      ///< File is not a regular file.
 
89
        FILE_OWNER,       ///< File is not owned by user root.
 
90
        FILE_PERMS,       ///< File has write permissions for others.
 
91
        FILE_UNLOCK,      ///< Failed to discard lock.
 
92
        LOCATION_ABS,     ///< Location must have an absolute path.
 
93
        SESSION_UNLINK,   ///< Failed to unlink session file.
 
94
        SESSION_WRITE,    ///< Failed to write session file.
 
95
        VERBOSITY_INVALID ///< Message verbosity is invalid.
87
96
      };
88
97
 
89
98
    /// Exception type.
343
352
    set_aliases (string_list const& aliases);
344
353
 
345
354
    /**
 
355
     * Check if the environment should be preserved in the chroot.
 
356
     *
 
357
     * @returns true to preserve or false to clean.
 
358
     */
 
359
    bool
 
360
    get_preserve_environment () const;
 
361
 
 
362
    /**
 
363
     * Set if the environment should be preserved in the chroot.
 
364
     *
 
365
     * @param preserve_environment true to preserve or false to clean.
 
366
     */
 
367
    void
 
368
    set_preserve_environment (bool preserve_environment);
 
369
 
 
370
    /**
346
371
     * Get the environment filter of the chroot.  This is a POSIX
347
372
     * extended regular expression used to remove insecure environment
348
373
     * variables from the chroot environment.
353
378
    get_environment_filter () const;
354
379
 
355
380
    /**
356
 
     * Get the environment filter of the chroot.  This is a POSIX
 
381
     * Set the environment filter of the chroot.  This is a POSIX
357
382
     * extended regular expression used to remove insecure environment
358
383
     * variables from the chroot environment.
359
384
     *
445
470
    set_command_prefix (string_list const& command_prefix);
446
471
 
447
472
    /**
 
473
     * Get the message verbosity.
 
474
     *
 
475
     * Returns the verbosity level.
 
476
     */
 
477
    verbosity
 
478
    get_verbosity () const;
 
479
 
 
480
    /**
 
481
     * Get the message verbosity.
 
482
     *
 
483
     * Returns the verbosity level.
 
484
     */
 
485
    const char *
 
486
    get_verbosity_string () const;
 
487
 
 
488
    /**
 
489
     * Set the message verbosity.
 
490
     *
 
491
     * @param verbosity the verbosity level.
 
492
     */
 
493
    void
 
494
    set_verbosity (verbosity verbosity);
 
495
 
 
496
    /**
 
497
     * Set the message verbosity.
 
498
     *
 
499
     * @param verbosity the verbosity level.
 
500
     */
 
501
    void
 
502
    set_verbosity (std::string const& verbosity);
 
503
 
 
504
    /**
448
505
     * Get the type of the chroot.
449
506
     *
450
507
     * @returns the chroot type.
719
776
    string_list   root_groups;
720
777
    /// Alternative names for the chroot.
721
778
    string_list   aliases;
 
779
    /// Preserve environment?
 
780
    bool          preserve_environment;
722
781
    /// Environment filter regex.
723
782
    regex         environment_filter;
724
783
    /// Location to mount chroot in the filesystem (if any).
731
790
    std::string   script_config;
732
791
    /// Command prefix.
733
792
    string_list   command_prefix;
 
793
    /// The message verbosity.
 
794
    verbosity     message_verbosity;
734
795
 
735
796
    typedef std::tr1::shared_ptr<chroot_facet> facet_ptr;
736
797
    typedef std::list<facet_ptr> facet_list;
 
798
    /// Contained chroot facets
737
799
    facet_list facets;
738
800
  };
739
801