~ubuntu-branches/debian/stretch/aptitude/stretch

« back to all changes in this revision

Viewing changes to src/generic/apt/matching/pattern.h

  • Committer: Package Import Robot
  • Author(s): Daniel Hartwig
  • Date: 2012-11-05 09:52:12 UTC
  • mfrom: (4.1.15)
  • Revision ID: package-import@ubuntu.com-20121105095212-9p0tme8ipzx9nsx5
Tags: 0.6.8.2-1
* [all]: Support for matching architectures using specification
         strings and wildcards (for example, "linux-any").  See
         Debian Policy section 11.1 "Architecture specification
         strings" for more details.
* [cmdline]: Fix typo which prevented installing tasks using the
             apt-get compatible syntax ("aptitude install
             gnome-desktop^").
* [cmdline]: Do not assume that APT::Default-Release always provides
             the candidate version of a package, instead use the
             policy defined by apt_preferences(5).
             (Closes: #587775, #631464, #686316)
* [all]: Download changelogs from APT::Changelogs::Server instead
         of a fixed location, and replace very ancient and disused
         option for Aptitude::Changelog-URL-Template.
         (Closes: #687239)
* Documentation:
  - Update for default value of APT::AutoRemove::SuggestsImportant
    which is "true" since apt 0.8.15.3. (Closes: #685310)
  - Correctly reference APT::AutoRemove::RecommendsImportant and
    SuggestsImportant which do not contain any hyphens.
    (Closes: #579071)
* Translation updates:
  - Czech (Closes: #681693)
  - French (Closes: #680040, #685084)
  - Polish (Closes: #678153)
  - Russian (Closes: #686016)
  - Spanish (Closes: #686752)
* debian/control: Bump Build-Depends on libapt-pkg-dev to (>= 0.9.7) for
  architecture specification string support.

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
#include <sys/types.h>
34
34
 
35
35
#include <apt-pkg/pkgcache.h>
 
36
#include <apt-pkg/cachefilter.h>
 
37
 
36
38
 
37
39
namespace aptitude
38
40
{
55
57
      std::string errmsg() const;
56
58
    };
57
59
 
 
60
    /** \brief Ref-counted wrapper for PackageArchitectureMatchesSpecification.
 
61
     */
 
62
    class arch_specification : public util::refcounted_base_threadsafe
 
63
    {
 
64
      APT::CacheFilter::PackageArchitectureMatchesSpecification pams;
 
65
      const std::string spec;
 
66
 
 
67
    public:
 
68
      arch_specification(const std::string &_spec);
 
69
 
 
70
      bool matches(const char * const &arch);
 
71
      inline bool matches(const pkgCache::VerIterator &ver)
 
72
      {
 
73
        return matches(ver.Arch());
 
74
      }
 
75
 
 
76
      inline const std::string &get_specification() const
 
77
      {
 
78
        return spec;
 
79
      }
 
80
    };
 
81
 
58
82
    /** \brief C++ wrapper for regular expression objects.
59
83
     *
60
84
     *  This class turns compilation errors into exceptions and
238
262
           *  Fields: pattern.
239
263
           */
240
264
          any_version,
241
 
          /** \brief ?architecture(PATTERN)
242
 
           *
243
 
           *  Matches packages by their architecture.
244
 
           *
245
 
           *  Fields: regex_info.
 
265
          /** \brief ?architecture(SPECIFICATION)
 
266
           *
 
267
           *  Matches packages whose architecture meets the given
 
268
           *  SPECIFICATION string (see Debian Policy section 11.1).
 
269
           *
 
270
           *  Fields: arch_specification.
246
271
           */
247
272
          architecture,
248
273
          /** \brief ?automatic
669
694
      // to the action match information.
670
695
      std::string string_info;
671
696
 
 
697
      cwidget::util::ref_ptr<arch_specification> arch_spec;
 
698
 
672
699
      // Groups several POD values that aren't used simultaneously.
673
700
      union
674
701
      {
804
831
        info.multiarch = multiarch_type;
805
832
      }
806
833
 
 
834
      // Allocate a pattern that has an architecture specification.
 
835
      pattern(type _tp,
 
836
              const cwidget::util::ref_ptr<arch_specification> &spec)
 
837
        : tp(_tp),
 
838
          arch_spec(spec)
 
839
      {
 
840
      }
 
841
 
807
842
    public:
808
843
 
809
844
      /** \name archive term constructor and accessors. */
907
942
 
908
943
      /** \brief Create an ?architecture term.
909
944
       *
910
 
       *  \param arch  The architecture to match.
 
945
       *  \param spec  The architecture specification string to match.
911
946
       */
912
947
      static cwidget::util::ref_ptr<pattern>
913
 
      make_architecture(const std::string &arch)
 
948
      make_architecture(const std::string &spec)
914
949
      {
915
 
        return new pattern(architecture, arch);
 
950
        return new pattern(architecture,
 
951
                           new arch_specification(spec));
916
952
      }
917
953
 
918
 
      const std::string &get_architecture_architecture() const
 
954
      const cwidget::util::ref_ptr<arch_specification> &
 
955
      get_architecture_arch_specification() const
919
956
      {
920
957
        eassert(tp == architecture);
921
958
 
922
 
        return string_info;
 
959
        return arch_spec;
923
960
      }
924
961
 
925
962
      // @}