Part of lp.archivepublisher.diskpool View In Hierarchy
Its constructor receives 'rootpath', which is the pool path where the files will be installed, and the 'temppath', which is a temporary directory used to store the installation candidate from librarian.
'rootpath' and 'temppath' must be in the same filesystem, see DiskPoolEntry for further information.
|Method||pathFor||Return the path for the given pool folder or file.|
|Method||addFile||Add a file with the given contents to the pool.|
|Method||removeFile||Remove the specified file from the pool.|
|Method||_getEntry||Return a new DiskPoolEntry for the given sourcename and file.|
If file is none, the path to the folder containing all packages for the given component and source package name will be returned.
If file is specified, the path to the specific package file will be returned.
Add a file with the given contents to the pool. Component, sourcename and filename are used to calculate the on-disk location. sha1 is used to compare with the existing file's checksum, if a file already exists for any component. contents is a file-like object containing the contents we want to write. There are four possible outcomes: - If the file doesn't exist in the pool for any component, it will be written from the given contents and results.ADDED_FILE will be returned. - If the file already exists in the pool, in this or any other component, the checksum of the file on disk will be calculated and compared with the checksum provided. If they fail to match, PoolFileOverwriteError will be raised. - If the file already exists but not in this component, and the checksum test above passes, a symlink will be added, and results.SYMLINK_ADDED will be returned. Also, the symlinks will be checked and sanitised, to ensure the real copy of the file is in the most preferred component, according to HARDCODED_COMPONENT_ORDER. - If the file already exists and is already in this component, either as a file or a symlink, and the checksum check passes, results.NONE will be returned and nothing will be done.
Remove the specified file from the pool. There are three possible outcomes: - If the specified file does not exist, NotInPool will be raised. - If the specified file exists and is a symlink, or is the only copy of the file in the pool, it will simply be deleted, and its size will be returned. - If the specified file is a real file and there are symlinks referencing it, the symlink in the next most preferred component will be deleted, and the file will be moved to replace it. The size of the deleted symlink will be returned.