repository.hh
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef PALUDIS_GUARD_PALUDIS_REPOSITORY_HH
00021 #define PALUDIS_GUARD_PALUDIS_REPOSITORY_HH 1
00022
00023 #include <paludis/action-fwd.hh>
00024 #include <paludis/repository-fwd.hh>
00025 #include <paludis/dep_spec-fwd.hh>
00026 #include <paludis/dep_tree.hh>
00027 #include <paludis/name.hh>
00028 #include <paludis/package_id-fwd.hh>
00029 #include <paludis/qa-fwd.hh>
00030 #include <paludis/util/attributes.hh>
00031 #include <paludis/util/exception.hh>
00032 #include <paludis/util/sr.hh>
00033 #include <paludis/util/fs_entry.hh>
00034 #include <paludis/util/wrapped_forward_iterator-fwd.hh>
00035 #include <paludis/util/options.hh>
00036 #include <paludis/util/named_value.hh>
00037 #include <paludis/util/output_deviator-fwd.hh>
00038 #include <paludis/version_spec.hh>
00039 #include <paludis/metadata_key-fwd.hh>
00040 #include <paludis/metadata_key_holder.hh>
00041 #include <paludis/merger-fwd.hh>
00042 #include <string>
00043 #include <tr1/functional>
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055 namespace paludis
00056 {
00057 namespace n
00058 {
00059 struct arch;
00060 struct destination_interface;
00061 struct e_interface;
00062 struct environment_file;
00063 struct environment_variable_interface;
00064 struct hook_interface;
00065 struct image_dir;
00066 struct make_virtuals_interface;
00067 struct manifest_interface;
00068 struct mirrors_interface;
00069 struct options;
00070 struct package_id;
00071 struct path;
00072 struct profile;
00073 struct provided_by;
00074 struct provided_by_spec;
00075 struct provides_interface;
00076 struct qa_interface;
00077 struct sets_interface;
00078 struct status;
00079 struct syncable_interface;
00080 struct used_this_for_config_protect;
00081 struct virtual_name;
00082 struct virtuals_interface;
00083 }
00084
00085
00086
00087
00088
00089
00090
00091
00092 struct RepositoryCapabilities
00093 {
00094 NamedValue<n::destination_interface, RepositoryDestinationInterface *> destination_interface;
00095 NamedValue<n::e_interface, RepositoryEInterface *> e_interface;
00096 NamedValue<n::environment_variable_interface, RepositoryEnvironmentVariableInterface *> environment_variable_interface;
00097 NamedValue<n::hook_interface, RepositoryHookInterface *> hook_interface;
00098 NamedValue<n::make_virtuals_interface, RepositoryMakeVirtualsInterface *> make_virtuals_interface;
00099 NamedValue<n::manifest_interface, RepositoryManifestInterface *> manifest_interface;
00100 NamedValue<n::mirrors_interface, RepositoryMirrorsInterface *> mirrors_interface;
00101 NamedValue<n::provides_interface, RepositoryProvidesInterface *> provides_interface;
00102 NamedValue<n::qa_interface, RepositoryQAInterface *> qa_interface;
00103 NamedValue<n::sets_interface, RepositorySetsInterface *> sets_interface;
00104 NamedValue<n::syncable_interface, RepositorySyncableInterface *> syncable_interface;
00105 NamedValue<n::virtuals_interface, RepositoryVirtualsInterface *> virtuals_interface;
00106 };
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116 struct RepositoryEInterfaceProfilesDescLine
00117 {
00118 NamedValue<n::arch, std::string> arch;
00119 NamedValue<n::path, FSEntry> path;
00120 NamedValue<n::profile, std::tr1::shared_ptr<ERepositoryProfile> > profile;
00121 NamedValue<n::status, std::string> status;
00122 };
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132 struct RepositoryProvidesEntry
00133 {
00134 NamedValue<n::provided_by, std::tr1::shared_ptr<const PackageID> > provided_by;
00135 NamedValue<n::virtual_name, QualifiedPackageName> virtual_name;
00136 };
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146 struct RepositoryVirtualsEntry
00147 {
00148 NamedValue<n::provided_by_spec, std::tr1::shared_ptr<const PackageDepSpec> > provided_by_spec;
00149 NamedValue<n::virtual_name, QualifiedPackageName> virtual_name;
00150 };
00151
00152
00153
00154
00155
00156
00157
00158
00159 struct MergeParams
00160 {
00161 NamedValue<n::environment_file, FSEntry> environment_file;
00162 NamedValue<n::image_dir, FSEntry> image_dir;
00163 NamedValue<n::options, MergerOptions> options;
00164 NamedValue<n::package_id, std::tr1::shared_ptr<const PackageID> > package_id;
00165 NamedValue<n::used_this_for_config_protect, std::tr1::function<void (const std::string &)> > used_this_for_config_protect;
00166 };
00167
00168
00169
00170
00171
00172
00173
00174
00175 class PALUDIS_VISIBLE NoSuchSetError :
00176 public Exception
00177 {
00178 private:
00179 std::string _name;
00180
00181 public:
00182
00183
00184
00185 NoSuchSetError(const std::string & name) throw ();
00186
00187 virtual ~NoSuchSetError() throw ()
00188 {
00189 }
00190
00191
00192
00193
00194
00195
00196 const std::string & name() const
00197 {
00198 return _name;
00199 }
00200 };
00201
00202
00203
00204
00205
00206
00207
00208
00209 class PALUDIS_VISIBLE RecursivelyDefinedSetError :
00210 public Exception
00211 {
00212 private:
00213 std::string _name;
00214
00215 public:
00216
00217
00218
00219 RecursivelyDefinedSetError(const std::string & name) throw ();
00220
00221 virtual ~RecursivelyDefinedSetError() throw ()
00222 {
00223 }
00224
00225
00226
00227
00228
00229
00230 const std::string & name() const
00231 {
00232 return _name;
00233 }
00234 };
00235
00236
00237
00238
00239
00240
00241
00242
00243 class PALUDIS_VISIBLE Repository :
00244 private InstantiationPolicy<Repository, instantiation_method::NonCopyableTag>,
00245 private PrivateImplementationPattern<Repository>,
00246 public RepositoryCapabilities,
00247 public MetadataKeyHolder
00248 {
00249 private:
00250 PrivateImplementationPattern<Repository>::ImpPtr & _imp;
00251
00252 protected:
00253
00254
00255
00256 Repository(const Environment * const, const RepositoryName &, const RepositoryCapabilities &);
00257
00258
00259
00260 public:
00261
00262
00263
00264 virtual ~Repository();
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274 const RepositoryName name() const PALUDIS_ATTRIBUTE((nothrow))
00275 PALUDIS_ATTRIBUTE((warn_unused_result));
00276
00277
00278
00279
00280 virtual bool can_be_favourite_repository() const;
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292 virtual const std::tr1::shared_ptr<const MetadataValueKey<std::string> > format_key() const = 0;
00293
00294
00295
00296
00297
00298
00299 virtual const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > location_key() const = 0;
00300
00301
00302
00303
00304
00305
00306
00307
00308 virtual const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > installed_root_key() const = 0;
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318 virtual bool has_category_named(const CategoryNamePart & c) const = 0;
00319
00320
00321
00322
00323 virtual bool has_package_named(const QualifiedPackageName & q) const = 0;
00324
00325
00326
00327
00328 virtual std::tr1::shared_ptr<const CategoryNamePartSet> category_names() const = 0;
00329
00330
00331
00332
00333 virtual std::tr1::shared_ptr<const CategoryNamePartSet> unimportant_category_names() const;
00334
00335
00336
00337
00338 virtual std::tr1::shared_ptr<const CategoryNamePartSet> category_names_containing_package(
00339 const PackageNamePart & p) const;
00340
00341
00342
00343
00344 virtual std::tr1::shared_ptr<const QualifiedPackageNameSet> package_names(
00345 const CategoryNamePart & c) const = 0;
00346
00347
00348
00349
00350 virtual std::tr1::shared_ptr<const PackageIDSequence> package_ids(const QualifiedPackageName & p) const = 0;
00351
00352
00353
00354
00355
00356
00357
00358
00359 virtual bool some_ids_might_support_action(const SupportsActionTestBase &) const = 0;
00360
00361
00362
00363
00364
00365
00366
00367
00368
00369 virtual void invalidate() = 0;
00370
00371
00372
00373
00374 virtual void invalidate_masks() = 0;
00375
00376
00377
00378
00379 virtual void regenerate_cache() const;
00380
00381
00382
00383 };
00384
00385
00386
00387
00388
00389
00390
00391
00392 class PALUDIS_VISIBLE RepositorySetsInterface
00393 {
00394 public:
00395
00396
00397
00398
00399
00400
00401 virtual std::tr1::shared_ptr<SetSpecTree::ConstItem> package_set(const SetName & s) const = 0;
00402
00403
00404
00405
00406 virtual std::tr1::shared_ptr<const SetNameSet> sets_list() const
00407 PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
00408
00409
00410
00411 virtual ~RepositorySetsInterface();
00412 };
00413
00414
00415
00416
00417
00418
00419
00420
00421 class PALUDIS_VISIBLE RepositorySyncableInterface
00422 {
00423 public:
00424
00425
00426
00427
00428
00429
00430
00431
00432
00433 virtual bool sync(const std::tr1::shared_ptr<const OutputDeviant> & output_deviant) const = 0;
00434
00435
00436
00437 virtual ~RepositorySyncableInterface();
00438 };
00439
00440
00441
00442
00443
00444
00445
00446
00447 class PALUDIS_VISIBLE RepositoryEnvironmentVariableInterface
00448 {
00449 public:
00450
00451
00452
00453
00454
00455
00456 virtual std::string get_environment_variable(
00457 const std::tr1::shared_ptr<const PackageID> & for_package,
00458 const std::string & var) const
00459 PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
00460
00461
00462
00463 virtual ~RepositoryEnvironmentVariableInterface();
00464 };
00465
00466
00467
00468
00469
00470
00471
00472
00473 class PALUDIS_VISIBLE RepositoryMirrorsInterface
00474 {
00475 public:
00476
00477
00478
00479 struct MirrorsConstIteratorTag;
00480 typedef WrappedForwardIterator<MirrorsConstIteratorTag,
00481 const std::pair<const std::string, std::string> > MirrorsConstIterator;
00482
00483 virtual MirrorsConstIterator begin_mirrors(const std::string & s) const
00484 PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
00485 virtual MirrorsConstIterator end_mirrors(const std::string & s) const
00486 PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
00487
00488
00489
00490
00491 bool is_mirror(const std::string & s) const;
00492
00493
00494
00495 virtual ~RepositoryMirrorsInterface();
00496 };
00497
00498
00499
00500
00501
00502
00503
00504
00505 class PALUDIS_VISIBLE RepositoryVirtualsInterface
00506 {
00507 public:
00508
00509
00510
00511
00512
00513
00514 typedef Sequence<RepositoryVirtualsEntry> VirtualsSequence;
00515
00516
00517
00518
00519 virtual std::tr1::shared_ptr<const VirtualsSequence> virtual_packages() const
00520 PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
00521
00522
00523
00524 virtual ~RepositoryVirtualsInterface();
00525 };
00526
00527
00528
00529
00530
00531
00532
00533
00534 class PALUDIS_VISIBLE RepositoryMakeVirtualsInterface
00535 {
00536 public:
00537 virtual ~RepositoryMakeVirtualsInterface();
00538
00539 virtual const std::tr1::shared_ptr<const PackageID> make_virtual_package_id(
00540 const QualifiedPackageName & virtual_name, const std::tr1::shared_ptr<const PackageID> & provider) const
00541 PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
00542 };
00543
00544
00545
00546
00547
00548
00549
00550
00551 class PALUDIS_VISIBLE RepositoryProvidesInterface
00552 {
00553 public:
00554
00555
00556
00557
00558
00559
00560 typedef Sequence<RepositoryProvidesEntry> ProvidesSequence;
00561
00562
00563
00564
00565 virtual std::tr1::shared_ptr<const ProvidesSequence> provided_packages() const
00566 PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
00567
00568
00569
00570 virtual ~RepositoryProvidesInterface();
00571 };
00572
00573
00574
00575
00576
00577
00578
00579
00580 class PALUDIS_VISIBLE RepositoryDestinationInterface
00581 {
00582 public:
00583
00584
00585
00586
00587
00588
00589 virtual bool is_suitable_destination_for(const PackageID &) const
00590 PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
00591
00592
00593
00594
00595 virtual bool is_default_destination() const
00596 PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
00597
00598
00599
00600
00601
00602
00603
00604
00605
00606 virtual bool want_pre_post_phases() const
00607 PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
00608
00609
00610
00611
00612 virtual void merge(const MergeParams &) = 0;
00613
00614
00615
00616 virtual ~RepositoryDestinationInterface();
00617 };
00618
00619
00620
00621
00622
00623
00624
00625
00626 class PALUDIS_VISIBLE RepositoryEInterface
00627 {
00628 public:
00629
00630
00631
00632 virtual std::string profile_variable(const std::string &) const = 0;
00633 virtual std::string accept_keywords_variable() const = 0;
00634 virtual std::string arch_variable() const = 0;
00635
00636
00637
00638
00639
00640
00641 typedef RepositoryEInterfaceProfilesDescLine ProfilesDescLine;
00642
00643 struct ProfilesConstIteratorTag;
00644 typedef WrappedForwardIterator<ProfilesConstIteratorTag, const ProfilesDescLine> ProfilesConstIterator;
00645 virtual ProfilesConstIterator begin_profiles() const = 0;
00646 virtual ProfilesConstIterator end_profiles() const = 0;
00647
00648 virtual ProfilesConstIterator find_profile(const FSEntry & location) const = 0;
00649 virtual void set_profile(const ProfilesConstIterator & iter) = 0;
00650 virtual void set_profile_by_arch(const std::string &) = 0;
00651
00652
00653
00654 virtual ~RepositoryEInterface();
00655 };
00656
00657
00658
00659
00660
00661
00662
00663
00664 class PALUDIS_VISIBLE RepositoryQAInterface
00665 {
00666 public:
00667
00668
00669
00670 virtual void check_qa(
00671 QAReporter &,
00672 const QACheckProperties &,
00673 const QACheckProperties &,
00674 const QAMessageLevel,
00675 const FSEntry &
00676 ) const = 0;
00677
00678
00679
00680
00681 virtual ~RepositoryQAInterface();
00682
00683
00684 };
00685
00686
00687
00688
00689
00690
00691
00692
00693 class PALUDIS_VISIBLE RepositoryManifestInterface
00694 {
00695 public:
00696
00697
00698
00699
00700 virtual void make_manifest(const QualifiedPackageName &) = 0;
00701
00702
00703
00704
00705 virtual ~RepositoryManifestInterface();
00706
00707
00708 };
00709
00710
00711
00712
00713
00714
00715
00716
00717 class PALUDIS_VISIBLE RepositoryHookInterface
00718 {
00719 public:
00720
00721
00722
00723 virtual HookResult perform_hook(const Hook & hook) const
00724 PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
00725
00726
00727
00728
00729 virtual ~RepositoryHookInterface();
00730
00731
00732 };
00733 }
00734
00735 #endif