diff options
Diffstat (limited to 'ftparchive')
-rw-r--r-- | ftparchive/apt-ftparchive.cc | 7 | ||||
-rw-r--r-- | ftparchive/writer.cc | 19 |
2 files changed, 17 insertions, 9 deletions
diff --git a/ftparchive/apt-ftparchive.cc b/ftparchive/apt-ftparchive.cc index 6f9fa7ab3..73d34249b 100644 --- a/ftparchive/apt-ftparchive.cc +++ b/ftparchive/apt-ftparchive.cc @@ -135,6 +135,8 @@ void PackageMap::GetGeneral(Configuration &Setup,Configuration &Block) PkgExt = Block.Find("Packages::Extensions", Setup.Find("Default::Packages::Extensions",".deb").c_str()); + Permissions = Setup.FindI("Default::FileMode",0644); + if (FLFile.empty() == false) FLFile = flCombine(Setup.Find("Dir::FileListDir"),FLFile); @@ -457,7 +459,7 @@ void LoadTree(vector<PackageMap> &PkgList,Configuration &Setup) string DFLFile = Setup.Find("TreeDefault::FileList", ""); string DSFLFile = Setup.Find("TreeDefault::SourceFileList", ""); - int const Permissions = Setup.FindI("Default::FileMode",0644); + mode_t const Permissions = Setup.FindI("Default::FileMode",0644); bool const LongDescription = Setup.FindB("Default::LongDescription", _config->FindB("APT::FTPArchive::LongDescription", true)); @@ -548,6 +550,8 @@ void LoadTree(vector<PackageMap> &PkgList,Configuration &Setup) /* */ void LoadBinDir(vector<PackageMap> &PkgList,Configuration &Setup) { + mode_t const Permissions = Setup.FindI("Default::FileMode",0644); + // Process 'bindirectory' type sections const Configuration::Item *Top = Setup.Tree("bindirectory"); for (Top = (Top == 0?0:Top->Child); Top != 0;) @@ -567,6 +571,7 @@ void LoadBinDir(vector<PackageMap> &PkgList,Configuration &Setup) Itm.InternalPrefix = Block.Find("InternalPrefix",Top->Tag.c_str()); Itm.Contents = Block.Find("Contents"); Itm.ContentsHead = Block.Find("Contents::Header"); + Itm.Permissions = Block.FindI("FileMode", Permissions); Itm.GetGeneral(Setup,Block); PkgList.push_back(Itm); diff --git a/ftparchive/writer.cc b/ftparchive/writer.cc index 58e32dade..d7d699ddc 100644 --- a/ftparchive/writer.cc +++ b/ftparchive/writer.cc @@ -708,18 +708,21 @@ bool SourcesWriter::DoPackage(string FileName) // Add the dsc to the files hash list string const strippedName = flNotDir(FileName); std::ostringstream ostreamFiles; - ostreamFiles << "\n " << string(MD5.Result()) << " " << St.st_size << " " - << strippedName << "\n " << Tags.FindS("Files"); + if (Tags.Exists("Files")) + ostreamFiles << "\n " << string(MD5.Result()) << " " << St.st_size << " " + << strippedName << "\n " << Tags.FindS("Files"); string const Files = ostreamFiles.str(); std::ostringstream ostreamSha1; - ostreamSha1 << "\n " << string(SHA1.Result()) << " " << St.st_size << " " - << strippedName << "\n " << Tags.FindS("Checksums-Sha1"); + if (Tags.Exists("Checksums-Sha1")) + ostreamSha1 << "\n " << string(SHA1.Result()) << " " << St.st_size << " " + << strippedName << "\n " << Tags.FindS("Checksums-Sha1"); string const ChecksumsSha1 = ostreamSha1.str(); std::ostringstream ostreamSha256; - ostreamSha256 << "\n " << string(SHA256.Result()) << " " << St.st_size << " " - << strippedName << "\n " << Tags.FindS("Checksums-Sha256"); + if (Tags.Exists("Checksums-Sha256")) + ostreamSha256 << "\n " << string(SHA256.Result()) << " " << St.st_size << " " + << strippedName << "\n " << Tags.FindS("Checksums-Sha256"); string const ChecksumsSha256 = ostreamSha256.str(); // Strip the DirStrip prefix from the FileName and add the PathPrefix @@ -925,12 +928,12 @@ ReleaseWriter::ReleaseWriter(string const &DB) } time_t const validuntil = now + _config->FindI("APT::FTPArchive::Release::ValidTime", 0); - char validstr[128] = ""; + char validstr[128]; if (now == validuntil || strftime(validstr, sizeof(validstr), "%a, %d %b %Y %H:%M:%S UTC", gmtime(&validuntil)) == 0) { - datestr[0] = '\0'; + validstr[0] = '\0'; } map<string,string> Fields; |