diff options
author | Ishan Jayawardena <udeshike@gmail.com> | 2011-06-13 15:16:14 +0530 |
---|---|---|
committer | Ishan Jayawardena <udeshike@gmail.com> | 2011-06-13 15:16:14 +0530 |
commit | 9995c4a0bc2d8567ff9f11d338ad610754682372 (patch) | |
tree | 8c365793c339382270c998dcd8395dc3a4471943 /apt-pkg/contrib/fileutl.cc | |
parent | b8b21ea0d77e70b08948a594c6741252a39a6ca2 (diff) |
added support for downloading debdelta files and queuing successfully downloaded debdeltas for processing with the debdelta apt method, in apt-pkg/acquire-item.{cc,h} in pkgAcqArchive class. Currently, no index for deltas are used. Proper progress reporting and methods to verify the debdeltas are yet to be added.
Diffstat (limited to 'apt-pkg/contrib/fileutl.cc')
-rw-r--r-- | apt-pkg/contrib/fileutl.cc | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc index 50019872e..b1724971f 100644 --- a/apt-pkg/contrib/fileutl.cc +++ b/apt-pkg/contrib/fileutl.cc @@ -148,7 +148,8 @@ bool CopyFile(FileFd &From,FileFd &To) return true; } - /*}}}*/ + +/*}}}*/ // GetLock - Gets a lock file /*{{{*/ // --------------------------------------------------------------------- /* This will create an empty file of the given name and lock it. Once this @@ -275,7 +276,22 @@ bool CreateDirectory(string const &Parent, string const &Path) } return true; } - /*}}}*/ + +// Rename - Rename a file /*{{{*/ +// --------------------------------------------------------------------- +/* This helper function is used by alot of item methods as thier final + step */ +bool Rename(string From, string To) +{ + if (rename(From.c_str(),To.c_str()) != 0) + { + return _error->Error("Rename failed. %s (%s -> %s).",strerror(errno), + From.c_str(),To.c_str()); + } + return true; +} + +/*}}}*/ // CreateAPTDirectoryIfNeeded - ensure that the given directory exists /*{{{*/ // --------------------------------------------------------------------- /* a small wrapper around CreateDirectory to check if it exists and to @@ -571,6 +587,7 @@ void SetNonBlock(int Fd,bool Block) in seconds. */ bool WaitFd(int Fd,bool write,unsigned long timeout) { + //std::cerr << "WaitFd()" << std::endl; fd_set Set; struct timeval tv; FD_ZERO(&Set); @@ -601,7 +618,7 @@ bool WaitFd(int Fd,bool write,unsigned long timeout) if (Res <= 0) return false; } - + //std::cerr << " waited for FD " << Fd << std::endl; return true; } /*}}}*/ |