9 #ifndef APT_8_CLEANER_HEADERS
10 #include <apt-pkg/init.h>
17 class pkgCdromStatus
/*{{{*/
23 pkgCdromStatus() : totalSteps(0) {};
24 virtual ~pkgCdromStatus() {};
27 virtual void SetTotal(int total
) { totalSteps
= total
; };
28 // update steps, will be called regularly as a "pulse"
29 virtual void Update(std::string text
="", int current
=0) = 0;
31 // ask for cdrom insert
32 virtual bool ChangeCdrom() = 0;
34 virtual bool AskCdromName(std::string
&Name
) = 0;
35 // Progress indicator for the Index rewriter
36 virtual OpProgress
* GetOpProgress() {return NULL
; };
39 class pkgCdrom
/*{{{*/
56 bool FindPackages(std::string CD
,
57 std::vector
<std::string
> &List
,
58 std::vector
<std::string
> &SList
,
59 std::vector
<std::string
> &SigList
,
60 std::vector
<std::string
> &TransList
,
61 std::string
&InfoDir
, pkgCdromStatus
*log
,
62 unsigned int Depth
= 0);
63 bool DropBinaryArch(std::vector
<std::string
> &List
);
64 bool DropRepeats(std::vector
<std::string
> &List
,const char *Name
);
65 bool DropTranslation(std::vector
<std::string
> &List
);
66 void ReduceSourcelist(std::string CD
,std::vector
<std::string
> &List
);
67 bool WriteDatabase(Configuration
&Cnf
);
68 bool WriteSourceList(std::string Name
,std::vector
<std::string
> &List
,bool Source
);
69 int Score(std::string Path
);
72 bool Ident(std::string
&ident
, pkgCdromStatus
*log
);
73 bool Add(pkgCdromStatus
*log
);
76 bool MountAndIdentCDROM(Configuration
&Database
, std::string
&CDROM
,
77 std::string
&ident
, pkgCdromStatus
* const log
, bool const interactive
);
82 // class that uses libudev to find cdrom/removable devices dynamically
83 struct CdromDevice
/*{{{*/
85 std::string DeviceName
;
87 std::string MountPath
;
90 class pkgUdevCdromDevices
/*{{{*/
93 // libudev dlopen structure
95 struct udev
* (*udev_new
)(void);
96 int (*udev_enumerate_add_match_property
)(struct udev_enumerate
*udev_enumerate
, const char *property
, const char *value
);
97 int (*udev_enumerate_scan_devices
)(struct udev_enumerate
*udev_enumerate
);
98 struct udev_list_entry
* (*udev_enumerate_get_list_entry
)(struct udev_enumerate
*udev_enumerate
);
99 struct udev_device
* (*udev_device_new_from_syspath
)(struct udev
*udev
, const char *syspath
);
100 struct udev
* (*udev_enumerate_get_udev
)(struct udev_enumerate
*udev_enumerate
);
101 const char* (*udev_list_entry_get_name
)(struct udev_list_entry
*list_entry
);
102 const char* (*udev_device_get_devnode
)(struct udev_device
*udev_device
);
103 struct udev_enumerate
*(*udev_enumerate_new
) (struct udev
*udev
);
104 struct udev_list_entry
*(*udev_list_entry_get_next
)(struct udev_list_entry
*list_entry
);
105 const char* (*udev_device_get_property_value
)(struct udev_device
*udev_device
, const char *key
);
106 int (*udev_enumerate_add_match_sysattr
)(struct udev_enumerate
*udev_enumerate
, const char *property
, const char *value
);
107 // end libudev dlopen
110 pkgUdevCdromDevices();
111 virtual ~pkgUdevCdromDevices();
116 // convenience interface, this will just call ScanForRemovable
117 // with "APT::cdrom::CdromOnly"
118 std::vector
<CdromDevice
> Scan();
120 std::vector
<CdromDevice
> ScanForRemovable(bool CdromOnly
);