4 #include<apt-pkg/init.h>
11 class pkgCdromStatus
/*{{{*/
18 virtual ~pkgCdromStatus() {};
21 virtual void SetTotal(int total
) { totalSteps
= total
; };
22 // update steps, will be called regularly as a "pulse"
23 virtual void Update(string text
="", int current
=0) = 0;
25 // ask for cdrom insert
26 virtual bool ChangeCdrom() = 0;
28 virtual bool AskCdromName(string
&Name
) = 0;
29 // Progress indicator for the Index rewriter
30 virtual OpProgress
* GetOpProgress() {return NULL
; };
33 class pkgCdrom
/*{{{*/
50 bool FindPackages(string CD
,
52 vector
<string
> &SList
,
53 vector
<string
> &SigList
,
54 vector
<string
> &TransList
,
55 string
&InfoDir
, pkgCdromStatus
*log
,
56 unsigned int Depth
= 0);
57 bool DropBinaryArch(vector
<string
> &List
);
58 bool DropRepeats(vector
<string
> &List
,const char *Name
);
59 void ReduceSourcelist(string CD
,vector
<string
> &List
);
60 bool WriteDatabase(Configuration
&Cnf
);
61 bool WriteSourceList(string Name
,vector
<string
> &List
,bool Source
);
62 int Score(string Path
);
65 bool Ident(string
&ident
, pkgCdromStatus
*log
);
66 bool Add(pkgCdromStatus
*log
);
71 // class that uses libudev to find cdrom/removable devices dynamically
72 struct CdromDevice
/*{{{*/
79 class pkgUdevCdromDevices
/*{{{*/
82 // libudev dlopen stucture
84 struct udev
* (*udev_new
)(void);
85 int (*udev_enumerate_add_match_property
)(struct udev_enumerate
*udev_enumerate
, const char *property
, const char *value
);
86 int (*udev_enumerate_scan_devices
)(struct udev_enumerate
*udev_enumerate
);
87 struct udev_list_entry
* (*udev_enumerate_get_list_entry
)(struct udev_enumerate
*udev_enumerate
);
88 struct udev_device
* (*udev_device_new_from_syspath
)(struct udev
*udev
, const char *syspath
);
89 struct udev
* (*udev_enumerate_get_udev
)(struct udev_enumerate
*udev_enumerate
);
90 const char* (*udev_list_entry_get_name
)(struct udev_list_entry
*list_entry
);
91 const char* (*udev_device_get_devnode
)(struct udev_device
*udev_device
);
92 struct udev_enumerate
*(*udev_enumerate_new
) (struct udev
*udev
);
93 struct udev_list_entry
*(*udev_list_entry_get_next
)(struct udev_list_entry
*list_entry
);
94 const char* (*udev_device_get_property_value
)(struct udev_device
*udev_device
, const char *key
);
95 int (*udev_enumerate_add_match_sysattr
)(struct udev_enumerate
*udev_enumerate
, const char *property
, const char *value
);
99 pkgUdevCdromDevices();
100 virtual ~pkgUdevCdromDevices();
105 // convenience interface, this will just call ScanForRemovable
106 // with "APT::cdrom::CdromOnly"
107 vector
<CdromDevice
> Scan();
109 vector
<CdromDevice
> ScanForRemovable(bool CdromOnly
);