7 #ifndef APT_8_CLEANER_HEADERS
8 #include <apt-pkg/init.h>
15 class pkgCdromStatus
/*{{{*/
22 virtual ~pkgCdromStatus() {};
25 virtual void SetTotal(int total
) { totalSteps
= total
; };
26 // update steps, will be called regularly as a "pulse"
27 virtual void Update(std::string text
="", int current
=0) = 0;
29 // ask for cdrom insert
30 virtual bool ChangeCdrom() = 0;
32 virtual bool AskCdromName(std::string
&Name
) = 0;
33 // Progress indicator for the Index rewriter
34 virtual OpProgress
* GetOpProgress() {return NULL
; };
37 class pkgCdrom
/*{{{*/
54 bool FindPackages(std::string CD
,
55 std::vector
<std::string
> &List
,
56 std::vector
<std::string
> &SList
,
57 std::vector
<std::string
> &SigList
,
58 std::vector
<std::string
> &TransList
,
59 std::string
&InfoDir
, pkgCdromStatus
*log
,
60 unsigned int Depth
= 0);
61 bool DropBinaryArch(std::vector
<std::string
> &List
);
62 bool DropRepeats(std::vector
<std::string
> &List
,const char *Name
);
63 void ReduceSourcelist(std::string CD
,std::vector
<std::string
> &List
);
64 bool WriteDatabase(Configuration
&Cnf
);
65 bool WriteSourceList(std::string Name
,std::vector
<std::string
> &List
,bool Source
);
66 int Score(std::string Path
);
69 bool Ident(std::string
&ident
, pkgCdromStatus
*log
);
70 bool Add(pkgCdromStatus
*log
);
75 // class that uses libudev to find cdrom/removable devices dynamically
76 struct CdromDevice
/*{{{*/
78 std::string DeviceName
;
80 std::string MountPath
;
83 class pkgUdevCdromDevices
/*{{{*/
86 // libudev dlopen stucture
88 struct udev
* (*udev_new
)(void);
89 int (*udev_enumerate_add_match_property
)(struct udev_enumerate
*udev_enumerate
, const char *property
, const char *value
);
90 int (*udev_enumerate_scan_devices
)(struct udev_enumerate
*udev_enumerate
);
91 struct udev_list_entry
* (*udev_enumerate_get_list_entry
)(struct udev_enumerate
*udev_enumerate
);
92 struct udev_device
* (*udev_device_new_from_syspath
)(struct udev
*udev
, const char *syspath
);
93 struct udev
* (*udev_enumerate_get_udev
)(struct udev_enumerate
*udev_enumerate
);
94 const char* (*udev_list_entry_get_name
)(struct udev_list_entry
*list_entry
);
95 const char* (*udev_device_get_devnode
)(struct udev_device
*udev_device
);
96 struct udev_enumerate
*(*udev_enumerate_new
) (struct udev
*udev
);
97 struct udev_list_entry
*(*udev_list_entry_get_next
)(struct udev_list_entry
*list_entry
);
98 const char* (*udev_device_get_property_value
)(struct udev_device
*udev_device
, const char *key
);
99 int (*udev_enumerate_add_match_sysattr
)(struct udev_enumerate
*udev_enumerate
, const char *property
, const char *value
);
100 // end libudev dlopen
103 pkgUdevCdromDevices();
104 virtual ~pkgUdevCdromDevices();
109 // convenience interface, this will just call ScanForRemovable
110 // with "APT::cdrom::CdromOnly"
111 std::vector
<CdromDevice
> Scan();
113 std::vector
<CdromDevice
> ScanForRemovable(bool CdromOnly
);