[Debtags-commits] [svn] r1025 - in libdebtags1/trunk: . debian
debtags
Enrico Zini
enrico at costa.debian.org
Sun Jul 31 01:35:00 UTC 2005
Author: enrico
Date: Sun Jul 31 01:34:59 2005
New Revision: 1025
Modified:
libdebtags1/trunk/README
libdebtags1/trunk/debian/changelog
libdebtags1/trunk/debtags/Update.cc
Log:
Cleanup fetcher code
Use /var/cache/debtags/partial as download directory
Don't ask apt to decompress, since debtags can do it (it also avoids messing with file names)
Correctly catch errors on renaming the downloaded file
Modified: libdebtags1/trunk/README
==============================================================================
--- libdebtags1/trunk/README (original)
+++ libdebtags1/trunk/README Sun Jul 31 01:34:59 2005
@@ -119,6 +119,15 @@
These are the TODO-list items completed so far::
+ * Done in version 1.0.7
+
+ + Don't read /usr/share/debtags/vocabulary on update: after a restructuring,
+ it might bring in obsolete tags. That file can best be used as copied in the
+ APT download cache before debtags update on postinst.
+ + Do the download in /var/cache/debtags/partial instead of libapt's default
+ + Simplified downloader code
+
+
* Done in version 1.0.5
+ Transition to gcc4
Modified: libdebtags1/trunk/debian/changelog
==============================================================================
--- libdebtags1/trunk/debian/changelog (original)
+++ libdebtags1/trunk/debian/changelog Sun Jul 31 01:34:59 2005
@@ -1,3 +1,12 @@
+libdebtags1 (1.0.7) unstable; urgency=low
+
+ * Catch error while renaming the downloaded file.
+ Also tries to download in a /var/cache/debtags/partial instead of
+ libapt's default, to have more chances to be in the same partition.
+ Closes: #319126.
+
+ -- Enrico Zini <enrico at debian.org> Sun, 31 Jul 2005 03:17:43 +0200
+
libdebtags1 (1.0.6) unstable; urgency=low
* Compiles with gcc 4
Modified: libdebtags1/trunk/debtags/Update.cc
==============================================================================
--- libdebtags1/trunk/debtags/Update.cc (original)
+++ libdebtags1/trunk/debtags/Update.cc Sun Jul 31 01:34:59 2005
@@ -325,21 +325,19 @@
// Item class for index files
class AcqTagfile: public pkgAcquire::Item
{
- protected:
- bool decompression;
- bool erase;
- pkgAcquire::ItemDesc Desc;
- string RealURI;
-
- public:
-
- // Specialized action members
- virtual void Done(string Message,unsigned long Size,string Md5Hash,
- pkgAcquire::MethodConfig *Cnf);
- virtual string DescURI() {return RealURI + ".gz";};
+protected:
+ pkgAcquire::ItemDesc Desc;
+ string RealURI;
- AcqTagfile(pkgAcquire *Owner,string URI,string URIDesc,
- string ShortDesct);
+public:
+
+ // Specialized action members
+ virtual void Done(string Message,unsigned long Size,string Md5Hash,
+ pkgAcquire::MethodConfig *Cnf);
+ virtual string DescURI() {return RealURI + ".gz";};
+
+ AcqTagfile(pkgAcquire *Owner,string URI,string URIDesc,
+ string ShortDesct);
};
// AcqTagfile::AcqTagfile - Constructor
@@ -348,23 +346,21 @@
instantiated to fetch the revision file */
AcqTagfile::AcqTagfile(pkgAcquire *Owner,
string URI,string URIDesc,string ShortDesc) :
- Item(Owner), RealURI(URI)
+ Item(Owner), RealURI(URI)
{
- //fprintf(stderr, "AcqTagfile::AcqTagfile ('%.*s') called\n", PFSTR(URI));
- decompression = false;
- erase = false;
+ //fprintf(stderr, "AcqTagfile::AcqTagfile ('%.*s') called\n", PFSTR(URI));
- DestFile = _config->FindDir("Dir::State::lists") + "partial/";
- DestFile += URItoFileName(URI);
- //fprintf(stderr, "DestFile: %.*s\n", PFSTR(DestFile));
-
- // Create the item
- Desc.URI = URI;
- Desc.Description = URIDesc;
- Desc.Owner = this;
- Desc.ShortDesc = ShortDesc;
+ DestFile = string(path_cache) + "/partial/"; //_config->FindDir("Dir::State::lists") + "partial/";
+ DestFile += URItoFileName(URI);
+ //fprintf(stderr, "DestFile: %.*s\n", PFSTR(DestFile));
+
+ // Create the item
+ Desc.URI = URI;
+ Desc.Description = URIDesc;
+ Desc.Owner = this;
+ Desc.ShortDesc = ShortDesc;
- QueueURI(Desc);
+ QueueURI(Desc);
}
// AcqTagfile::Done - Finished a fetch
@@ -377,40 +373,41 @@
void AcqTagfile::Done(string Message,unsigned long Size,string MD5,
pkgAcquire::MethodConfig *Cfg)
{
- Item::Done(Message,Size,MD5,Cfg);
- //fprintf(stderr, "AcqTagfile::Done (%.*s) called.\n", PFSTR(Message));
+ Item::Done(Message,Size,MD5,Cfg);
+ //fprintf(stderr, "AcqTagfile::Done (%.*s) called.\n", PFSTR(Message));
- if (decompression == true)
- {
- /* if (MD5.empty())
- {
- MD5Summation sum;
- FileFd Fd(DestFile, FileFd::ReadOnly);
- sum.AddFD(Fd.Fd(), Fd.Size());
- Fd.Close();
- MD5 = (string)sum.Result();
- } */
-
- // Done, move it into position
- //string FinalFile = _config->FindDir("Dir::State::lists") + "tags/";
- string FinalFile = path_cache;
- FinalFile += "/" + URItoFileName(RealURI);
- //fprintf(stderr, "FinalFile: %.*s\n", PFSTR(FinalFile));
- Rename(DestFile,FinalFile);
- chmod(FinalFile.c_str(),0644);
-
- /* We restore the original name to DestFile so that the clean operation
- will work OK */
- DestFile = _config->FindDir("Dir::State::lists") + "partial/";
- DestFile += URItoFileName(RealURI);
- //fprintf(stderr, "DestFile: %.*s\n", PFSTR(DestFile));
-
- // Remove the compressed version.
- if (erase == true)
- unlink(DestFile.c_str());
- return;
- }
+ /* if (MD5.empty())
+ {
+ MD5Summation sum;
+ FileFd Fd(DestFile, FileFd::ReadOnly);
+ sum.AddFD(Fd.Fd(), Fd.Size());
+ Fd.Close();
+ MD5 = (string)sum.Result();
+ } */
+
+ // Done, move it into position
+ //string FinalFile = _config->FindDir("Dir::State::lists") + "tags/";
+ string FinalFile = path_cache;
+ FinalFile += "/" + URItoFileName(RealURI);
+ //fprintf(stderr, "FinalFile: %.*s\n", PFSTR(FinalFile));
+ // TODO: replace this by a properly checked rename
+ //Rename(DestFile,FinalFile);
+ if (rename(DestFile.c_str(), FinalFile.c_str()) == -1)
+ throw FileException(errno, "renaming " + DestFile + " to " + FinalFile);
+ chmod(FinalFile.c_str(),0644);
+
+ /* We restore the original name to DestFile so that the clean operation
+ will work OK */
+ //DestFile = _config->FindDir("Dir::State::lists") + "partial/";
+ //DestFile += URItoFileName(RealURI);
+ //fprintf(stderr, "DestFile: %.*s\n", PFSTR(DestFile));
+
+ // Remove the compressed version.
+ //if (erase == true)
+ //unlink(DestFile.c_str());
+ return;
+/*
erase = false;
Complete = true;
@@ -451,6 +448,7 @@
Desc.URI = "gzip:" + FileName;
QueueURI(Desc);
Mode = "gzip";
+*/
}
class basicAcquireStatus : public pkgAcquireStatus
@@ -520,7 +518,7 @@
pkgAcquire fetcher(status);
vector<AcqTagfile*> acquirers;
- // TODO: deallocate acquirers!
+ // TODO: deallocate acquirers (or is pkgAcquire doing it?)
for (vector<source>::const_iterator i = sources.begin();
i != sources.end(); i++)
switch (i->type)
More information about the Debtags-commits
mailing list