]> git.saurik.com Git - apt.git/blame - methods/aptmethod.h
respect user pinning in M-A:same version (un)screwing
[apt.git] / methods / aptmethod.h
CommitLineData
30c8107e
DK
1#ifndef APT_APTMETHOD_H
2#define APT_APTMETHOD_H
3
4#include <apt-pkg/acquire-method.h>
23e64f6d 5#include <apt-pkg/configuration.h>
30c8107e
DK
6
7#include <string>
8
9class aptMethod : public pkgAcqMethod
10{
11 char const * const Binary;
30c8107e 12
23e64f6d
DK
13public:
14 virtual bool Configuration(std::string Message) APT_OVERRIDE
15 {
16 if (pkgAcqMethod::Configuration(Message) == false)
17 return false;
18
19 std::string const conf = std::string("Binary::") + Binary;
20 _config->MoveSubTree(conf.c_str(), NULL);
21
22 DropPrivsOrDie();
23
24 return true;
25 }
26
27 bool CalculateHashes(FetchItem const * const Itm, FetchResult &Res) const
28 {
29 Hashes Hash(Itm->ExpectedHashes);
30 FileFd Fd;
31 if (Fd.Open(Res.Filename, FileFd::ReadOnly) == false || Hash.AddFD(Fd) == false)
32 return false;
33 Res.TakeHashes(Hash);
34 return true;
35 }
36
8c9b7725
JAK
37 void Warning(const char *Format,...)
38 {
39 va_list args;
40 va_start(args,Format);
41 PrintStatus("104 Warning", Format, args);
42 va_end(args);
43 }
44
23e64f6d
DK
45 aptMethod(char const * const Binary, char const * const Ver, unsigned long const Flags) :
46 pkgAcqMethod(Ver, Flags), Binary(Binary)
47 {}
30c8107e 48};
30c8107e
DK
49
50#endif