sbuild  1.7.2
file.h
1 /* Copyright © 2005-2013 Roger Leigh <rleigh@debian.org>
2  *
3  * schroot is free software: you can redistribute it and/or modify it
4  * under the terms of the GNU General Public License as published by
5  * the Free Software Foundation, either version 3 of the License, or
6  * (at your option) any later version.
7  *
8  * schroot is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  * General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see
15  * <http://www.gnu.org/licenses/>.
16  *
17  *********************************************************************/
18 
19 #ifndef SBUILD_CHROOT_FACET_FILE_H
20 #define SBUILD_CHROOT_FACET_FILE_H
21 
22 #include <sbuild/chroot/chroot.h>
23 #include <sbuild/chroot/facet/facet.h>
24 #include <sbuild/chroot/facet/source-setup.h>
25 #include <sbuild/chroot/facet/storage.h>
26 
27 namespace sbuild
28 {
29  namespace chroot
30  {
31  namespace facet
32  {
33 
39  class file : public facet,
40  public storage,
41  public source_setup
42  {
43  public:
46 
48  typedef std::shared_ptr<file> ptr;
49 
51  typedef std::shared_ptr<const file> const_ptr;
52 
53  protected:
55  file ();
56 
58  file (const file& rhs);
59 
60  void
62  bool copy);
63 
64  friend class chroot;
65 
66  public:
68  virtual ~file ();
69 
70  virtual std::string const&
71  get_name () const;
72 
78  static ptr
79  create ();
80 
82  clone () const;
83 
89  std::string const&
90  get_filename () const;
91 
97  void
98  set_filename (const std::string& filename);
99 
106  virtual std::string const&
107  get_location () const;
108 
115  virtual void
116  set_location (const std::string& location);
117 
124  bool
125  get_file_repack () const;
126 
134  void
135  set_file_repack (bool repack);
136 
137  virtual void
138  setup_env (environment& env) const;
139 
140  std::string
141  get_path () const;
142 
143  virtual session_flags
144  get_session_flags () const;
145 
146  protected:
147  virtual void
148  setup_lock (chroot::setup_type type,
149  bool lock,
150  int status);
151 
152  virtual void
153  get_details (format_detail& detail) const;
154 
155  virtual void
156  get_used_keys (string_list& used_keys) const;
157 
158  virtual void
159  get_keyfile (keyfile& keyfile) const;
160 
161  virtual void
162  set_keyfile (const keyfile& keyfile);
163 
164  virtual void
165  chroot_source_setup (const chroot& parent);
166 
167  private:
169  std::string filename;
171  std::string location;
173  bool repack;
174  };
175 
176  }
177  }
178 }
179 
180 #endif /* SBUILD_CHROOT_FACET_FILE_H */
181 
182 /*
183  * Local Variables:
184  * mode:C++
185  * End:
186  */
Debian source builder components.
Definition: ctty.cc:31
chroot::error error
Exception type.
Definition: file.h:45
Chroot storage.
Definition: storage.h:39
facet::ptr clone() const
Copy the chroot facet.
Definition: file.cc:108
virtual void setup_env(environment &env) const
Set environment.
Definition: file.cc:167
std::shared_ptr< file > ptr
A shared_ptr to a chroot facet object.
Definition: file.h:48
std::shared_ptr< const file > const_ptr
A shared_ptr to a const chroot facet object.
Definition: file.h:51
virtual void set_keyfile(const keyfile &keyfile)
Set the chroot properties from a keyfile.
Definition: file.cc:253
Container of environment variables.
Definition: environment.h:38
void set_file_repack(bool repack)
Set the file repack status.
Definition: file.cc:150
std::string location
Location inside the mount location root.
Definition: file.h:171
virtual session_flags get_session_flags() const
Get the session flags of the chroot.
Definition: file.cc:206
Common chroot data.
Definition: chroot.h:50
Advisory locking.
Definition: lock.h:38
static ptr create()
Create a chroot facet.
Definition: file.cc:102
virtual void get_details(format_detail &detail) const
Get detailed information about the chroot for output.
Definition: file.cc:217
std::string filename
The file to use.
Definition: file.h:169
session_flags
Chroot session properties.
Definition: facet.h:54
virtual void set_location(const std::string &location)
Set the location.
Definition: file.cc:135
Base class for all facets.
Definition: facet.h:50
virtual void get_keyfile(keyfile &keyfile) const
Copy the chroot properties into a keyfile.
Definition: file.cc:236
std::vector< std::string > string_list
A string vector.
Definition: types.h:38
Custom error.
Definition: custom-error.h:31
void set_filename(const std::string &filename)
Set the filename used by the chroot.
Definition: file.cc:120
bool repack
Should the chroot be repacked?
Definition: file.h:173
Common chroot data.
Definition: source-setup.h:41
Format names and values for output.
Definition: format-detail.h:38
virtual void get_used_keys(string_list &used_keys) const
Get a list of the keys used during keyfile parsing.
Definition: file.cc:228
std::string const & get_filename() const
Get the filename used by the chroot.
Definition: file.cc:114
Configuration file parser.
Definition: keyfile.h:46
std::string get_path() const
Get the path to the chroot.
Definition: file.cc:156
void set_chroot(chroot &chroot, bool copy)
Set containing chroot.
Definition: file.cc:83
A chroot stored in a file archive (tar with optional compression).
Definition: file.h:39
std::shared_ptr< facet > ptr
A shared_ptr to a chroot facet object.
Definition: facet.h:63
virtual void chroot_source_setup(const chroot &parent)
Set up a newly-cloned source chroot.
Definition: file.cc:274
virtual std::string const & get_location() const
Get the location.
Definition: file.cc:129
bool get_file_repack() const
Get the repack status.
Definition: file.cc:144
virtual std::string const & get_name() const
Get the name of the chroot facet.
Definition: file.cc:96
setup_type
Type of setup to perform.
Definition: chroot.h:54
file()
The constructor.
Definition: file.cc:59
virtual ~file()
The destructor.
Definition: file.cc:78