4 #include <apt-pkg/macros.h>
11 #ifndef APT_8_CLEANER_HEADERS
12 #include <apt-pkg/init.h>
19 class pkgCdromStatus
/*{{{*/
27 virtual ~pkgCdromStatus();
30 virtual void SetTotal(int total
) { totalSteps
= total
; };
31 // update steps, will be called regularly as a "pulse"
32 virtual void Update(std::string text
="", int current
=0) = 0;
34 // ask for cdrom insert
35 virtual bool ChangeCdrom() = 0;
37 virtual bool AskCdromName(std::string
&Name
) = 0;
38 // Progress indicator for the Index rewriter
39 virtual OpProgress
* GetOpProgress() {return NULL
; };
42 class pkgCdrom
/*{{{*/
59 bool FindPackages(std::string CD
,
60 std::vector
<std::string
> &List
,
61 std::vector
<std::string
> &SList
,
62 std::vector
<std::string
> &SigList
,
63 std::vector
<std::string
> &TransList
,
64 std::string
&InfoDir
, pkgCdromStatus
*log
,
65 unsigned int Depth
= 0);
66 bool DropBinaryArch(std::vector
<std::string
> &List
);
67 bool DropRepeats(std::vector
<std::string
> &List
,const char *Name
);
68 bool DropTranslation(std::vector
<std::string
> &List
);
69 void ReduceSourcelist(std::string CD
,std::vector
<std::string
> &List
);
70 bool WriteDatabase(Configuration
&Cnf
);
71 bool WriteSourceList(std::string Name
,std::vector
<std::string
> &List
,bool Source
);
72 int Score(std::string Path
);
75 bool Ident(std::string
&ident
, pkgCdromStatus
*log
);
76 bool Add(pkgCdromStatus
*log
);
84 APT_HIDDEN
bool MountAndIdentCDROM(Configuration
&Database
, std::string
&CDROM
,
85 std::string
&ident
, pkgCdromStatus
* const log
, bool const interactive
);
86 APT_HIDDEN
bool UnmountCDROM(std::string
const &CDROM
, pkgCdromStatus
* const log
);
91 // class that uses libudev to find cdrom/removable devices dynamically
92 struct CdromDevice
/*{{{*/
94 std::string DeviceName
;
96 std::string MountPath
;
99 class pkgUdevCdromDevices
/*{{{*/
103 // libudev dlopen structure
104 void *libudev_handle
;
105 struct udev
* (*udev_new
)(void);
106 int (*udev_enumerate_add_match_property
)(struct udev_enumerate
*udev_enumerate
, const char *property
, const char *value
);
107 int (*udev_enumerate_scan_devices
)(struct udev_enumerate
*udev_enumerate
);
108 struct udev_list_entry
* (*udev_enumerate_get_list_entry
)(struct udev_enumerate
*udev_enumerate
);
109 struct udev_device
* (*udev_device_new_from_syspath
)(struct udev
*udev
, const char *syspath
);
110 struct udev
* (*udev_enumerate_get_udev
)(struct udev_enumerate
*udev_enumerate
);
111 const char* (*udev_list_entry_get_name
)(struct udev_list_entry
*list_entry
);
112 const char* (*udev_device_get_devnode
)(struct udev_device
*udev_device
);
113 struct udev_enumerate
*(*udev_enumerate_new
) (struct udev
*udev
);
114 struct udev_list_entry
*(*udev_list_entry_get_next
)(struct udev_list_entry
*list_entry
);
115 const char* (*udev_device_get_property_value
)(struct udev_device
*udev_device
, const char *key
);
116 int (*udev_enumerate_add_match_sysattr
)(struct udev_enumerate
*udev_enumerate
, const char *property
, const char *value
);
117 // end libudev dlopen
120 pkgUdevCdromDevices();
121 virtual ~pkgUdevCdromDevices();
126 // convenience interface, this will just call ScanForRemovable
127 // with "APT::cdrom::CdromOnly"
128 std::vector
<CdromDevice
> Scan();
130 std::vector
<CdromDevice
> ScanForRemovable(bool CdromOnly
);