diff options
author | Arch Librarian <arch@canonical.com> | 2004-09-20 17:04:38 +0000 |
---|---|---|
committer | Arch Librarian <arch@canonical.com> | 2004-09-20 17:04:38 +0000 |
commit | c0eb6bc6c89ba41011b9e7ef2e94cdfa4c92e142 (patch) | |
tree | 3b2a704cb63706cd0423cfba5e1a295fc84944e9 /ftparchive | |
parent | 80dcb3eed6c61ca712cdd6cb6042b3e4ba473f8a (diff) | |
download | apt-c0eb6bc6c89ba41011b9e7ef2e94cdfa4c92e142.tar.gz |
* Have "apt-ftparchive release" strip the leading path ...
Author: mdz
Date: 2004-01-02 21:48:13 GMT
* Have "apt-ftparchive release" strip the leading path component from
the checksum entries
Diffstat (limited to 'ftparchive')
-rw-r--r-- | ftparchive/apt-ftparchive.cc | 8 | ||||
-rw-r--r-- | ftparchive/writer.cc | 13 |
2 files changed, 15 insertions, 6 deletions
diff --git a/ftparchive/apt-ftparchive.cc b/ftparchive/apt-ftparchive.cc index 287f40a10..64aa58f4c 100644 --- a/ftparchive/apt-ftparchive.cc +++ b/ftparchive/apt-ftparchive.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: apt-ftparchive.cc,v 1.11 2003/12/26 22:50:52 mdz Exp $ +// $Id: apt-ftparchive.cc,v 1.12 2004/01/02 21:48:13 mdz Exp $ /* ###################################################################### apt-scanpackages - Efficient work-alike for dpkg-scanpackages @@ -681,11 +681,15 @@ bool SimpleGenRelease(CommandLine &CmdL) if (CmdL.FileSize() < 2) return ShowHelp(CmdL); + string Dir = CmdL.FileList[1]; + ReleaseWriter Release(""); + Release.DirStrip = Dir; + if (_error->PendingError() == true) return false; - if (Release.RecursiveScan(CmdL.FileList[1]) == false) + if (Release.RecursiveScan(Dir) == false) return false; Release.Finish(); diff --git a/ftparchive/writer.cc b/ftparchive/writer.cc index d7d843067..e495a4c45 100644 --- a/ftparchive/writer.cc +++ b/ftparchive/writer.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: writer.cc,v 1.10 2003/12/26 23:09:30 mdz Exp $ +// $Id: writer.cc,v 1.11 2004/01/02 21:48:13 mdz Exp $ /* ###################################################################### Writer @@ -849,9 +849,14 @@ bool ReleaseWriter::DoPackage(string FileName) FileName.length() > DirStrip.length() && stringcmp(FileName.begin(),FileName.begin() + DirStrip.length(), DirStrip.begin(),DirStrip.end()) == 0) + { NewFileName = string(FileName.begin() + DirStrip.length(),FileName.end()); + while (NewFileName[0] == '/') + NewFileName = string(FileName.begin() + 1,FileName.end()); + } else NewFileName = FileName; + if (PathPrefix.empty() == false) NewFileName = flCombine(PathPrefix,NewFileName); @@ -862,16 +867,16 @@ bool ReleaseWriter::DoPackage(string FileName) return false; } - CheckSums[FileName].size = fd.Size(); + CheckSums[NewFileName].size = fd.Size(); MD5Summation MD5; MD5.AddFD(fd.Fd(), fd.Size()); - CheckSums[FileName].MD5 = MD5.Result(); + CheckSums[NewFileName].MD5 = MD5.Result(); fd.Seek(0); SHA1Summation SHA1; SHA1.AddFD(fd.Fd(), fd.Size()); - CheckSums[FileName].SHA1 = SHA1.Result(); + CheckSums[NewFileName].SHA1 = SHA1.Result(); fd.Close(); |