From a537ce19f955f39ee62281bb12bc71a4c67bc635 Mon Sep 17 00:00:00 2001
From: Michael Vogt
Date: Mon, 2 Dec 2013 08:01:00 +0100
Subject: first version with test
---
apt-pkg/sourcelist.cc | 46 ++++++++++++++++++++++++++++++++++++++++------
1 file changed, 40 insertions(+), 6 deletions(-)
(limited to 'apt-pkg')
diff --git a/apt-pkg/sourcelist.cc b/apt-pkg/sourcelist.cc
index 0fd237cad..1261ebb52 100644
--- a/apt-pkg/sourcelist.cc
+++ b/apt-pkg/sourcelist.cc
@@ -17,6 +17,7 @@
#include
#include
#include
+#include
#include
@@ -242,16 +243,49 @@ bool pkgSourceList::Read(string File)
/* */
bool pkgSourceList::ReadAppend(string File)
{
+ // try reading as deb822
+ // FIXME: proper error handling so that we do not error for good old-style
+ // sources
+ FileFd Fd(File, FileFd::ReadOnly);
+ pkgTagFile Sources(&Fd);
+ if (_error->PendingError() == false)
+ {
+ pkgTagSection Tags;
+ map Options;
+ int i=0;
+ while (Sources.Step(Tags) == true)
+ {
+ if(!Tags.Exists("Type"))
+ continue;
+ string const type = Tags.FindS("Type");
+ Type *Parse = Type::GetType(type.c_str());
+ if (Parse == 0)
+ return _error->Error(_("Type '%s' is not known on stanza %u in source list %s"),type.c_str(),i,File.c_str());
+
+ string URI = Tags.FindS("URL");
+ if (!Parse->FixupURI(URI))
+ return _error->Error(_("Malformed stanza %lu in source list %s (URI parse)"),i,File.c_str());
+ string const Dist = Tags.FindS("Dist");
+ string const Section = Tags.FindS("Section");
+ // check if there are any options we support
+ const char* option_str[] = {
+ "arch", "arch+", "arch-", "trusted" };
+ for (unsigned int j=0; j < sizeof(option_str)/sizeof(char*); j++)
+ if (Tags.Exists(option_str[j]))
+ Options[option_str[j]] = Tags.FindS(option_str[j]);
+ Parse->CreateItem(SrcList, URI, Dist, Section, Options);
+ i++;
+ }
+ // we are done
+ if(i>0)
+ return true;
+ }
+
// Open the stream for reading
ifstream F(File.c_str(),ios::in /*| ios::nocreate*/);
if (!F != 0)
return _error->Errno("ifstream::ifstream",_("Opening %s"),File.c_str());
-
-#if 0 // Now Reset() does this.
- for (const_iterator I = SrcList.begin(); I != SrcList.end(); I++)
- delete *I;
- SrcList.erase(SrcList.begin(),SrcList.end());
-#endif
+
// CNC:2003-12-10 - 300 is too short.
char Buffer[1024];
--
cgit v1.2.3-70-g09d2
From 300b15e3456aff88b3016a8bac90a0ba8911db8f Mon Sep 17 00:00:00 2001
From: Michael Vogt
Date: Mon, 2 Dec 2013 08:36:10 +0100
Subject: fix section adding
---
apt-pkg/sourcelist.cc | 11 ++++++++++-
test/integration/test-apt-sources-deb822 | 10 ++++++++++
2 files changed, 20 insertions(+), 1 deletion(-)
(limited to 'apt-pkg')
diff --git a/apt-pkg/sourcelist.cc b/apt-pkg/sourcelist.cc
index 1261ebb52..4883e2fab 100644
--- a/apt-pkg/sourcelist.cc
+++ b/apt-pkg/sourcelist.cc
@@ -273,7 +273,16 @@ bool pkgSourceList::ReadAppend(string File)
for (unsigned int j=0; j < sizeof(option_str)/sizeof(char*); j++)
if (Tags.Exists(option_str[j]))
Options[option_str[j]] = Tags.FindS(option_str[j]);
- Parse->CreateItem(SrcList, URI, Dist, Section, Options);
+
+ // now create one item per section
+ std::vector list;
+ if (Section.find(","))
+ list = StringSplit(Section, ",");
+ else
+ list = StringSplit(Section, " ");
+ for (int i=0; i < list.size(); i++)
+ Parse->CreateItem(SrcList, URI, Dist, list[i], Options);
+
i++;
}
// we are done
diff --git a/test/integration/test-apt-sources-deb822 b/test/integration/test-apt-sources-deb822
index cdf30c02a..6e9700bb0 100755
--- a/test/integration/test-apt-sources-deb822
+++ b/test/integration/test-apt-sources-deb822
@@ -22,6 +22,16 @@ testequal "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.
'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 " aptget update --print-uris
+# two sections (we support both "," and " " as seperator)
+echo "$BASE" | sed s/main/"main,contrib"/ > rootdir/etc/apt/sources.list
+
+testequal "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 :
+'http://ftp.debian.org/debian/dists/stable/contrib/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_contrib_binary-i386_Packages 0 :
+'http://ftp.debian.org/debian/dists/stable/contrib/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_contrib_i18n_Translation-en 0 :
+'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 :
+'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 " aptget update --print-uris
+
+
# Two entries
echo "$BASE" > rootdir/etc/apt/sources.list
echo "" >> rootdir/etc/apt/sources.list
--
cgit v1.2.3-70-g09d2
From 6f4478134e13070517c00960e7eb3793d142c0ea Mon Sep 17 00:00:00 2001
From: Michael Vogt
Date: Mon, 9 Dec 2013 07:59:18 +0100
Subject: refactor deb822 reading into its own function
---
apt-pkg/sourcelist.cc | 49 +++++++++++++++++++++++++++++++++----------------
apt-pkg/sourcelist.h | 5 ++++-
2 files changed, 37 insertions(+), 17 deletions(-)
(limited to 'apt-pkg')
diff --git a/apt-pkg/sourcelist.cc b/apt-pkg/sourcelist.cc
index 4883e2fab..c28cf0127 100644
--- a/apt-pkg/sourcelist.cc
+++ b/apt-pkg/sourcelist.cc
@@ -238,21 +238,15 @@ bool pkgSourceList::Read(string File)
return ReadAppend(File);
}
/*}}}*/
-// SourceList::ReadAppend - Parse a sourcelist file /*{{{*/
-// ---------------------------------------------------------------------
-/* */
-bool pkgSourceList::ReadAppend(string File)
+
+// FIXME: move into pkgSourceList::Type::ParseFile()
+bool pkgSourceList::ParseFileDeb822(FileFd &Fd)
{
- // try reading as deb822
- // FIXME: proper error handling so that we do not error for good old-style
- // sources
- FileFd Fd(File, FileFd::ReadOnly);
- pkgTagFile Sources(&Fd);
- if (_error->PendingError() == false)
- {
pkgTagSection Tags;
map Options;
- int i=0;
+ unsigned int i=0;
+
+ pkgTagFile Sources(&Fd);
while (Sources.Step(Tags) == true)
{
if(!Tags.Exists("Type"))
@@ -260,11 +254,11 @@ bool pkgSourceList::ReadAppend(string File)
string const type = Tags.FindS("Type");
Type *Parse = Type::GetType(type.c_str());
if (Parse == 0)
- return _error->Error(_("Type '%s' is not known on stanza %u in source list %s"),type.c_str(),i,File.c_str());
+ return _error->Error(_("Type '%s' is not known on stanza %u in source list %s"),type.c_str(),i,Fd.Name().c_str());
string URI = Tags.FindS("URL");
if (!Parse->FixupURI(URI))
- return _error->Error(_("Malformed stanza %lu in source list %s (URI parse)"),i,File.c_str());
+ return _error->Error(_("Malformed stanza %u in source list %s (URI parse)"),i,Fd.Name().c_str());
string const Dist = Tags.FindS("Dist");
string const Section = Tags.FindS("Section");
// check if there are any options we support
@@ -280,16 +274,39 @@ bool pkgSourceList::ReadAppend(string File)
list = StringSplit(Section, ",");
else
list = StringSplit(Section, " ");
- for (int i=0; i < list.size(); i++)
- Parse->CreateItem(SrcList, URI, Dist, list[i], Options);
+ for (std::vector::const_iterator I = list.begin();
+ I != list.end(); I++)
+ Parse->CreateItem(SrcList, URI, Dist, (*I), Options);
i++;
}
+
// we are done
if(i>0)
return true;
+
+ return false;
+}
+
+
+// SourceList::ReadAppend - Parse a sourcelist file /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+bool pkgSourceList::ReadAppend(string File)
+{
+ // *first* try reading as deb822
+ // FIXME: proper error handling so that we do not error for good old-style
+ // sources
+ FileFd Fd(File, FileFd::ReadOnly);
+ if (_error->PendingError() == false)
+ {
+ if (ParseFileDeb822(Fd))
+ return true;
}
+
+ // *then* read as old-style sources.list
+
// Open the stream for reading
ifstream F(File.c_str(),ios::in /*| ios::nocreate*/);
if (!F != 0)
diff --git a/apt-pkg/sourcelist.h b/apt-pkg/sourcelist.h
index 02e27101a..af3f4f5c6 100644
--- a/apt-pkg/sourcelist.h
+++ b/apt-pkg/sourcelist.h
@@ -75,7 +75,10 @@ class pkgSourceList
protected:
std::vector SrcList;
-
+
+ // FIXME: move int Type with the next ABI break
+ bool ParseFileDeb822(FileFd &Fd);
+
public:
bool ReadMainList();
--
cgit v1.2.3-70-g09d2
From 1fa78a8a3730633be662df07f7aec8f4c3dcc766 Mon Sep 17 00:00:00 2001
From: Michael Vogt
Date: Mon, 9 Dec 2013 08:21:53 +0100
Subject: more refactor
---
apt-pkg/sourcelist.cc | 133 +++++++++++++++++++++++++-------------------------
apt-pkg/sourcelist.h | 4 +-
2 files changed, 69 insertions(+), 68 deletions(-)
(limited to 'apt-pkg')
diff --git a/apt-pkg/sourcelist.cc b/apt-pkg/sourcelist.cc
index c28cf0127..714918bc1 100644
--- a/apt-pkg/sourcelist.cc
+++ b/apt-pkg/sourcelist.cc
@@ -160,7 +160,6 @@ bool pkgSourceList::Type::ParseLine(vector &List,
return true;
}
/*}}}*/
-
// SourceList::pkgSourceList - Constructors /*{{{*/
// ---------------------------------------------------------------------
/* */
@@ -182,7 +181,6 @@ pkgSourceList::~pkgSourceList()
delete *I;
}
/*}}}*/
- /*}}}*/
// SourceList::ReadMainList - Read the main source list from etc /*{{{*/
// ---------------------------------------------------------------------
/* */
@@ -217,7 +215,6 @@ bool pkgSourceList::ReadMainList()
return Res;
}
/*}}}*/
-// CNC:2003-03-03 - Needed to preserve backwards compatibility.
// SourceList::Reset - Clear the sourcelist contents /*{{{*/
// ---------------------------------------------------------------------
/* */
@@ -228,7 +225,6 @@ void pkgSourceList::Reset()
SrcList.erase(SrcList.begin(),SrcList.end());
}
/*}}}*/
-// CNC:2003-03-03 - Function moved to ReadAppend() and Reset().
// SourceList::Read - Parse the sourcelist file /*{{{*/
// ---------------------------------------------------------------------
/* */
@@ -238,75 +234,21 @@ bool pkgSourceList::Read(string File)
return ReadAppend(File);
}
/*}}}*/
-
-// FIXME: move into pkgSourceList::Type::ParseFile()
-bool pkgSourceList::ParseFileDeb822(FileFd &Fd)
-{
- pkgTagSection Tags;
- map Options;
- unsigned int i=0;
-
- pkgTagFile Sources(&Fd);
- while (Sources.Step(Tags) == true)
- {
- if(!Tags.Exists("Type"))
- continue;
- string const type = Tags.FindS("Type");
- Type *Parse = Type::GetType(type.c_str());
- if (Parse == 0)
- return _error->Error(_("Type '%s' is not known on stanza %u in source list %s"),type.c_str(),i,Fd.Name().c_str());
-
- string URI = Tags.FindS("URL");
- if (!Parse->FixupURI(URI))
- return _error->Error(_("Malformed stanza %u in source list %s (URI parse)"),i,Fd.Name().c_str());
- string const Dist = Tags.FindS("Dist");
- string const Section = Tags.FindS("Section");
- // check if there are any options we support
- const char* option_str[] = {
- "arch", "arch+", "arch-", "trusted" };
- for (unsigned int j=0; j < sizeof(option_str)/sizeof(char*); j++)
- if (Tags.Exists(option_str[j]))
- Options[option_str[j]] = Tags.FindS(option_str[j]);
-
- // now create one item per section
- std::vector list;
- if (Section.find(","))
- list = StringSplit(Section, ",");
- else
- list = StringSplit(Section, " ");
- for (std::vector::const_iterator I = list.begin();
- I != list.end(); I++)
- Parse->CreateItem(SrcList, URI, Dist, (*I), Options);
-
- i++;
- }
-
- // we are done
- if(i>0)
- return true;
-
- return false;
-}
-
-
// SourceList::ReadAppend - Parse a sourcelist file /*{{{*/
// ---------------------------------------------------------------------
/* */
bool pkgSourceList::ReadAppend(string File)
{
- // *first* try reading as deb822
- // FIXME: proper error handling so that we do not error for good old-style
- // sources
- FileFd Fd(File, FileFd::ReadOnly);
- if (_error->PendingError() == false)
- {
- if (ParseFileDeb822(Fd))
+ if (ParseFileDeb822(File))
return true;
- }
-
-
- // *then* read as old-style sources.list
+ return ParseFileOldStyle(File);
+}
+// SourceList::ReadFileOldStyle - Read Traditional style sources.list /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+bool pkgSourceList::ParseFileOldStyle(string File)
+{
// Open the stream for reading
ifstream F(File.c_str(),ios::in /*| ios::nocreate*/);
if (!F != 0)
@@ -358,6 +300,65 @@ bool pkgSourceList::ReadAppend(string File)
return true;
}
/*}}}*/
+// SourceList::ParseFileDeb822 - Parse deb822 style sources.list /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+bool pkgSourceList::ParseFileDeb822(string File)
+{
+ // FIXME: proper error handling so that we do not error for good old-style
+ // sources
+ FileFd Fd(File, FileFd::ReadOnly);
+ if (_error->PendingError() == true)
+ {
+ return false;
+ }
+
+ pkgTagSection Tags;
+ map Options;
+ unsigned int i=0;
+
+ pkgTagFile Sources(&Fd);
+ while (Sources.Step(Tags) == true)
+ {
+ if(!Tags.Exists("Type"))
+ continue;
+ string const type = Tags.FindS("Type");
+ Type *Parse = Type::GetType(type.c_str());
+ if (Parse == 0)
+ return _error->Error(_("Type '%s' is not known on stanza %u in source list %s"),type.c_str(),i,Fd.Name().c_str());
+
+ string URI = Tags.FindS("URL");
+ if (!Parse->FixupURI(URI))
+ return _error->Error(_("Malformed stanza %u in source list %s (URI parse)"),i,Fd.Name().c_str());
+ string const Dist = Tags.FindS("Dist");
+ string const Section = Tags.FindS("Section");
+ // check if there are any options we support
+ const char* option_str[] = {
+ "arch", "arch+", "arch-", "trusted" };
+ for (unsigned int j=0; j < sizeof(option_str)/sizeof(char*); j++)
+ if (Tags.Exists(option_str[j]))
+ Options[option_str[j]] = Tags.FindS(option_str[j]);
+
+ // now create one item per section
+ std::vector list;
+ if (Section.find(","))
+ list = StringSplit(Section, ",");
+ else
+ list = StringSplit(Section, " ");
+ for (std::vector::const_iterator I = list.begin();
+ I != list.end(); I++)
+ Parse->CreateItem(SrcList, URI, Dist, (*I), Options);
+
+ i++;
+ }
+
+ // we are done
+ if(i>0)
+ return true;
+
+ return false;
+}
+ /*}}}*/
// SourceList::FindIndex - Get the index associated with a file /*{{{*/
// ---------------------------------------------------------------------
/* */
diff --git a/apt-pkg/sourcelist.h b/apt-pkg/sourcelist.h
index af3f4f5c6..5e0d585bb 100644
--- a/apt-pkg/sourcelist.h
+++ b/apt-pkg/sourcelist.h
@@ -76,8 +76,8 @@ class pkgSourceList
std::vector SrcList;
- // FIXME: move int Type with the next ABI break
- bool ParseFileDeb822(FileFd &Fd);
+ bool ParseFileDeb822(std::string File);
+ bool ParseFileOldStyle(std::string File);
public:
--
cgit v1.2.3-70-g09d2
From fce9f472046344d15d4f4df281a003d837cf4177 Mon Sep 17 00:00:00 2001
From: Michael Vogt
Date: Mon, 9 Dec 2013 08:30:01 +0100
Subject: add APT::Sources::Use-Deb822 to allow disabling the deb822 parser
---
apt-pkg/sourcelist.cc | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
(limited to 'apt-pkg')
diff --git a/apt-pkg/sourcelist.cc b/apt-pkg/sourcelist.cc
index 714918bc1..0bbb2bd3f 100644
--- a/apt-pkg/sourcelist.cc
+++ b/apt-pkg/sourcelist.cc
@@ -239,7 +239,8 @@ bool pkgSourceList::Read(string File)
/* */
bool pkgSourceList::ReadAppend(string File)
{
- if (ParseFileDeb822(File))
+ if (_config->FindB("APT::Sources::Use-Deb822", true) == true)
+ if (ParseFileDeb822(File))
return true;
return ParseFileOldStyle(File);
}
@@ -305,19 +306,23 @@ bool pkgSourceList::ParseFileOldStyle(string File)
/* */
bool pkgSourceList::ParseFileDeb822(string File)
{
- // FIXME: proper error handling so that we do not error for good old-style
- // sources
+
+ pkgTagSection Tags;
+ map Options;
+ unsigned int i=0;
+
+ // see if we can read the file
+ _error->PushToStack();
FileFd Fd(File, FileFd::ReadOnly);
+ pkgTagFile Sources(&Fd);
if (_error->PendingError() == true)
{
+ _error->RevertToStack();
return false;
}
-
- pkgTagSection Tags;
- map Options;
- unsigned int i=0;
+ _error->MergeWithStack();
- pkgTagFile Sources(&Fd);
+ // read step by step
while (Sources.Step(Tags) == true)
{
if(!Tags.Exists("Type"))
--
cgit v1.2.3-70-g09d2
From 42e19c826b9da6c21a6d286f31db51bc04c73d87 Mon Sep 17 00:00:00 2001
From: Michael Vogt
Date: Mon, 9 Dec 2013 08:33:28 +0100
Subject: suppoer $(ARCH) in deb822 sources.list as well
---
apt-pkg/sourcelist.cc | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
(limited to 'apt-pkg')
diff --git a/apt-pkg/sourcelist.cc b/apt-pkg/sourcelist.cc
index 0bbb2bd3f..99cdbe030 100644
--- a/apt-pkg/sourcelist.cc
+++ b/apt-pkg/sourcelist.cc
@@ -327,6 +327,7 @@ bool pkgSourceList::ParseFileDeb822(string File)
{
if(!Tags.Exists("Type"))
continue;
+
string const type = Tags.FindS("Type");
Type *Parse = Type::GetType(type.c_str());
if (Parse == 0)
@@ -335,8 +336,10 @@ bool pkgSourceList::ParseFileDeb822(string File)
string URI = Tags.FindS("URL");
if (!Parse->FixupURI(URI))
return _error->Error(_("Malformed stanza %u in source list %s (URI parse)"),i,Fd.Name().c_str());
- string const Dist = Tags.FindS("Dist");
- string const Section = Tags.FindS("Section");
+
+ string Dist = Tags.FindS("Dist");
+ Dist = SubstVar(Dist,"$(ARCH)",_config->Find("APT::Architecture"));
+
// check if there are any options we support
const char* option_str[] = {
"arch", "arch+", "arch-", "trusted" };
@@ -345,6 +348,7 @@ bool pkgSourceList::ParseFileDeb822(string File)
Options[option_str[j]] = Tags.FindS(option_str[j]);
// now create one item per section
+ string const Section = Tags.FindS("Section");
std::vector list;
if (Section.find(","))
list = StringSplit(Section, ",");
--
cgit v1.2.3-70-g09d2
From 5e1ed0889d8aac82ca18add8c6139b153225ae71 Mon Sep 17 00:00:00 2001
From: David Kalnischkies
Date: Sun, 1 Dec 2013 21:52:36 +0100
Subject: query an empty pkgAcqIndexDiffs if index is up-to-date
The previous code already did this, this is just being a hell of a lot
more obvious, so that it isn't that easy to break in the future.
Git-Dch: Ignore
---
apt-pkg/acquire-item.cc | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
(limited to 'apt-pkg')
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc
index b76921312..009531c2e 100644
--- a/apt-pkg/acquire-item.cc
+++ b/apt-pkg/acquire-item.cc
@@ -426,16 +426,18 @@ bool pkgAcqDiffIndex::ParseDiffIndex(string IndexDiffFile) /*{{{*/
SHA1.AddFD(fd);
string const local_sha1 = SHA1.Result();
- if(local_sha1 == ServerSha1)
+ if(local_sha1 == ServerSha1)
{
- // we have the same sha1 as the server
+ // we have the same sha1 as the server so we are done here
if(Debug)
std::clog << "Package file is up-to-date" << std::endl;
- // set found to true, this will queue a pkgAcqIndexDiffs with
- // a empty availabe_patches
- found = true;
- }
- else
+ // list cleanup needs to know that this file as well as the already
+ // present index is ours, so we create an empty diff to save it for us
+ new pkgAcqIndexDiffs(Owner, RealURI, Description, Desc.ShortDesc,
+ ExpectedHash, ServerSha1, available_patches);
+ return true;
+ }
+ else
{
if(Debug)
std::clog << "SHA1-Current: " << ServerSha1 << " and we start at "<< fd.Name() << " " << fd.Size() << " " << local_sha1 << std::endl;
--
cgit v1.2.3-70-g09d2
From 9d39208af5c8c72d3886c70d603921cf427056ee Mon Sep 17 00:00:00 2001
From: David Kalnischkies
Date: Tue, 3 Dec 2013 20:53:04 +0100
Subject: allow ':' in GetListOfFilesInDir
run-parts doesn't allow this char in valid filenames, but we tend to
have files with this character in e.g. /var/lib/apt/lists/
Git-Dch: Ignore
---
apt-pkg/contrib/fileutl.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'apt-pkg')
diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc
index 7fbe4d604..130e990c3 100644
--- a/apt-pkg/contrib/fileutl.cc
+++ b/apt-pkg/contrib/fileutl.cc
@@ -465,7 +465,7 @@ std::vector GetListOfFilesInDir(string const &Dir, std::vector c
const char *C = Ent->d_name;
for (; *C != 0; ++C)
if (isalpha(*C) == 0 && isdigit(*C) == 0
- && *C != '_' && *C != '-') {
+ && *C != '_' && *C != '-' && *C != ':') {
// no required extension -> dot is a bad character
if (*C == '.' && Ext.empty() == false)
continue;
--
cgit v1.2.3-70-g09d2
From 47d2bc78adb49f3182f9a3d7a4baea363e772d64 Mon Sep 17 00:00:00 2001
From: David Kalnischkies
Date: Fri, 6 Dec 2013 12:17:48 +0100
Subject: implement POC client-side merging of pdiffs via apt-file
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The idea of pdiffs is to avoid downloading the hole file by patching the
existing index. This works very well, but becomes slow if a lot of
patches needs to be applied to reconstruct an up-to-date index and in
recent years more and more dinstall (or similar) runs are executed
creating more and more pdiffs in the same amount of time, so pdiffs
became less useful.
The solution is simple: Reduce the amount of patches (which are very
small) which need to be applied on top of the index we have available
(which is usually pretty big).
This can be done in two ways: Either merge the patches on the
server-side so that the client has to download only one patch or the
patches are all downloaded and merged on the client-side.
The first needs a client who is doing one step at a time who can also
skip patches if it needs (APT supports this for a long time now).
The later is implemented by this commit, but depends on the server NOT
merging the patches and the patches being in a strict order in which no
patch is skipped.
This is traditionally the case for dak, but other repository creators
support merging – e.g. reprepro (which helpfully adds a flag indicating
that the patches are merged). To support both or even mixes a client
needs more information which isn't available for now.
This POC uses the external diffindex-rred included in apt-file to
do the heavy lifting of merging & applying all patches in one pass,
hence to test this feature apt-file needs to be installed.
---
apt-pkg/acquire-item.cc | 151 +++++++++++++++++++++++++++++++++++++-
apt-pkg/acquire-item.h | 100 ++++++++++++++++++++++++-
methods/rred.cc | 128 ++++++++++++++++++++++++--------
test/integration/test-pdiff-usage | 147 ++++++++++++++++++++++++++++++++-----
4 files changed, 470 insertions(+), 56 deletions(-)
(limited to 'apt-pkg')
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc
index 009531c2e..b5b9577ef 100644
--- a/apt-pkg/acquire-item.cc
+++ b/apt-pkg/acquire-item.cc
@@ -498,14 +498,42 @@ bool pkgAcqDiffIndex::ParseDiffIndex(string IndexDiffFile) /*{{{*/
}
// we have something, queue the next diff
- if(found)
+ if(found)
{
// queue the diffs
string::size_type const last_space = Description.rfind(" ");
if(last_space != string::npos)
Description.erase(last_space, Description.size()-last_space);
- new pkgAcqIndexDiffs(Owner, RealURI, Description, Desc.ShortDesc,
- ExpectedHash, ServerSha1, available_patches);
+
+ /* decide if we should download patches one by one or in one go:
+ The first is good if the server merges patches, but many don't so client
+ based merging can be attempt in which case the second is better.
+ "bad things" will happen if patches are merged on the server,
+ but client side merging is attempt as well */
+ bool pdiff_merge = _config->FindB("Acquire::PDiffs::Merge", true);
+ if (pdiff_merge == true)
+ {
+ // this perl script is provided by apt-file
+ pdiff_merge = FileExists(_config->FindFile("Dir::Bin::rred", "/usr/bin/diffindex-rred"));
+ if (pdiff_merge == true)
+ {
+ // reprepro adds this flag if it has merged patches on the server
+ std::string const precedence = Tags.FindS("X-Patch-Precedence");
+ pdiff_merge = (precedence != "merged");
+ }
+ }
+
+ if (pdiff_merge == false)
+ new pkgAcqIndexDiffs(Owner, RealURI, Description, Desc.ShortDesc,
+ ExpectedHash, ServerSha1, available_patches);
+ else
+ {
+ std::vector *diffs = new std::vector(available_patches.size());
+ for(size_t i = 0; i < available_patches.size(); ++i)
+ (*diffs)[i] = new pkgAcqIndexMergeDiffs(Owner, RealURI, Description, Desc.ShortDesc, ExpectedHash,
+ available_patches[i], diffs);
+ }
+
Complete = false;
Status = StatDone;
Dequeue();
@@ -754,6 +782,123 @@ void pkgAcqIndexDiffs::Done(string Message,unsigned long long Size,string Md5Has
}
}
/*}}}*/
+// AcqIndexMergeDiffs::AcqIndexMergeDiffs - Constructor /*{{{*/
+pkgAcqIndexMergeDiffs::pkgAcqIndexMergeDiffs(pkgAcquire *Owner,
+ string const &URI, string const &URIDesc,
+ string const &ShortDesc, HashString const &ExpectedHash,
+ DiffInfo const &patch,
+ std::vector const * const allPatches)
+ : Item(Owner), RealURI(URI), ExpectedHash(ExpectedHash),
+ patch(patch),allPatches(allPatches), State(StateFetchDiff)
+{
+
+ DestFile = _config->FindDir("Dir::State::lists") + "partial/";
+ DestFile += URItoFileName(URI);
+
+ Debug = _config->FindB("Debug::pkgAcquire::Diffs",false);
+
+ Description = URIDesc;
+ Desc.Owner = this;
+ Desc.ShortDesc = ShortDesc;
+
+ Desc.URI = string(RealURI) + ".diff/" + patch.file + ".gz";
+ Desc.Description = Description + " " + patch.file + string(".pdiff");
+ DestFile = _config->FindDir("Dir::State::lists") + "partial/";
+ DestFile += URItoFileName(RealURI + ".diff/" + patch.file);
+
+ if(Debug)
+ std::clog << "pkgAcqIndexMergeDiffs: " << Desc.URI << std::endl;
+
+ QueueURI(Desc);
+}
+ /*}}}*/
+void pkgAcqIndexMergeDiffs::Failed(string Message,pkgAcquire::MethodConfig *Cnf)/*{{{*/
+{
+ if(Debug)
+ std::clog << "pkgAcqIndexMergeDiffs failed: " << Desc.URI << " with " << Message << std::endl;
+ Complete = false;
+ Status = StatDone;
+ Dequeue();
+
+ // check if we are the first to fail, otherwise we are done here
+ State = StateDoneDiff;
+ for (std::vector::const_iterator I = allPatches->begin();
+ I != allPatches->end(); ++I)
+ if ((*I)->State == StateErrorDiff)
+ return;
+
+ // first failure means we should fallback
+ State = StateErrorDiff;
+ std::clog << "Falling back to normal index file aquire" << std::endl;
+ new pkgAcqIndex(Owner, RealURI, Description,Desc.ShortDesc,
+ ExpectedHash);
+}
+ /*}}}*/
+void pkgAcqIndexMergeDiffs::Done(string Message,unsigned long long Size,string Md5Hash, /*{{{*/
+ pkgAcquire::MethodConfig *Cnf)
+{
+ if(Debug)
+ std::clog << "pkgAcqIndexMergeDiffs::Done(): " << Desc.URI << std::endl;
+
+ Item::Done(Message,Size,Md5Hash,Cnf);
+
+ string const FinalFile = _config->FindDir("Dir::State::lists") + URItoFileName(RealURI);
+
+ if (State == StateFetchDiff)
+ {
+ // rred expects the patch as $FinalFile.ed.$patchname.gz
+ Rename(DestFile, FinalFile + ".ed." + patch.file + ".gz");
+
+ // check if this is the last completed diff
+ State = StateDoneDiff;
+ for (std::vector::const_iterator I = allPatches->begin();
+ I != allPatches->end(); ++I)
+ if ((*I)->State != StateDoneDiff)
+ {
+ if(Debug)
+ std::clog << "Not the last done diff in the batch: " << Desc.URI << std::endl;
+ return;
+ }
+
+ // this is the last completed diff, so we are ready to apply now
+ State = StateApplyDiff;
+
+ if(Debug)
+ std::clog << "Sending to rred method: " << FinalFile << std::endl;
+
+ Local = true;
+ Desc.URI = "rred:" + FinalFile;
+ QueueURI(Desc);
+ Mode = "rred";
+ return;
+ }
+ // success in download/apply all diffs, clean up
+ else if (State == StateApplyDiff)
+ {
+ // see if we really got the expected file
+ if(!ExpectedHash.empty() && !ExpectedHash.VerifyFile(DestFile))
+ {
+ RenameOnError(HashSumMismatch);
+ return;
+ }
+
+ // move the result into place
+ if(Debug)
+ std::clog << "Moving patched file in place: " << std::endl
+ << DestFile << " -> " << FinalFile << std::endl;
+ Rename(DestFile, FinalFile);
+ chmod(FinalFile.c_str(), 0644);
+
+ // otherwise lists cleanup will eat the file
+ DestFile = FinalFile;
+
+ // all set and done
+ Complete = true;
+ if(Debug)
+ std::clog << "allDone: " << DestFile << "\n" << std::endl;
+ }
+}
+ /*}}}*/
// AcqIndex::AcqIndex - Constructor /*{{{*/
// ---------------------------------------------------------------------
/* The package file is added to the queue and a second class is
diff --git a/apt-pkg/acquire-item.h b/apt-pkg/acquire-item.h
index 6b4f73708..5a1c7979c 100644
--- a/apt-pkg/acquire-item.h
+++ b/apt-pkg/acquire-item.h
@@ -429,7 +429,105 @@ class pkgAcqDiffIndex : public pkgAcquire::Item
std::string ShortDesc, HashString ExpectedHash);
};
/*}}}*/
-/** \brief An item that is responsible for fetching all the patches {{{
+/** \brief An item that is responsible for fetching client-merge patches {{{
+ * that need to be applied to a given package index file.
+ *
+ * Instead of downloading and applying each patch one by one like its
+ * sister #pkgAcqIndexDiffs this class will download all patches at once
+ * and call rred with all the patches downloaded once. Rred will then
+ * merge and apply them in one go, which should be a lot faster – but is
+ * incompatible with server-based merges of patches like reprepro can do.
+ *
+ * \sa pkgAcqDiffIndex, pkgAcqIndex
+ */
+class pkgAcqIndexMergeDiffs : public pkgAcquire::Item
+{
+ protected:
+
+ /** \brief If \b true, debugging output will be written to
+ * std::clog.
+ */
+ bool Debug;
+
+ /** \brief description of the item that is currently being
+ * downloaded.
+ */
+ pkgAcquire::ItemDesc Desc;
+
+ /** \brief URI of the package index file that is being
+ * reconstructed.
+ */
+ std::string RealURI;
+
+ /** \brief HashSum of the package index file that is being
+ * reconstructed.
+ */
+ HashString ExpectedHash;
+
+ /** \brief description of the file being downloaded. */
+ std::string Description;
+
+ /** \brief information about the current patch */
+ struct DiffInfo const patch;
+
+ /** \brief list of all download items for the patches */
+ std::vector const * const allPatches;
+
+ /** The current status of this patch. */
+ enum DiffState
+ {
+ /** \brief The diff is currently being fetched. */
+ StateFetchDiff,
+
+ /** \brief The diff is currently being applied. */
+ StateApplyDiff,
+
+ /** \brief the work with this diff is done */
+ StateDoneDiff,
+
+ /** \brief something bad happened and fallback was triggered */
+ StateErrorDiff
+ } State;
+
+ public:
+ /** \brief Called when the patch file failed to be downloaded.
+ *
+ * This method will fall back to downloading the whole index file
+ * outright; its arguments are ignored.
+ */
+ virtual void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf);
+
+ virtual void Done(std::string Message,unsigned long long Size,std::string Md5Hash,
+ pkgAcquire::MethodConfig *Cnf);
+ virtual std::string DescURI() {return RealURI + "Index";};
+
+ /** \brief Create an index merge-diff item.
+ *
+ * \param Owner The pkgAcquire object that owns this item.
+ *
+ * \param URI The URI of the package index file being
+ * reconstructed.
+ *
+ * \param URIDesc A long description of this item.
+ *
+ * \param ShortDesc A brief description of this item.
+ *
+ * \param ExpectedHash The expected md5sum of the completely
+ * reconstructed package index file; the index file will be tested
+ * against this value when it is entirely reconstructed.
+ *
+ * \param patch contains infos about the patch this item is supposed
+ * to download which were read from the index
+ *
+ * \param allPatches contains all related items so that each item can
+ * check if it was the last one to complete the download step
+ */
+ pkgAcqIndexMergeDiffs(pkgAcquire *Owner,std::string const &URI,std::string const &URIDesc,
+ std::string const &ShortDesc, HashString const &ExpectedHash,
+ DiffInfo const &patch, std::vector const * const allPatches);
+};
+ /*}}}*/
+/** \brief An item that is responsible for fetching server-merge patches {{{
* that need to be applied to a given package index file.
*
* After downloading and applying a single patch, this item will
diff --git a/methods/rred.cc b/methods/rred.cc
index 7c65f8f92..bea8ed263 100644
--- a/methods/rred.cc
+++ b/methods/rred.cc
@@ -11,6 +11,8 @@
#include
#include
+#include
+#include
#include
#include
#include
@@ -465,50 +467,112 @@ bool RredMethod::Fetch(FetchItem *Itm) /*{{{*/
} else
URIStart(Res);
- if (Debug == true)
- std::clog << "Patching " << Path << " with " << Path
- << ".ed and putting result into " << Itm->DestFile << std::endl;
- // Open the source and destination files (the d'tor of FileFd will do
- // the cleanup/closing of the fds)
- FileFd From(Path,FileFd::ReadOnly);
- FileFd Patch(Path+".ed",FileFd::ReadOnly, FileFd::Gzip);
- FileFd To(Itm->DestFile,FileFd::WriteAtomic);
- To.EraseOnFailure();
- if (_error->PendingError() == true)
- return false;
-
+ std::string lastPatchName;
Hashes Hash;
- // now do the actual patching
- State const result = patchMMap(Patch, From, To, &Hash);
- if (result == MMAP_FAILED) {
- // retry with patchFile
- Patch.Seek(0);
- From.Seek(0);
- To.Open(Itm->DestFile,FileFd::WriteAtomic);
+
+ // check for a single ed file
+ if (FileExists(Path+".ed") == true)
+ {
+ if (Debug == true)
+ std::clog << "Patching " << Path << " with " << Path
+ << ".ed and putting result into " << Itm->DestFile << std::endl;
+
+ // Open the source and destination files
+ lastPatchName = Path + ".ed";
+ FileFd From(Path,FileFd::ReadOnly);
+ FileFd To(Itm->DestFile,FileFd::WriteAtomic);
+ To.EraseOnFailure();
+ FileFd Patch(lastPatchName, FileFd::ReadOnly, FileFd::Gzip);
if (_error->PendingError() == true)
- return false;
- if (patchFile(Patch, From, To, &Hash) != ED_OK) {
- return _error->WarningE("rred", _("Could not patch %s with mmap and with file operation usage - the patch seems to be corrupt."), Path.c_str());
+ return false;
+
+ // now do the actual patching
+ State const result = patchMMap(Patch, From, To, &Hash);
+ if (result == MMAP_FAILED) {
+ // retry with patchFile
+ Patch.Seek(0);
+ From.Seek(0);
+ To.Open(Itm->DestFile,FileFd::WriteAtomic);
+ if (_error->PendingError() == true)
+ return false;
+ if (patchFile(Patch, From, To, &Hash) != ED_OK) {
+ return _error->WarningE("rred", _("Could not patch %s with mmap and with file operation usage - the patch seems to be corrupt."), Path.c_str());
+ } else if (Debug == true) {
+ std::clog << "rred: finished file patching of " << Path << " after mmap failed." << std::endl;
+ }
+ } else if (result != ED_OK) {
+ return _error->Errno("rred", _("Could not patch %s with mmap (but no mmap specific fail) - the patch seems to be corrupt."), Path.c_str());
} else if (Debug == true) {
- std::clog << "rred: finished file patching of " << Path << " after mmap failed." << std::endl;
+ std::clog << "rred: finished mmap patching of " << Path << std::endl;
}
- } else if (result != ED_OK) {
- return _error->Errno("rred", _("Could not patch %s with mmap (but no mmap specific fail) - the patch seems to be corrupt."), Path.c_str());
- } else if (Debug == true) {
- std::clog << "rred: finished mmap patching of " << Path << std::endl;
+
+ // write out the result
+ From.Close();
+ Patch.Close();
+ To.Close();
}
+ else
+ {
+ if (Debug == true)
+ std::clog << "Patching " << Path << " with all " << Path << ".ed.*.gz files and "
+ << "putting result into " << Itm->DestFile << std::endl;
+
+ int From = open(Path.c_str(), O_RDONLY);
+ unlink(Itm->DestFile.c_str());
+ int To = open(Itm->DestFile.c_str(), O_WRONLY | O_CREAT | O_EXCL, 0644);
+ SetCloseExec(From, false);
+ SetCloseExec(To, false);
+
+ _error->PushToStack();
+ std::vector patches = GetListOfFilesInDir(flNotFile(Path), "gz", true, false);
+ _error->RevertToStack();
+
+ std::string externalrred = _config->Find("Dir::Bin::rred", "/usr/bin/diffindex-rred");
+ std::vector Args;
+ Args.reserve(22);
+ Args.push_back(externalrred.c_str());
+
+ std::string const baseName = Path + ".ed.";
+ for (std::vector::const_iterator p = patches.begin();
+ p != patches.end(); ++p)
+ if (p->compare(0, baseName.length(), baseName) == 0)
+ Args.push_back(p->c_str());
+
+ Args.push_back(NULL);
+
+ pid_t Patcher = ExecFork();
+ if (Patcher == 0) {
+ dup2(From, STDIN_FILENO);
+ dup2(To, STDOUT_FILENO);
+
+ execvp(Args[0], (char **) &Args[0]);
+ std::cerr << "Failed to execute patcher " << Args[0] << "!" << std::endl;
+ _exit(100);
+ }
+ // last is NULL, so the one before is the last patch
+ lastPatchName = Args[Args.size() - 2];
- // write out the result
- From.Close();
- Patch.Close();
- To.Close();
+ if (ExecWait(Patcher, "rred") == false)
+ return _error->Errno("rred", "Patching via external rred failed");
+
+ close(From);
+ close(To);
+
+ struct stat Buf;
+ if (stat(Itm->DestFile.c_str(), &Buf) != 0)
+ return _error->Errno("stat",_("Failed to stat"));
+
+ To = open(Path.c_str(), O_RDONLY);
+ Hash.AddFD(To, Buf.st_size);
+ close(To);
+ }
/* Transfer the modification times from the patch file
to be able to see in which state the file should be
and use the access time from the "old" file */
struct stat BufBase, BufPatch;
if (stat(Path.c_str(),&BufBase) != 0 ||
- stat(std::string(Path+".ed").c_str(),&BufPatch) != 0)
+ stat(lastPatchName.c_str(), &BufPatch) != 0)
return _error->Errno("stat",_("Failed to stat"));
struct utimbuf TimeBuf;
diff --git a/test/integration/test-pdiff-usage b/test/integration/test-pdiff-usage
index ac0563b7f..5a06e0ccb 100755
--- a/test/integration/test-pdiff-usage
+++ b/test/integration/test-pdiff-usage
@@ -5,39 +5,146 @@ TESTDIR=$(readlink -f $(dirname $0))
. $TESTDIR/framework
setupenvironment
-configarchitecture "i386"
+configarchitecture 'i386'
buildaptarchive
setupflataptarchive
changetowebserver
-signreleasefiles
-testsuccess aptget update
-testnopackage newstuff
PKGFILE="${TESTDIR}/$(echo "$(basename $0)" | sed 's#^test-#Packages-#')"
-testequal "$(cat ${PKGFILE})
+
+echo '#!/bin/sh
+touch merge-was-used
+/usr/bin/diffindex-rred "$@"' > extrred
+chmod +x extrred
+echo 'Dir::Bin::rred "./extrred";' > rootdir/etc/apt/apt.conf.d/99rred
+
+wasmergeused() {
+ testsuccess aptget update "$@"
+ msgtest 'Check if the right pdiff merger was used'
+ if [ -e ./merge-was-used ]; then
+ rm -f ./merge-was-used
+ if echo "$*" | grep -q -- '-o Acquire::PDiffs::Merge=1'; then
+ msgpass
+ else
+ msgfail "Merge shouldn't have been used, but was"
+ fi
+ elif echo "$*" | grep -q -- '-o Acquire::PDiffs::Merge=1'; then
+ msgfail "Merge should have been used, but wasn't"
+ else
+ msgpass
+ fi
+}
+
+testrun() {
+ # setup the base
+ find aptarchive -name 'Packages*' -type f -delete
+ cp ${PKGFILE} aptarchive/Packages
+ compressfile 'aptarchive/Packages'
+ generatereleasefiles
+ signreleasefiles
+ rm -rf aptarchive/Packages.diff rootdir/var/lib/apt/lists
+ testsuccess aptget update "$@"
+ cp -a rootdir/var/lib/apt/lists rootdir/var/lib/apt/lists-bak
+ testnopackage newstuff
+ testequal "$(cat ${PKGFILE})
" aptcache show apt oldstuff
-cp ${PKGFILE}-new aptarchive/Packages
-compressfile 'aptarchive/Packages'
-rm -rf aptarchive/Packages.diff
-mkdir -p aptarchive/Packages.diff
-PATCHFILE="aptarchive/Packages.diff/$(date +%Y-%m-%d-%H%M.%S)"
-diff -e ${PKGFILE} ${PKGFILE}-new > ${PATCHFILE} || true
-cat $PATCHFILE | gzip > ${PATCHFILE}.gz
-PATCHINDEX="aptarchive/Packages.diff/Index"
-echo "SHA1-Current: $(sha1sum ${PKGFILE}-new | cut -d' ' -f 1) $(stat -c%s ${PKGFILE}-new)
+ # apply with one patch
+ cp ${PKGFILE}-new aptarchive/Packages
+ compressfile 'aptarchive/Packages'
+ mkdir -p aptarchive/Packages.diff
+ PATCHFILE="aptarchive/Packages.diff/$(date +%Y-%m-%d-%H%M.%S)"
+ diff -e ${PKGFILE} ${PKGFILE}-new > ${PATCHFILE} || true
+ cat $PATCHFILE | gzip > ${PATCHFILE}.gz
+ PATCHINDEX='aptarchive/Packages.diff/Index'
+ echo "SHA1-Current: $(sha1sum ${PKGFILE}-new | cut -d' ' -f 1) $(stat -c%s ${PKGFILE}-new)
SHA1-History:
9f4148e06d7faa37062994ff10d0c842d7017513 33053002 2010-08-18-2013.28
$(sha1sum $PKGFILE | cut -d' ' -f 1) $(stat -c%s $PKGFILE) $(basename $PATCHFILE)
SHA1-Patches:
7651fc0ac57cd83d41c63195a9342e2db5650257 19722 2010-08-18-0814.28
$(sha1sum $PATCHFILE | cut -d' ' -f 1) $(stat -c%s $PATCHFILE) $(basename $PATCHFILE)" > $PATCHINDEX
-generatereleasefiles '+1hour'
-signreleasefiles
-find aptarchive -name 'Packages*' -type f -delete
-testsuccess aptget update
+ generatereleasefiles '+1hour'
+ signreleasefiles
+ find aptarchive -name 'Packages*' -type f -delete
+ wasmergeused "$@"
+ testnopackage oldstuff
+ testequal "$(cat ${PKGFILE}-new)
+" aptcache show apt newstuff
-testnopackage oldstuff
-testequal "$(cat ${PKGFILE}-new)
+ # index is already up-to-date
+ find rootdir/var/lib/apt/lists -name '*.IndexDiff' -type f -delete
+ testsuccess aptget update "$@"
+ testequal "$(cat ${PKGFILE}-new)
" aptcache show apt newstuff
+
+ # apply with two patches
+ cp ${PKGFILE}-new aptarchive/Packages
+ echo '
+Package: futurestuff
+Version: 1.0
+Architecture: i386
+Maintainer: Joe Sixpack
+Installed-Size: 202
+Filename: pool/futurestuff_1.0_i386.deb
+Size: 202200
+MD5sum: 311aeeaaae5ba33aff1ceaf3e1f76671
+SHA1: 3c695e028f7a1ae324deeaae5ba332desa81088c
+SHA256: b46fd154615edaae5ba33c56a5cc0e7deaef23e2da3e4f129727fd660f28f050
+Description: some cool and shiny future stuff
+ This package will appear in the next next mirror update
+Description-md5: d5f89fbbc2ce34c455dfee9b67d82b6b' >> aptarchive/Packages
+
+ compressfile 'aptarchive/Packages'
+ PATCHFILE2="aptarchive/Packages.diff/$(date -d 'now + 1hour' '+%Y-%m-%d-%H%M.%S')"
+ diff -e ${PKGFILE}-new aptarchive/Packages > ${PATCHFILE2} || true
+ cat $PATCHFILE2 | gzip > ${PATCHFILE2}.gz
+ echo "SHA1-Current: $(sha1sum aptarchive/Packages | cut -d' ' -f 1) $(stat -c%s aptarchive/Packages)
+SHA1-History:
+ 9f4148e06d7faa37062994ff10d0c842d7017513 33053002 2010-08-18-2013.28
+ $(sha1sum ${PKGFILE} | cut -d' ' -f 1) $(stat -c%s ${PKGFILE}) $(basename ${PATCHFILE})
+ $(sha1sum ${PKGFILE}-new | cut -d' ' -f 1) $(stat -c%s ${PKGFILE}-new) $(basename ${PATCHFILE2})
+SHA1-Patches:
+ 7651fc0ac57cd83d41c63195a9342e2db5650257 19722 2010-08-18-0814.28
+ $(sha1sum $PATCHFILE | cut -d' ' -f 1) $(stat -c%s $PATCHFILE) $(basename $PATCHFILE)
+ $(sha1sum ${PATCHFILE2} | cut -d' ' -f 1) $(stat -c%s ${PATCHFILE2}) $(basename ${PATCHFILE2})" > $PATCHINDEX
+ generatereleasefiles '+2hour'
+ signreleasefiles
+ cp -a aptarchive/Packages Packages-future
+ find aptarchive -name 'Packages*' -type f -delete
+ rm -rf rootdir/var/lib/apt/lists
+ cp -a rootdir/var/lib/apt/lists-bak rootdir/var/lib/apt/lists
+ wasmergeused "$@"
+ testnopackage oldstuff
+ testequal "$(cat Packages-future)
+" aptcache show apt newstuff futurestuff
+
+ # patch applying fails, but successful fallback
+ rm -rf rootdir/var/lib/apt/lists
+ cp -a rootdir/var/lib/apt/lists-bak rootdir/var/lib/apt/lists
+ cp ${PKGFILE}-new aptarchive/Packages
+ compressfile 'aptarchive/Packages'
+ mkdir -p aptarchive/Packages.diff
+ PATCHFILE="aptarchive/Packages.diff/$(date +%Y-%m-%d-%H%M.%S)"
+ diff -e ${PKGFILE} ${PKGFILE}-new > ${PATCHFILE} || true
+ PATCHINDEX='aptarchive/Packages.diff/Index'
+ echo "SHA1-Current: $(sha1sum ${PKGFILE}-new | cut -d' ' -f 1) $(stat -c%s ${PKGFILE}-new)
+SHA1-History:
+ 9f4148e06d7faa37062994ff10d0c842d7017513 33053002 2010-08-18-2013.28
+ $(sha1sum $PKGFILE | cut -d' ' -f 1) $(stat -c%s $PKGFILE) $(basename $PATCHFILE)
+SHA1-Patches:
+ 7651fc0ac57cd83d41c63195a9342e2db5650257 19722 2010-08-18-0814.28
+ $(sha1sum $PATCHFILE | cut -d' ' -f 1) $(stat -c%s $PATCHFILE) $(basename $PATCHFILE)" > $PATCHINDEX
+ echo 'I am Mallory and I change files' >> $PATCHFILE
+ cat $PATCHFILE | gzip > ${PATCHFILE}.gz
+ generatereleasefiles '+1hour'
+ signreleasefiles
+ testsuccess aptget update "$@"
+ testnopackage oldstuff
+ testequal "$(cat ${PKGFILE}-new)
+" aptcache show apt newstuff
+}
+
+testrun -o Debug::pkgAcquire::Diffs=1 -o Debug::pkgAcquire::rred=1 -o Acquire::PDiffs::Merge=0
+testrun -o Debug::pkgAcquire::Diffs=1 -o Debug::pkgAcquire::rred=1 -o Acquire::PDiffs::Merge=1
--
cgit v1.2.3-70-g09d2
From d2d68aaf5bc2211e9c488f2603ccb4e5fd591a6d Mon Sep 17 00:00:00 2001
From: Michael Vogt
Date: Sat, 4 Jan 2014 15:39:04 +0100
Subject: improve tests
---
apt-pkg/sourcelist.cc | 3 ++-
test/integration/framework | 13 +++++++++++--
test/integration/test-apt-sources-deb822 | 21 ++++++++++++++++-----
3 files changed, 29 insertions(+), 8 deletions(-)
(limited to 'apt-pkg')
diff --git a/apt-pkg/sourcelist.cc b/apt-pkg/sourcelist.cc
index 99cdbe030..35e13b6f5 100644
--- a/apt-pkg/sourcelist.cc
+++ b/apt-pkg/sourcelist.cc
@@ -342,7 +342,8 @@ bool pkgSourceList::ParseFileDeb822(string File)
// check if there are any options we support
const char* option_str[] = {
- "arch", "arch+", "arch-", "trusted" };
+ "arch", "arch+", "arch-", "trusted",
+ };
for (unsigned int j=0; j < sizeof(option_str)/sizeof(char*); j++)
if (Tags.Exists(option_str[j]))
Options[option_str[j]] = Tags.FindS(option_str[j]);
diff --git a/test/integration/framework b/test/integration/framework
index a28363768..6ada1e9cc 100644
--- a/test/integration/framework
+++ b/test/integration/framework
@@ -948,13 +948,22 @@ testempty() {
test -z "$($* 2>&1)" && msgpass || msgfail
}
-testequal() {
+testequalwithmsg() {
+ local MSG="$1"
+ shift
local COMPAREFILE=$(mktemp)
addtrap "rm $COMPAREFILE;"
echo "$1" > $COMPAREFILE
shift
- msgtest "Test for equality of" "$*"
+ msgtest "$MSG"
$* 2>&1 | checkdiff $COMPAREFILE - && msgpass || msgfail
+}
+
+testequal() {
+ local EXPECTED="$1"
+ shift
+ local MSG="Test for equality of $*"
+ testequalwithmsg "$MSG" "$EXPECTED" $*
}
testequalor2() {
diff --git a/test/integration/test-apt-sources-deb822 b/test/integration/test-apt-sources-deb822
index 6e9700bb0..24fb1bdb0 100755
--- a/test/integration/test-apt-sources-deb822
+++ b/test/integration/test-apt-sources-deb822
@@ -7,7 +7,17 @@ TESTDIR=$(readlink -f $(dirname $0))
setupenvironment
configarchitecture "i386"
-BASE="Type: deb
+echo "deb http://ftp.debian.org/debian stable main" > rootdir/etc/apt/sources.list
+testequalwithmsg "Old style sources.list works" "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 :
+'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 :
+'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 " aptget update --print-uris
+
+
+BASE="# some comment
+# that contains a : as well
+#Type: meep
+
+Type: deb
URL: http://ftp.debian.org/debian
Dist: stable
Section: main
@@ -17,7 +27,7 @@ Comment: Some random string
# simple case
echo "$BASE" > rootdir/etc/apt/sources.list
-testequal "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 :
+testequalwithmsg "Simple deb822 sources.list works" "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 :
'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 :
'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 " aptget update --print-uris
@@ -25,7 +35,7 @@ testequal "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.
# two sections (we support both "," and " " as seperator)
echo "$BASE" | sed s/main/"main,contrib"/ > rootdir/etc/apt/sources.list
-testequal "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 :
+testequalwithmsg "Two sections deb822 sources.list work" "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 :
'http://ftp.debian.org/debian/dists/stable/contrib/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_contrib_binary-i386_Packages 0 :
'http://ftp.debian.org/debian/dists/stable/contrib/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_contrib_i18n_Translation-en 0 :
'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 :
@@ -37,7 +47,7 @@ echo "$BASE" > rootdir/etc/apt/sources.list
echo "" >> rootdir/etc/apt/sources.list
echo "$BASE" | sed s/stable/unstable/ >> rootdir/etc/apt/sources.list
-testequal "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 :
+testequalwithmsg "Multiple entries in deb822 sources.list work" "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 :
'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 :
'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0
'http://ftp.debian.org/debian/dists/unstable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_unstable_main_binary-i386_Packages 0 :
@@ -49,7 +59,8 @@ testequal "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.
echo "$BASE" > rootdir/etc/apt/sources.list
echo "Arch: amd64,armel" >> rootdir/etc/apt/sources.list
-testequal "'http://ftp.debian.org/debian/dists/stable/main/binary-amd64/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-amd64_Packages 0 :
+testequalwithmsg "Arch: option in deb822 sources.list works" "'http://ftp.debian.org/debian/dists/stable/main/binary-amd64/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-amd64_Packages 0 :
'http://ftp.debian.org/debian/dists/stable/main/binary-armel/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-armel_Packages 0 :
'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 :
'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 " aptget update --print-uris
+
--
cgit v1.2.3-70-g09d2
From 4194c9aee2766845618ef0431fd4803b0467aab7 Mon Sep 17 00:00:00 2001
From: Michael Vogt
Date: Sat, 4 Jan 2014 16:23:32 +0100
Subject: improve error message
---
apt-pkg/sourcelist.cc | 34 +++++++++++++++++++++-----------
apt-pkg/sourcelist.h | 2 +-
test/integration/test-apt-sources-deb822 | 30 ++++++++++++++++++++--------
3 files changed, 45 insertions(+), 21 deletions(-)
(limited to 'apt-pkg')
diff --git a/apt-pkg/sourcelist.cc b/apt-pkg/sourcelist.cc
index 35e13b6f5..5e4a58e95 100644
--- a/apt-pkg/sourcelist.cc
+++ b/apt-pkg/sourcelist.cc
@@ -240,8 +240,14 @@ bool pkgSourceList::Read(string File)
bool pkgSourceList::ReadAppend(string File)
{
if (_config->FindB("APT::Sources::Use-Deb822", true) == true)
- if (ParseFileDeb822(File))
+ {
+ int lines_parsed =ParseFileDeb822(File);
+ if (lines_parsed < 0)
+ return false;
+ else if (lines_parsed > 0)
return true;
+ // no lines parsed ... fall through and use old style parser
+ }
return ParseFileOldStyle(File);
}
@@ -303,10 +309,9 @@ bool pkgSourceList::ParseFileOldStyle(string File)
/*}}}*/
// SourceList::ParseFileDeb822 - Parse deb822 style sources.list /*{{{*/
// ---------------------------------------------------------------------
-/* */
-bool pkgSourceList::ParseFileDeb822(string File)
+/* Returns: the number of stanzas parsed*/
+int pkgSourceList::ParseFileDeb822(string File)
{
-
pkgTagSection Tags;
map Options;
unsigned int i=0;
@@ -318,7 +323,7 @@ bool pkgSourceList::ParseFileDeb822(string File)
if (_error->PendingError() == true)
{
_error->RevertToStack();
- return false;
+ return 0;
}
_error->MergeWithStack();
@@ -331,11 +336,19 @@ bool pkgSourceList::ParseFileDeb822(string File)
string const type = Tags.FindS("Type");
Type *Parse = Type::GetType(type.c_str());
if (Parse == 0)
- return _error->Error(_("Type '%s' is not known on stanza %u in source list %s"),type.c_str(),i,Fd.Name().c_str());
+ {
+ _error->Error(_("Type '%s' is not known on stanza %u in source list %s"),type.c_str(),i,Fd.Name().c_str());
+ // true means we do not retry with old-style sources.list
+ return -1;
+ }
string URI = Tags.FindS("URL");
if (!Parse->FixupURI(URI))
- return _error->Error(_("Malformed stanza %u in source list %s (URI parse)"),i,Fd.Name().c_str());
+ {
+ _error->Error(_("Malformed stanza %u in source list %s (URI parse)"),i,Fd.Name().c_str());
+ // means we do not retry with old-style sources.list
+ return -1;
+ }
string Dist = Tags.FindS("Dist");
Dist = SubstVar(Dist,"$(ARCH)",_config->Find("APT::Architecture"));
@@ -362,11 +375,8 @@ bool pkgSourceList::ParseFileDeb822(string File)
i++;
}
- // we are done
- if(i>0)
- return true;
-
- return false;
+ // we are done, return the number of stanzas read
+ return i;
}
/*}}}*/
// SourceList::FindIndex - Get the index associated with a file /*{{{*/
diff --git a/apt-pkg/sourcelist.h b/apt-pkg/sourcelist.h
index 5e0d585bb..d83c76d6a 100644
--- a/apt-pkg/sourcelist.h
+++ b/apt-pkg/sourcelist.h
@@ -76,7 +76,7 @@ class pkgSourceList
std::vector SrcList;
- bool ParseFileDeb822(std::string File);
+ int ParseFileDeb822(std::string File);
bool ParseFileOldStyle(std::string File);
public:
diff --git a/test/integration/test-apt-sources-deb822 b/test/integration/test-apt-sources-deb822
index 24fb1bdb0..bacad1ed4 100755
--- a/test/integration/test-apt-sources-deb822
+++ b/test/integration/test-apt-sources-deb822
@@ -7,7 +7,9 @@ TESTDIR=$(readlink -f $(dirname $0))
setupenvironment
configarchitecture "i386"
-echo "deb http://ftp.debian.org/debian stable main" > rootdir/etc/apt/sources.list
+SOURCES="rootdir/etc/apt/sources.list"
+
+echo "deb http://ftp.debian.org/debian stable main" > $SOURCES
testequalwithmsg "Old style sources.list works" "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 :
'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 :
'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 " aptget update --print-uris
@@ -25,7 +27,7 @@ Comment: Some random string
that can be very long"
# simple case
-echo "$BASE" > rootdir/etc/apt/sources.list
+echo "$BASE" > $SOURCES
testequalwithmsg "Simple deb822 sources.list works" "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 :
'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 :
@@ -33,7 +35,7 @@ testequalwithmsg "Simple deb822 sources.list works" "'http://ftp.debian.org/debi
# two sections (we support both "," and " " as seperator)
-echo "$BASE" | sed s/main/"main,contrib"/ > rootdir/etc/apt/sources.list
+echo "$BASE" | sed s/main/"main,contrib"/ > $SOURCES
testequalwithmsg "Two sections deb822 sources.list work" "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 :
'http://ftp.debian.org/debian/dists/stable/contrib/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_contrib_binary-i386_Packages 0 :
@@ -43,9 +45,9 @@ testequalwithmsg "Two sections deb822 sources.list work" "'http://ftp.debian.org
# Two entries
-echo "$BASE" > rootdir/etc/apt/sources.list
-echo "" >> rootdir/etc/apt/sources.list
-echo "$BASE" | sed s/stable/unstable/ >> rootdir/etc/apt/sources.list
+echo "$BASE" > $SOURCES
+echo "" >> $SOURCES
+echo "$BASE" | sed s/stable/unstable/ >> $SOURCES
testequalwithmsg "Multiple entries in deb822 sources.list work" "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 :
'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 :
@@ -56,11 +58,23 @@ testequalwithmsg "Multiple entries in deb822 sources.list work" "'http://ftp.deb
# ARCH option
-echo "$BASE" > rootdir/etc/apt/sources.list
-echo "Arch: amd64,armel" >> rootdir/etc/apt/sources.list
+echo "$BASE" > $SOURCES
+echo "Arch: amd64,armel" >> $SOURCES
testequalwithmsg "Arch: option in deb822 sources.list works" "'http://ftp.debian.org/debian/dists/stable/main/binary-amd64/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-amd64_Packages 0 :
'http://ftp.debian.org/debian/dists/stable/main/binary-armel/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-armel_Packages 0 :
'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 :
'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 " aptget update --print-uris
+# invalid sources.list file
+echo "deb http://ftp.debian.org" > $SOURCES
+
+testequalwithmsg "Invalid sources.list file gives proper error" "E: Malformed line 1 in source list $TMPWORKINGDIRECTORY/rootdir/etc/apt/sources.list (dist)
+E: The list of sources could not be read." aptget update --print-uris
+
+echo "Type: deb
+Dist: stable
+" > $SOURCES
+
+testequalwithmsg "Invalid deb822 sources.list file gives proper error" "E: Malformed stanza 0 in source list $TMPWORKINGDIRECTORY/rootdir/etc/apt/sources.list (URI parse)
+E: The list of sources could not be read." aptget update --print-uris
--
cgit v1.2.3-70-g09d2
From 1e4a2b763f2225d6de3d498263da2a1a12697667 Mon Sep 17 00:00:00 2001
From: Anthony Towns
Date: Wed, 15 Jan 2014 15:55:26 +0100
Subject: correct IndexDiff vs DiffIndex in Debug output
---
apt-pkg/acquire-item.cc | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
(limited to 'apt-pkg')
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc
index b5b9577ef..73f5f4901 100644
--- a/apt-pkg/acquire-item.cc
+++ b/apt-pkg/acquire-item.cc
@@ -369,10 +369,10 @@ pkgAcqDiffIndex::pkgAcqDiffIndex(pkgAcquire *Owner,
return;
}
- if(Debug)
- std::clog << "pkgAcqIndexDiffs::pkgAcqIndexDiffs(): "
- << CurrentPackagesFile << std::endl;
-
+ if(Debug)
+ std::clog << "pkgAcqDiffIndex::pkgAcqDiffIndex(): "
+ << CurrentPackagesFile << std::endl;
+
QueueURI(Desc);
}
@@ -398,8 +398,8 @@ string pkgAcqDiffIndex::Custom600Headers()
bool pkgAcqDiffIndex::ParseDiffIndex(string IndexDiffFile) /*{{{*/
{
if(Debug)
- std::clog << "pkgAcqIndexDiffs::ParseIndexDiff() " << IndexDiffFile
- << std::endl;
+ std::clog << "pkgAcqDiffIndex::ParseIndexDiff() " << IndexDiffFile
+ << std::endl;
pkgTagSection Tags;
string ServerSha1;
--
cgit v1.2.3-70-g09d2
From c3a17127ad383ec8e1f480ff2e1a4dccaa537a11 Mon Sep 17 00:00:00 2001
From: David Kalnischkies
Date: Fri, 27 Dec 2013 14:52:15 +0100
Subject: reenable unlimited pdiff files download
In 51fc6def77edfb1f429a48e5169519e9e05a759b we limited the amount of
pdiff to be downloaded per index to 20. This was a compromise between
not letting it go overboard (becoming even slower) and not using
bandwidth needlessly. Now that with the POC the speed reason is gone it
makes sense again to download as much files as we possible can via pdiff
to save bandwidth (and possibly even time).
It also avoids problems with the limit in cases we were we deal with a
server merged archieve as this limit assumes a strict patch progression.
---
apt-pkg/acquire-item.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'apt-pkg')
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc
index 73f5f4901..7f6443555 100644
--- a/apt-pkg/acquire-item.cc
+++ b/apt-pkg/acquire-item.cc
@@ -462,7 +462,7 @@ bool pkgAcqDiffIndex::ParseDiffIndex(string IndexDiffFile) /*{{{*/
if (available_patches.empty() == false)
{
// patching with too many files is rather slow compared to a fast download
- unsigned long const fileLimit = _config->FindI("Acquire::PDiffs::FileLimit", 20);
+ unsigned long const fileLimit = _config->FindI("Acquire::PDiffs::FileLimit", 0);
if (fileLimit != 0 && fileLimit < available_patches.size())
{
if (Debug)
--
cgit v1.2.3-70-g09d2
From 50bd6fd3794dd1f61185302129dc6cd218d20b98 Mon Sep 17 00:00:00 2001
From: David Kalnischkies
Date: Wed, 15 Jan 2014 17:23:05 +0100
Subject: integrate Anthonys rred with POC for client-side merge
Providing the benefits of both without the downsides :)
(ABI breaks or external dependencies)
For this Anthonys rred is equipped with:
- magic-filename-pickup of patches rather than explicit messages
- use of FileFd instead of FILE* to get on-the-fly uncompress
of the gzip compressed pdiff patches
The acquire code in turn stops checking for apt-file's helper
as our own rred is now clever enough for our needs.
---
apt-pkg/acquire-item.cc | 11 ++---
methods/rred.cc | 94 +++++++++++----------------------------
test/integration/test-pdiff-usage | 23 +++++++---
3 files changed, 45 insertions(+), 83 deletions(-)
(limited to 'apt-pkg')
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc
index 7f6443555..1185908f3 100644
--- a/apt-pkg/acquire-item.cc
+++ b/apt-pkg/acquire-item.cc
@@ -513,14 +513,9 @@ bool pkgAcqDiffIndex::ParseDiffIndex(string IndexDiffFile) /*{{{*/
bool pdiff_merge = _config->FindB("Acquire::PDiffs::Merge", true);
if (pdiff_merge == true)
{
- // this perl script is provided by apt-file
- pdiff_merge = FileExists(_config->FindFile("Dir::Bin::rred", "/usr/bin/diffindex-rred"));
- if (pdiff_merge == true)
- {
- // reprepro adds this flag if it has merged patches on the server
- std::string const precedence = Tags.FindS("X-Patch-Precedence");
- pdiff_merge = (precedence != "merged");
- }
+ // reprepro adds this flag if it has merged patches on the server
+ std::string const precedence = Tags.FindS("X-Patch-Precedence");
+ pdiff_merge = (precedence != "merged");
}
if (pdiff_merge == false)
diff --git a/methods/rred.cc b/methods/rred.cc
index ed3fcc82e..313166160 100644
--- a/methods/rred.cc
+++ b/methods/rred.cc
@@ -407,13 +407,13 @@ class Patch {
public:
- void read_diff(FILE *f)
+ void read_diff(FileFd &f)
{
char buffer[BLOCK_SIZE];
bool cmdwanted = true;
Change ch(0);
- while(fgets(buffer, sizeof(buffer), f))
+ while(f.ReadLine(buffer, sizeof(buffer)))
{
if (cmdwanted) {
char *m, *c;
@@ -534,66 +534,11 @@ class Patch {
}
};
-bool LookupPatches(const std::string &Message, std::vector &lines)
-{
- const char *Tag = "Patches";
- const size_t Length = strlen(Tag);
-
- std::string::const_iterator I, J;
-
- std::clog << "Looking for \"Patches:\" section in message:\n\n" << Message << "\n\n";
- std::clog.flush();
-
- for (I = Message.begin(); I + Length < Message.end(); ++I)
- {
- if (I[Length] == ':' && stringcasecmp(I, I+Length, Tag) == 0)
- {
- // found the tag, now read the patches
- for(;;) {
- for (; I < Message.end() && *I != '\n'; ++I);
- if (I < Message.end()) I++;
- if (I == Message.end() || *I != ' ')
- break;
- while (I < Message.end() && isspace(*I)) I++;
- for (J = I; J < Message.end() && *J != '\n'; ++J)
- ;
- do
- J--;
- while (I < J && isspace(*J));
- if (I < J)
- lines.push_back(std::string(I,++J));
- else
- break;
- I = J;
- }
- std::clog << "Found " << lines.size() << " patches!\n";
- std::clog.flush();
- return true;
- }
- }
- std::clog << "Found no patches! :(\n";
- std::clog.flush();
- return false;
-}
-
-
class RredMethod : public pkgAcqMethod {
private:
bool Debug;
- std::vector patchpaths;
protected:
- virtual bool HandleMessage(int Number, std::string Message) {
- if (Number == 600)
- {
- patchpaths.clear();
- LookupPatches(Message, patchpaths);
- std::clog << "Ended up with " << patchpaths.size() << " patches!\n";
- std::clog.flush();
- }
- return pkgAcqMethod::HandleMessage(Number, Message);
- }
-
virtual bool Fetch(FetchItem *Itm) {
Debug = _config->FindB("Debug::pkgAcquire::RRed", false);
URI Get = Itm->Uri;
@@ -601,17 +546,29 @@ class RredMethod : public pkgAcqMethod {
FetchResult Res;
Res.Filename = Itm->DestFile;
- if (Itm->Uri.empty()) {
+ if (Itm->Uri.empty())
+ {
Path = Itm->DestFile;
Itm->DestFile.append(".result");
} else
URIStart(Res);
+ std::vector patchpaths;
Patch patch;
- if (patchpaths.empty())
- {
+ if (FileExists(Path + ".ed") == true)
patchpaths.push_back(Path + ".ed");
+ else
+ {
+ _error->PushToStack();
+ std::vector patches = GetListOfFilesInDir(flNotFile(Path), "gz", true, false);
+ _error->RevertToStack();
+
+ std::string const baseName = Path + ".ed.";
+ for (std::vector::const_iterator p = patches.begin();
+ p != patches.end(); ++p)
+ if (p->compare(0, baseName.length(), baseName) == 0)
+ patchpaths.push_back(*p);
}
std::string patch_name;
@@ -624,13 +581,15 @@ class RredMethod : public pkgAcqMethod {
std::clog << "Patching " << Path << " with " << patch_name
<< std::endl;
- FILE *p = fopen(patch_name.c_str(), "r");
- if (p == NULL) {
- std::clog << "Could not open patch file " << patch_name << std::endl;
+ FileFd p;
+ // all patches are compressed, even if the name doesn't reflect it
+ if (p.Open(patch_name, FileFd::ReadOnly, FileFd::Gzip) == false) {
+ std::cerr << "Could not open patch file " << patch_name << std::endl;
+ _error->DumpErrors(std::cerr);
abort();
}
patch.read_diff(p);
- fclose(p);
+ p.Close();
}
if (Debug == true)
@@ -697,10 +656,9 @@ int main(int argc, char **argv)
}
for (; i < argc; i++) {
- FILE *p;
- p = fopen(argv[i], "r");
- if (!p) {
- perror(argv[i]);
+ FileFd p;
+ if (p.Open(argv[i], FileFd::ReadOnly) == false) {
+ _error->DumpErrors(std::cerr);
exit(1);
}
patch.read_diff(p);
diff --git a/test/integration/test-pdiff-usage b/test/integration/test-pdiff-usage
index 5a06e0ccb..ad31511b9 100755
--- a/test/integration/test-pdiff-usage
+++ b/test/integration/test-pdiff-usage
@@ -20,10 +20,19 @@ chmod +x extrred
echo 'Dir::Bin::rred "./extrred";' > rootdir/etc/apt/apt.conf.d/99rred
wasmergeused() {
- testsuccess aptget update "$@"
+ msgtest 'Test for successful execution of' "$*"
+ local OUTPUT=$(mktemp)
+ addtrap "rm $OUTPUT;"
+ if aptget update "$@" >${OUTPUT} 2>&1; then
+ msgpass
+ else
+ echo
+ cat $OUTPUT
+ msgfail
+ fi
+
msgtest 'Check if the right pdiff merger was used'
- if [ -e ./merge-was-used ]; then
- rm -f ./merge-was-used
+ if grep -q '^pkgAcqIndexMergeDiffs::Done(): rred' $OUTPUT; then
if echo "$*" | grep -q -- '-o Acquire::PDiffs::Merge=1'; then
msgpass
else
@@ -50,7 +59,7 @@ testrun() {
testequal "$(cat ${PKGFILE})
" aptcache show apt oldstuff
- # apply with one patch
+ msgmsg 'Testcase: apply with one patch'
cp ${PKGFILE}-new aptarchive/Packages
compressfile 'aptarchive/Packages'
mkdir -p aptarchive/Packages.diff
@@ -73,13 +82,13 @@ SHA1-Patches:
testequal "$(cat ${PKGFILE}-new)
" aptcache show apt newstuff
- # index is already up-to-date
+ msgmsg 'Testcase: index is already up-to-date'
find rootdir/var/lib/apt/lists -name '*.IndexDiff' -type f -delete
testsuccess aptget update "$@"
testequal "$(cat ${PKGFILE}-new)
" aptcache show apt newstuff
- # apply with two patches
+ msgmsg 'Testcase: apply with two patches'
cp ${PKGFILE}-new aptarchive/Packages
echo '
Package: futurestuff
@@ -120,7 +129,7 @@ SHA1-Patches:
testequal "$(cat Packages-future)
" aptcache show apt newstuff futurestuff
- # patch applying fails, but successful fallback
+ msgmsg 'Testcase: patch applying fails, but successful fallback'
rm -rf rootdir/var/lib/apt/lists
cp -a rootdir/var/lib/apt/lists-bak rootdir/var/lib/apt/lists
cp ${PKGFILE}-new aptarchive/Packages
--
cgit v1.2.3-70-g09d2
From db6594dfc508378b6d658aff2761da5406404238 Mon Sep 17 00:00:00 2001
From: Michael Vogt
Date: Thu, 16 Jan 2014 08:03:24 +0100
Subject: remove "," in components again
---
apt-pkg/sourcelist.cc | 6 +-----
test/integration/test-apt-sources-deb822 | 11 -----------
2 files changed, 1 insertion(+), 16 deletions(-)
(limited to 'apt-pkg')
diff --git a/apt-pkg/sourcelist.cc b/apt-pkg/sourcelist.cc
index 5e4a58e95..42ada7e18 100644
--- a/apt-pkg/sourcelist.cc
+++ b/apt-pkg/sourcelist.cc
@@ -363,11 +363,7 @@ int pkgSourceList::ParseFileDeb822(string File)
// now create one item per section
string const Section = Tags.FindS("Section");
- std::vector list;
- if (Section.find(","))
- list = StringSplit(Section, ",");
- else
- list = StringSplit(Section, " ");
+ std::vector list = StringSplit(Section, " ");
for (std::vector::const_iterator I = list.begin();
I != list.end(); I++)
Parse->CreateItem(SrcList, URI, Dist, (*I), Options);
diff --git a/test/integration/test-apt-sources-deb822 b/test/integration/test-apt-sources-deb822
index bacad1ed4..b110c1462 100755
--- a/test/integration/test-apt-sources-deb822
+++ b/test/integration/test-apt-sources-deb822
@@ -33,17 +33,6 @@ testequalwithmsg "Simple deb822 sources.list works" "'http://ftp.debian.org/debi
'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 :
'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 " aptget update --print-uris
-
-# two sections (we support both "," and " " as seperator)
-echo "$BASE" | sed s/main/"main,contrib"/ > $SOURCES
-
-testequalwithmsg "Two sections deb822 sources.list work" "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 :
-'http://ftp.debian.org/debian/dists/stable/contrib/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_contrib_binary-i386_Packages 0 :
-'http://ftp.debian.org/debian/dists/stable/contrib/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_contrib_i18n_Translation-en 0 :
-'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 :
-'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 " aptget update --print-uris
-
-
# Two entries
echo "$BASE" > $SOURCES
echo "" >> $SOURCES
--
cgit v1.2.3-70-g09d2
From 7037aab52fc935298b033a4c7ba7ccb5b697622e Mon Sep 17 00:00:00 2001
From: Michael Vogt
Date: Thu, 16 Jan 2014 16:25:33 +0100
Subject: * refactor to have a new virtual ParseStanza
Have a similar ParseStanza() to the current ParseLine().
Rename the Architectures options in deb822 to make it more
user friendly
---
apt-pkg/sourcelist.cc | 65 +++++++++++++++++++-------------
apt-pkg/sourcelist.h | 5 +++
test/integration/test-apt-sources-deb822 | 2 +-
3 files changed, 45 insertions(+), 27 deletions(-)
(limited to 'apt-pkg')
diff --git a/apt-pkg/sourcelist.cc b/apt-pkg/sourcelist.cc
index 42ada7e18..fe0eace07 100644
--- a/apt-pkg/sourcelist.cc
+++ b/apt-pkg/sourcelist.cc
@@ -71,6 +71,44 @@ bool pkgSourceList::Type::FixupURI(string &URI) const
return true;
}
/*}}}*/
+bool pkgSourceList::Type::ParseStanza(vector &List,
+ pkgTagSection &Tags,
+ int i,
+ FileFd &Fd)
+{
+ map Options;
+
+ string URI = Tags.FindS("URL");
+ if (!FixupURI(URI))
+ {
+ _error->Error(_("Malformed stanza %u in source list %s (URI parse)"),i,Fd.Name().c_str());
+ return false;
+ }
+
+ string Dist = Tags.FindS("Dist");
+ Dist = SubstVar(Dist,"$(ARCH)",_config->Find("APT::Architecture"));
+
+ // Define external/internal options
+ const char* option_deb822[] = {
+ "Architectures", "Architectures-Add", "Architectures-Delete", "Trusted",
+ };
+ const char* option_internal[] = {
+ "arch", "arch+", "arch-", "trusted",
+ };
+ for (unsigned int j=0; j < sizeof(option_deb822)/sizeof(char*); j++)
+ if (Tags.Exists(option_deb822[j]))
+ Options[option_internal[j]] = Tags.FindS(option_deb822[j]);
+
+ // now create one item per section
+ string const Section = Tags.FindS("Section");
+ std::vector list = StringSplit(Section, " ");
+ for (std::vector::const_iterator I = list.begin();
+ I != list.end(); I++)
+ return CreateItem(List, URI, Dist, (*I), Options);
+
+ return true;
+}
+
// Type::ParseLine - Parse a single line /*{{{*/
// ---------------------------------------------------------------------
/* This is a generic one that is the 'usual' format for sources.list
@@ -313,7 +351,6 @@ bool pkgSourceList::ParseFileOldStyle(string File)
int pkgSourceList::ParseFileDeb822(string File)
{
pkgTagSection Tags;
- map Options;
unsigned int i=0;
// see if we can read the file
@@ -338,35 +375,11 @@ int pkgSourceList::ParseFileDeb822(string File)
if (Parse == 0)
{
_error->Error(_("Type '%s' is not known on stanza %u in source list %s"),type.c_str(),i,Fd.Name().c_str());
- // true means we do not retry with old-style sources.list
return -1;
}
- string URI = Tags.FindS("URL");
- if (!Parse->FixupURI(URI))
- {
- _error->Error(_("Malformed stanza %u in source list %s (URI parse)"),i,Fd.Name().c_str());
- // means we do not retry with old-style sources.list
+ if (!Parse->ParseStanza(SrcList, Tags, i, Fd))
return -1;
- }
-
- string Dist = Tags.FindS("Dist");
- Dist = SubstVar(Dist,"$(ARCH)",_config->Find("APT::Architecture"));
-
- // check if there are any options we support
- const char* option_str[] = {
- "arch", "arch+", "arch-", "trusted",
- };
- for (unsigned int j=0; j < sizeof(option_str)/sizeof(char*); j++)
- if (Tags.Exists(option_str[j]))
- Options[option_str[j]] = Tags.FindS(option_str[j]);
-
- // now create one item per section
- string const Section = Tags.FindS("Section");
- std::vector list = StringSplit(Section, " ");
- for (std::vector::const_iterator I = list.begin();
- I != list.end(); I++)
- Parse->CreateItem(SrcList, URI, Dist, (*I), Options);
i++;
}
diff --git a/apt-pkg/sourcelist.h b/apt-pkg/sourcelist.h
index d83c76d6a..0ccb4aa00 100644
--- a/apt-pkg/sourcelist.h
+++ b/apt-pkg/sourcelist.h
@@ -31,6 +31,7 @@
#include
#include
-
Diety/dselect are the first introduction that people have to
+
Deity/dselect are the first introduction that people have to
Debian, and unfortunately this first impression contributes
greatly to the public perception of the distribution. It is
imperative that this be a showcase for Debian, rather than
diff --git a/doc/dpkg-tech.sgml b/doc/dpkg-tech.sgml
index 1a15f6a4c..ce0c5fa83 100644
--- a/doc/dpkg-tech.sgml
+++ b/doc/dpkg-tech.sgml
@@ -322,7 +322,7 @@ The main principal of the new-format Debian archive (I won't describe the old
format - for that have a look at deb-old.5), is that the archive really is
an archive - as used by "ar" and friends. However, dpkg-deb uses this format
internally, rather than calling "ar". Inside this archive, there are usually
-the folowing members:-
+the following members:-
debian-binary
@@ -349,7 +349,7 @@ supports the following options:-
--build (-b) <dir> - builds a .deb archive, takes a directory which
contains all the files as an argument. Note that the directory
<dir>/DEBIAN will be packed separately into the control archive.
---contents (-c) <debfile> - Lists the contents of ther "data.tar.gz"
+--contents (-c) <debfile> - Lists the contents of the "data.tar.gz"
member.
--control (-e) <debfile> - Extracts the control archive into a
directory called DEBIAN. Alternatively, with another argument, it will extract
@@ -450,7 +450,7 @@ cleaned up when dpkg exits cleanly.
Juding by the use of the updates directory I would call it a Journal. Inorder
-to effeciently ensure the complete integrity of the status file dpkg will
+to efficiently ensure the complete integrity of the status file dpkg will
"checkpoint" or journal all of it's activities in the updates directory. By
merging the contents of the updates directory (in order!!) against the
original status file it can get the precise current state of the system,
diff --git a/doc/examples/configure-index b/doc/examples/configure-index
index f4d9d17f2..93e96cf16 100644
--- a/doc/examples/configure-index
+++ b/doc/examples/configure-index
@@ -142,7 +142,7 @@ APT
// APT::Archives::MinAge "2"; (old, deprecated)
MinAge "2"; // (new)
// - Set minimum age of a package file. If a file is younger it
- // will not be deleted (0=disable). Usefull to prevent races
+ // will not be deleted (0=disable). Useful to prevent races
// and to keep backups of the packages for emergency.
// APT::Archives::MaxSize "0"; (old, deprecated)
diff --git a/doc/files.sgml b/doc/files.sgml
index a52efc756..56c7f574d 100644
--- a/doc/files.sgml
+++ b/doc/files.sgml
@@ -201,7 +201,7 @@ from partial into archives/. Any files found in archives/ can be assumed
to be verified.
-No directory structure is transfered from the receiving site and all .deb
+No directory structure is transferred from the receiving site and all .deb
file names conform to debian conventions. No short (msdos) filename should
be placed in archives. If the need arises .debs should be unpacked, scanned
and renamed to their correct internal names. This is mostly to prevent
diff --git a/doc/libapt-pkg2_to_3.txt b/doc/libapt-pkg2_to_3.txt
index c1f71f9f2..b94dc666e 100644
--- a/doc/libapt-pkg2_to_3.txt
+++ b/doc/libapt-pkg2_to_3.txt
@@ -3,7 +3,7 @@ people need to be aware of.. Many of this changes are done so that most old
source will continue to function, but perhaps at reduced functionality.
* pkgDepCache is no longer self initilizing, you have to call the Init
- method seperately after constructing it. Users of pkgCacheFile do not
+ method separately after constructing it. Users of pkgCacheFile do not
need to worry about this
* GetCandidateVer/etc is gone from the pkgCache. It exists only in the
DepCache and is just an inline around the new Policy class
@@ -55,7 +55,7 @@ source will continue to function, but perhaps at reduced functionality.
(should be transparent largely)
* Locking is handled differently, there is no dpkg lock class, the _system
class provides Lock/UnLock methods
-* pkgDepCache is not a subclass of pkgCache, it agregates it now. Some
+* pkgDepCache is not a subclass of pkgCache, it aggregates it now. Some
compatibility functions are provided that make this transition fairly
easy.
* The following functions have had minor argument changes:
diff --git a/doc/method.sgml b/doc/method.sgml
index 27db50173..5aa7b52e8 100644
--- a/doc/method.sgml
+++ b/doc/method.sgml
@@ -246,14 +246,14 @@ pre-transfer status for Internet type methods.
Fields: Message
200 URI Start
-Indicates the URI is starting to be transfered. The URI is specified
+Indicates the URI is starting to be transferred. The URI is specified
along with stats about the file itself.
Fields: URI, Size, Last-Modified, Resume-Point
201 URI Done
-Indicates that a URI has completed being transfered. It is possible
+Indicates that a URI has completed being transferred. It is possible
to specify a 201 URI Done> without a URI Start> which would
-mean no data was transfered but the file is now available. A Filename
+mean no data was transferred but the file is now available. A Filename
field is specified when the URI is directly available in the local
pathname space. APT will either directly use that file or copy it into
another location. It is possible to return Alt-* fields to indicate that
diff --git a/doc/style.txt b/doc/style.txt
index 2072251d0..7658b0314 100644
--- a/doc/style.txt
+++ b/doc/style.txt
@@ -9,7 +9,7 @@ Ver - A version
Indenting, Comments, Etc
~~~~~~~~~~~~~~~~~~~~~~~~
Would make Linus cry :P However it is what I prefer. 3 space indent,
-8 space tab all braces on seperate lines, function return on the same line
+8 space tab all braces on separate lines, function return on the same line
as the function, cases aligned with their code. The 'indent' options for
this style are:
indent -bl -bli0 -di1 -i3 -nsc -ts8 -npcs -npsl
@@ -60,13 +60,13 @@ almost always designates a change in ownership rules).
* Pass by non-const reference may be used to indicate a OUT type variable
* Pass by pointer (except in the case where the pointer is really an array)
should be used when the object will be retained or ownership will be
- transfered. Ownership transference should be rare and noted by a comment.
+ transferred. Ownership transference should be rare and noted by a comment.
* Standard C things (FILE * etc) should be left as is.
* Return by references should indicate a borrowed object
* Return by pointer (except arrays) should indicate ownership is
- transfered. Return by pointer should not be used unless ownership is
- transfered.
+ transferred. Return by pointer should not be used unless ownership is
+ transferred.
* Return by pointer to variable indicates ownership transfer unless the
pointer is an 'input' parameter (designated generally by an =0,
indicating a default of 'none')
diff --git a/ftparchive/apt-ftparchive.cc b/ftparchive/apt-ftparchive.cc
index 2639bc2f6..712f8469a 100644
--- a/ftparchive/apt-ftparchive.cc
+++ b/ftparchive/apt-ftparchive.cc
@@ -864,7 +864,7 @@ bool Generate(CommandLine &CmdL)
unsigned long MaxContentsChange = Setup.FindI("Default::MaxContentsChange",UINT_MAX)*1024;
for (vector::iterator I = PkgList.begin(); I != PkgList.end(); ++I)
{
- // This record is not relevent
+ // This record is not relevant
if (I->ContentsDone == true ||
I->Contents.empty() == true)
continue;
diff --git a/methods/file.cc b/methods/file.cc
index 7ed4e6f60..3d0687c5b 100644
--- a/methods/file.cc
+++ b/methods/file.cc
@@ -5,7 +5,7 @@
File URI method for APT
- This simply checks that the file specified exists, if so the relevent
+ This simply checks that the file specified exists, if so the relevant
information is returned. If a .gz filename is specified then the file
name with .gz removed will also be checked and information about it
will be returned in Alt-*
diff --git a/methods/ftp.cc b/methods/ftp.cc
index 70bf4f607..621f48476 100644
--- a/methods/ftp.cc
+++ b/methods/ftp.cc
@@ -3,7 +3,7 @@
// $Id: ftp.cc,v 1.31.2.1 2004/01/16 18:58:50 mdz Exp $
/* ######################################################################
- FTP Aquire Method - This is the FTP aquire method for APT.
+ FTP Acquire Method - This is the FTP acquire method for APT.
This is a very simple implementation that does not try to optimize
at all. Commands are sent syncronously with the FTP server (as the
@@ -946,7 +946,7 @@ FtpMethod::FtpMethod() : pkgAcqMethod("1.0",SendConfig)
/*}}}*/
// FtpMethod::SigTerm - Handle a fatal signal /*{{{*/
// ---------------------------------------------------------------------
-/* This closes and timestamps the open file. This is neccessary to get
+/* This closes and timestamps the open file. This is necessary to get
resume behavoir on user abort */
void FtpMethod::SigTerm(int)
{
diff --git a/methods/ftp.h b/methods/ftp.h
index 2634f0732..8055c389f 100644
--- a/methods/ftp.h
+++ b/methods/ftp.h
@@ -3,7 +3,7 @@
// $Id: ftp.h,v 1.4 2001/03/06 07:15:29 jgg Exp $
/* ######################################################################
- FTP Aquire Method - This is the FTP aquire method for APT.
+ FTP Acquire Method - This is the FTP acquire method for APT.
##################################################################### */
/*}}}*/
diff --git a/methods/http.cc b/methods/http.cc
index 96c4e3ca0..42b31beeb 100644
--- a/methods/http.cc
+++ b/methods/http.cc
@@ -3,7 +3,7 @@
// $Id: http.cc,v 1.59 2004/05/08 19:42:35 mdz Exp $
/* ######################################################################
- HTTP Acquire Method - This is the HTTP aquire method for APT.
+ HTTP Acquire Method - This is the HTTP acquire method for APT.
It uses HTTP/1.1 and many of the fancy options there-in, such as
pipelining, range, if-range and so on.
@@ -732,7 +732,7 @@ void HttpMethod::SendReq(FetchItem *Itm)
}
// If we ask for uncompressed files servers might respond with content-
- // negotation which lets us end up with compressed files we do not support,
+ // negotiation which lets us end up with compressed files we do not support,
// see 657029, 657560 and co, so if we have no extension on the request
// ask for text only. As a sidenote: If there is nothing to negotate servers
// seem to be nice and ignore it.
diff --git a/methods/http.h b/methods/http.h
index 02c04e8ae..450a42eed 100644
--- a/methods/http.h
+++ b/methods/http.h
@@ -3,7 +3,7 @@
// $Id: http.h,v 1.12 2002/04/18 05:09:38 jgg Exp $
/* ######################################################################
- HTTP Acquire Method - This is the HTTP aquire method for APT.
+ HTTP Acquire Method - This is the HTTP acquire method for APT.
##################################################################### */
/*}}}*/
diff --git a/methods/https.cc b/methods/https.cc
index e713be19f..febe6a0f0 100644
--- a/methods/https.cc
+++ b/methods/https.cc
@@ -3,7 +3,7 @@
// $Id: http.cc,v 1.59 2004/05/08 19:42:35 mdz Exp $
/* ######################################################################
- HTTPS Acquire Method - This is the HTTPS aquire method for APT.
+ HTTPS Acquire Method - This is the HTTPS acquire method for APT.
It uses libcurl
@@ -309,7 +309,7 @@ bool HttpsMethod::Fetch(FetchItem *Itm)
curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, curl_errorstr);
// If we ask for uncompressed files servers might respond with content-
- // negotation which lets us end up with compressed files we do not support,
+ // negotiation which lets us end up with compressed files we do not support,
// see 657029, 657560 and co, so if we have no extension on the request
// ask for text only. As a sidenote: If there is nothing to negotate servers
// seem to be nice and ignore it.
diff --git a/methods/https.h b/methods/https.h
index 89a89d19c..ab0dd3407 100644
--- a/methods/https.h
+++ b/methods/https.h
@@ -3,7 +3,7 @@
// $Id: http.h,v 1.12 2002/04/18 05:09:38 jgg Exp $
/* ######################################################################
- HTTP Acquire Method - This is the HTTP aquire method for APT.
+ HTTP Acquire Method - This is the HTTP acquire method for APT.
##################################################################### */
/*}}}*/
diff --git a/methods/mirror.cc b/methods/mirror.cc
index 83ef0d133..085f3717b 100644
--- a/methods/mirror.cc
+++ b/methods/mirror.cc
@@ -3,7 +3,7 @@
// $Id: mirror.cc,v 1.59 2004/05/08 19:42:35 mdz Exp $
/* ######################################################################
- Mirror Aquire Method - This is the Mirror aquire method for APT.
+ Mirror Acquire Method - This is the Mirror acquire method for APT.
##################################################################### */
/*}}}*/
@@ -49,7 +49,7 @@ using namespace std;
* of the failure that is also send to LP
*
* TODO:
- * - deal with runing as non-root because we can't write to the lists
+ * - deal with running as non-root because we can't write to the lists
dir then -> use the cached mirror file
* - better method to download than having a pkgAcquire interface here
* and better error handling there!
@@ -290,7 +290,7 @@ bool MirrorMethod::InitMirrors()
// FIXME: make the mirror selection more clever, do not
// just use the first one!
// BUT: we can not make this random, the mirror has to be
- // stable accross session, because otherwise we can
+ // stable across session, because otherwise we can
// get into sync issues (got indexfiles from mirror A,
// but packages from mirror B - one might be out of date etc)
ifstream in(MirrorFile.c_str());
diff --git a/methods/mirror.h b/methods/mirror.h
index 81e531e21..1dd9f2ec6 100644
--- a/methods/mirror.h
+++ b/methods/mirror.h
@@ -3,7 +3,7 @@
// $Id: http.h,v 1.12 2002/04/18 05:09:38 jgg Exp $
/* ######################################################################
- MIRROR Aquire Method - This is the MIRROR aquire method for APT.
+ MIRROR Acquire Method - This is the MIRROR acquire method for APT.
##################################################################### */
/*}}}*/
diff --git a/methods/rfc2553emu.h b/methods/rfc2553emu.h
index b15facb31..ad7ddf48a 100644
--- a/methods/rfc2553emu.h
+++ b/methods/rfc2553emu.h
@@ -75,7 +75,7 @@
#endif
/* If we don't have getaddrinfo then we probably don't have
- sockaddr_storage either (same RFC) so we definately will not be
+ sockaddr_storage either (same RFC) so we definitely will not be
doing any IPv6 stuff. Do not use the members of this structure to
retain portability, cast to a sockaddr. */
#define sockaddr_storage sockaddr_in
diff --git a/methods/rsh.cc b/methods/rsh.cc
index 4e1aaea26..550f77eca 100644
--- a/methods/rsh.cc
+++ b/methods/rsh.cc
@@ -255,7 +255,7 @@ bool RSHConn::WriteMsg(std::string &Text,bool Sync,const char *Fmt,...)
/*}}}*/
// RSHConn::Size - Return the size of the file /*{{{*/
// ---------------------------------------------------------------------
-/* Right now for successfull transfer the file size must be known in
+/* Right now for successful transfer the file size must be known in
advance. */
bool RSHConn::Size(const char *Path,unsigned long long &Size)
{
diff --git a/methods/server.cc b/methods/server.cc
index 6dd3970a6..ef90c809c 100644
--- a/methods/server.cc
+++ b/methods/server.cc
@@ -86,7 +86,7 @@ ServerState::RunHeadersResult ServerState::RunHeaders(FileFd * const File)
if (Result == 100)
continue;
- // Tidy up the connection persistance state.
+ // Tidy up the connection persistence state.
if (Encoding == Closes && HaveContent == true)
Persistent = false;
@@ -146,7 +146,7 @@ bool ServerState::HeaderLine(string Line)
return _error->Error(_("The HTTP server sent an invalid reply header"));
}
- /* Check the HTTP response header to get the default persistance
+ /* Check the HTTP response header to get the default persistence
state. */
if (Major < 1)
Persistent = false;
@@ -366,7 +366,7 @@ ServerMethod::DealWithHeaders(FetchResult &Res)
/*}}}*/
// ServerMethod::SigTerm - Handle a fatal signal /*{{{*/
// ---------------------------------------------------------------------
-/* This closes and timestamps the open file. This is neccessary to get
+/* This closes and timestamps the open file. This is necessary to get
resume behavoir on user abort */
void ServerMethod::SigTerm(int)
{
diff --git a/test/integration/framework b/test/integration/framework
index 08d796a10..63df86df7 100644
--- a/test/integration/framework
+++ b/test/integration/framework
@@ -947,7 +947,7 @@ URI: $1
Filename: ${2}
"
# simple worker keeping stdin open until we are done (201) or error (400)
- # and requesting new URIs on try-agains/redirects inbetween
+ # and requesting new URIs on try-agains/redirects in-between
{ tail -n 999 -f "$DOWNLOG" & echo "TAILPID: $!"; } | while read f1 f2; do
if [ "$f1" = 'TAILPID:' ]; then
TAILPID="$f2"
diff --git a/test/integration/test-apt-get-source b/test/integration/test-apt-get-source
index 083e26db1..33bd980d0 100755
--- a/test/integration/test-apt-get-source
+++ b/test/integration/test-apt-get-source
@@ -65,7 +65,7 @@ Need to get 0 B of source archives.
'file://${APTARCHIVE}/foo_1.0.tar.gz' foo_1.0.tar.gz 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e" aptget source -q --print-uris foo=1.0
# select by release with no binary package (Bug#731102) but ensure to get
-# higest version
+# highest version
testequal "$HEADER
Selected version '0.1' (wheezy) for foo
Need to get 0 B of source archives.
diff --git a/test/integration/test-bug-617690-allow-unauthenticated-makes-all-untrusted b/test/integration/test-bug-617690-allow-unauthenticated-makes-all-untrusted
index 633c197c0..f93510fd7 100755
--- a/test/integration/test-bug-617690-allow-unauthenticated-makes-all-untrusted
+++ b/test/integration/test-bug-617690-allow-unauthenticated-makes-all-untrusted
@@ -11,7 +11,7 @@ buildsimplenativepackage 'cool' 'i386' '1.0' 'unstable'
setupaptarchive --no-update
testfileexists() {
- msgtest 'Test for existance of file' "$1"
+ msgtest 'Test for existence of file' "$1"
test -e "$1" && msgpass || msgfail
rm -f "$1"
}
diff --git a/test/integration/test-sourceslist-arch-plusminus-options b/test/integration/test-sourceslist-arch-plusminus-options
index 0d4d7448f..0091964e6 100755
--- a/test/integration/test-sourceslist-arch-plusminus-options
+++ b/test/integration/test-sourceslist-arch-plusminus-options
@@ -76,7 +76,7 @@ echo 'deb [arch=mips,i386 arch-=mips] http://example.org/debian stable rocks' >
testbinaries 'substract from a arch-set' 'i386'
echo 'deb [arch=mips,i386 arch-=mips] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
-testbinaries 'useless substract from a arch-set' 'i386'
+testbinaries 'useless subtract from a arch-set' 'i386'
echo 'deb [arch=mips,i386 arch+=armhf] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
testbinaries 'addition to a arch-set' 'i386' 'mips' 'armhf'
diff --git a/test/libapt/globalerror_test.cc b/test/libapt/globalerror_test.cc
index 72044d493..b6939231d 100644
--- a/test/libapt/globalerror_test.cc
+++ b/test/libapt/globalerror_test.cc
@@ -15,17 +15,17 @@ int main(int argc,char *argv[])
equals(_error->empty(), true);
equals(_error->empty(GlobalError::DEBUG), false);
equals(_error->PendingError(), false);
- equals(_error->Error("%s horrible %s %d times", "Something", "happend", 2), false);
+ equals(_error->Error("%s horrible %s %d times", "Something", "happened", 2), false);
equals(_error->PendingError(), true);
std::string text;
equals(_error->PopMessage(text), false);
equals(_error->PendingError(), true);
equals(text, "A Notice");
equals(_error->PopMessage(text), true);
- equals(text, "Something horrible happend 2 times");
+ equals(text, "Something horrible happened 2 times");
equals(_error->empty(GlobalError::DEBUG), true);
equals(_error->PendingError(), false);
- equals(_error->Error("%s horrible %s %d times", "Something", "happend", 2), false);
+ equals(_error->Error("%s horrible %s %d times", "Something", "happened", 2), false);
equals(_error->PendingError(), true);
equals(_error->empty(GlobalError::FATAL), false);
_error->Discard();
@@ -33,7 +33,7 @@ int main(int argc,char *argv[])
equals(_error->empty(), true);
equals(_error->PendingError(), false);
equals(_error->Notice("%s Notice", "A"), false);
- equals(_error->Error("%s horrible %s %d times", "Something", "happend", 2), false);
+ equals(_error->Error("%s horrible %s %d times", "Something", "happened", 2), false);
equals(_error->PendingError(), true);
equals(_error->empty(GlobalError::NOTICE), false);
_error->PushToStack();
@@ -49,12 +49,12 @@ int main(int argc,char *argv[])
equals(_error->PendingError(), true);
equals(text, "A Notice");
equals(_error->PopMessage(text), true);
- equals(text, "Something horrible happend 2 times");
+ equals(text, "Something horrible happened 2 times");
equals(_error->PendingError(), false);
equals(_error->empty(), true);
equals(_error->Notice("%s Notice", "A"), false);
- equals(_error->Error("%s horrible %s %d times", "Something", "happend", 2), false);
+ equals(_error->Error("%s horrible %s %d times", "Something", "happened", 2), false);
equals(_error->PendingError(), true);
equals(_error->empty(GlobalError::NOTICE), false);
_error->PushToStack();
@@ -70,7 +70,7 @@ int main(int argc,char *argv[])
equals(_error->PendingError(), true);
equals(text, "A Notice");
equals(_error->PopMessage(text), true);
- equals(text, "Something horrible happend 2 times");
+ equals(text, "Something horrible happened 2 times");
equals(_error->PendingError(), false);
equals(_error->empty(), false);
equals(_error->PopMessage(text), false);
@@ -78,24 +78,24 @@ int main(int argc,char *argv[])
equals(_error->empty(), true);
errno = 0;
- equals(_error->Errno("errno", "%s horrible %s %d times", "Something", "happend", 2), false);
+ equals(_error->Errno("errno", "%s horrible %s %d times", "Something", "happened", 2), false);
equals(_error->empty(), false);
equals(_error->PendingError(), true);
equals(_error->PopMessage(text), true);
equals(_error->PendingError(), false);
- equals(text, std::string("Something horrible happend 2 times - errno (0: ").append(textOfErrnoZero).append(")"));
+ equals(text, std::string("Something horrible happened 2 times - errno (0: ").append(textOfErrnoZero).append(")"));
equals(_error->empty(), true);
std::string longText;
for (size_t i = 0; i < 500; ++i)
longText.append("a");
- equals(_error->Error("%s horrible %s %d times", longText.c_str(), "happend", 2), false);
+ equals(_error->Error("%s horrible %s %d times", longText.c_str(), "happened", 2), false);
equals(_error->PopMessage(text), true);
- equals(text, std::string(longText).append(" horrible happend 2 times"));
+ equals(text, std::string(longText).append(" horrible happened 2 times"));
- equals(_error->Errno("errno", "%s horrible %s %d times", longText.c_str(), "happend", 2), false);
+ equals(_error->Errno("errno", "%s horrible %s %d times", longText.c_str(), "happened", 2), false);
equals(_error->PopMessage(text), true);
- equals(text, std::string(longText).append(" horrible happend 2 times - errno (0: ").append(textOfErrnoZero).append(")"));
+ equals(text, std::string(longText).append(" horrible happened 2 times - errno (0: ").append(textOfErrnoZero).append(")"));
equals(_error->Warning("Репозиторий не обновлён и будут %d %s", 4, "test"), false);
equals(_error->PopMessage(text), false);
--
cgit v1.2.3-70-g09d2
From ed9665aedf77b3b8345bd4ed33de7885738e29f0 Mon Sep 17 00:00:00 2001
From: Michael Vogt
Date: Thu, 27 Feb 2014 16:46:05 +0100
Subject: initial version of apt-helper
---
apt-pkg/acquire-item.cc | 2 +-
cmdline/apt-helper.cc | 127 ++++++++++++++++++++++++++++
cmdline/makefile | 7 ++
debian/rules | 3 +
debian/tests/run-tests | 1 +
test/integration/framework | 43 ++--------
test/integration/test-apt-https-no-redirect | 2 +-
7 files changed, 148 insertions(+), 37 deletions(-)
create mode 100644 cmdline/apt-helper.cc
(limited to 'apt-pkg')
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc
index 36bb48382..de03011bf 100644
--- a/apt-pkg/acquire-item.cc
+++ b/apt-pkg/acquire-item.cc
@@ -2201,7 +2201,7 @@ pkgAcqFile::pkgAcqFile(pkgAcquire *Owner,string URI,string Hash,
if (stat(DestFile.c_str(),&Buf) == 0)
{
// Hmm, the partial file is too big, erase it
- if ((unsigned long long)Buf.st_size > Size)
+ if ((Size > 0) && (unsigned long long)Buf.st_size > Size)
unlink(DestFile.c_str());
else
PartialSize = Buf.st_size;
diff --git a/cmdline/apt-helper.cc b/cmdline/apt-helper.cc
new file mode 100644
index 000000000..c1c8b2178
--- /dev/null
+++ b/cmdline/apt-helper.cc
@@ -0,0 +1,127 @@
+// -*- mode: cpp; mode: fold -*-
+// Description /*{{{*/
+/* #####################################################################
+ apt-helper - cmdline helpers
+ ##################################################################### */
+ /*}}}*/
+// Include Files /*{{{*/
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+
+
+#include
+ /*}}}*/
+using namespace std;
+
+bool DoDownloadFile(CommandLine &CmdL)
+{
+ if (CmdL.FileSize() <= 2)
+ return _error->Error(_("Must specify at least one pair url/filename"));
+
+
+ pkgAcquire Fetcher;
+ AcqTextStatus Stat(ScreenWidth, _config->FindI("quiet",0));
+ Fetcher.Setup(&Stat);
+ std::string download_uri = CmdL.FileList[1];
+ std::string targetfile = CmdL.FileList[2];
+ new pkgAcqFile(&Fetcher, download_uri, "", 0, "desc", "short-desc",
+ "dest-dir-ignored", targetfile);
+ Fetcher.Run();
+ if (!FileExists(targetfile))
+ {
+ _error->Error(_("Download Failed"));
+ return false;
+ }
+ return true;
+}
+
+bool ShowHelp(CommandLine &CmdL)
+{
+ ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION,
+ COMMON_ARCH,__DATE__,__TIME__);
+
+ if (_config->FindB("version") == true)
+ return true;
+
+ cout <<
+ _("Usage: apt-helper [options] command\n"
+ " apt-helper [options] download-file uri target-path\n"
+ "\n"
+ "apt-helper is a internal helper for apt\n"
+ "\n"
+ "Commands:\n"
+ " download-file - download the given uri to the target-path\n"
+ "\n"
+ " This APT helper has Super Meep Powers.\n");
+ return true;
+}
+
+
+int main(int argc,const char *argv[]) /*{{{*/
+{
+ CommandLine::Dispatch Cmds[] = {{"help",&ShowHelp},
+ {"download-file", &DoDownloadFile},
+ {0,0}};
+
+ std::vector Args = getCommandArgs(
+ "apt-download", CommandLine::GetCommand(Cmds, argc, argv));
+
+ // Set up gettext support
+ setlocale(LC_ALL,"");
+ textdomain(PACKAGE);
+
+ // Parse the command line and initialize the package library
+ CommandLine CmdL(Args.data(),_config);
+ if (pkgInitConfig(*_config) == false ||
+ CmdL.Parse(argc,argv) == false ||
+ pkgInitSystem(*_config,_system) == false)
+ {
+ if (_config->FindB("version") == true)
+ ShowHelp(CmdL);
+ _error->DumpErrors();
+ return 100;
+ }
+
+ // See if the help should be shown
+ if (_config->FindB("help") == true ||
+ _config->FindB("version") == true ||
+ CmdL.FileSize() == 0)
+ {
+ ShowHelp(CmdL);
+ return 0;
+ }
+
+ InitOutput();
+
+ // Match the operation
+ CmdL.DispatchArg(Cmds);
+
+ // Print any errors or warnings found during parsing
+ bool const Errors = _error->PendingError();
+ if (_config->FindI("quiet",0) > 0)
+ _error->DumpErrors();
+ else
+ _error->DumpErrors(GlobalError::DEBUG);
+ return Errors == true ? 100 : 0;
+}
+ /*}}}*/
diff --git a/cmdline/makefile b/cmdline/makefile
index f89192e10..c4a249cd6 100644
--- a/cmdline/makefile
+++ b/cmdline/makefile
@@ -47,6 +47,13 @@ LIB_MAKES = apt-pkg/makefile
SOURCE = apt-mark.cc
include $(PROGRAM_H)
+# The apt-helper
+PROGRAM=apt-helper
+SLIBS = -lapt-pkg -lapt-private $(INTLLIBS)
+LIB_MAKES = apt-pkg/makefile
+SOURCE = apt-helper.cc
+include $(PROGRAM_H)
+
# The apt-report-mirror-failure program
#SOURCE=apt-report-mirror-failure
#TO=$(BIN)
diff --git a/debian/rules b/debian/rules
index 1b3782ab6..eec016607 100755
--- a/debian/rules
+++ b/debian/rules
@@ -207,6 +207,9 @@ apt: build-binary build-manpages debian/apt.install
#mv debian/$@/usr/bin/apt-report-mirror-failure \
# debian/$@/usr/lib/apt/apt-report-mirror-failure \
+ # move the apt-helper in place
+ mv debian/$@/usr/bin/apt-helper debian/$@/usr/lib/apt/apt-helper
+
dh_bugfiles -p$@
dh_lintian -p$@
dh_installexamples -p$@ $(BLD)/docs/examples/*
diff --git a/debian/tests/run-tests b/debian/tests/run-tests
index 6dc4eaa93..e03db9b0c 100644
--- a/debian/tests/run-tests
+++ b/debian/tests/run-tests
@@ -14,5 +14,6 @@ make -C test/interactive-helper/
# run against the installed apt
APT_INTEGRATION_TESTS_WEBSERVER_BIN_DIR=$(pwd)/build/bin \
APT_INTEGRATION_TESTS_METHODS_DIR=/usr/lib/apt/methods \
+APT_INTEGRATION_TESTS_LIBEXEC_DIR=/usr/lib/apt/ \
APT_INTEGRATION_TESTS_BUILD_DIR=/usr/bin \
./test/integration/run-tests
diff --git a/test/integration/framework b/test/integration/framework
index 99214ef73..911a4d742 100644
--- a/test/integration/framework
+++ b/test/integration/framework
@@ -111,6 +111,9 @@ aptftparchive() { runapt apt-ftparchive "$@"; }
aptkey() { runapt apt-key "$@"; }
aptmark() { runapt apt-mark "$@"; }
apt() { runapt apt "$@"; }
+apthelper() {
+ LD_LIBRARY_PATH=${APTHELPERBINDIR} ${APTHELPERBINDIR}/apt-helper "$@";
+}
aptwebserver() {
LD_LIBRARY_PATH=${APTWEBSERVERBINDIR} ${APTWEBSERVERBINDIR}/aptwebserver "$@";
}
@@ -177,6 +180,7 @@ setupenvironment() {
# allow overriding the default BUILDDIR location
BUILDDIRECTORY=${APT_INTEGRATION_TESTS_BUILD_DIR:-"${TESTDIRECTORY}/../../build/bin"}
METHODSDIR=${APT_INTEGRATION_TESTS_METHODS_DIR:-"${BUILDDIRECTORY}/methods"}
+ APTHELPERBINDIR=${APT_INTEGRATION_TESTS_LIBEXEC_DIR:-"${BUILDDIRECTORY}"}
APTWEBSERVERBINDIR=${APT_INTEGRATION_TESTS_WEBSERVER_BIN_DIR:-"${BUILDDIRECTORY}"}
test -x "${BUILDDIRECTORY}/apt-get" || msgdie "You need to build tree first"
# -----
@@ -934,41 +938,10 @@ changetocdrom() {
}
downloadfile() {
- PROTO="$(echo "$1" | cut -d':' -f 1)"
- if [ ! -x "${METHODSDIR}/${PROTO}" ]; then
- msgwarn "can not find ${METHODSDIR}/${PROTO}"
- return 1
- fi
- local DOWNLOG="${TMPWORKINGDIRECTORY}/download.log"
- rm -f "$DOWNLOG"
- touch "$DOWNLOG"
- {
- echo "601 Configuration
-Config-Item: Acquire::https::CaInfo=${TESTDIR}/apt.pem
-Config-Item: Debug::Acquire::${PROTO}=1
-
-600 Acquire URI
-URI: $1
-Filename: ${2}
-"
- # simple worker keeping stdin open until we are done (201) or error (400)
- # and requesting new URIs on try-agains/redirects in-between
- { tail -n 999 -f "$DOWNLOG" & echo "TAILPID: $!"; } | while read f1 f2; do
- if [ "$f1" = 'TAILPID:' ]; then
- TAILPID="$f2"
- elif [ "$f1" = 'New-URI:' ]; then
- echo "600 Acquire URI
-URI: $f2
-Filename: ${2}
-"
- elif [ "$f1" = '201' ] || [ "$f1" = '400' ]; then
- # tail would only die on next read – which never happens
- test -z "$TAILPID" || kill -s HUP "$TAILPID"
- break
- fi
- done
- } | LD_LIBRARY_PATH=${BUILDDIRECTORY} ${METHODSDIR}/${PROTO} 2>&1 | tee "$DOWNLOG"
- rm "$DOWNLOG"
+ PROTO="$(echo "$1" | cut -d':' -f 1)"
+ apthelper -o Acquire::https::CaInfo=${TESTDIR}/apt.pem \
+ -o Debug::Acquire::${PROTO}=1 \
+ download-file "$1" "$2" 2>&1
# only if the file exists the download was successful
if [ -e "$2" ]; then
return 0
diff --git a/test/integration/test-apt-https-no-redirect b/test/integration/test-apt-https-no-redirect
index c405d1167..0408c6832 100755
--- a/test/integration/test-apt-https-no-redirect
+++ b/test/integration/test-apt-https-no-redirect
@@ -19,6 +19,6 @@ msgtest 'normal https download works'
downloadfile 'https://localhost:4433/pool/apt_1.0/changelog' changelog >/dev/null 2>/dev/null && msgpass || msgfail
msgtest 'redirecting https to http does not work'
-downloadfile 'https://localhost:4433/redirectme/pool/apt_1.0/changelog' changelog3 2>&1 | grep "Protocol http not supported or disabled in libcurl" > /dev/null && msgpass
+downloadfile 'https://localhost:4433/redirectme/pool/apt_1.0/changelog' changelog3 2>&1 | grep "Protocol http not supported or disabled in libcurl" > /dev/null && msgpass || msgfail
--
cgit v1.2.3-70-g09d2
From e43a426e5d402d36eb180935fbbf1430a4a86e3f Mon Sep 17 00:00:00 2001
From: Michael Vogt
Date: Thu, 27 Feb 2014 16:46:05 +0100
Subject: initial version of apt-helper
---
apt-pkg/acquire-item.cc | 2 +-
cmdline/apt-helper.cc | 127 ++++++++++++++++++++++++++++
cmdline/makefile | 7 ++
debian/rules | 3 +
debian/tests/run-tests | 1 +
test/integration/framework | 69 ++++-----------
test/integration/test-apt-https-no-redirect | 20 ++++-
7 files changed, 174 insertions(+), 55 deletions(-)
create mode 100644 cmdline/apt-helper.cc
(limited to 'apt-pkg')
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc
index 36bb48382..de03011bf 100644
--- a/apt-pkg/acquire-item.cc
+++ b/apt-pkg/acquire-item.cc
@@ -2201,7 +2201,7 @@ pkgAcqFile::pkgAcqFile(pkgAcquire *Owner,string URI,string Hash,
if (stat(DestFile.c_str(),&Buf) == 0)
{
// Hmm, the partial file is too big, erase it
- if ((unsigned long long)Buf.st_size > Size)
+ if ((Size > 0) && (unsigned long long)Buf.st_size > Size)
unlink(DestFile.c_str());
else
PartialSize = Buf.st_size;
diff --git a/cmdline/apt-helper.cc b/cmdline/apt-helper.cc
new file mode 100644
index 000000000..c1c8b2178
--- /dev/null
+++ b/cmdline/apt-helper.cc
@@ -0,0 +1,127 @@
+// -*- mode: cpp; mode: fold -*-
+// Description /*{{{*/
+/* #####################################################################
+ apt-helper - cmdline helpers
+ ##################################################################### */
+ /*}}}*/
+// Include Files /*{{{*/
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+
+
+#include
+ /*}}}*/
+using namespace std;
+
+bool DoDownloadFile(CommandLine &CmdL)
+{
+ if (CmdL.FileSize() <= 2)
+ return _error->Error(_("Must specify at least one pair url/filename"));
+
+
+ pkgAcquire Fetcher;
+ AcqTextStatus Stat(ScreenWidth, _config->FindI("quiet",0));
+ Fetcher.Setup(&Stat);
+ std::string download_uri = CmdL.FileList[1];
+ std::string targetfile = CmdL.FileList[2];
+ new pkgAcqFile(&Fetcher, download_uri, "", 0, "desc", "short-desc",
+ "dest-dir-ignored", targetfile);
+ Fetcher.Run();
+ if (!FileExists(targetfile))
+ {
+ _error->Error(_("Download Failed"));
+ return false;
+ }
+ return true;
+}
+
+bool ShowHelp(CommandLine &CmdL)
+{
+ ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION,
+ COMMON_ARCH,__DATE__,__TIME__);
+
+ if (_config->FindB("version") == true)
+ return true;
+
+ cout <<
+ _("Usage: apt-helper [options] command\n"
+ " apt-helper [options] download-file uri target-path\n"
+ "\n"
+ "apt-helper is a internal helper for apt\n"
+ "\n"
+ "Commands:\n"
+ " download-file - download the given uri to the target-path\n"
+ "\n"
+ " This APT helper has Super Meep Powers.\n");
+ return true;
+}
+
+
+int main(int argc,const char *argv[]) /*{{{*/
+{
+ CommandLine::Dispatch Cmds[] = {{"help",&ShowHelp},
+ {"download-file", &DoDownloadFile},
+ {0,0}};
+
+ std::vector Args = getCommandArgs(
+ "apt-download", CommandLine::GetCommand(Cmds, argc, argv));
+
+ // Set up gettext support
+ setlocale(LC_ALL,"");
+ textdomain(PACKAGE);
+
+ // Parse the command line and initialize the package library
+ CommandLine CmdL(Args.data(),_config);
+ if (pkgInitConfig(*_config) == false ||
+ CmdL.Parse(argc,argv) == false ||
+ pkgInitSystem(*_config,_system) == false)
+ {
+ if (_config->FindB("version") == true)
+ ShowHelp(CmdL);
+ _error->DumpErrors();
+ return 100;
+ }
+
+ // See if the help should be shown
+ if (_config->FindB("help") == true ||
+ _config->FindB("version") == true ||
+ CmdL.FileSize() == 0)
+ {
+ ShowHelp(CmdL);
+ return 0;
+ }
+
+ InitOutput();
+
+ // Match the operation
+ CmdL.DispatchArg(Cmds);
+
+ // Print any errors or warnings found during parsing
+ bool const Errors = _error->PendingError();
+ if (_config->FindI("quiet",0) > 0)
+ _error->DumpErrors();
+ else
+ _error->DumpErrors(GlobalError::DEBUG);
+ return Errors == true ? 100 : 0;
+}
+ /*}}}*/
diff --git a/cmdline/makefile b/cmdline/makefile
index f89192e10..c4a249cd6 100644
--- a/cmdline/makefile
+++ b/cmdline/makefile
@@ -47,6 +47,13 @@ LIB_MAKES = apt-pkg/makefile
SOURCE = apt-mark.cc
include $(PROGRAM_H)
+# The apt-helper
+PROGRAM=apt-helper
+SLIBS = -lapt-pkg -lapt-private $(INTLLIBS)
+LIB_MAKES = apt-pkg/makefile
+SOURCE = apt-helper.cc
+include $(PROGRAM_H)
+
# The apt-report-mirror-failure program
#SOURCE=apt-report-mirror-failure
#TO=$(BIN)
diff --git a/debian/rules b/debian/rules
index 1b3782ab6..eec016607 100755
--- a/debian/rules
+++ b/debian/rules
@@ -207,6 +207,9 @@ apt: build-binary build-manpages debian/apt.install
#mv debian/$@/usr/bin/apt-report-mirror-failure \
# debian/$@/usr/lib/apt/apt-report-mirror-failure \
+ # move the apt-helper in place
+ mv debian/$@/usr/bin/apt-helper debian/$@/usr/lib/apt/apt-helper
+
dh_bugfiles -p$@
dh_lintian -p$@
dh_installexamples -p$@ $(BLD)/docs/examples/*
diff --git a/debian/tests/run-tests b/debian/tests/run-tests
index 6dc4eaa93..e03db9b0c 100644
--- a/debian/tests/run-tests
+++ b/debian/tests/run-tests
@@ -14,5 +14,6 @@ make -C test/interactive-helper/
# run against the installed apt
APT_INTEGRATION_TESTS_WEBSERVER_BIN_DIR=$(pwd)/build/bin \
APT_INTEGRATION_TESTS_METHODS_DIR=/usr/lib/apt/methods \
+APT_INTEGRATION_TESTS_LIBEXEC_DIR=/usr/lib/apt/ \
APT_INTEGRATION_TESTS_BUILD_DIR=/usr/bin \
./test/integration/run-tests
diff --git a/test/integration/framework b/test/integration/framework
index 99214ef73..d9bacef83 100644
--- a/test/integration/framework
+++ b/test/integration/framework
@@ -90,18 +90,18 @@ msgdone() {
echo "${CDONE}DONE${CNORMAL}";
fi
}
-
+getaptconfig() {
+ if [ -f ./aptconfig.conf ]; then
+ echo "./aptconfig.conf"
+ elif [ -f ../aptconfig.conf ]; then
+ echo "../aptconfig.conf"
+ fi
+}
runapt() {
msgdebug "Executing: ${CCMD}$*${CDEBUG} "
local CMD="$1"
shift
- if [ -f ./aptconfig.conf ]; then
- MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG=aptconfig.conf LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/$CMD "$@"
- elif [ -f ../aptconfig.conf ]; then
- MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG=../aptconfig.conf LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/$CMD "$@"
- else
- MALLOC_PERTURB_=21 MALLOC_CHECK_=2 LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/$CMD "$@"
- fi
+ MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG="$(getaptconfig)" LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/$CMD "$@"
}
aptconfig() { runapt apt-config "$@"; }
aptcache() { runapt apt-cache "$@"; }
@@ -111,6 +111,9 @@ aptftparchive() { runapt apt-ftparchive "$@"; }
aptkey() { runapt apt-key "$@"; }
aptmark() { runapt apt-mark "$@"; }
apt() { runapt apt "$@"; }
+apthelper() {
+ APT_CONFIG="$(getaptconfig)" LD_LIBRARY_PATH=${APTHELPERBINDIR} ${APTHELPERBINDIR}/apt-helper "$@";
+}
aptwebserver() {
LD_LIBRARY_PATH=${APTWEBSERVERBINDIR} ${APTWEBSERVERBINDIR}/aptwebserver "$@";
}
@@ -118,17 +121,11 @@ dpkg() {
command dpkg --root=${TMPWORKINGDIRECTORY}/rootdir --force-not-root --force-bad-path --log=${TMPWORKINGDIRECTORY}/rootdir/var/log/dpkg.log "$@"
}
aptitude() {
- if [ -f ./aptconfig.conf ]; then
- APT_CONFIG=aptconfig.conf LD_LIBRARY_PATH=${BUILDDIRECTORY} command aptitude "$@"
- elif [ -f ../aptconfig.conf ]; then
- APT_CONFIG=../aptconfig.conf LD_LIBRARY_PATH=${BUILDDIRECTORY} command aptitude "$@"
- else
- LD_LIBRARY_PATH=${BUILDDIRECTORY} command aptitude "$@"
- fi
+ APT_CONFIG="$(getaptconfig)" LD_LIBRARY_PATH=${BUILDDIRECTORY} command aptitude "$@"
}
gdb() {
echo "gdb: run »$*«"
- APT_CONFIG=aptconfig.conf LD_LIBRARY_PATH=${BUILDDIRECTORY} command gdb ${BUILDDIRECTORY}/$1 --args "$@"
+ APT_CONFIG="$(getaptconfig)" LD_LIBRARY_PATH=${BUILDDIRECTORY} command gdb ${BUILDDIRECTORY}/$1 --args "$@"
}
http() {
LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/methods/http
@@ -177,6 +174,7 @@ setupenvironment() {
# allow overriding the default BUILDDIR location
BUILDDIRECTORY=${APT_INTEGRATION_TESTS_BUILD_DIR:-"${TESTDIRECTORY}/../../build/bin"}
METHODSDIR=${APT_INTEGRATION_TESTS_METHODS_DIR:-"${BUILDDIRECTORY}/methods"}
+ APTHELPERBINDIR=${APT_INTEGRATION_TESTS_LIBEXEC_DIR:-"${BUILDDIRECTORY}"}
APTWEBSERVERBINDIR=${APT_INTEGRATION_TESTS_WEBSERVER_BIN_DIR:-"${BUILDDIRECTORY}"}
test -x "${BUILDDIRECTORY}/apt-get" || msgdie "You need to build tree first"
# -----
@@ -934,41 +932,10 @@ changetocdrom() {
}
downloadfile() {
- PROTO="$(echo "$1" | cut -d':' -f 1)"
- if [ ! -x "${METHODSDIR}/${PROTO}" ]; then
- msgwarn "can not find ${METHODSDIR}/${PROTO}"
- return 1
- fi
- local DOWNLOG="${TMPWORKINGDIRECTORY}/download.log"
- rm -f "$DOWNLOG"
- touch "$DOWNLOG"
- {
- echo "601 Configuration
-Config-Item: Acquire::https::CaInfo=${TESTDIR}/apt.pem
-Config-Item: Debug::Acquire::${PROTO}=1
-
-600 Acquire URI
-URI: $1
-Filename: ${2}
-"
- # simple worker keeping stdin open until we are done (201) or error (400)
- # and requesting new URIs on try-agains/redirects in-between
- { tail -n 999 -f "$DOWNLOG" & echo "TAILPID: $!"; } | while read f1 f2; do
- if [ "$f1" = 'TAILPID:' ]; then
- TAILPID="$f2"
- elif [ "$f1" = 'New-URI:' ]; then
- echo "600 Acquire URI
-URI: $f2
-Filename: ${2}
-"
- elif [ "$f1" = '201' ] || [ "$f1" = '400' ]; then
- # tail would only die on next read – which never happens
- test -z "$TAILPID" || kill -s HUP "$TAILPID"
- break
- fi
- done
- } | LD_LIBRARY_PATH=${BUILDDIRECTORY} ${METHODSDIR}/${PROTO} 2>&1 | tee "$DOWNLOG"
- rm "$DOWNLOG"
+ PROTO="$(echo "$1" | cut -d':' -f 1)"
+ apthelper -o Acquire::https::CaInfo=${TESTDIR}/apt.pem \
+ -o Debug::Acquire::${PROTO}=1 \
+ download-file "$1" "$2" 2>&1
# only if the file exists the download was successful
if [ -e "$2" ]; then
return 0
diff --git a/test/integration/test-apt-https-no-redirect b/test/integration/test-apt-https-no-redirect
index c405d1167..106d4bced 100755
--- a/test/integration/test-apt-https-no-redirect
+++ b/test/integration/test-apt-https-no-redirect
@@ -12,13 +12,27 @@ setupaptarchive --no-update
changetohttpswebserver -o 'aptwebserver::redirect::replace::/redirectme/=http://localhost:8080/'
+DOWNLOG='download-testfile.log'
msgtest 'normal http download works'
-downloadfile 'http://localhost:8080/pool/apt_1.0/changelog' changelog2 >/dev/null 2>/dev/null && msgpass || msgfail
+downloadfile 'http://localhost:8080/pool/apt_1.0/changelog' changelog2 > "$DOWNLOG" && msgpass || msgfail
msgtest 'normal https download works'
-downloadfile 'https://localhost:4433/pool/apt_1.0/changelog' changelog >/dev/null 2>/dev/null && msgpass || msgfail
+downloadfile 'https://localhost:4433/pool/apt_1.0/changelog' changelog > "$DOWNLOG" && msgpass || msgfail
msgtest 'redirecting https to http does not work'
-downloadfile 'https://localhost:4433/redirectme/pool/apt_1.0/changelog' changelog3 2>&1 | grep "Protocol http not supported or disabled in libcurl" > /dev/null && msgpass
+if ! downloadfile 'https://localhost:4433/redirectme/pool/apt_1.0/changelog' changelog3 > "$DOWNLOG"; then
+ msgpass
+else
+ cat >&2 "$DOWNLOG"
+ msgfail
+fi
+
+msgtest 'https methods given proper error on redirect attempt'
+if grep -q 'Protocol http not supported or disabled in libcurl' "$DOWNLOG"; then
+ msgpass
+else
+ cat >&2 "$DOWNLOG"
+ msgfail
+fi
--
cgit v1.2.3-70-g09d2
From c1409d1be88557529c62883be3174793481233de Mon Sep 17 00:00:00 2001
From: Michael Vogt
Date: Wed, 12 Mar 2014 20:33:05 +0100
Subject: add hashsum support in apt-file download and add more tests
---
apt-pkg/contrib/fileutl.cc | 11 +++++++++++
apt-pkg/contrib/fileutl.h | 1 +
cmdline/apt-helper.cc | 11 +++++++++++
test/integration/test-apt-helper | 37 +++++++++++++++++++++++++++++++++++++
4 files changed, 60 insertions(+)
create mode 100755 test/integration/test-apt-helper
(limited to 'apt-pkg')
diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc
index 52411a762..79bcf112c 100644
--- a/apt-pkg/contrib/fileutl.cc
+++ b/apt-pkg/contrib/fileutl.cc
@@ -1841,3 +1841,14 @@ std::string GetTempDir()
return string(tmpdir);
}
+
+bool Rename(std::string From, std::string To)
+{
+ if (rename(From.c_str(),To.c_str()) != 0)
+ {
+ _error->Error(_("rename failed, %s (%s -> %s)."),strerror(errno),
+ From.c_str(),To.c_str());
+ return false;
+ }
+ return true;
+}
diff --git a/apt-pkg/contrib/fileutl.h b/apt-pkg/contrib/fileutl.h
index e752e9621..f0569b6fd 100644
--- a/apt-pkg/contrib/fileutl.h
+++ b/apt-pkg/contrib/fileutl.h
@@ -164,6 +164,7 @@ bool RealFileExists(std::string File);
bool DirectoryExists(std::string const &Path) __attrib_const;
bool CreateDirectory(std::string const &Parent, std::string const &Path);
time_t GetModificationTime(std::string const &Path);
+bool Rename(std::string From, std::string To);
std::string GetTempDir();
diff --git a/cmdline/apt-helper.cc b/cmdline/apt-helper.cc
index c1c8b2178..4a24b01d9 100644
--- a/cmdline/apt-helper.cc
+++ b/cmdline/apt-helper.cc
@@ -44,6 +44,9 @@ bool DoDownloadFile(CommandLine &CmdL)
Fetcher.Setup(&Stat);
std::string download_uri = CmdL.FileList[1];
std::string targetfile = CmdL.FileList[2];
+ HashString hash;
+ if (CmdL.FileSize() > 3)
+ hash = HashString(CmdL.FileList[3]);
new pkgAcqFile(&Fetcher, download_uri, "", 0, "desc", "short-desc",
"dest-dir-ignored", targetfile);
Fetcher.Run();
@@ -52,6 +55,14 @@ bool DoDownloadFile(CommandLine &CmdL)
_error->Error(_("Download Failed"));
return false;
}
+ if(hash.empty() == false)
+ if(hash.VerifyFile(targetfile) == false)
+ {
+ _error->Error(_("HashSum Failed"));
+ Rename(targetfile, targetfile+".failed");
+ return false;
+ }
+
return true;
}
diff --git a/test/integration/test-apt-helper b/test/integration/test-apt-helper
new file mode 100755
index 000000000..37ed95181
--- /dev/null
+++ b/test/integration/test-apt-helper
@@ -0,0 +1,37 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+
+setupenvironment
+configarchitecture "i386"
+
+changetohttpswebserver
+
+echo "foo" > aptarchive/foo
+
+msgtest 'apt-file download-file md5sum'
+apthelper -qq download-file http://localhost:8080/foo foo2 MD5Sum:d3b07384d113edec49eaa6238ad5ff00 && msgpass || msgfail
+testfileequal foo2 'foo'
+
+msgtest 'apt-file download-file sha1'
+apthelper -qq download-file http://localhost:8080/foo foo1 SHA1:f1d2d2f924e986ac86fdf7b36c94bcdf32beec15 && msgpass || msgfail
+testfileequal foo1 'foo'
+
+msgtest 'apt-file download-file sha256'
+apthelper -qq download-file http://localhost:8080/foo foo3 SHA256:b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c && msgpass || msgfail
+testfileequal foo3 'foo'
+
+msgtest 'apt-file download-file no-hash'
+apthelper -qq download-file http://localhost:8080/foo foo4 && msgpass || msgfail
+testfileequal foo4 'foo'
+
+msgtest 'apt-file download-file wrong hash'
+if ! apthelper -qq download-file http://localhost:8080/foo foo5 MD5Sum:aabbcc 2>&1 2> download.stderr; then
+ msgpass
+else
+ msgfail
+fi
+testfileequal download.stderr 'E: HashSum Failed'
+testfileequal foo5.failed 'foo'
--
cgit v1.2.3-70-g09d2
From 8daf68e366fa9fa2794ae667f51562663856237c Mon Sep 17 00:00:00 2001
From: David Kalnischkies
Date: Sat, 15 Feb 2014 13:38:39 +0100
Subject: propagate a negative score point along breaks/conflicts
versioned -dev packages like db and boost have the problem of no
dependencies which would give them a competitive advantage against an
older incarnation of the -dev package, so they tend to be kept back
until the old version is removed from the archive, which, if the user
has older releases in its sources can take a long time (or never happens).
The newer version has a conflicts/breaks against the older one, but the
older one hasn't against the newer, so by giving via the conflicts the
older one a reduced score the newer one can win if there is no other
reason to keep it. If both have a conflict against each other the
scoring will cancel itself out, so no harm done.
This gives "action" a slightly bigger edge in breaks/conflicts cases
than before, but holding back isn't a really good solution anyway.
---
apt-pkg/algorithms.cc | 39 +++++++++++-------
.../test-allow-scores-for-all-dependency-types | 47 ++++++++++++++++++++++
2 files changed, 72 insertions(+), 14 deletions(-)
create mode 100755 test/integration/test-allow-scores-for-all-dependency-types
(limited to 'apt-pkg')
diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc
index 0363ab3e2..db1ebd7e3 100644
--- a/apt-pkg/algorithms.cc
+++ b/apt-pkg/algorithms.cc
@@ -394,8 +394,18 @@ void pkgProblemResolver::MakeScores()
};
int PrioEssentials = _config->FindI("pkgProblemResolver::Scores::Essentials",100);
int PrioInstalledAndNotObsolete = _config->FindI("pkgProblemResolver::Scores::NotObsolete",1);
- int PrioDepends = _config->FindI("pkgProblemResolver::Scores::Depends",1);
- int PrioRecommends = _config->FindI("pkgProblemResolver::Scores::Recommends",1);
+ int DepMap[] = {
+ 0,
+ _config->FindI("pkgProblemResolver::Scores::Depends",1),
+ _config->FindI("pkgProblemResolver::Scores::PreDepends",1),
+ _config->FindI("pkgProblemResolver::Scores::Suggests",0),
+ _config->FindI("pkgProblemResolver::Scores::Recommends",1),
+ _config->FindI("pkgProblemResolver::Scores::Conflicts",-1),
+ _config->FindI("pkgProblemResolver::Scores::Replaces",0),
+ _config->FindI("pkgProblemResolver::Scores::Obsoletes",0),
+ _config->FindI("pkgProblemResolver::Scores::Breaks",-1),
+ _config->FindI("pkgProblemResolver::Scores::Enhances",0)
+ };
int AddProtected = _config->FindI("pkgProblemResolver::Scores::AddProtected",10000);
int AddEssential = _config->FindI("pkgProblemResolver::Scores::AddEssential",5000);
@@ -408,8 +418,15 @@ void pkgProblemResolver::MakeScores()
<< " Extra => " << PrioMap[pkgCache::State::Extra] << endl
<< " Essentials => " << PrioEssentials << endl
<< " InstalledAndNotObsolete => " << PrioInstalledAndNotObsolete << endl
- << " Depends => " << PrioDepends << endl
- << " Recommends => " << PrioRecommends << endl
+ << " Pre-Depends => " << DepMap[pkgCache::Dep::PreDepends] << endl
+ << " Depends => " << DepMap[pkgCache::Dep::Depends] << endl
+ << " Recommends => " << DepMap[pkgCache::Dep::Recommends] << endl
+ << " Suggests => " << DepMap[pkgCache::Dep::Suggests] << endl
+ << " Conflicts => " << DepMap[pkgCache::Dep::Conflicts] << endl
+ << " Breaks => " << DepMap[pkgCache::Dep::DpkgBreaks] << endl
+ << " Replaces => " << DepMap[pkgCache::Dep::Replaces] << endl
+ << " Obsoletes => " << DepMap[pkgCache::Dep::Obsoletes] << endl
+ << " Enhances => " << DepMap[pkgCache::Dep::Enhances] << endl
<< " AddProtected => " << AddProtected << endl
<< " AddEssential => " << AddEssential << endl;
@@ -446,17 +463,11 @@ void pkgProblemResolver::MakeScores()
{
if (Cache[I].InstallVer == 0)
continue;
-
+
for (pkgCache::DepIterator D = Cache[I].InstVerIter(Cache).DependsList(); D.end() == false; ++D)
- {
- if (D->Type == pkgCache::Dep::Depends ||
- D->Type == pkgCache::Dep::PreDepends)
- Scores[D.TargetPkg()->ID] += PrioDepends;
- else if (D->Type == pkgCache::Dep::Recommends)
- Scores[D.TargetPkg()->ID] += PrioRecommends;
- }
- }
-
+ Scores[D.TargetPkg()->ID] += DepMap[D->Type];
+ }
+
// Copy the scores to advoid additive looping
SPtrArray OldScores = new int[Size];
memcpy(OldScores,Scores,sizeof(*Scores)*Size);
diff --git a/test/integration/test-allow-scores-for-all-dependency-types b/test/integration/test-allow-scores-for-all-dependency-types
new file mode 100755
index 000000000..7e15a883b
--- /dev/null
+++ b/test/integration/test-allow-scores-for-all-dependency-types
@@ -0,0 +1,47 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+setupenvironment
+configarchitecture 'amd64'
+
+insertinstalledpackage 'libdb-dev' 'amd64' '5.1.7' 'Depends: libdb5.1-dev'
+insertinstalledpackage 'libdb5.1-dev' 'amd64' '5.1.29-7'
+
+insertpackage 'unstable' 'libdb-dev' 'amd64' '5.3.0' 'Depends: libdb5.3-dev
+Conflicts: libdb5.1-dev'
+insertpackage 'unstable' 'libdb5.1-dev' 'amd64' '5.1.29-7'
+insertpackage 'unstable' 'libdb5.3-dev' 'amd64' '5.3.28-3' 'Conflicts: libdb5.1-dev'
+
+insertpackage 'unstable' 'foo' 'amd64' '1'
+insertpackage 'unstable' 'bar' 'amd64' '1'
+insertpackage 'unstable' 'foo' 'amd64' '2' 'Conflicts: bar'
+insertpackage 'unstable' 'bar' 'amd64' '2' 'Conflicts: foo'
+
+setupaptarchive
+
+testequal 'Reading package lists...
+Building dependency tree...
+The following packages will be REMOVED:
+ libdb5.1-dev
+The following NEW packages will be installed:
+ libdb5.3-dev
+The following packages will be upgraded:
+ libdb-dev
+1 upgraded, 1 newly installed, 1 to remove and 0 not upgraded.
+Remv libdb5.1-dev [5.1.29-7] [libdb-dev:amd64 ]
+Inst libdb-dev [5.1.7] (5.3.0 unstable [amd64]) []
+Inst libdb5.3-dev (5.3.28-3 unstable [amd64])
+Conf libdb5.3-dev (5.3.28-3 unstable [amd64])
+Conf libdb-dev (5.3.0 unstable [amd64])' aptget dist-upgrade -s
+
+rm rootdir/var/lib/dpkg/status
+insertinstalledpackage 'foo' 'amd64' '1'
+insertinstalledpackage 'bar' 'amd64' '1'
+
+testequal 'Reading package lists...
+Building dependency tree...
+The following packages have been kept back:
+ bar foo
+0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.' aptget dist-upgrade -s
--
cgit v1.2.3-70-g09d2
From cb4b85b0bdba6a0c43ca62259dcd35fccd38a45a Mon Sep 17 00:00:00 2001
From: David Kalnischkies
Date: Sat, 15 Feb 2014 14:47:24 +0100
Subject: do not do the same looping twice
Git-Dch: Ignore
---
apt-pkg/algorithms.cc | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
(limited to 'apt-pkg')
diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc
index db1ebd7e3..4d86e5ff8 100644
--- a/apt-pkg/algorithms.cc
+++ b/apt-pkg/algorithms.cc
@@ -456,14 +456,8 @@ void pkgProblemResolver::MakeScores()
*/
if (I->CurrentVer != 0 && Cache[I].CandidateVer != 0 && Cache[I].CandidateVerIter(Cache).Downloadable())
Score += PrioInstalledAndNotObsolete;
- }
-
- // Now that we have the base scores we go and propagate dependencies
- for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; ++I)
- {
- if (Cache[I].InstallVer == 0)
- continue;
+ // propagate score points along dependencies
for (pkgCache::DepIterator D = Cache[I].InstVerIter(Cache).DependsList(); D.end() == false; ++D)
Scores[D.TargetPkg()->ID] += DepMap[D->Type];
}
--
cgit v1.2.3-70-g09d2
From 2252183c69fb5e3e020b45c37d9728b3437d797d Mon Sep 17 00:00:00 2001
From: David Kalnischkies
Date: Sun, 23 Feb 2014 22:22:15 +0100
Subject: show debug output only if told so in packagemanager
Git-Dch: Ignore
---
apt-pkg/packagemanager.cc | 3 ++-
test/integration/test-conflicts-loop | 12 +++---------
2 files changed, 5 insertions(+), 10 deletions(-)
(limited to 'apt-pkg')
diff --git a/apt-pkg/packagemanager.cc b/apt-pkg/packagemanager.cc
index 5f9a31264..0be76b311 100644
--- a/apt-pkg/packagemanager.cc
+++ b/apt-pkg/packagemanager.cc
@@ -741,7 +741,8 @@ bool pkgPackageManager::SmartUnPack(PkgIterator Pkg, bool const Immediate, int c
// See if the current version is conflicting
if (ConflictPkg.CurrentVer() == Ver && List->IsNow(ConflictPkg))
{
- clog << OutputInDepth(Depth) << Pkg.FullName() << " conflicts with " << ConflictPkg.FullName() << endl;
+ if (Debug)
+ clog << OutputInDepth(Depth) << Pkg.FullName() << " conflicts with " << ConflictPkg.FullName() << endl;
/* If a loop is not present or has not yet been detected, attempt to unpack packages
to resolve this conflict. If there is a loop present, remove packages to resolve this conflict */
if (List->IsFlag(ConflictPkg,pkgOrderList::Loop) == false)
diff --git a/test/integration/test-conflicts-loop b/test/integration/test-conflicts-loop
index 4407fbd9d..4978fe1e8 100755
--- a/test/integration/test-conflicts-loop
+++ b/test/integration/test-conflicts-loop
@@ -6,11 +6,11 @@ TESTDIR=$(readlink -f $(dirname $0))
setupenvironment
configarchitecture "i386"
-insertinstalledpackage 'openjdk-6-jre' 'i386' '6b16-1.8-0ubuntu1'
+insertinstalledpackage 'openjdk-6-jre' 'i386' '6b16-1.8-0ubuntu1'
insertpackage 'unstable' 'openjdk-6-jre' 'i386' '6b20-1.9.8-0ubuntu1~10.04.1' 'Conflicts: openjdk-6-jre-headless (<< 6b17~pre3-1), openjdk-6-jre-lib (<< 6b17~pre3-1)'
-insertinstalledpackage 'openjdk-6-jre-lib' 'i386' '6b16-1.8-0ubuntu1'
+insertinstalledpackage 'openjdk-6-jre-lib' 'i386' '6b16-1.8-0ubuntu1'
insertpackage 'unstable' 'openjdk-6-jre-lib' 'i386' '6b20-1.9.8-0ubuntu1~10.04.1' 'Conflicts: openjdk-6-jre (<< 6b17~pre3-1), openjdk-6-jre-headless (<< 6b17~pre3-1)'
-insertinstalledpackage 'openjdk-6-jre-headless' 'i386' '6b16-1.8-0ubuntu1'
+insertinstalledpackage 'openjdk-6-jre-headless' 'i386' '6b16-1.8-0ubuntu1'
insertpackage 'unstable' 'openjdk-6-jre-headless' 'i386' '6b20-1.9.8-0ubuntu1~10.04.1' 'Conflicts: openjdk-6-jre (<< 6b17~pre3-1), openjdk-6-jre-lib (<< 6b17~pre3-1)'
setupaptarchive
@@ -19,16 +19,10 @@ testequal 'Reading package lists...
Building dependency tree...
The following packages will be upgraded:
openjdk-6-jre openjdk-6-jre-headless openjdk-6-jre-lib
- openjdk-6-jre-lib:i386 conflicts with openjdk-6-jre:i386
- openjdk-6-jre:i386 conflicts with openjdk-6-jre-headless:i386
- openjdk-6-jre-headless:i386 conflicts with openjdk-6-jre:i386
3 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Remv openjdk-6-jre [6b16-1.8-0ubuntu1]
- openjdk-6-jre-headless:i386 conflicts with openjdk-6-jre-lib:i386
Remv openjdk-6-jre-lib [6b16-1.8-0ubuntu1]
Inst openjdk-6-jre-headless [6b16-1.8-0ubuntu1] (6b20-1.9.8-0ubuntu1~10.04.1 unstable [i386])
- openjdk-6-jre:i386 conflicts with openjdk-6-jre-lib:i386
- openjdk-6-jre:i386 conflicts with openjdk-6-jre-lib:i386
Inst openjdk-6-jre [6b16-1.8-0ubuntu1] (6b20-1.9.8-0ubuntu1~10.04.1 unstable [i386])
Inst openjdk-6-jre-lib [6b16-1.8-0ubuntu1] (6b20-1.9.8-0ubuntu1~10.04.1 unstable [i386])
Conf openjdk-6-jre-lib (6b20-1.9.8-0ubuntu1~10.04.1 unstable [i386])
--
cgit v1.2.3-70-g09d2
From 9ec748ff103840c4c65471ca00d3b72984131ce4 Mon Sep 17 00:00:00 2001
From: David Kalnischkies
Date: Sun, 23 Feb 2014 22:24:27 +0100
Subject: check version before adding scores in resolver
Prevents that "old" dependencies have an influence in the scoring.
With positive dependencies this is usually not a problem, but negative
dependencies can linger around for a long time.
---
apt-pkg/algorithms.cc | 13 +-
.../test-allow-scores-for-all-dependency-types | 131 ++++++++++++++++++---
2 files changed, 126 insertions(+), 18 deletions(-)
(limited to 'apt-pkg')
diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc
index 4d86e5ff8..8320e7ef0 100644
--- a/apt-pkg/algorithms.cc
+++ b/apt-pkg/algorithms.cc
@@ -459,7 +459,18 @@ void pkgProblemResolver::MakeScores()
// propagate score points along dependencies
for (pkgCache::DepIterator D = Cache[I].InstVerIter(Cache).DependsList(); D.end() == false; ++D)
- Scores[D.TargetPkg()->ID] += DepMap[D->Type];
+ {
+ if (DepMap[D->Type] == 0)
+ continue;
+ pkgCache::PkgIterator const T = D.TargetPkg();
+ if (D->Version != 0)
+ {
+ pkgCache::VerIterator const IV = Cache[T].InstVerIter(Cache);
+ if (IV.end() == true || D.IsSatisfied(IV) != D.IsNegative())
+ continue;
+ }
+ Scores[T->ID] += DepMap[D->Type];
+ }
}
// Copy the scores to advoid additive looping
diff --git a/test/integration/test-allow-scores-for-all-dependency-types b/test/integration/test-allow-scores-for-all-dependency-types
index 7e15a883b..a5c98f3d6 100755
--- a/test/integration/test-allow-scores-for-all-dependency-types
+++ b/test/integration/test-allow-scores-for-all-dependency-types
@@ -6,21 +6,51 @@ TESTDIR=$(readlink -f $(dirname $0))
setupenvironment
configarchitecture 'amd64'
-insertinstalledpackage 'libdb-dev' 'amd64' '5.1.7' 'Depends: libdb5.1-dev'
-insertinstalledpackage 'libdb5.1-dev' 'amd64' '5.1.29-7'
-
-insertpackage 'unstable' 'libdb-dev' 'amd64' '5.3.0' 'Depends: libdb5.3-dev
+insertpackage 'unversioned' 'libdb-dev' 'amd64' '5.3.0' 'Depends: libdb5.3-dev
Conflicts: libdb5.1-dev'
-insertpackage 'unstable' 'libdb5.1-dev' 'amd64' '5.1.29-7'
-insertpackage 'unstable' 'libdb5.3-dev' 'amd64' '5.3.28-3' 'Conflicts: libdb5.1-dev'
+insertpackage 'unversioned' 'libdb5.1-dev' 'amd64' '5.1.29-7'
+insertpackage 'unversioned' 'libdb5.3-dev' 'amd64' '5.3.28-3' 'Conflicts: libdb5.1-dev'
+
+insertpackage 'unversioned' 'foo' 'amd64' '1'
+insertpackage 'unversioned' 'bar' 'amd64' '1'
+insertpackage 'unversioned' 'foo' 'amd64' '2' 'Conflicts: bar'
+insertpackage 'unversioned' 'bar' 'amd64' '2' 'Conflicts: foo'
+insertpackage 'unversioned' 'baz' 'amd64' '2' 'Depends: bar | foo'
+
+insertpackage 'versioned' 'libdb-dev' 'amd64' '5.3.0' 'Depends: libdb5.3-dev
+Conflicts: libdb5.1-dev (<< 5.2)'
+insertpackage 'versioned' 'libdb5.3-dev' 'amd64' '5.3.28-3' 'Conflicts: libdb5.1-dev (<< 5.2)'
+
+insertpackage 'versioned' 'foo' 'amd64' '2' 'Conflicts: bar (<= 2)'
+insertpackage 'versioned' 'bar' 'amd64' '2' 'Conflicts: foo (<= 2)'
+insertpackage 'versioned' 'baz' 'amd64' '2' 'Depends: bar (>= 2) | foo (>= 2)'
+
+insertpackage 'multipleno' 'foo' 'amd64' '2.1' 'Conflicts: bar (<= 3)'
+insertpackage 'multipleno' 'bar' 'amd64' '2.1' 'Conflicts: foo (<= 3), foo (<= 1)'
-insertpackage 'unstable' 'foo' 'amd64' '1'
-insertpackage 'unstable' 'bar' 'amd64' '1'
-insertpackage 'unstable' 'foo' 'amd64' '2' 'Conflicts: bar'
-insertpackage 'unstable' 'bar' 'amd64' '2' 'Conflicts: foo'
+insertpackage 'multipleyes' 'foo' 'amd64' '2.2' 'Conflicts: bar (<= 3)'
+# having foo multiple times as conflict is a non-advisable hack in general
+insertpackage 'multipleyes' 'bar' 'amd64' '2.2' 'Conflicts: foo (<= 3), foo (<= 3)'
+cp rootdir/var/lib/dpkg/status rootdir/var/lib/dpkg/status-backup
setupaptarchive
+insertinstalledpackage 'libdb-dev' 'amd64' '5.1.7' 'Depends: libdb5.1-dev'
+insertinstalledpackage 'libdb5.1-dev' 'amd64' '5.1.29-7'
+testequal 'Reading package lists...
+Building dependency tree...
+The following packages will be REMOVED:
+ libdb5.1-dev
+The following NEW packages will be installed:
+ libdb5.3-dev
+The following packages will be upgraded:
+ libdb-dev
+1 upgraded, 1 newly installed, 1 to remove and 0 not upgraded.
+Remv libdb5.1-dev [5.1.29-7] [libdb-dev:amd64 ]
+Inst libdb-dev [5.1.7] (5.3.0 unversioned [amd64]) []
+Inst libdb5.3-dev (5.3.28-3 unversioned [amd64])
+Conf libdb5.3-dev (5.3.28-3 unversioned [amd64])
+Conf libdb-dev (5.3.0 unversioned [amd64])' aptget dist-upgrade -st unversioned
testequal 'Reading package lists...
Building dependency tree...
The following packages will be REMOVED:
@@ -31,17 +61,84 @@ The following packages will be upgraded:
libdb-dev
1 upgraded, 1 newly installed, 1 to remove and 0 not upgraded.
Remv libdb5.1-dev [5.1.29-7] [libdb-dev:amd64 ]
-Inst libdb-dev [5.1.7] (5.3.0 unstable [amd64]) []
-Inst libdb5.3-dev (5.3.28-3 unstable [amd64])
-Conf libdb5.3-dev (5.3.28-3 unstable [amd64])
-Conf libdb-dev (5.3.0 unstable [amd64])' aptget dist-upgrade -s
+Inst libdb-dev [5.1.7] (5.3.0 versioned [amd64]) []
+Inst libdb5.3-dev (5.3.28-3 versioned [amd64])
+Conf libdb5.3-dev (5.3.28-3 versioned [amd64])
+Conf libdb-dev (5.3.0 versioned [amd64])' aptget dist-upgrade -st versioned
-rm rootdir/var/lib/dpkg/status
+cp -f rootdir/var/lib/dpkg/status-backup rootdir/var/lib/dpkg/status
insertinstalledpackage 'foo' 'amd64' '1'
insertinstalledpackage 'bar' 'amd64' '1'
-
testequal 'Reading package lists...
Building dependency tree...
The following packages have been kept back:
bar foo
-0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.' aptget dist-upgrade -s
+0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.' aptget dist-upgrade -st unversioned
+testequal 'Reading package lists...
+Building dependency tree...
+The following packages have been kept back:
+ bar foo
+0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.' aptget dist-upgrade -st versioned
+testequal 'Reading package lists...
+Building dependency tree...
+The following packages have been kept back:
+ bar foo
+0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.' aptget dist-upgrade -st multipleno
+testequal 'Reading package lists...
+Building dependency tree...
+The following packages will be REMOVED:
+ foo
+The following packages will be upgraded:
+ bar
+1 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
+Remv foo [1]
+Inst bar [1] (2.2 multipleyes [amd64])
+Conf bar (2.2 multipleyes [amd64])' aptget dist-upgrade -st multipleyes
+
+testequal 'Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+ baz
+0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded.
+Inst baz (2 unversioned [amd64])
+Conf baz (2 unversioned [amd64])' aptget install baz -st unversioned
+testequal 'Reading package lists...
+Building dependency tree...
+The following extra packages will be installed:
+ foo
+The following packages will be REMOVED:
+ bar
+The following NEW packages will be installed:
+ baz
+The following packages will be upgraded:
+ foo
+1 upgraded, 1 newly installed, 1 to remove and 0 not upgraded.
+Remv bar [1]
+Inst foo [1] (2 versioned [amd64])
+Inst baz (2 versioned [amd64])
+Conf foo (2 versioned [amd64])
+Conf baz (2 versioned [amd64])' aptget install baz -st versioned
+
+testequal 'Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+ baz
+0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded.
+Inst baz (2 unversioned [amd64])
+Conf baz (2 unversioned [amd64])' aptget install baz -st unversioned
+testequal 'Reading package lists...
+Building dependency tree...
+The following extra packages will be installed:
+ foo
+The following packages will be REMOVED:
+ bar
+The following NEW packages will be installed:
+ baz
+The following packages will be upgraded:
+ foo
+1 upgraded, 1 newly installed, 1 to remove and 0 not upgraded.
+Remv bar [1]
+Inst foo [1] (2 versioned [amd64])
+Inst baz (2 versioned [amd64])
+Conf foo (2 versioned [amd64])
+Conf baz (2 versioned [amd64])' aptget install baz -st versioned
--
cgit v1.2.3-70-g09d2
From a5414e56403537678d5be87acf59c37a05f55719 Mon Sep 17 00:00:00 2001
From: David Kalnischkies
Date: Mon, 24 Feb 2014 23:10:25 +0100
Subject: add default and override handling for Cnf::FindVector
Automatically handle the override of list options via its parent value
which can even be a comma-separated list of values. It also adds an easy
way of providing a default for the list.
---
apt-pkg/aptconfiguration.cc | 72 ++++++---------------------------------
apt-pkg/contrib/configuration.cc | 14 ++++++--
apt-pkg/contrib/configuration.h | 16 ++++++++-
apt-pkg/contrib/strutl.cc | 4 ++-
prepare-release | 1 +
test/libapt/configuration_test.cc | 34 ++++++++++++++++--
test/libapt/getlanguages_test.cc | 8 +++++
7 files changed, 81 insertions(+), 68 deletions(-)
(limited to 'apt-pkg')
diff --git a/apt-pkg/aptconfiguration.cc b/apt-pkg/aptconfiguration.cc
index 0b0b546c5..f5c758e14 100644
--- a/apt-pkg/aptconfiguration.cc
+++ b/apt-pkg/aptconfiguration.cc
@@ -49,11 +49,6 @@ const Configuration::getCompressionTypes(bool const &Cached) {
setDefaultConfigurationForCompressors();
std::vector const compressors = getCompressors();
- // accept non-list order as override setting for config settings on commandline
- std::string const overrideOrder = _config->Find("Acquire::CompressionTypes::Order","");
- if (overrideOrder.empty() == false)
- types.push_back(overrideOrder);
-
// load the order setting into our vector
std::vector const order = _config->FindVector("Acquire::CompressionTypes::Order");
for (std::vector::const_iterator o = order.begin();
@@ -227,61 +222,11 @@ std::vector const Configuration::getLanguages(bool const &All,
}
}
} else {
+ // cornercase: LANG=C, so we use only "en" Translation
environment.push_back("en");
}
- // Support settings like Acquire::Languages=none on the command line to
- // override the configuration settings vector of languages.
- string const forceLang = _config->Find("Acquire::Languages","");
- if (forceLang.empty() == false) {
- if (forceLang == "none") {
- codes.clear();
- allCodes.clear();
- allCodes.push_back("none");
- } else {
- if (forceLang == "environment")
- codes = environment;
- else
- codes.push_back(forceLang);
- allCodes = codes;
- for (std::vector::const_iterator b = builtin.begin();
- b != builtin.end(); ++b)
- if (std::find(allCodes.begin(), allCodes.end(), *b) == allCodes.end())
- allCodes.push_back(*b);
- }
- if (All == true)
- return allCodes;
- else
- return codes;
- }
-
- // cornercase: LANG=C, so we use only "en" Translation
- if (envShort == "C") {
- allCodes = codes = environment;
- allCodes.insert(allCodes.end(), builtin.begin(), builtin.end());
- if (All == true)
- return allCodes;
- else
- return codes;
- }
-
- std::vector const lang = _config->FindVector("Acquire::Languages");
- // the default setting -> "environment, en"
- if (lang.empty() == true) {
- codes = environment;
- if (envShort != "en")
- codes.push_back("en");
- allCodes = codes;
- for (std::vector::const_iterator b = builtin.begin();
- b != builtin.end(); ++b)
- if (std::find(allCodes.begin(), allCodes.end(), *b) == allCodes.end())
- allCodes.push_back(*b);
- if (All == true)
- return allCodes;
- else
- return codes;
- }
-
+ std::vector const lang = _config->FindVector("Acquire::Languages", "environment,en");
// the configs define the order, so add the environment
// then needed and ensure the codes are not listed twice.
bool noneSeen = false;
@@ -308,10 +253,15 @@ std::vector const Configuration::getLanguages(bool const &All,
allCodes.push_back(*l);
}
- for (std::vector::const_iterator b = builtin.begin();
- b != builtin.end(); ++b)
- if (std::find(allCodes.begin(), allCodes.end(), *b) == allCodes.end())
- allCodes.push_back(*b);
+ if (allCodes.empty() == false) {
+ for (std::vector::const_iterator b = builtin.begin();
+ b != builtin.end(); ++b)
+ if (std::find(allCodes.begin(), allCodes.end(), *b) == allCodes.end())
+ allCodes.push_back(*b);
+ } else {
+ // "none" was forced
+ allCodes.push_back("none");
+ }
if (All == true)
return allCodes;
diff --git a/apt-pkg/contrib/configuration.cc b/apt-pkg/contrib/configuration.cc
index 4ef4663c0..8eddd56d4 100644
--- a/apt-pkg/contrib/configuration.cc
+++ b/apt-pkg/contrib/configuration.cc
@@ -21,6 +21,7 @@
#include
#include
#include
+#include
#include
#include
@@ -246,12 +247,18 @@ string Configuration::FindDir(const char *Name,const char *Default) const
// Configuration::FindVector - Find a vector of values /*{{{*/
// ---------------------------------------------------------------------
/* Returns a vector of config values under the given item */
-vector Configuration::FindVector(const char *Name) const
+#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR < 13)
+vector Configuration::FindVector(const char *Name) const { return FindVector(Name, ""); }
+#endif
+vector Configuration::FindVector(const char *Name, std::string const &Default) const
{
vector Vec;
const Item *Top = Lookup(Name);
if (Top == NULL)
- return Vec;
+ return VectorizeString(Default, ',');
+
+ if (Top->Value.empty() == false)
+ return VectorizeString(Top->Value, ',');
Item *I = Top->Child;
while(I != NULL)
@@ -259,6 +266,9 @@ vector Configuration::FindVector(const char *Name) const
Vec.push_back(I->Value);
I = I->Next;
}
+ if (Vec.empty() == true)
+ return VectorizeString(Default, ',');
+
return Vec;
}
/*}}}*/
diff --git a/apt-pkg/contrib/configuration.h b/apt-pkg/contrib/configuration.h
index 8e09ea0a6..c256139f4 100644
--- a/apt-pkg/contrib/configuration.h
+++ b/apt-pkg/contrib/configuration.h
@@ -74,8 +74,22 @@ class Configuration
std::string Find(std::string const &Name, std::string const &Default) const {return Find(Name.c_str(),Default.c_str());};
std::string FindFile(const char *Name,const char *Default = 0) const;
std::string FindDir(const char *Name,const char *Default = 0) const;
+ /** return a list of child options
+ *
+ * Options like Acquire::Languages are handled as lists which
+ * can be overridden and have a default. For the later two a comma
+ * separated list of values is supported.
+ *
+ * \param Name of the parent node
+ * \param Default list of values separated by commas */
+ std::vector FindVector(const char *Name, std::string const &Default) const;
+ std::vector FindVector(std::string const &Name, std::string const &Default) const { return FindVector(Name.c_str(), Default); };
+#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13)
+ std::vector FindVector(const char *Name) const { return FindVector(Name, ""); };
+#else
std::vector FindVector(const char *Name) const;
- std::vector FindVector(std::string const &Name) const { return FindVector(Name.c_str()); };
+#endif
+ std::vector FindVector(std::string const &Name) const { return FindVector(Name.c_str(), ""); };
int FindI(const char *Name,int const &Default = 0) const;
int FindI(std::string const &Name,int const &Default = 0) const {return FindI(Name.c_str(),Default);};
bool FindB(const char *Name,bool const &Default = false) const;
diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc
index d4f53ea3a..f8bb3890d 100644
--- a/apt-pkg/contrib/strutl.cc
+++ b/apt-pkg/contrib/strutl.cc
@@ -1130,9 +1130,11 @@ bool TokSplitString(char Tok,char *Input,char **List,
also, but the advantage is that we have an iteratable vector */
vector VectorizeString(string const &haystack, char const &split)
{
+ vector exploded;
+ if (haystack.empty() == true)
+ return exploded;
string::const_iterator start = haystack.begin();
string::const_iterator end = start;
- vector exploded;
do {
for (; end != haystack.end() && *end != split; ++end);
exploded.push_back(string(start, end));
diff --git a/prepare-release b/prepare-release
index 6141ce6e4..6229ee1fd 100755
--- a/prepare-release
+++ b/prepare-release
@@ -1,6 +1,7 @@
#!/bin/sh
set -e
+cd "$(readlink -f $(dirname $0))"
dpkg-checkbuilddeps -d 'libxml2-utils'
if [ -n "${GBP_BUILD_DIR}" ]; then
diff --git a/test/libapt/configuration_test.cc b/test/libapt/configuration_test.cc
index 2c974ee0a..957e905d5 100644
--- a/test/libapt/configuration_test.cc
+++ b/test/libapt/configuration_test.cc
@@ -98,9 +98,37 @@ int main(int argc,const char *argv[]) {
equals(Cnf.FindDir("Dir::State"), "/rootdir/dev/null");
equals(Cnf.FindDir("Dir::State::lists"), "/rootdir/dev/null");
- Cnf.Set("Moo::Bar", "1");
- Cnf.Clear();
- equals(Cnf.Find("Moo::Bar"), "");
+ Cnf.Set("Moo::Bar", "1");
+ Cnf.Clear();
+ equals(Cnf.Find("Moo::Bar"), "");
+
+ std::vector vec = Cnf.FindVector("Test::Vector", "");
+ equals(vec.size(), 0);
+ vec = Cnf.FindVector("Test::Vector", "foo");
+ equals(vec.size(), 1);
+ equals(vec[0], "foo");
+ vec = Cnf.FindVector("Test::Vector", "foo,bar");
+ equals(vec.size(), 2);
+ equals(vec[0], "foo");
+ equals(vec[1], "bar");
+ Cnf.Set("Test::Vector::", "baz");
+ Cnf.Set("Test::Vector::", "bob");
+ Cnf.Set("Test::Vector::", "dob");
+ vec = Cnf.FindVector("Test::Vector");
+ equals(vec.size(), 3);
+ equals(vec[0], "baz");
+ equals(vec[1], "bob");
+ equals(vec[2], "dob");
+ vec = Cnf.FindVector("Test::Vector", "foo,bar");
+ equals(vec.size(), 3);
+ equals(vec[0], "baz");
+ equals(vec[1], "bob");
+ equals(vec[2], "dob");
+ Cnf.Set("Test::Vector", "abel,bravo");
+ vec = Cnf.FindVector("Test::Vector", "foo,bar");
+ equals(vec.size(), 2);
+ equals(vec[0], "abel");
+ equals(vec[1], "bravo");
//FIXME: Test for configuration file parsing;
// currently only integration/ tests test them implicitly
diff --git a/test/libapt/getlanguages_test.cc b/test/libapt/getlanguages_test.cc
index cef89bde6..51cfecee3 100644
--- a/test/libapt/getlanguages_test.cc
+++ b/test/libapt/getlanguages_test.cc
@@ -105,6 +105,14 @@ int main(int argc,char *argv[])
vec = APT::Configuration::getLanguages(false, false, env);
equals(vec.size(), 1);
equals(vec[0], "fr");
+
+ _config->Set("Acquire::Languages", "environment,en");
+ env[0] = "de_DE.UTF-8";
+ vec = APT::Configuration::getLanguages(false, false, env);
+ equals(vec.size(), 3);
+ equals(vec[0], "de_DE");
+ equals(vec[1], "de");
+ equals(vec[2], "en");
_config->Set("Acquire::Languages", "");
_config->Set("Acquire::Languages::1", "environment");
--
cgit v1.2.3-70-g09d2
From 565ded7b65240b25ad8551789ac388c8ce72b1f4 Mon Sep 17 00:00:00 2001
From: Johannes Schauer
Date: Tue, 25 Feb 2014 00:12:20 +0100
Subject: implement BuildProfileSpec support as dpkg has in 1.17.2
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Build-dependencies are now able to include a
specification limiting usage similar to already supported [arch …].
More details: https://wiki.debian.org/BuildProfileSpec
Closes: 661537
---
apt-pkg/deb/deblistparser.cc | 91 ++++++++++++++++++++++++++++++++++++++--
apt-pkg/deb/deblistparser.h | 17 ++++++--
apt-pkg/deb/debsrcrecords.cc | 2 +-
test/libapt/parsedepends_test.cc | 88 ++++++++++++++++++++++++++------------
4 files changed, 162 insertions(+), 36 deletions(-)
(limited to 'apt-pkg')
diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc
index acdcc4554..a4795f15d 100644
--- a/apt-pkg/deb/deblistparser.cc
+++ b/apt-pkg/deb/deblistparser.cc
@@ -474,18 +474,31 @@ const char *debListParser::ConvertRelation(const char *I,unsigned int &Op)
// ---------------------------------------------------------------------
/* This parses the dependency elements out of a standard string in place,
bit by bit. */
+const char *debListParser::ParseDepends(const char *Start,const char *Stop,
+ std::string &Package,std::string &Ver,unsigned int &Op)
+ { return ParseDepends(Start, Stop, Package, Ver, Op, false, true, false); }
+const char *debListParser::ParseDepends(const char *Start,const char *Stop,
+ std::string &Package,std::string &Ver,unsigned int &Op,
+ bool const &ParseArchFlags)
+ { return ParseDepends(Start, Stop, Package, Ver, Op, ParseArchFlags, true, false); }
+const char *debListParser::ParseDepends(const char *Start,const char *Stop,
+ std::string &Package,std::string &Ver,unsigned int &Op,
+ bool const &ParseArchFlags, bool const &StripMultiArch)
+ { return ParseDepends(Start, Stop, Package, Ver, Op, ParseArchFlags, StripMultiArch, false); }
const char *debListParser::ParseDepends(const char *Start,const char *Stop,
string &Package,string &Ver,
unsigned int &Op, bool const &ParseArchFlags,
- bool const &StripMultiArch)
+ bool const &StripMultiArch,
+ bool const &ParseRestrictionsList)
{
// Strip off leading space
- for (;Start != Stop && isspace(*Start) != 0; Start++);
+ for (;Start != Stop && isspace(*Start) != 0; ++Start);
// Parse off the package name
const char *I = Start;
for (;I != Stop && isspace(*I) == 0 && *I != '(' && *I != ')' &&
- *I != ',' && *I != '|' && *I != '[' && *I != ']'; I++);
+ *I != ',' && *I != '|' && *I != '[' && *I != ']' &&
+ *I != '<' && *I != '>'; ++I);
// Malformed, no '('
if (I != Stop && *I == ')')
@@ -602,6 +615,76 @@ const char *debListParser::ParseDepends(const char *Start,const char *Stop,
for (;I != Stop && isspace(*I) != 0; I++);
}
+ if (ParseRestrictionsList == true)
+ {
+ // Parse a restrictions list
+ if (I != Stop && *I == '<')
+ {
+ ++I;
+ // malformed
+ if (unlikely(I == Stop))
+ return 0;
+
+ std::vector const profiles = _config->FindVector("APT::Build-Profiles");
+
+ const char *End = I;
+ bool Found = false;
+ bool NegRestriction = false;
+ while (I != Stop)
+ {
+ // look for whitespace or ending '>'
+ for (;End != Stop && !isspace(*End) && *End != '>'; ++End);
+
+ if (unlikely(End == Stop))
+ return 0;
+
+ if (*I == '!')
+ {
+ NegRestriction = true;
+ ++I;
+ }
+
+ std::string restriction(I, End);
+
+ std::string prefix = "profile.";
+ // only support for "profile" prefix, ignore others
+ if (restriction.size() > prefix.size() &&
+ restriction.substr(0, prefix.size()) == prefix)
+ {
+ // get the name of the profile
+ restriction = restriction.substr(prefix.size());
+
+ if (restriction.empty() == false && profiles.empty() == false &&
+ std::find(profiles.begin(), profiles.end(), restriction) != profiles.end())
+ {
+ Found = true;
+ if (I[-1] != '!')
+ NegRestriction = false;
+ // we found a match, so fast-forward to the end of the wildcards
+ for (; End != Stop && *End != '>'; ++End);
+ }
+ }
+
+ if (*End++ == '>') {
+ I = End;
+ break;
+ }
+
+ I = End;
+ for (;I != Stop && isspace(*I) != 0; I++);
+ }
+
+ if (NegRestriction == true)
+ Found = !Found;
+
+ if (Found == false)
+ Package = ""; /* not for this restriction */
+ }
+
+ // Skip whitespace
+ for (;I != Stop && isspace(*I) != 0; I++);
+ }
+
if (I != Stop && *I == '|')
Op |= pkgCache::Dep::Or;
@@ -635,7 +718,7 @@ bool debListParser::ParseDepends(pkgCache::VerIterator &Ver,
string Version;
unsigned int Op;
- Start = ParseDepends(Start, Stop, Package, Version, Op, false, false);
+ Start = ParseDepends(Start, Stop, Package, Version, Op, false, false, false);
if (Start == 0)
return _error->Error("Problem parsing dependency %s",Tag);
size_t const found = Package.rfind(':');
diff --git a/apt-pkg/deb/deblistparser.h b/apt-pkg/deb/deblistparser.h
index 386d291a2..0531b20f3 100644
--- a/apt-pkg/deb/deblistparser.h
+++ b/apt-pkg/deb/deblistparser.h
@@ -72,11 +72,20 @@ class debListParser : public pkgCacheGenerator::ListParser
bool LoadReleaseInfo(pkgCache::PkgFileIterator &FileI,FileFd &File,
std::string section);
-
+
+ static const char *ParseDepends(const char *Start,const char *Stop,
+ std::string &Package,std::string &Ver,unsigned int &Op);
static const char *ParseDepends(const char *Start,const char *Stop,
- std::string &Package,std::string &Ver,unsigned int &Op,
- bool const &ParseArchFlags = false,
- bool const &StripMultiArch = true);
+ std::string &Package,std::string &Ver,unsigned int &Op,
+ bool const &ParseArchFlags);
+ static const char *ParseDepends(const char *Start,const char *Stop,
+ std::string &Package,std::string &Ver,unsigned int &Op,
+ bool const &ParseArchFlags, bool const &StripMultiArch);
+ static const char *ParseDepends(const char *Start,const char *Stop,
+ std::string &Package,std::string &Ver,unsigned int &Op,
+ bool const &ParseArchFlags, bool const &StripMultiArch,
+ bool const &ParseRestrictionsList);
+
static const char *ConvertRelation(const char *I,unsigned int &Op);
debListParser(FileFd *File, std::string const &Arch = "");
diff --git a/apt-pkg/deb/debsrcrecords.cc b/apt-pkg/deb/debsrcrecords.cc
index ce55ccd1f..90182b4a4 100644
--- a/apt-pkg/deb/debsrcrecords.cc
+++ b/apt-pkg/deb/debsrcrecords.cc
@@ -90,7 +90,7 @@ bool debSrcRecordParser::BuildDepends(std::vectorError("Problem parsing dependency: %s", fields[I]);
diff --git a/test/libapt/parsedepends_test.cc b/test/libapt/parsedepends_test.cc
index e95016240..67dbab823 100644
--- a/test/libapt/parsedepends_test.cc
+++ b/test/libapt/parsedepends_test.cc
@@ -10,7 +10,9 @@ int main(int argc,char *argv[]) {
unsigned int Null = 0;
bool StripMultiArch = true;
bool ParseArchFlags = false;
+ bool ParseRestrictionsList = false;
_config->Set("APT::Architecture","amd64");
+ _config->Set("APT::Build-Profiles","stage1");
const char* Depends =
"debhelper:any (>= 5.0), "
@@ -27,6 +29,9 @@ int main(int argc,char *argv[]) {
"os-for-me [ linux-any ], "
"cpu-not-for-me [ any-armel ], "
"os-not-for-me [ kfreebsd-any ], "
+ "not-in-stage1 , "
+ "not-in-stage1-or-nodoc , "
+ "only-in-stage1 , "
"overlord-dev:any (= 7.15.3~) | overlord-dev:native (>> 7.15.5), "
;
@@ -39,7 +44,7 @@ test:
const char* Start = Depends;
const char* End = Depends + strlen(Depends);
- Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch);
+ Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList);
if (StripMultiArch == true)
equals("debhelper", Package);
else
@@ -47,7 +52,7 @@ test:
equals("5.0", Version);
equals(Null | pkgCache::Dep::GreaterEq, Op);
- Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch);
+ Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList);
if (StripMultiArch == true)
equals("libdb-dev", Package);
else
@@ -55,7 +60,7 @@ test:
equals("", Version);
equals(Null | pkgCache::Dep::NoOp, Op);
- Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch);
+ Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList);
if (StripMultiArch == true)
equals("gettext", Package);
else
@@ -63,7 +68,7 @@ test:
equals("0.12", Version);
equals(Null | pkgCache::Dep::LessEq, Op);
- Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch);
+ Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList);
if (StripMultiArch == true)
equals("libcurl4-gnutls-dev", Package);
else
@@ -71,104 +76,131 @@ test:
equals("", Version);
equals(Null | pkgCache::Dep::Or, Op);
- Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch);
+ Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList);
equals("libcurl3-gnutls-dev", Package);
equals("7.15.5", Version);
equals(Null | pkgCache::Dep::Greater, Op);
- Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch);
+ Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList);
equals("debiandoc-sgml", Package);
equals("", Version);
equals(Null | pkgCache::Dep::NoOp, Op);
- Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch);
+ Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList);
equals("apt", Package);
equals("0.7.25", Version);
equals(Null | pkgCache::Dep::GreaterEq, Op);
if (ParseArchFlags == true) {
- Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch);
+ Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList);
equals("", Package); // not-for-me
} else {
- equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch));
+ equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList));
Start = strstr(Start, ",");
Start++;
}
if (ParseArchFlags == true) {
- Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch);
+ Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList);
equals("only-for-me", Package);
equals("", Version);
equals(Null | pkgCache::Dep::NoOp, Op);
} else {
- equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch));
+ equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList));
Start = strstr(Start, ",");
Start++;
}
if (ParseArchFlags == true) {
- Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch);
+ Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList);
equals("any-for-me", Package);
equals("", Version);
equals(Null | pkgCache::Dep::NoOp, Op);
} else {
- equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch));
+ equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList));
Start = strstr(Start, ",");
Start++;
}
if (ParseArchFlags == true) {
- Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch);
+ Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList);
equals("not-for-darwin", Package);
equals("", Version);
equals(Null | pkgCache::Dep::NoOp, Op);
} else {
- equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch));
+ equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList));
Start = strstr(Start, ",");
Start++;
}
if (ParseArchFlags == true) {
- Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch);
+ Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList);
equals("cpu-for-me", Package);
equals("", Version);
equals(Null | pkgCache::Dep::NoOp, Op);
} else {
- equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch));
+ equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList));
Start = strstr(Start, ",");
Start++;
}
if (ParseArchFlags == true) {
- Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch);
+ Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList);
equals("os-for-me", Package);
equals("", Version);
equals(Null | pkgCache::Dep::NoOp, Op);
} else {
- equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch));
+ equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList));
Start = strstr(Start, ",");
Start++;
}
if (ParseArchFlags == true) {
- Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch);
+ Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList);
equals("", Package); // cpu-not-for-me
} else {
- equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch));
+ equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList));
Start = strstr(Start, ",");
Start++;
}
if (ParseArchFlags == true) {
- Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch);
+ Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList);
equals("", Package); // os-not-for-me
} else {
- equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch));
+ equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList));
Start = strstr(Start, ",");
Start++;
}
- Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch);
+ if (ParseRestrictionsList == true) {
+ Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList);
+ equals("", Package); // not-in-stage1
+ } else {
+ equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList));
+ Start = strstr(Start, ",");
+ Start++;
+ }
+
+ if (ParseRestrictionsList == true) {
+ Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList);
+ equals("", Package); // not-in-stage1-or-in-nodoc
+ } else {
+ equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList));
+ Start = strstr(Start, ",");
+ Start++;
+ }
+
+ if (ParseRestrictionsList == true) {
+ Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList);
+ equals("only-in-stage1", Package);
+ } else {
+ equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList));
+ Start = strstr(Start, ",");
+ Start++;
+ }
+
+ Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList);
if (StripMultiArch == true)
equals("overlord-dev", Package);
else
@@ -176,7 +208,7 @@ test:
equals("7.15.3~", Version);
equals(Null | pkgCache::Dep::Equals | pkgCache::Dep::Or, Op);
- debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch);
+ debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList);
if (StripMultiArch == true)
equals("overlord-dev", Package);
else
@@ -185,11 +217,13 @@ test:
equals(Null | pkgCache::Dep::Greater, Op);
if (StripMultiArch == false)
- ParseArchFlags = true;
+ if (ParseArchFlags == false)
+ ParseRestrictionsList = !ParseRestrictionsList;
+ ParseArchFlags = !ParseArchFlags;
StripMultiArch = !StripMultiArch;
runner++;
- if (runner < 4)
+ if (runner < 8)
goto test; // this is the prove: tests are really evil ;)
return 0;
--
cgit v1.2.3-70-g09d2
From ce7f128c020e1347f91c6074238fc5da58c5df71 Mon Sep 17 00:00:00 2001
From: David Kalnischkies
Date: Tue, 25 Feb 2014 14:26:18 +0100
Subject: support DEB_BUILD_PROFILES and -P for build profiles
Inspired by the rest of the patch in 661537, but abstract the
parsing of various ways of setting the build profiles more so it can
potentially be reused and all apt parts have the same behaviour.
Especially config options, cmdline options and environment will not be
combined as proposed as this isn't APTs usual behaviour and dpkg doesn't
do it either, so one overrides the other as it normally does.
---
apt-pkg/aptconfiguration.cc | 26 +++-
apt-pkg/aptconfiguration.h | 5 +
apt-pkg/deb/deblistparser.cc | 2 +-
apt-private/private-cmndline.cc | 2 +
cmdline/apt-config.cc | 5 +
cmdline/apt-get.cc | 6 +
debian/control | 2 +-
doc/apt-get.8.xml | 13 +-
doc/apt.conf.5.xml | 9 ++
test/integration/framework | 6 +
.../test-bug-661537-build-profiles-support | 147 +++++++++++++++++++++
11 files changed, 219 insertions(+), 4 deletions(-)
create mode 100755 test/integration/test-bug-661537-build-profiles-support
(limited to 'apt-pkg')
diff --git a/apt-pkg/aptconfiguration.cc b/apt-pkg/aptconfiguration.cc
index f5c758e14..3948854c6 100644
--- a/apt-pkg/aptconfiguration.cc
+++ b/apt-pkg/aptconfiguration.cc
@@ -426,7 +426,7 @@ void Configuration::setDefaultConfigurationForCompressors() {
}
}
/*}}}*/
-// getCompressors - Return Vector of usbale compressors /*{{{*/
+// getCompressors - Return Vector of usealbe compressors /*{{{*/
// ---------------------------------------------------------------------
/* return a vector of compressors used by apt-ftparchive in the
multicompress functionality or to detect data.tar files */
@@ -508,4 +508,28 @@ Configuration::Compressor::Compressor(char const *name, char const *extension,
UncompressArgs.push_back(uncompressArg);
}
/*}}}*/
+// getBuildProfiles - return a vector of enabled build profiles /*{{{*/
+std::vector const Configuration::getBuildProfiles() {
+ // order is: override value (~= commandline), environment variable, list (~= config file)
+ std::string profiles_env = getenv("DEB_BUILD_PROFILES") == 0 ? "" : getenv("DEB_BUILD_PROFILES");
+ if (profiles_env.empty() == false) {
+ profiles_env = SubstVar(profiles_env, " ", ",");
+ std::string const bp = _config->Find("APT::Build-Profiles");
+ _config->Clear("APT::Build-Profiles");
+ if (bp.empty() == false)
+ _config->Set("APT::Build-Profiles", bp);
+ }
+ return _config->FindVector("APT::Build-Profiles", profiles_env);
+}
+std::string const Configuration::getBuildProfilesString() {
+ std::vector profiles = getBuildProfiles();
+ if (profiles.empty() == true)
+ return "";
+ std::vector::const_iterator p = profiles.begin();
+ std::string list = *p;
+ for (; p != profiles.end(); ++p)
+ list.append(",").append(*p);
+ return list;
+}
+ /*}}}*/
}
diff --git a/apt-pkg/aptconfiguration.h b/apt-pkg/aptconfiguration.h
index bf7deae85..026493c6d 100644
--- a/apt-pkg/aptconfiguration.h
+++ b/apt-pkg/aptconfiguration.h
@@ -117,6 +117,11 @@ public: /*{{{*/
/** \brief Return a vector of extensions supported for data.tar's */
std::vector static const getCompressorExtensions();
+
+ /** \return Return a vector of enabled build profile specifications */
+ std::vector static const getBuildProfiles();
+ /** \return Return a comma-separated list of enabled build profile specifications */
+ std::string static const getBuildProfilesString();
/*}}}*/
private: /*{{{*/
void static setDefaultConfigurationForCompressors();
diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc
index a4795f15d..89f3514c9 100644
--- a/apt-pkg/deb/deblistparser.cc
+++ b/apt-pkg/deb/deblistparser.cc
@@ -625,7 +625,7 @@ const char *debListParser::ParseDepends(const char *Start,const char *Stop,
if (unlikely(I == Stop))
return 0;
- std::vector const profiles = _config->FindVector("APT::Build-Profiles");
+ std::vector const profiles = APT::Configuration::getBuildProfiles();
const char *End = I;
bool Found = false;
diff --git a/apt-private/private-cmndline.cc b/apt-private/private-cmndline.cc
index ef7d65f3c..b99443210 100644
--- a/apt-private/private-cmndline.cc
+++ b/apt-private/private-cmndline.cc
@@ -141,6 +141,7 @@ bool addArgumentsAPTGet(std::vector &Args, char const * const
{
addArg('b', "compile", "APT::Get::Compile", 0);
addArg('b', "build", "APT::Get::Compile", 0);
+ addArg('P', "build-profiles", "APT::Build-Profiles", CommandLine::HasArg);
addArg(0, "diff-only", "APT::Get::Diff-Only", 0);
addArg(0, "debian-only", "APT::Get::Diff-Only", 0);
addArg(0, "tar-only", "APT::Get::Tar-Only", 0);
@@ -149,6 +150,7 @@ bool addArgumentsAPTGet(std::vector &Args, char const * const
else if (CmdMatches("build-dep"))
{
addArg('a', "host-architecture", "APT::Get::Host-Architecture", CommandLine::HasArg);
+ addArg('P', "build-profiles", "APT::Build-Profiles", CommandLine::HasArg);
addArg(0, "purge", "APT::Get::Purge", 0);
addArg(0, "solver", "APT::Solver", CommandLine::HasArg);
// this has no effect *but* sbuild is using it (see LP: #1255806)
diff --git a/cmdline/apt-config.cc b/cmdline/apt-config.cc
index 30c2a22d5..9f20b3c1b 100644
--- a/cmdline/apt-config.cc
+++ b/cmdline/apt-config.cc
@@ -155,6 +155,11 @@ int main(int argc,const char *argv[]) /*{{{*/
_config->Set(comp + "UncompressArg::", *a);
}
+ std::vector const profiles = APT::Configuration::getBuildProfiles();
+ _config->Clear("APT::Build-Profiles");
+ for (std::vector::const_iterator p = profiles.begin(); p != profiles.end(); ++p)
+ _config->Set("APT::Build-Profiles::", *p);
+
// Match the operation
CmdL.DispatchArg(Cmds);
diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc
index 12e385b69..f8de80a91 100644
--- a/cmdline/apt-get.cc
+++ b/cmdline/apt-get.cc
@@ -970,6 +970,12 @@ bool DoSource(CommandLine &CmdL)
string buildopts = _config->Find("APT::Get::Host-Architecture");
if (buildopts.empty() == false)
buildopts = "-a" + buildopts + " ";
+
+ // get all active build profiles
+ std::string const profiles = APT::Configuration::getBuildProfilesString();
+ if (profiles.empty() == false)
+ buildopts.append(" -P").append(profiles).append(" ");
+
buildopts.append(_config->Find("DPkg::Build-Options","-b -uc"));
// Call dpkg-buildpackage
diff --git a/debian/control b/debian/control
index 2d58d0711..5ce68414e 100644
--- a/debian/control
+++ b/debian/control
@@ -21,7 +21,7 @@ Depends: ${shlibs:Depends}, ${misc:Depends}, ${apt:keyring}, gnupg
Replaces: manpages-pl (<< 20060617-3~), manpages-it (<< 2.80-4~)
Breaks: manpages-pl (<< 20060617-3~), manpages-it (<< 2.80-4~)
Conflicts: python-apt (<< 0.7.93.2~)
-Suggests: aptitude | synaptic | wajig, dpkg-dev, apt-doc, python-apt
+Suggests: aptitude | synaptic | wajig, dpkg-dev (>= 1.17.2), apt-doc, python-apt
Description: commandline package manager
This package provides commandline tools for searching and
managing as well as querying information about packages
diff --git a/doc/apt-get.8.xml b/doc/apt-get.8.xml
index 595ea875d..1ed08904e 100644
--- a/doc/apt-get.8.xml
+++ b/doc/apt-get.8.xml
@@ -371,7 +371,18 @@
by apt-get source --compile and how cross-builddependencies
are satisfied. By default is it not set which means that the host architecture
is the same as the build architecture (which is defined by APT::Architecture).
- Configuration Item: APT::Get::Host-Architecture
+ Configuration Item: APT::Get::Host-Architecture.
+
+
+
+
+
+ This option controls the activated build profiles for which
+ a source package is built by apt-get source --compile and
+ how build dependencies are satisfied. By default no build profile is active.
+ More than one build profile can be activated at a time by concatenating them
+ with a comma.
+ Configuration Item: APT::Build-Profiles.
diff --git a/doc/apt.conf.5.xml b/doc/apt.conf.5.xml
index bfc43ba29..78f6a27a2 100644
--- a/doc/apt.conf.5.xml
+++ b/doc/apt.conf.5.xml
@@ -177,6 +177,15 @@ DPkg::Pre-Install-Pkgs {"/usr/sbin/dpkg-preconfigure --apt";};
+
+
+ List of all build profiles enabled for build-dependency resolution,
+ without the "profile." namespace prefix.
+ By default this list is empty. The DEB_BUILD_PROFILES
+ as used by &dpkg-buildpackage; overrides the list notation.
+
+
+
Default release to install packages from if more than one
version is available. Contains release name, codename or release version. Examples: 'stable', 'testing',
diff --git a/test/integration/framework b/test/integration/framework
index 911a4d742..9c4ac87d3 100644
--- a/test/integration/framework
+++ b/test/integration/framework
@@ -120,6 +120,9 @@ aptwebserver() {
dpkg() {
command dpkg --root=${TMPWORKINGDIRECTORY}/rootdir --force-not-root --force-bad-path --log=${TMPWORKINGDIRECTORY}/rootdir/var/log/dpkg.log "$@"
}
+dpkgcheckbuilddeps() {
+ command dpkg-checkbuilddeps --admindir=${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg "$@"
+}
aptitude() {
if [ -f ./aptconfig.conf ]; then
APT_CONFIG=aptconfig.conf LD_LIBRARY_PATH=${BUILDDIRECTORY} command aptitude "$@"
@@ -240,6 +243,9 @@ setupenvironment() {
# newer gpg versions are fine without it, but play it safe for now
gpg --quiet --check-trustdb --secret-keyring $SECRETKEYRING --keyring $SECRETKEYRING >/dev/null 2>&1
+ # cleanup the environment a bit
+ unset GREP_OPTIONS DEB_BUILD_PROFILES
+
msgdone "info"
}
diff --git a/test/integration/test-bug-661537-build-profiles-support b/test/integration/test-bug-661537-build-profiles-support
new file mode 100755
index 000000000..ae1403f71
--- /dev/null
+++ b/test/integration/test-bug-661537-build-profiles-support
@@ -0,0 +1,147 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+setupenvironment
+configarchitecture 'amd64' 'i386' 'armel'
+
+insertinstalledpackage 'build-essential' 'all' '0' 'Multi-Arch: foreign'
+
+insertpackage 'unstable' 'foo' 'all' '1.0'
+insertpackage 'unstable' 'bar' 'all' '1.0'
+
+insertsource 'unstable' 'buildprofiles' 'any' '1' 'Build-Depends: foo (>= 1.0) [i386 arm] , bar'
+
+# table from https://wiki.debian.org/BuildProfileSpec
+insertsource 'unstable' 'spec-1' 'any' '1' 'Build-Depends: foo '
+insertsource 'unstable' 'spec-2' 'any' '1' 'Build-Depends: foo '
+insertsource 'unstable' 'spec-3' 'any' '1' 'Build-Depends: foo '
+insertsource 'unstable' 'spec-4' 'any' '1' 'Build-Depends: foo '
+insertsource 'unstable' 'spec-5' 'any' '1' 'Build-Depends: foo '
+insertsource 'unstable' 'spec-6' 'any' '1' 'Build-Depends: foo '
+# multiple stanzas not supported: error out
+insertsource 'unstable' 'spec-7' 'any' '1' 'Build-Depends: foo '
+insertsource 'unstable' 'spec-8' 'any' '1' 'Build-Depends: foo '
+
+setupaptarchive
+
+testequal 'Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+ bar
+0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
+Inst bar (1.0 unstable [all])
+Conf bar (1.0 unstable [all])' aptget build-dep buildprofiles -s
+
+testequal 'Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+ bar foo
+0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
+Inst bar (1.0 unstable [all])
+Inst foo (1.0 unstable [all])
+Conf bar (1.0 unstable [all])
+Conf foo (1.0 unstable [all])' aptget build-dep buildprofiles -s -o APT::Architecture=i386
+
+testequal 'Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+ bar
+0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
+Inst bar (1.0 unstable [all])
+Conf bar (1.0 unstable [all])' aptget build-dep buildprofiles -s -o APT::Architecture=armel
+
+testequal 'Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+ bar
+0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
+Inst bar (1.0 unstable [all])
+Conf bar (1.0 unstable [all])' aptget build-dep buildprofiles -s -o APT::Architecture=i386 -P stage1
+
+KEEP='Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+ foo
+0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
+Inst foo (1.0 unstable [all])
+Conf foo (1.0 unstable [all])'
+DROP='Reading package lists...
+Building dependency tree...
+0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.'
+
+msgtest 'Check if version of installed dpkg is high enough for' 'build profiles support'
+if dpkg --compare-versions "$(command dpkg-query --showformat='${Version}' --show dpkg)" 'ge' '1.17.2'; then
+ msgpass
+ testwithdpkg() {
+ msgtest "Test with" "dpkg-checkbuilddeps -d '$1' -P '$2'"
+ local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testwithdpkg.output"
+ if dpkgcheckbuilddeps -d "$1" -P "$2" /dev/null >$OUTPUT 2>&1; then
+ if [ "$3" = "$DROP" ]; then
+ msgpass
+ else
+ cat $OUTPUT
+ msgfail
+ fi
+ else
+ if [ "$3" = "$KEEP" ]; then
+ msgpass
+ else
+ cat $OUTPUT
+ msgfail
+ fi
+ fi
+ }
+else
+ msgskip
+ testwithdpkg() {
+ msgtest "Test with" "dpkg-checkbuilddeps -d '$1' -P '$2'"
+ msgskip
+ }
+fi
+
+testprofile() {
+ if [ -n "$3" ]; then
+ testequal "$4" aptget build-dep "$1" -s -P "$3"
+ export DEB_BUILD_PROFILES="$(echo "$3" | tr ',' ' ')"
+ testequal "$4" aptget build-dep "$1" -s -o with::environment=1
+ unset DEB_BUILD_PROFILES
+ else
+ testequal "$4" aptget build-dep "$1" -s
+ fi
+ testwithdpkg "$2" "$3" "$4"
+}
+
+testprofile 'spec-1' 'foo ' '' "$KEEP"
+testprofile 'spec-1' 'foo ' 'stage1' "$DROP"
+testprofile 'spec-1' 'foo ' 'notest' "$KEEP"
+testprofile 'spec-1' 'foo ' 'stage1,notest' "$DROP"
+
+testprofile 'spec-2' 'foo ' '' "$DROP"
+testprofile 'spec-2' 'foo ' 'stage1' "$KEEP"
+testprofile 'spec-2' 'foo ' 'notest' "$DROP"
+testprofile 'spec-2' 'foo ' 'stage1,notest' "$KEEP"
+
+testprofile 'spec-3' 'foo ' '' "$KEEP"
+testprofile 'spec-3' 'foo ' 'stage1' "$DROP"
+testprofile 'spec-3' 'foo ' 'notest' "$DROP"
+testprofile 'spec-3' 'foo ' 'stage1,notest' "$DROP"
+
+testprofile 'spec-4' 'foo ' '' "$DROP"
+testprofile 'spec-4' 'foo ' 'stage1' "$KEEP"
+testprofile 'spec-4' 'foo ' 'notest' "$KEEP"
+testprofile 'spec-4' 'foo ' 'stage1,notest' "$KEEP"
+
+testprofile 'spec-5' 'foo ' '' "$KEEP"
+testprofile 'spec-5' 'foo ' 'stage1' "$DROP"
+testprofile 'spec-5' 'foo ' 'notest' "$KEEP"
+testprofile 'spec-5' 'foo ' 'stage1,notest' "$DROP"
+
+testprofile 'spec-6' 'foo ' '' "$KEEP"
+testprofile 'spec-6' 'foo ' 'stage1' "$KEEP"
+testprofile 'spec-6' 'foo ' 'notest' "$DROP"
+testprofile 'spec-6' 'foo ' 'stage1,notest' "$KEEP"
+
+testfailure aptget build-dep spec-7 -s
+testfailure aptget build-dep spec-8 -s
--
cgit v1.2.3-70-g09d2
From 255c9e4b74fe677d723c51d3450869ad45ca5463 Mon Sep 17 00:00:00 2001
From: David Kalnischkies
Date: Tue, 25 Feb 2014 22:10:40 +0100
Subject: make doxygen more quiet, fix issues and disable latex
Git-Dch: Ignore
---
apt-pkg/acquire-item.h | 15 ++++++++-------
apt-pkg/acquire-worker.h | 4 ++--
apt-pkg/acquire.h | 4 ++--
apt-pkg/cachefilter.h | 2 +-
apt-pkg/cacheset.h | 7 +++++--
apt-pkg/contrib/error.h | 4 ++--
apt-pkg/depcache.h | 6 +++---
apt-pkg/pkgcache.h | 8 ++++----
doc/Doxyfile.in | 10 +++++-----
9 files changed, 32 insertions(+), 28 deletions(-)
(limited to 'apt-pkg')
diff --git a/apt-pkg/acquire-item.h b/apt-pkg/acquire-item.h
index 5a1c7979c..0524743c6 100644
--- a/apt-pkg/acquire-item.h
+++ b/apt-pkg/acquire-item.h
@@ -64,7 +64,7 @@ class pkgAcquire::Item : public WeakPointable
/** \brief Insert this item into its owner's queue.
*
- * \param ItemDesc Metadata about this item (its URI and
+ * \param Item Metadata about this item (its URI and
* description).
*/
inline void QueueURI(ItemDesc &Item)
@@ -79,7 +79,7 @@ class pkgAcquire::Item : public WeakPointable
*
* \param From The file to be renamed.
*
- * \param To The new name of #From. If #To exists it will be
+ * \param To The new name of \a From. If \a To exists it will be
* overwritten.
*/
void Rename(std::string From,std::string To);
@@ -115,7 +115,7 @@ class pkgAcquire::Item : public WeakPointable
} Status;
/** \brief Contains a textual description of the error encountered
- * if #Status is #StatError or #StatAuthError.
+ * if #ItemState is #StatError or #StatAuthError.
*/
std::string ErrorText;
@@ -293,7 +293,6 @@ class pkgAcquire::Item : public WeakPointable
/** \brief Rename failed file and set error
*
* \param state respresenting the error we encountered
- * \param errorMsg a message describing the error
*/
bool RenameOnError(RenameOnErrorState const state);
};
@@ -636,7 +635,7 @@ class pkgAcqIndexDiffs : public pkgAcquire::Item
/** \brief Create an index diff item.
*
* After filling in its basic fields, this invokes Finish(true) if
- * #diffs is empty, or QueueNextDiff() otherwise.
+ * \a diffs is empty, or QueueNextDiff() otherwise.
*
* \param Owner The pkgAcquire object that owns this item.
*
@@ -651,6 +650,8 @@ class pkgAcqIndexDiffs : public pkgAcquire::Item
* reconstructed package index file; the index file will be tested
* against this value when it is entirely reconstructed.
*
+ * \param ServerSha1 is the sha1sum of the current file on the server
+ *
* \param diffs The remaining diffs from the index of diffs. They
* should be ordered so that each diff appears before any diff
* that depends on it.
@@ -1162,8 +1163,8 @@ class pkgAcqFile : public pkgAcquire::Item
* \param IsIndexFile The file is considered a IndexFile and cache-control
* headers like "cache-control: max-age=0" are send
*
- * If DestFilename is empty, download to DestDir/ if
- * DestDir is non-empty, $CWD/ otherwise. If
+ * If DestFilename is empty, download to DestDir/\ if
+ * DestDir is non-empty, $CWD/\ otherwise. If
* DestFilename is NOT empty, DestDir is ignored and DestFilename
* is the absolute name to which the file should be downloaded.
*/
diff --git a/apt-pkg/acquire-worker.h b/apt-pkg/acquire-worker.h
index 848a6bad7..a558f69a7 100644
--- a/apt-pkg/acquire-worker.h
+++ b/apt-pkg/acquire-worker.h
@@ -136,8 +136,8 @@ class pkgAcquire::Worker : public WeakPointable
/** \brief Retrieve any available messages from the subprocess.
*
- * The messages are retrieved as in ::ReadMessages(), and
- * MessageFailure() is invoked if an error occurs; in particular,
+ * The messages are retrieved as in \link strutl.h ReadMessages()\endlink, and
+ * #MethodFailure() is invoked if an error occurs; in particular,
* if the pipe to the subprocess dies unexpectedly while a message
* is being read.
*
diff --git a/apt-pkg/acquire.h b/apt-pkg/acquire.h
index 3d5d7a4b7..2c0b37635 100644
--- a/apt-pkg/acquire.h
+++ b/apt-pkg/acquire.h
@@ -282,13 +282,13 @@ class pkgAcquire
*/
void Shutdown();
- /** \brief Get the first #Worker object.
+ /** \brief Get the first Worker object.
*
* \return the first active worker in this download process.
*/
inline Worker *WorkersBegin() {return Workers;};
- /** \brief Advance to the next #Worker object.
+ /** \brief Advance to the next Worker object.
*
* \return the worker immediately following I, or \b NULL if none
* exists.
diff --git a/apt-pkg/cachefilter.h b/apt-pkg/cachefilter.h
index 34b7d0b46..81ae1383c 100644
--- a/apt-pkg/cachefilter.h
+++ b/apt-pkg/cachefilter.h
@@ -47,7 +47,7 @@ public:
/** \class PackageArchitectureMatchesSpecification
\brief matching against architecture specification strings
- The strings are of the format - where either component,
+ The strings are of the format \-\ where either component,
or the whole string, can be the wildcard "any" as defined in
debian-policy §11.1 "Architecture specification strings".
diff --git a/apt-pkg/cacheset.h b/apt-pkg/cacheset.h
index b69d74b8e..ce502d8ca 100644
--- a/apt-pkg/cacheset.h
+++ b/apt-pkg/cacheset.h
@@ -479,14 +479,16 @@ protected: /*{{{*/
/** \brief returns the candidate version of the package
\param Cache to be used to query for information
- \param Pkg we want the candidate version from this package */
+ \param Pkg we want the candidate version from this package
+ \param helper used in this container instance */
static pkgCache::VerIterator getCandidateVer(pkgCacheFile &Cache,
pkgCache::PkgIterator const &Pkg, CacheSetHelper &helper);
/** \brief returns the installed version of the package
\param Cache to be used to query for information
- \param Pkg we want the installed version from this package */
+ \param Pkg we want the installed version from this package
+ \param helper used in this container instance */
static pkgCache::VerIterator getInstalledVer(pkgCacheFile &Cache,
pkgCache::PkgIterator const &Pkg, CacheSetHelper &helper);
/*}}}*/
@@ -558,6 +560,7 @@ public: /*{{{*/
non specifically requested and executes regex's if needed on names.
\param Cache the packages and versions are in
\param cmdline Command line the versions should be extracted from
+ \param fallback version specification
\param helper responsible for error and message handling */
static VersionContainer FromCommandLine(pkgCacheFile &Cache, const char **cmdline,
Version const &fallback, CacheSetHelper &helper) {
diff --git a/apt-pkg/contrib/error.h b/apt-pkg/contrib/error.h
index bcee70b1a..c06e45ee4 100644
--- a/apt-pkg/contrib/error.h
+++ b/apt-pkg/contrib/error.h
@@ -232,11 +232,11 @@ public: /*{{{*/
* if you want to check if also no notices happened set the parameter
* flag to \b false.
*
- * \param WithoutNotice does notices count, default is \b true, so no
+ * \param threshold minimim level considered
*
* \return \b true if an the list is empty, \b false otherwise
*/
- bool empty(MsgType const &trashhold = WARNING) const;
+ bool empty(MsgType const &threshold = WARNING) const;
/** \brief returns and removes the first (or last) message in the list
*
diff --git a/apt-pkg/depcache.h b/apt-pkg/depcache.h
index f6848f383..a02a86b87 100644
--- a/apt-pkg/depcache.h
+++ b/apt-pkg/depcache.h
@@ -381,8 +381,8 @@ class pkgDepCache : protected pkgCache::Namespace
/** \brief Update the Marked and Garbage fields of all packages.
*
* This routine is implicitly invoked after all state manipulators
- * and when an ActionGroup is destroyed. It invokes #MarkRequired
- * and #Sweep to do its dirty work.
+ * and when an ActionGroup is destroyed. It invokes the private
+ * MarkRequired() and Sweep() to do its dirty work.
*
* \param rootFunc A predicate that returns \b true for packages
* that should be added to the root set.
@@ -465,7 +465,7 @@ class pkgDepCache : protected pkgCache::Namespace
*
* The parameters are the same as in the calling MarkDelete:
* \param Pkg the package that MarkDelete wants to remove.
- * \param Purge should we purge instead of "only" remove?
+ * \param MarkPurge should we purge instead of "only" remove?
* \param Depth recursive deep of this Marker call
* \param FromUser was the remove requested by the user?
*/
diff --git a/apt-pkg/pkgcache.h b/apt-pkg/pkgcache.h
index c31c5f30b..669904c84 100644
--- a/apt-pkg/pkgcache.h
+++ b/apt-pkg/pkgcache.h
@@ -451,7 +451,7 @@ struct pkgCache::PackageFile
/** \brief Modification time for the file */
time_t mtime;
- /* @TODO document PackageFile::Flags */
+ /** @TODO document PackageFile::Flags */
unsigned long Flags;
// Linked list
@@ -474,7 +474,7 @@ struct pkgCache::VerFile
map_ptrloc NextFile; // PkgVerFile
/** \brief position in the package file */
map_ptrloc Offset; // File offset
- /* @TODO document pkgCache::VerFile::Size */
+ /** @TODO document pkgCache::VerFile::Size */
unsigned long Size;
};
/*}}}*/
@@ -488,7 +488,7 @@ struct pkgCache::DescFile
map_ptrloc NextFile; // PkgVerFile
/** \brief position in the file */
map_ptrloc Offset; // File offset
- /* @TODO document pkgCache::DescFile::Size */
+ /** @TODO document pkgCache::DescFile::Size */
unsigned long Size;
};
/*}}}*/
@@ -571,7 +571,7 @@ struct pkgCache::Description
and to check that the Translation is up-to-date. */
map_ptrloc md5sum; // StringItem
- /* @TODO document pkgCache::Description::FileList */
+ /** @TODO document pkgCache::Description::FileList */
map_ptrloc FileList; // DescFile
/** \brief next translation for this description */
map_ptrloc NextDesc; // Description
diff --git a/doc/Doxyfile.in b/doc/Doxyfile.in
index 306bab1dc..ffd7c88b9 100644
--- a/doc/Doxyfile.in
+++ b/doc/Doxyfile.in
@@ -40,7 +40,7 @@ PROJECT_NUMBER = @PACKAGE_VERSION@
# for a project that appears at the top of each page and should give viewer
# a quick idea about the purpose of the project. Keep the description short.
-PROJECT_BRIEF =
+PROJECT_BRIEF = "commandline package manager"
# With the PROJECT_LOGO tag one can specify an logo or icon that is
# included in the documentation. The maximum height of the logo should not
@@ -197,7 +197,7 @@ TAB_SIZE = 8
# will result in a user-defined paragraph with heading "Side Effects:".
# You can put \n's in the value part of an alias to insert newlines.
-ALIASES =
+ALIASES = "TODO=\todo"
# This tag can be used to specify a number of word-keyword mappings (TCL only).
# A mapping has the form "name=value". For example adding
@@ -601,7 +601,7 @@ CITE_BIB_FILES =
# The QUIET tag can be used to turn on/off the messages that are generated
# by doxygen. Possible values are YES and NO. If left blank NO is used.
-QUIET = NO
+QUIET = YES
# The WARNINGS tag can be used to turn on/off the warning messages that are
# generated by doxygen. Possible values are YES and NO. If left blank
@@ -748,7 +748,7 @@ IMAGE_PATH =
# code is scanned, but not when the output code is generated. If lines are added
# or removed, the anchors will not be placed correctly.
-INPUT_FILTER =
+INPUT_FILTER = "sed -e 's#//[ ]*FIXME:\?#/// \\todo#'"
# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
# basis.
@@ -1287,7 +1287,7 @@ EXTRA_SEARCH_MAPPINGS =
# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
# generate Latex output.
-GENERATE_LATEX = YES
+GENERATE_LATEX = NO
# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
# If a relative path is entered the value of OUTPUT_DIRECTORY will be
--
cgit v1.2.3-70-g09d2
From 67c3067f1a615fd6ff0b332c2a526d052442913d Mon Sep 17 00:00:00 2001
From: David Kalnischkies
Date: Tue, 25 Feb 2014 22:22:41 +0100
Subject: fix -Wmissing-field-initializers warnings
Reported-By: gcc
Git-Dch: Ignore
---
apt-pkg/deb/deblistparser.cc | 8 ++++----
apt-pkg/indexcopy.cc | 8 ++++----
apt-private/private-show.cc | 26 +++++++++++++-------------
cmdline/apt-cache.cc | 2 +-
ftparchive/apt-ftparchive.cc | 2 +-
methods/ftp.cc | 4 ++--
6 files changed, 25 insertions(+), 25 deletions(-)
(limited to 'apt-pkg')
diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc
index 89f3514c9..3374865ac 100644
--- a/apt-pkg/deb/deblistparser.cc
+++ b/apt-pkg/deb/deblistparser.cc
@@ -34,7 +34,7 @@ static debListParser::WordList PrioList[] = {
{"standard",pkgCache::State::Standard},
{"optional",pkgCache::State::Optional},
{"extra",pkgCache::State::Extra},
- {}};
+ {NULL, 0}};
// ListParser::debListParser - Constructor /*{{{*/
// ---------------------------------------------------------------------
@@ -354,7 +354,7 @@ bool debListParser::ParseStatus(pkgCache::PkgIterator &Pkg,
{"hold",pkgCache::State::Hold},
{"deinstall",pkgCache::State::DeInstall},
{"purge",pkgCache::State::Purge},
- {}};
+ {NULL, 0}};
if (GrabWord(string(Start,I-Start),WantList,Pkg->SelectedState) == false)
return _error->Error("Malformed 1st word in the Status line");
@@ -370,7 +370,7 @@ bool debListParser::ParseStatus(pkgCache::PkgIterator &Pkg,
{"reinstreq",pkgCache::State::ReInstReq},
{"hold",pkgCache::State::HoldInst},
{"hold-reinstreq",pkgCache::State::HoldReInstReq},
- {}};
+ {NULL, 0}};
if (GrabWord(string(Start,I-Start),FlagList,Pkg->InstState) == false)
return _error->Error("Malformed 2nd word in the Status line");
@@ -392,7 +392,7 @@ bool debListParser::ParseStatus(pkgCache::PkgIterator &Pkg,
{"triggers-pending",pkgCache::State::TriggersPending},
{"post-inst-failed",pkgCache::State::HalfConfigured},
{"removal-failed",pkgCache::State::HalfInstalled},
- {}};
+ {NULL, 0}};
if (GrabWord(string(Start,I-Start),StatusList,Pkg->CurrentState) == false)
return _error->Error("Malformed 3rd word in the Status line");
diff --git a/apt-pkg/indexcopy.cc b/apt-pkg/indexcopy.cc
index 7694cb1dd..9ea244139 100644
--- a/apt-pkg/indexcopy.cc
+++ b/apt-pkg/indexcopy.cc
@@ -436,8 +436,8 @@ bool PackageCopy::GetFile(string &File,unsigned long long &Size)
/* */
bool PackageCopy::RewriteEntry(FILE *Target,string File)
{
- TFRewriteData Changes[] = {{"Filename",File.c_str()},
- {}};
+ TFRewriteData Changes[] = {{ "Filename", File.c_str(), NULL },
+ { NULL, NULL, NULL }};
if (TFRewrite(Target,*Section,TFRewritePackageOrder,Changes) == false)
return false;
@@ -482,8 +482,8 @@ bool SourceCopy::GetFile(string &File,unsigned long long &Size)
bool SourceCopy::RewriteEntry(FILE *Target,string File)
{
string Dir(File,0,File.rfind('/'));
- TFRewriteData Changes[] = {{"Directory",Dir.c_str()},
- {}};
+ TFRewriteData Changes[] = {{ "Directory", Dir.c_str(), NULL },
+ { NULL, NULL, NULL }};
if (TFRewrite(Target,*Section,TFRewriteSourceOrder,Changes) == false)
return false;
diff --git a/apt-private/private-show.cc b/apt-private/private-show.cc
index 60d951316..9e4bbd35e 100644
--- a/apt-private/private-show.cc
+++ b/apt-private/private-show.cc
@@ -96,23 +96,23 @@ bool DisplayRecord(pkgCacheFile &CacheFile, pkgCache::VerIterator V,
// FIXME: add verbose that does not do the removal of the tags?
TFRewriteData RW[] = {
// delete, apt-cache show has this info and most users do not care
- {"MD5sum", 0},
- {"SHA1", 0},
- {"SHA256", 0},
- {"Filename", 0},
- {"Multi-Arch", 0},
- {"Architecture", 0},
- {"Conffiles",0},
+ {"MD5sum", NULL, NULL},
+ {"SHA1", NULL, NULL},
+ {"SHA256", NULL, NULL},
+ {"Filename", NULL, NULL},
+ {"Multi-Arch", NULL, NULL},
+ {"Architecture", NULL, NULL},
+ {"Conffiles", NULL, NULL},
// we use the translated description
- {"Description",0},
- {"Description-md5",0},
+ {"Description", NULL, NULL},
+ {"Description-md5", NULL, NULL},
// improve
- {"Installed-Size", installed_size.c_str(), 0},
+ {"Installed-Size", installed_size.c_str(), NULL},
{"Size", package_size.c_str(), "Download-Size"},
// add
- {"APT-Manual-Installed", manual_installed, 0},
- {"APT-Sources", source_index_file.c_str(), 0},
- {}
+ {"APT-Manual-Installed", manual_installed, NULL},
+ {"APT-Sources", source_index_file.c_str(), NULL},
+ {NULL, NULL, NULL}
};
if(TFRewrite(stdout, Tags, NULL, RW) == false)
diff --git a/cmdline/apt-cache.cc b/cmdline/apt-cache.cc
index b8892d23d..22778eb24 100644
--- a/cmdline/apt-cache.cc
+++ b/cmdline/apt-cache.cc
@@ -532,7 +532,7 @@ bool DumpAvail(CommandLine &Cmd)
if ((File->Flags & pkgCache::Flag::NotSource) == pkgCache::Flag::NotSource)
{
pkgTagSection Tags;
- TFRewriteData RW[] = {{"Status",0},{"Config-Version",0},{}};
+ TFRewriteData RW[] = {{"Status", NULL, NULL},{"Config-Version", NULL, NULL},{NULL, NULL, NULL}};
const char *Zero = 0;
if (Tags.Scan(Buffer+Jitter,VF.Size+1) == false ||
TFRewrite(stdout,Tags,&Zero,RW) == false)
diff --git a/ftparchive/apt-ftparchive.cc b/ftparchive/apt-ftparchive.cc
index 712f8469a..d14b68044 100644
--- a/ftparchive/apt-ftparchive.cc
+++ b/ftparchive/apt-ftparchive.cc
@@ -484,7 +484,7 @@ void LoadTree(vector &PkgList,Configuration &Setup)
struct SubstVar const Vars[] = {{"$(DIST)",&Dist},
{"$(SECTION)",&Section},
{"$(ARCH)",&Arch},
- {}};
+ {NULL, NULL}};
mode_t const Perms = Block.FindI("FileMode", Permissions);
bool const LongDesc = Block.FindB("LongDescription", LongDescription);
TranslationWriter *TransWriter;
diff --git a/methods/ftp.cc b/methods/ftp.cc
index 621f48476..5a87ded1c 100644
--- a/methods/ftp.cc
+++ b/methods/ftp.cc
@@ -56,9 +56,9 @@ struct AFMap
};
#ifndef AF_INET6
-struct AFMap AFMap[] = {{AF_INET,1},{}};
+struct AFMap AFMap[] = {{AF_INET,1},{0, 0}};
#else
-struct AFMap AFMap[] = {{AF_INET,1},{AF_INET6,2},{}};
+struct AFMap AFMap[] = {{AF_INET,1},{AF_INET6,2},{0, 0}};
#endif
unsigned long TimeOut = 120;
--
cgit v1.2.3-70-g09d2
From d3e8fbb395f57954acd7a2095f02ce530a05ec6a Mon Sep 17 00:00:00 2001
From: David Kalnischkies
Date: Thu, 27 Feb 2014 01:20:53 +0100
Subject: warning: extra ‘;’ [-Wpedantic]
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Git-Dch: Ignore
Reported-By: gcc -Wpedantic
---
apt-inst/filelist.h | 152 +++++++++++++-------------
apt-pkg/acquire.cc | 2 +-
apt-pkg/cacheiterators.h | 226 +++++++++++++++++++--------------------
apt-pkg/cacheset.h | 176 +++++++++++++++---------------
apt-pkg/cdrom.cc | 6 +-
apt-pkg/contrib/configuration.cc | 3 +-
apt-pkg/contrib/error.cc | 2 +-
apt-pkg/contrib/gpgv.h | 2 +-
apt-pkg/contrib/progress.cc | 12 +--
apt-pkg/contrib/strutl.cc | 2 +-
apt-pkg/contrib/strutl.h | 38 +++----
apt-pkg/depcache.cc | 4 +-
apt-pkg/indexcopy.cc | 4 +-
apt-pkg/install-progress.cc | 4 +-
apt-pkg/install-progress.h | 32 +++---
apt-pkg/pkgcache.cc | 20 ++--
apt-pkg/pkgcache.h | 42 ++++----
apt-pkg/upgrade.h | 2 +-
apt-private/acqprogress.cc | 62 +++++------
cmdline/apt-cdrom.cc | 26 ++---
ftparchive/override.cc | 8 +-
methods/cdrom.cc | 2 +-
methods/http.cc | 6 +-
methods/https.cc | 2 +-
methods/mirror.cc | 28 ++---
methods/rsh.cc | 2 +-
methods/server.cc | 20 ++--
methods/server.h | 2 +-
28 files changed, 443 insertions(+), 444 deletions(-)
(limited to 'apt-pkg')
diff --git a/apt-inst/filelist.h b/apt-inst/filelist.h
index 0405d61df..8c4891bcf 100644
--- a/apt-inst/filelist.h
+++ b/apt-inst/filelist.h
@@ -42,25 +42,25 @@ class pkgFLCache
struct Package;
struct Diversion;
struct ConfFile;
-
+
class NodeIterator;
class DirIterator;
class PkgIterator;
class DiverIterator;
-
+
protected:
std::string CacheFile;
DynamicMMap ⤅
map_ptrloc LastTreeLookup;
unsigned long LastLookupSize;
-
+
// Helpers for the addition algorithms
map_ptrloc TreeLookup(map_ptrloc *Base,const char *Text,const char *TextEnd,
unsigned long Size,unsigned int *Count = 0,
bool Insert = false);
-
+
public:
-
+
// Pointers to the arrays of items
Header *HeaderP;
Node *NodeP;
@@ -70,10 +70,10 @@ class pkgFLCache
ConfFile *ConfP;
char *StrP;
unsigned char *AnyP;
-
+
// Quick accessors
Node *FileHash;
-
+
// Accessors
Header &Head() {return *HeaderP;};
void PrintTree(map_ptrloc Base,unsigned long Size);
@@ -89,7 +89,7 @@ class pkgFLCache
void DropNode(map_ptrloc Node);
inline DiverIterator DiverBegin();
-
+
// Diversion control
void BeginDiverLoad();
void FinishDiverLoad();
@@ -97,7 +97,7 @@ class pkgFLCache
const char *To);
bool AddConfFile(const char *Name,const char *NameEnd,
PkgIterator const &Owner,const unsigned char *Sum);
-
+
pkgFLCache(DynamicMMap &Map);
// ~pkgFLCache();
};
@@ -109,7 +109,7 @@ struct pkgFLCache::Header
short MajorVersion;
short MinorVersion;
bool Dirty;
-
+
// Size of structure values
unsigned HeaderSz;
unsigned NodeSz;
@@ -117,7 +117,7 @@ struct pkgFLCache::Header
unsigned PackageSz;
unsigned DiversionSz;
unsigned ConfFileSz;
-
+
// Structure Counts;
unsigned int NodeCount;
unsigned int DirCount;
@@ -126,13 +126,13 @@ struct pkgFLCache::Header
unsigned int ConfFileCount;
unsigned int HashSize;
unsigned long UniqNodes;
-
+
// Offsets
map_ptrloc FileHash;
map_ptrloc DirTree;
map_ptrloc Packages;
map_ptrloc Diversions;
-
+
/* Allocation pools, there should be one of these for each structure
excluding the header */
DynamicMMap::Pool Pools[5];
@@ -177,7 +177,7 @@ struct pkgFLCache::Diversion
map_ptrloc OwnerPkg; // Package
map_ptrloc DivertFrom; // Node
map_ptrloc DivertTo; // String
-
+
map_ptrloc Next; // Diversion
unsigned long Flags;
@@ -194,120 +194,120 @@ class pkgFLCache::PkgIterator
{
Package *Pkg;
pkgFLCache *Owner;
-
+
public:
-
+
inline bool end() const {return Owner == 0 || Pkg == Owner->PkgP?true:false;}
-
+
// Accessors
- inline Package *operator ->() {return Pkg;};
- inline Package const *operator ->() const {return Pkg;};
- inline Package const &operator *() const {return *Pkg;};
- inline operator Package *() {return Pkg == Owner->PkgP?0:Pkg;};
- inline operator Package const *() const {return Pkg == Owner->PkgP?0:Pkg;};
-
- inline unsigned long Offset() const {return Pkg - Owner->PkgP;};
- inline const char *Name() const {return Pkg->Name == 0?0:Owner->StrP + Pkg->Name;};
+ inline Package *operator ->() {return Pkg;}
+ inline Package const *operator ->() const {return Pkg;}
+ inline Package const &operator *() const {return *Pkg;}
+ inline operator Package *() {return Pkg == Owner->PkgP?0:Pkg;}
+ inline operator Package const *() const {return Pkg == Owner->PkgP?0:Pkg;}
+
+ inline unsigned long Offset() const {return Pkg - Owner->PkgP;}
+ inline const char *Name() const {return Pkg->Name == 0?0:Owner->StrP + Pkg->Name;}
inline pkgFLCache::NodeIterator Files() const;
- PkgIterator() : Pkg(0), Owner(0) {};
- PkgIterator(pkgFLCache &Owner,Package *Trg) : Pkg(Trg), Owner(&Owner) {};
+ PkgIterator() : Pkg(0), Owner(0) {}
+ PkgIterator(pkgFLCache &Owner,Package *Trg) : Pkg(Trg), Owner(&Owner) {}
};
class pkgFLCache::DirIterator
{
Directory *Dir;
pkgFLCache *Owner;
-
+
public:
-
+
// Accessors
- inline Directory *operator ->() {return Dir;};
- inline Directory const *operator ->() const {return Dir;};
- inline Directory const &operator *() const {return *Dir;};
- inline operator Directory *() {return Dir == Owner->DirP?0:Dir;};
- inline operator Directory const *() const {return Dir == Owner->DirP?0:Dir;};
+ inline Directory *operator ->() {return Dir;}
+ inline Directory const *operator ->() const {return Dir;}
+ inline Directory const &operator *() const {return *Dir;}
+ inline operator Directory *() {return Dir == Owner->DirP?0:Dir;}
+ inline operator Directory const *() const {return Dir == Owner->DirP?0:Dir;}
- inline const char *Name() const {return Dir->Name == 0?0:Owner->StrP + Dir->Name;};
+ inline const char *Name() const {return Dir->Name == 0?0:Owner->StrP + Dir->Name;}
- DirIterator() : Dir(0), Owner(0) {};
- DirIterator(pkgFLCache &Owner,Directory *Trg) : Dir(Trg), Owner(&Owner) {};
+ DirIterator() : Dir(0), Owner(0) {}
+ DirIterator(pkgFLCache &Owner,Directory *Trg) : Dir(Trg), Owner(&Owner) {}
};
class pkgFLCache::DiverIterator
{
Diversion *Diver;
pkgFLCache *Owner;
-
+
public:
// Iteration
- void operator ++(int) {if (Diver != Owner->DiverP) Diver = Owner->DiverP + Diver->Next;};
- inline void operator ++() {operator ++(0);};
- inline bool end() const {return Owner == 0 || Diver == Owner->DiverP;};
+ void operator ++(int) {if (Diver != Owner->DiverP) Diver = Owner->DiverP + Diver->Next;}
+ inline void operator ++() {operator ++(0);}
+ inline bool end() const {return Owner == 0 || Diver == Owner->DiverP;}
// Accessors
- inline Diversion *operator ->() {return Diver;};
- inline Diversion const *operator ->() const {return Diver;};
- inline Diversion const &operator *() const {return *Diver;};
- inline operator Diversion *() {return Diver == Owner->DiverP?0:Diver;};
- inline operator Diversion const *() const {return Diver == Owner->DiverP?0:Diver;};
+ inline Diversion *operator ->() {return Diver;}
+ inline Diversion const *operator ->() const {return Diver;}
+ inline Diversion const &operator *() const {return *Diver;}
+ inline operator Diversion *() {return Diver == Owner->DiverP?0:Diver;}
+ inline operator Diversion const *() const {return Diver == Owner->DiverP?0:Diver;}
- inline PkgIterator OwnerPkg() const {return PkgIterator(*Owner,Owner->PkgP + Diver->OwnerPkg);};
+ inline PkgIterator OwnerPkg() const {return PkgIterator(*Owner,Owner->PkgP + Diver->OwnerPkg);}
inline NodeIterator DivertFrom() const;
inline NodeIterator DivertTo() const;
DiverIterator() : Diver(0), Owner(0) {};
- DiverIterator(pkgFLCache &Owner,Diversion *Trg) : Diver(Trg), Owner(&Owner) {};
+ DiverIterator(pkgFLCache &Owner,Diversion *Trg) : Diver(Trg), Owner(&Owner) {}
};
class pkgFLCache::NodeIterator
{
Node *Nde;
- enum {NdePkg, NdeHash} Type;
+ enum {NdePkg, NdeHash} Type;
pkgFLCache *Owner;
-
+
public:
-
+
// Iteration
- void operator ++(int) {if (Nde != Owner->NodeP) Nde = Owner->NodeP +
- (Type == NdePkg?Nde->NextPkg:Nde->Next);};
- inline void operator ++() {operator ++(0);};
- inline bool end() const {return Owner == 0 || Nde == Owner->NodeP;};
+ void operator ++(int) {if (Nde != Owner->NodeP) Nde = Owner->NodeP +
+ (Type == NdePkg?Nde->NextPkg:Nde->Next);}
+ inline void operator ++() {operator ++(0);}
+ inline bool end() const {return Owner == 0 || Nde == Owner->NodeP;}
// Accessors
- inline Node *operator ->() {return Nde;};
- inline Node const *operator ->() const {return Nde;};
- inline Node const &operator *() const {return *Nde;};
- inline operator Node *() {return Nde == Owner->NodeP?0:Nde;};
- inline operator Node const *() const {return Nde == Owner->NodeP?0:Nde;};
- inline unsigned long Offset() const {return Nde - Owner->NodeP;};
- inline DirIterator Dir() const {return DirIterator(*Owner,Owner->DirP + Nde->Dir);};
- inline DiverIterator Diversion() const {return DiverIterator(*Owner,Owner->DiverP + Nde->Pointer);};
- inline const char *File() const {return Nde->File == 0?0:Owner->StrP + Nde->File;};
- inline const char *DirN() const {return Owner->StrP + Owner->DirP[Nde->Dir].Name;};
+ inline Node *operator ->() {return Nde;}
+ inline Node const *operator ->() const {return Nde;}
+ inline Node const &operator *() const {return *Nde;}
+ inline operator Node *() {return Nde == Owner->NodeP?0:Nde;}
+ inline operator Node const *() const {return Nde == Owner->NodeP?0:Nde;}
+ inline unsigned long Offset() const {return Nde - Owner->NodeP;}
+ inline DirIterator Dir() const {return DirIterator(*Owner,Owner->DirP + Nde->Dir);}
+ inline DiverIterator Diversion() const {return DiverIterator(*Owner,Owner->DiverP + Nde->Pointer);}
+ inline const char *File() const {return Nde->File == 0?0:Owner->StrP + Nde->File;}
+ inline const char *DirN() const {return Owner->StrP + Owner->DirP[Nde->Dir].Name;}
Package *RealPackage() const;
-
+
NodeIterator() : Nde(0), Type(NdeHash), Owner(0) {};
- NodeIterator(pkgFLCache &Owner) : Nde(Owner.NodeP), Type(NdeHash), Owner(&Owner) {};
- NodeIterator(pkgFLCache &Owner,Node *Trg) : Nde(Trg), Type(NdeHash), Owner(&Owner) {};
- NodeIterator(pkgFLCache &Owner,Node *Trg,Package *) : Nde(Trg), Type(NdePkg), Owner(&Owner) {};
+ NodeIterator(pkgFLCache &Owner) : Nde(Owner.NodeP), Type(NdeHash), Owner(&Owner) {}
+ NodeIterator(pkgFLCache &Owner,Node *Trg) : Nde(Trg), Type(NdeHash), Owner(&Owner) {}
+ NodeIterator(pkgFLCache &Owner,Node *Trg,Package *) : Nde(Trg), Type(NdePkg), Owner(&Owner) {}
};
/* Inlines with forward references that cannot be included directly in their
respsective classes */
-inline pkgFLCache::NodeIterator pkgFLCache::DiverIterator::DivertFrom() const
- {return NodeIterator(*Owner,Owner->NodeP + Diver->DivertFrom);};
+inline pkgFLCache::NodeIterator pkgFLCache::DiverIterator::DivertFrom() const
+ {return NodeIterator(*Owner,Owner->NodeP + Diver->DivertFrom);}
inline pkgFLCache::NodeIterator pkgFLCache::DiverIterator::DivertTo() const
- {return NodeIterator(*Owner,Owner->NodeP + Diver->DivertTo);};
+ {return NodeIterator(*Owner,Owner->NodeP + Diver->DivertTo);}
inline pkgFLCache::NodeIterator pkgFLCache::PkgIterator::Files() const
- {return NodeIterator(*Owner,Owner->NodeP + Pkg->Files,Pkg);};
+ {return NodeIterator(*Owner,Owner->NodeP + Pkg->Files,Pkg);}
inline pkgFLCache::DiverIterator pkgFLCache::DiverBegin()
- {return DiverIterator(*this,DiverP + HeaderP->Diversions);};
+ {return DiverIterator(*this,DiverP + HeaderP->Diversions);}
-inline pkgFLCache::PkgIterator pkgFLCache::GetPkg(const char *Name,bool Insert)
- {return GetPkg(Name,Name+strlen(Name),Insert);};
+inline pkgFLCache::PkgIterator pkgFLCache::GetPkg(const char *Name,bool Insert)
+ {return GetPkg(Name,Name+strlen(Name),Insert);}
#endif
diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc
index 120e809e1..e8fa68338 100644
--- a/apt-pkg/acquire.cc
+++ b/apt-pkg/acquire.cc
@@ -468,7 +468,7 @@ void pkgAcquire::Bump()
pkgAcquire::Worker *pkgAcquire::WorkerStep(Worker *I)
{
return I->NextAcquire;
-};
+}
/*}}}*/
// Acquire::Clean - Cleans a directory /*{{{*/
// ---------------------------------------------------------------------
diff --git a/apt-pkg/cacheiterators.h b/apt-pkg/cacheiterators.h
index ea6a4afba..ca8bc5ca0 100644
--- a/apt-pkg/cacheiterators.h
+++ b/apt-pkg/cacheiterators.h
@@ -55,26 +55,26 @@ template class pkgCache::Iterator :
public:
// Iteration
virtual void operator ++(int) = 0;
- virtual void operator ++() = 0; // Should be {operator ++(0);};
- inline bool end() const {return Owner == 0 || S == OwnerPointer();};
+ virtual void operator ++() = 0; // Should be {operator ++(0);}
+ inline bool end() const {return Owner == 0 || S == OwnerPointer();}
// Comparison
- inline bool operator ==(const Itr &B) const {return S == B.S;};
- inline bool operator !=(const Itr &B) const {return S != B.S;};
+ inline bool operator ==(const Itr &B) const {return S == B.S;}
+ inline bool operator !=(const Itr &B) const {return S != B.S;}
// Accessors
- inline Str *operator ->() {return S;};
- inline Str const *operator ->() const {return S;};
- inline operator Str *() {return S == OwnerPointer() ? 0 : S;};
- inline operator Str const *() const {return S == OwnerPointer() ? 0 : S;};
- inline Str &operator *() {return *S;};
- inline Str const &operator *() const {return *S;};
- inline pkgCache *Cache() const {return Owner;};
+ inline Str *operator ->() {return S;}
+ inline Str const *operator ->() const {return S;}
+ inline operator Str *() {return S == OwnerPointer() ? 0 : S;}
+ inline operator Str const *() const {return S == OwnerPointer() ? 0 : S;}
+ inline Str &operator *() {return *S;}
+ inline Str const &operator *() const {return *S;}
+ inline pkgCache *Cache() const {return Owner;}
// Mixed stuff
- inline void operator =(const Itr &B) {S = B.S; Owner = B.Owner;};
- inline bool IsGood() const { return S && Owner && ! end();};
- inline unsigned long Index() const {return S - OwnerPointer();};
+ inline void operator =(const Itr &B) {S = B.S; Owner = B.Owner;}
+ inline bool IsGood() const { return S && Owner && ! end();}
+ inline unsigned long Index() const {return S - OwnerPointer();}
void ReMap(void const * const oldMap, void const * const newMap) {
if (Owner == 0 || S == 0)
@@ -83,8 +83,8 @@ template class pkgCache::Iterator :
}
// Constructors - look out for the variable assigning
- inline Iterator() : S(0), Owner(0) {};
- inline Iterator(pkgCache &Owner,Str *T = 0) : S(T), Owner(&Owner) {};
+ inline Iterator() : S(0), Owner(0) {}
+ inline Iterator(pkgCache &Owner,Str *T = 0) : S(T), Owner(&Owner) {}
};
/*}}}*/
// Group Iterator /*{{{*/
@@ -98,19 +98,19 @@ class pkgCache::GrpIterator: public Iterator {
protected:
inline Group* OwnerPointer() const {
return (Owner != 0) ? Owner->GrpP : 0;
- };
+ }
public:
// This constructor is the 'begin' constructor, never use it.
inline GrpIterator(pkgCache &Owner) : Iterator(Owner), HashIndex(-1) {
S = OwnerPointer();
operator ++(0);
- };
+ }
virtual void operator ++(int);
- virtual void operator ++() {operator ++(0);};
+ virtual void operator ++() {operator ++(0);}
- inline const char *Name() const {return S->Name == 0?0:Owner->StrP + S->Name;};
+ inline const char *Name() const {return S->Name == 0?0:Owner->StrP + S->Name;}
inline PkgIterator PackageList() const;
PkgIterator FindPkg(std::string Arch = "any") const;
/** \brief find the package with the "best" architecture
@@ -127,8 +127,8 @@ class pkgCache::GrpIterator: public Iterator {
inline GrpIterator(pkgCache &Owner, Group *Trg) : Iterator(Owner, Trg), HashIndex(0) {
if (S == 0)
S = OwnerPointer();
- };
- inline GrpIterator() : Iterator(), HashIndex(0) {};
+ }
+ inline GrpIterator() : Iterator(), HashIndex(0) {}
};
/*}}}*/
@@ -139,27 +139,27 @@ class pkgCache::PkgIterator: public Iterator {
protected:
inline Package* OwnerPointer() const {
return (Owner != 0) ? Owner->PkgP : 0;
- };
+ }
public:
// This constructor is the 'begin' constructor, never use it.
inline PkgIterator(pkgCache &Owner) : Iterator(Owner), HashIndex(-1) {
S = OwnerPointer();
operator ++(0);
- };
+ }
virtual void operator ++(int);
- virtual void operator ++() {operator ++(0);};
+ virtual void operator ++() {operator ++(0);}
enum OkState {NeedsNothing,NeedsUnpack,NeedsConfigure};
// Accessors
- inline const char *Name() const {return S->Name == 0?0:Owner->StrP + S->Name;};
- inline const char *Section() const {return S->Section == 0?0:Owner->StrP + S->Section;};
+ inline const char *Name() const {return S->Name == 0?0:Owner->StrP + S->Name;}
+ inline const char *Section() const {return S->Section == 0?0:Owner->StrP + S->Section;}
inline bool Purge() const {return S->CurrentState == pkgCache::State::Purge ||
- (S->CurrentVer == 0 && S->CurrentState == pkgCache::State::NotInstalled);};
- inline const char *Arch() const {return S->Arch == 0?0:Owner->StrP + S->Arch;};
- inline GrpIterator Group() const { return GrpIterator(*Owner, Owner->GrpP + S->Group);};
+ (S->CurrentVer == 0 && S->CurrentState == pkgCache::State::NotInstalled);}
+ inline const char *Arch() const {return S->Arch == 0?0:Owner->StrP + S->Arch;}
+ inline GrpIterator Group() const { return GrpIterator(*Owner, Owner->GrpP + S->Group);}
inline VerIterator VersionList() const;
inline VerIterator CurrentVer() const;
@@ -177,8 +177,8 @@ class pkgCache::PkgIterator: public Iterator {
inline PkgIterator(pkgCache &Owner,Package *Trg) : Iterator(Owner, Trg), HashIndex(0) {
if (S == 0)
S = OwnerPointer();
- };
- inline PkgIterator() : Iterator(), HashIndex(0) {};
+ }
+ inline PkgIterator() : Iterator(), HashIndex(0) {}
};
/*}}}*/
// Version Iterator /*{{{*/
@@ -186,12 +186,12 @@ class pkgCache::VerIterator : public Iterator {
protected:
inline Version* OwnerPointer() const {
return (Owner != 0) ? Owner->VerP : 0;
- };
+ }
public:
// Iteration
- void operator ++(int) {if (S != Owner->VerP) S = Owner->VerP + S->NextVer;};
- inline void operator ++() {operator ++(0);};
+ void operator ++(int) {if (S != Owner->VerP) S = Owner->VerP + S->NextVer;}
+ inline void operator ++() {operator ++(0);}
// Comparison
int CompareVer(const VerIterator &B) const;
@@ -201,17 +201,17 @@ class pkgCache::VerIterator : public Iterator {
referring to the same "real" version */
inline bool SimilarVer(const VerIterator &B) const {
return (B.end() == false && S->Hash == B->Hash && strcmp(VerStr(), B.VerStr()) == 0);
- };
+ }
// Accessors
- inline const char *VerStr() const {return S->VerStr == 0?0:Owner->StrP + S->VerStr;};
- inline const char *Section() const {return S->Section == 0?0:Owner->StrP + S->Section;};
+ inline const char *VerStr() const {return S->VerStr == 0?0:Owner->StrP + S->VerStr;}
+ inline const char *Section() const {return S->Section == 0?0:Owner->StrP + S->Section;}
inline const char *Arch() const {
if ((S->MultiArch & pkgCache::Version::All) == pkgCache::Version::All)
return "all";
return S->ParentPkg == 0?0:Owner->StrP + ParentPkg()->Arch;
- };
- inline PkgIterator ParentPkg() const {return PkgIterator(*Owner,Owner->PkgP + S->ParentPkg);};
+ }
+ inline PkgIterator ParentPkg() const {return PkgIterator(*Owner,Owner->PkgP + S->ParentPkg);}
inline DescIterator DescriptionList() const;
DescIterator TranslatedDescription() const;
@@ -219,7 +219,7 @@ class pkgCache::VerIterator : public Iterator {
inline PrvIterator ProvidesList() const;
inline VerFileIterator FileList() const;
bool Downloadable() const;
- inline const char *PriorityType() const {return Owner->Priority(S->Priority);};
+ inline const char *PriorityType() const {return Owner->Priority(S->Priority);}
const char *MultiArchType() const;
std::string RelStr() const;
@@ -229,8 +229,8 @@ class pkgCache::VerIterator : public Iterator {
inline VerIterator(pkgCache &Owner,Version *Trg = 0) : Iterator(Owner, Trg) {
if (S == 0)
S = OwnerPointer();
- };
- inline VerIterator() : Iterator() {};
+ }
+ inline VerIterator() : Iterator() {}
};
/*}}}*/
// Description Iterator /*{{{*/
@@ -238,26 +238,26 @@ class pkgCache::DescIterator : public Iterator {
protected:
inline Description* OwnerPointer() const {
return (Owner != 0) ? Owner->DescP : 0;
- };
+ }
public:
// Iteration
- void operator ++(int) {if (S != Owner->DescP) S = Owner->DescP + S->NextDesc;};
- inline void operator ++() {operator ++(0);};
+ void operator ++(int) {if (S != Owner->DescP) S = Owner->DescP + S->NextDesc;}
+ inline void operator ++() {operator ++(0);}
// Comparison
int CompareDesc(const DescIterator &B) const;
// Accessors
- inline const char *LanguageCode() const {return Owner->StrP + S->language_code;};
- inline const char *md5() const {return Owner->StrP + S->md5sum;};
+ inline const char *LanguageCode() const {return Owner->StrP + S->language_code;}
+ inline const char *md5() const {return Owner->StrP + S->md5sum;}
inline DescFileIterator FileList() const;
- inline DescIterator() : Iterator() {};
+ inline DescIterator() : Iterator() {}
inline DescIterator(pkgCache &Owner,Description *Trg = 0) : Iterator(Owner, Trg) {
if (S == 0)
S = Owner.DescP;
- };
+ }
};
/*}}}*/
// Dependency iterator /*{{{*/
@@ -267,21 +267,21 @@ class pkgCache::DepIterator : public Iterator {
protected:
inline Dependency* OwnerPointer() const {
return (Owner != 0) ? Owner->DepP : 0;
- };
+ }
public:
// Iteration
void operator ++(int) {if (S != Owner->DepP) S = Owner->DepP +
- (Type == DepVer ? S->NextDepends : S->NextRevDepends);};
- inline void operator ++() {operator ++(0);};
+ (Type == DepVer ? S->NextDepends : S->NextRevDepends);}
+ inline void operator ++() {operator ++(0);}
// Accessors
- inline const char *TargetVer() const {return S->Version == 0?0:Owner->StrP + S->Version;};
- inline PkgIterator TargetPkg() const {return PkgIterator(*Owner,Owner->PkgP + S->Package);};
- inline PkgIterator SmartTargetPkg() const {PkgIterator R(*Owner,0);SmartTargetPkg(R);return R;};
- inline VerIterator ParentVer() const {return VerIterator(*Owner,Owner->VerP + S->ParentVer);};
- inline PkgIterator ParentPkg() const {return PkgIterator(*Owner,Owner->PkgP + Owner->VerP[S->ParentVer].ParentPkg);};
- inline bool Reverse() const {return Type == DepRev;};
+ inline const char *TargetVer() const {return S->Version == 0?0:Owner->StrP + S->Version;}
+ inline PkgIterator TargetPkg() const {return PkgIterator(*Owner,Owner->PkgP + S->Package);}
+ inline PkgIterator SmartTargetPkg() const {PkgIterator R(*Owner,0);SmartTargetPkg(R);return R;}
+ inline VerIterator ParentVer() const {return VerIterator(*Owner,Owner->VerP + S->ParentVer);}
+ inline PkgIterator ParentPkg() const {return PkgIterator(*Owner,Owner->PkgP + Owner->VerP[S->ParentVer].ParentPkg);}
+ inline bool Reverse() const {return Type == DepRev;}
bool IsCritical() const;
bool IsNegative() const;
bool IsIgnorable(PrvIterator const &Prv) const;
@@ -292,8 +292,8 @@ class pkgCache::DepIterator : public Iterator {
void GlobOr(DepIterator &Start,DepIterator &End);
Version **AllTargets() const;
bool SmartTargetPkg(PkgIterator &Result) const;
- inline const char *CompType() const {return Owner->CompType(S->CompareOp);};
- inline const char *DepType() const {return Owner->DepType(S->Type);};
+ inline const char *CompType() const {return Owner->CompType(S->CompareOp);}
+ inline const char *DepType() const {return Owner->DepType(S->Type);}
//Nice printable representation
friend std::ostream& operator <<(std::ostream& out, DepIterator D);
@@ -302,13 +302,13 @@ class pkgCache::DepIterator : public Iterator {
Iterator(Owner, Trg), Type(DepVer) {
if (S == 0)
S = Owner.DepP;
- };
+ }
inline DepIterator(pkgCache &Owner, Dependency *Trg, Package*) :
Iterator(Owner, Trg), Type(DepRev) {
if (S == 0)
S = Owner.DepP;
- };
- inline DepIterator() : Iterator(), Type(DepVer) {};
+ }
+ inline DepIterator() : Iterator(), Type(DepVer) {}
};
/*}}}*/
// Provides iterator /*{{{*/
@@ -318,34 +318,34 @@ class pkgCache::PrvIterator : public Iterator {
protected:
inline Provides* OwnerPointer() const {
return (Owner != 0) ? Owner->ProvideP : 0;
- };
+ }
public:
// Iteration
void operator ++(int) {if (S != Owner->ProvideP) S = Owner->ProvideP +
- (Type == PrvVer?S->NextPkgProv:S->NextProvides);};
- inline void operator ++() {operator ++(0);};
+ (Type == PrvVer?S->NextPkgProv:S->NextProvides);}
+ inline void operator ++() {operator ++(0);}
// Accessors
- inline const char *Name() const {return Owner->StrP + Owner->PkgP[S->ParentPkg].Name;};
- inline const char *ProvideVersion() const {return S->ProvideVersion == 0?0:Owner->StrP + S->ProvideVersion;};
- inline PkgIterator ParentPkg() const {return PkgIterator(*Owner,Owner->PkgP + S->ParentPkg);};
- inline VerIterator OwnerVer() const {return VerIterator(*Owner,Owner->VerP + S->Version);};
- inline PkgIterator OwnerPkg() const {return PkgIterator(*Owner,Owner->PkgP + Owner->VerP[S->Version].ParentPkg);};
+ inline const char *Name() const {return Owner->StrP + Owner->PkgP[S->ParentPkg].Name;}
+ inline const char *ProvideVersion() const {return S->ProvideVersion == 0?0:Owner->StrP + S->ProvideVersion;}
+ inline PkgIterator ParentPkg() const {return PkgIterator(*Owner,Owner->PkgP + S->ParentPkg);}
+ inline VerIterator OwnerVer() const {return VerIterator(*Owner,Owner->VerP + S->Version);}
+ inline PkgIterator OwnerPkg() const {return PkgIterator(*Owner,Owner->PkgP + Owner->VerP[S->Version].ParentPkg);}
bool IsMultiArchImplicit() const;
- inline PrvIterator() : Iterator(), Type(PrvVer) {};
+ inline PrvIterator() : Iterator(), Type(PrvVer) {}
inline PrvIterator(pkgCache &Owner, Provides *Trg, Version*) :
Iterator(Owner, Trg), Type(PrvVer) {
if (S == 0)
S = Owner.ProvideP;
- };
+ }
inline PrvIterator(pkgCache &Owner, Provides *Trg, Package*) :
Iterator(Owner, Trg), Type(PrvPkg) {
if (S == 0)
S = Owner.ProvideP;
- };
+ }
};
/*}}}*/
// Package file /*{{{*/
@@ -353,32 +353,32 @@ class pkgCache::PkgFileIterator : public Iterator
protected:
inline PackageFile* OwnerPointer() const {
return (Owner != 0) ? Owner->PkgFileP : 0;
- };
+ }
public:
// Iteration
- void operator ++(int) {if (S != Owner->PkgFileP) S = Owner->PkgFileP + S->NextFile;};
- inline void operator ++() {operator ++(0);};
+ void operator ++(int) {if (S != Owner->PkgFileP) S = Owner->PkgFileP + S->NextFile;}
+ inline void operator ++() {operator ++(0);}
// Accessors
- inline const char *FileName() const {return S->FileName == 0?0:Owner->StrP + S->FileName;};
- inline const char *Archive() const {return S->Archive == 0?0:Owner->StrP + S->Archive;};
- inline const char *Component() const {return S->Component == 0?0:Owner->StrP + S->Component;};
- inline const char *Version() const {return S->Version == 0?0:Owner->StrP + S->Version;};
- inline const char *Origin() const {return S->Origin == 0?0:Owner->StrP + S->Origin;};
- inline const char *Codename() const {return S->Codename ==0?0:Owner->StrP + S->Codename;};
- inline const char *Label() const {return S->Label == 0?0:Owner->StrP + S->Label;};
- inline const char *Site() const {return S->Site == 0?0:Owner->StrP + S->Site;};
- inline const char *Architecture() const {return S->Architecture == 0?0:Owner->StrP + S->Architecture;};
- inline const char *IndexType() const {return S->IndexType == 0?0:Owner->StrP + S->IndexType;};
+ inline const char *FileName() const {return S->FileName == 0?0:Owner->StrP + S->FileName;}
+ inline const char *Archive() const {return S->Archive == 0?0:Owner->StrP + S->Archive;}
+ inline const char *Component() const {return S->Component == 0?0:Owner->StrP + S->Component;}
+ inline const char *Version() const {return S->Version == 0?0:Owner->StrP + S->Version;}
+ inline const char *Origin() const {return S->Origin == 0?0:Owner->StrP + S->Origin;}
+ inline const char *Codename() const {return S->Codename ==0?0:Owner->StrP + S->Codename;}
+ inline const char *Label() const {return S->Label == 0?0:Owner->StrP + S->Label;}
+ inline const char *Site() const {return S->Site == 0?0:Owner->StrP + S->Site;}
+ inline const char *Architecture() const {return S->Architecture == 0?0:Owner->StrP + S->Architecture;}
+ inline const char *IndexType() const {return S->IndexType == 0?0:Owner->StrP + S->IndexType;}
bool IsOk();
std::string RelStr();
// Constructors
- inline PkgFileIterator() : Iterator() {};
- inline PkgFileIterator(pkgCache &Owner) : Iterator(Owner, Owner.PkgFileP) {};
- inline PkgFileIterator(pkgCache &Owner,PackageFile *Trg) : Iterator(Owner, Trg) {};
+ inline PkgFileIterator() : Iterator() {}
+ inline PkgFileIterator(pkgCache &Owner) : Iterator(Owner, Owner.PkgFileP) {}
+ inline PkgFileIterator(pkgCache &Owner,PackageFile *Trg) : Iterator(Owner, Trg) {}
};
/*}}}*/
// Version File /*{{{*/
@@ -386,18 +386,18 @@ class pkgCache::VerFileIterator : public pkgCache::IteratorVerFileP : 0;
- };
+ }
public:
// Iteration
- void operator ++(int) {if (S != Owner->VerFileP) S = Owner->VerFileP + S->NextFile;};
- inline void operator ++() {operator ++(0);};
+ void operator ++(int) {if (S != Owner->VerFileP) S = Owner->VerFileP + S->NextFile;}
+ inline void operator ++() {operator ++(0);}
// Accessors
- inline PkgFileIterator File() const {return PkgFileIterator(*Owner,S->File + Owner->PkgFileP);};
+ inline PkgFileIterator File() const {return PkgFileIterator(*Owner,S->File + Owner->PkgFileP);}
- inline VerFileIterator() : Iterator() {};
- inline VerFileIterator(pkgCache &Owner,VerFile *Trg) : Iterator(Owner, Trg) {};
+ inline VerFileIterator() : Iterator() {}
+ inline VerFileIterator(pkgCache &Owner,VerFile *Trg) : Iterator(Owner, Trg) {}
};
/*}}}*/
// Description File /*{{{*/
@@ -405,40 +405,40 @@ class pkgCache::DescFileIterator : public Iterator {
protected:
inline DescFile* OwnerPointer() const {
return (Owner != 0) ? Owner->DescFileP : 0;
- };
+ }
public:
// Iteration
- void operator ++(int) {if (S != Owner->DescFileP) S = Owner->DescFileP + S->NextFile;};
- inline void operator ++() {operator ++(0);};
+ void operator ++(int) {if (S != Owner->DescFileP) S = Owner->DescFileP + S->NextFile;}
+ inline void operator ++() {operator ++(0);}
// Accessors
- inline PkgFileIterator File() const {return PkgFileIterator(*Owner,S->File + Owner->PkgFileP);};
+ inline PkgFileIterator File() const {return PkgFileIterator(*Owner,S->File + Owner->PkgFileP);}
- inline DescFileIterator() : Iterator() {};
- inline DescFileIterator(pkgCache &Owner,DescFile *Trg) : Iterator(Owner, Trg) {};
+ inline DescFileIterator() : Iterator() {}
+ inline DescFileIterator(pkgCache &Owner,DescFile *Trg) : Iterator(Owner, Trg) {}
};
/*}}}*/
// Inlined Begin functions can't be in the class because of order problems /*{{{*/
inline pkgCache::PkgIterator pkgCache::GrpIterator::PackageList() const
- {return PkgIterator(*Owner,Owner->PkgP + S->FirstPackage);};
+ {return PkgIterator(*Owner,Owner->PkgP + S->FirstPackage);}
inline pkgCache::VerIterator pkgCache::PkgIterator::VersionList() const
- {return VerIterator(*Owner,Owner->VerP + S->VersionList);};
+ {return VerIterator(*Owner,Owner->VerP + S->VersionList);}
inline pkgCache::VerIterator pkgCache::PkgIterator::CurrentVer() const
- {return VerIterator(*Owner,Owner->VerP + S->CurrentVer);};
+ {return VerIterator(*Owner,Owner->VerP + S->CurrentVer);}
inline pkgCache::DepIterator pkgCache::PkgIterator::RevDependsList() const
- {return DepIterator(*Owner,Owner->DepP + S->RevDepends,S);};
+ {return DepIterator(*Owner,Owner->DepP + S->RevDepends,S);}
inline pkgCache::PrvIterator pkgCache::PkgIterator::ProvidesList() const
- {return PrvIterator(*Owner,Owner->ProvideP + S->ProvidesList,S);};
+ {return PrvIterator(*Owner,Owner->ProvideP + S->ProvidesList,S);}
inline pkgCache::DescIterator pkgCache::VerIterator::DescriptionList() const
- {return DescIterator(*Owner,Owner->DescP + S->DescriptionList);};
+ {return DescIterator(*Owner,Owner->DescP + S->DescriptionList);}
inline pkgCache::PrvIterator pkgCache::VerIterator::ProvidesList() const
- {return PrvIterator(*Owner,Owner->ProvideP + S->ProvidesList,S);};
+ {return PrvIterator(*Owner,Owner->ProvideP + S->ProvidesList,S);}
inline pkgCache::DepIterator pkgCache::VerIterator::DependsList() const
- {return DepIterator(*Owner,Owner->DepP + S->DependsList,S);};
+ {return DepIterator(*Owner,Owner->DepP + S->DependsList,S);}
inline pkgCache::VerFileIterator pkgCache::VerIterator::FileList() const
- {return VerFileIterator(*Owner,Owner->VerFileP + S->FileList);};
+ {return VerFileIterator(*Owner,Owner->VerFileP + S->FileList);}
inline pkgCache::DescFileIterator pkgCache::DescIterator::FileList() const
- {return DescFileIterator(*Owner,Owner->DescFileP + S->FileList);};
+ {return DescFileIterator(*Owner,Owner->DescFileP + S->FileList);}
/*}}}*/
#endif
diff --git a/apt-pkg/cacheset.h b/apt-pkg/cacheset.h
index ce502d8ca..ef28bbc34 100644
--- a/apt-pkg/cacheset.h
+++ b/apt-pkg/cacheset.h
@@ -43,8 +43,8 @@ class CacheSetHelper { /*{{{*/
public: /*{{{*/
CacheSetHelper(bool const ShowError = true,
GlobalError::MsgType ErrorType = GlobalError::ERROR) :
- ShowError(ShowError), ErrorType(ErrorType) {};
- virtual ~CacheSetHelper() {};
+ ShowError(ShowError), ErrorType(ErrorType) {}
+ virtual ~CacheSetHelper() {}
virtual void showTaskSelection(pkgCache::PkgIterator const &pkg, std::string const &pattern);
virtual void showRegExSelection(pkgCache::PkgIterator const &pkg, std::string const &pattern);
@@ -76,9 +76,9 @@ public: /*{{{*/
virtual pkgCache::VerIterator canNotFindInstalledVer(pkgCacheFile &Cache,
pkgCache::PkgIterator const &Pkg);
- bool showErrors() const { return ShowError; };
- bool showErrors(bool const newValue) { if (ShowError == newValue) return ShowError; else return ((ShowError = newValue) == false); };
- GlobalError::MsgType errorType() const { return ErrorType; };
+ bool showErrors() const { return ShowError; }
+ bool showErrors(bool const newValue) { if (ShowError == newValue) return ShowError; else return ((ShowError = newValue) == false); }
+ GlobalError::MsgType errorType() const { return ErrorType; }
GlobalError::MsgType errorType(GlobalError::MsgType const &newValue)
{
if (ErrorType == newValue) return ErrorType;
@@ -87,7 +87,7 @@ public: /*{{{*/
ErrorType = newValue;
return oldValue;
}
- };
+ }
/*}}}*/
protected:
@@ -124,12 +124,12 @@ public:
inline pkgCache::PkgIterator::OkState State() const { return getPkg().State(); }
inline const char *CandVersion() const { return getPkg().CandVersion(); }
inline const char *CurVersion() const { return getPkg().CurVersion(); }
- inline pkgCache *Cache() const { return getPkg().Cache(); };
- inline unsigned long Index() const {return getPkg().Index();};
+ inline pkgCache *Cache() const { return getPkg().Cache(); }
+ inline unsigned long Index() const {return getPkg().Index();}
// we have only valid iterators here
- inline bool end() const { return false; };
+ inline bool end() const { return false; }
- inline pkgCache::Package const * operator->() const {return &*getPkg();};
+ inline pkgCache::Package const * operator->() const {return &*getPkg();}
};
/*}}}*/
@@ -154,7 +154,7 @@ public:
unsigned short ID;
const char * const Alias;
Position Pos;
- Modifier (unsigned short const &id, const char * const alias, Position const &pos) : ID(id), Alias(alias), Pos(pos) {};
+ Modifier (unsigned short const &id, const char * const alias, Position const &pos) : ID(id), Alias(alias), Pos(pos) {}
};
static bool FromModifierCommandLine(unsigned short &modID, PackageContainerInterface * const pci,
@@ -177,12 +177,12 @@ public: /*{{{*/
public:
const_iterator(typename Container::const_iterator i) : _iter(i) {}
pkgCache::PkgIterator getPkg(void) const { return *_iter; }
- inline pkgCache::PkgIterator operator*(void) const { return *_iter; };
+ inline pkgCache::PkgIterator operator*(void) const { return *_iter; }
operator typename Container::const_iterator(void) const { return _iter; }
inline const_iterator& operator++() { ++_iter; return *this; }
inline const_iterator operator++(int) { const_iterator tmp(*this); operator++(); return tmp; }
- inline bool operator!=(const_iterator const &i) const { return _iter != i._iter; };
- inline bool operator==(const_iterator const &i) const { return _iter == i._iter; };
+ inline bool operator!=(const_iterator const &i) const { return _iter != i._iter; }
+ inline bool operator==(const_iterator const &i) const { return _iter == i._iter; }
friend std::ostream& operator<<(std::ostream& out, const_iterator i) { return operator<<(out, *i); }
};
class iterator : public PackageContainerInterface::const_iterator,
@@ -191,43 +191,43 @@ public: /*{{{*/
public:
iterator(typename Container::iterator i) : _iter(i) {}
pkgCache::PkgIterator getPkg(void) const { return *_iter; }
- inline pkgCache::PkgIterator operator*(void) const { return *_iter; };
+ inline pkgCache::PkgIterator operator*(void) const { return *_iter; }
operator typename Container::iterator(void) const { return _iter; }
operator typename PackageContainer::const_iterator() { return typename PackageContainer::const_iterator(_iter); }
inline iterator& operator++() { ++_iter; return *this; }
inline iterator operator++(int) { iterator tmp(*this); operator++(); return tmp; }
- inline bool operator!=(iterator const &i) const { return _iter != i._iter; };
- inline bool operator==(iterator const &i) const { return _iter == i._iter; };
- inline iterator& operator=(iterator const &i) { _iter = i._iter; return *this; };
- inline iterator& operator=(typename Container::iterator const &i) { _iter = i; return *this; };
+ inline bool operator!=(iterator const &i) const { return _iter != i._iter; }
+ inline bool operator==(iterator const &i) const { return _iter == i._iter; }
+ inline iterator& operator=(iterator const &i) { _iter = i._iter; return *this; }
+ inline iterator& operator=(typename Container::iterator const &i) { _iter = i; return *this; }
friend std::ostream& operator<<(std::ostream& out, iterator i) { return operator<<(out, *i); }
};
/*}}}*/
- bool insert(pkgCache::PkgIterator const &P) { if (P.end() == true) return false; _cont.insert(P); return true; };
- template void insert(PackageContainer const &pkgcont) { _cont.insert((typename Cont::const_iterator)pkgcont.begin(), (typename Cont::const_iterator)pkgcont.end()); };
- void insert(const_iterator begin, const_iterator end) { _cont.insert(begin, end); };
+ bool insert(pkgCache::PkgIterator const &P) { if (P.end() == true) return false; _cont.insert(P); return true; }
+ template void insert(PackageContainer const &pkgcont) { _cont.insert((typename Cont::const_iterator)pkgcont.begin(), (typename Cont::const_iterator)pkgcont.end()); }
+ void insert(const_iterator begin, const_iterator end) { _cont.insert(begin, end); }
- bool empty() const { return _cont.empty(); };
- void clear() { return _cont.clear(); };
+ bool empty() const { return _cont.empty(); }
+ void clear() { return _cont.clear(); }
//FIXME: on ABI break, replace the first with the second without bool
- void erase(iterator position) { _cont.erase((typename Container::iterator)position); };
- iterator& erase(iterator &position, bool) { return position = _cont.erase((typename Container::iterator)position); };
- size_t erase(const pkgCache::PkgIterator x) { return _cont.erase(x); };
- void erase(iterator first, iterator last) { _cont.erase(first, last); };
- size_t size() const { return _cont.size(); };
+ void erase(iterator position) { _cont.erase((typename Container::iterator)position); }
+ iterator& erase(iterator &position, bool) { return position = _cont.erase((typename Container::iterator)position); }
+ size_t erase(const pkgCache::PkgIterator x) { return _cont.erase(x); }
+ void erase(iterator first, iterator last) { _cont.erase(first, last); }
+ size_t size() const { return _cont.size(); }
- const_iterator begin() const { return const_iterator(_cont.begin()); };
- const_iterator end() const { return const_iterator(_cont.end()); };
- iterator begin() { return iterator(_cont.begin()); };
- iterator end() { return iterator(_cont.end()); };
- const_iterator find(pkgCache::PkgIterator const &P) const { return const_iterator(_cont.find(P)); };
+ const_iterator begin() const { return const_iterator(_cont.begin()); }
+ const_iterator end() const { return const_iterator(_cont.end()); }
+ iterator begin() { return iterator(_cont.begin()); }
+ iterator end() { return iterator(_cont.end()); }
+ const_iterator find(pkgCache::PkgIterator const &P) const { return const_iterator(_cont.find(P)); }
- void setConstructor(Constructor const &by) { ConstructedBy = by; };
- Constructor getConstructor() const { return ConstructedBy; };
+ void setConstructor(Constructor const &by) { ConstructedBy = by; }
+ Constructor getConstructor() const { return ConstructedBy; }
- PackageContainer() : ConstructedBy(UNKNOWN) {};
- PackageContainer(Constructor const &by) : ConstructedBy(by) {};
+ PackageContainer() : ConstructedBy(UNKNOWN) {}
+ PackageContainer(Constructor const &by) : ConstructedBy(by) {}
/** \brief returns all packages in the cache who belong to the given task
@@ -365,7 +365,7 @@ private: /*{{{*/
template<> template void PackageContainer >::insert(PackageContainer const &pkgcont) {
for (typename PackageContainer::const_iterator p = pkgcont.begin(); p != pkgcont.end(); ++p)
_cont.push_back(*p);
-};
+}
// these two are 'inline' as otherwise the linker has problems with seeing these untemplated
// specializations again and again - but we need to see them, so that library users can use them
template<> inline bool PackageContainer >::insert(pkgCache::PkgIterator const &P) {
@@ -373,11 +373,11 @@ template<> inline bool PackageContainer >::inse
return false;
_cont.push_back(P);
return true;
-};
+}
template<> inline void PackageContainer >::insert(const_iterator begin, const_iterator end) {
for (const_iterator p = begin; p != end; ++p)
_cont.push_back(*p);
-};
+}
typedef PackageContainer > PackageSet;
typedef PackageContainer > PackageList;
@@ -392,27 +392,27 @@ public:
virtual pkgCache::VerIterator getVer() const = 0;
operator pkgCache::VerIterator(void) { return getVer(); }
- inline pkgCache *Cache() const { return getVer().Cache(); };
- inline unsigned long Index() const {return getVer().Index();};
- inline int CompareVer(const pkgCache::VerIterator &B) const { return getVer().CompareVer(B); };
- inline const char *VerStr() const { return getVer().VerStr(); };
- inline const char *Section() const { return getVer().Section(); };
- inline const char *Arch() const { return getVer().Arch(); };
- inline pkgCache::PkgIterator ParentPkg() const { return getVer().ParentPkg(); };
- inline pkgCache::DescIterator DescriptionList() const { return getVer().DescriptionList(); };
- inline pkgCache::DescIterator TranslatedDescription() const { return getVer().TranslatedDescription(); };
- inline pkgCache::DepIterator DependsList() const { return getVer().DependsList(); };
- inline pkgCache::PrvIterator ProvidesList() const { return getVer().ProvidesList(); };
- inline pkgCache::VerFileIterator FileList() const { return getVer().FileList(); };
- inline bool Downloadable() const { return getVer().Downloadable(); };
- inline const char *PriorityType() const { return getVer().PriorityType(); };
- inline std::string RelStr() const { return getVer().RelStr(); };
- inline bool Automatic() const { return getVer().Automatic(); };
- inline pkgCache::VerFileIterator NewestFile() const { return getVer().NewestFile(); };
+ inline pkgCache *Cache() const { return getVer().Cache(); }
+ inline unsigned long Index() const {return getVer().Index();}
+ inline int CompareVer(const pkgCache::VerIterator &B) const { return getVer().CompareVer(B); }
+ inline const char *VerStr() const { return getVer().VerStr(); }
+ inline const char *Section() const { return getVer().Section(); }
+ inline const char *Arch() const { return getVer().Arch(); }
+ inline pkgCache::PkgIterator ParentPkg() const { return getVer().ParentPkg(); }
+ inline pkgCache::DescIterator DescriptionList() const { return getVer().DescriptionList(); }
+ inline pkgCache::DescIterator TranslatedDescription() const { return getVer().TranslatedDescription(); }
+ inline pkgCache::DepIterator DependsList() const { return getVer().DependsList(); }
+ inline pkgCache::PrvIterator ProvidesList() const { return getVer().ProvidesList(); }
+ inline pkgCache::VerFileIterator FileList() const { return getVer().FileList(); }
+ inline bool Downloadable() const { return getVer().Downloadable(); }
+ inline const char *PriorityType() const { return getVer().PriorityType(); }
+ inline std::string RelStr() const { return getVer().RelStr(); }
+ inline bool Automatic() const { return getVer().Automatic(); }
+ inline pkgCache::VerFileIterator NewestFile() const { return getVer().NewestFile(); }
// we have only valid iterators here
- inline bool end() const { return false; };
+ inline bool end() const { return false; }
- inline pkgCache::Version const * operator->() const { return &*getVer(); };
+ inline pkgCache::Version const * operator->() const { return &*getVer(); }
};
/*}}}*/
@@ -446,7 +446,7 @@ public:
Version SelectVersion;
Modifier (unsigned short const &id, const char * const alias, Position const &pos,
Version const &select) : ID(id), Alias(alias), Pos(pos),
- SelectVersion(select) {};
+ SelectVersion(select) {}
};
static bool FromCommandLine(VersionContainerInterface * const vci, pkgCacheFile &Cache,
@@ -509,12 +509,12 @@ public: /*{{{*/
public:
const_iterator(typename Container::const_iterator i) : _iter(i) {}
pkgCache::VerIterator getVer(void) const { return *_iter; }
- inline pkgCache::VerIterator operator*(void) const { return *_iter; };
+ inline pkgCache::VerIterator operator*(void) const { return *_iter; }
operator typename Container::const_iterator(void) const { return _iter; }
inline const_iterator& operator++() { ++_iter; return *this; }
inline const_iterator operator++(int) { const_iterator tmp(*this); operator++(); return tmp; }
- inline bool operator!=(const_iterator const &i) const { return _iter != i._iter; };
- inline bool operator==(const_iterator const &i) const { return _iter == i._iter; };
+ inline bool operator!=(const_iterator const &i) const { return _iter != i._iter; }
+ inline bool operator==(const_iterator const &i) const { return _iter == i._iter; }
friend std::ostream& operator<<(std::ostream& out, const_iterator i) { return operator<<(out, *i); }
};
class iterator : public VersionContainerInterface::const_iterator,
@@ -523,36 +523,36 @@ public: /*{{{*/
public:
iterator(typename Container::iterator i) : _iter(i) {}
pkgCache::VerIterator getVer(void) const { return *_iter; }
- inline pkgCache::VerIterator operator*(void) const { return *_iter; };
+ inline pkgCache::VerIterator operator*(void) const { return *_iter; }
operator typename Container::iterator(void) const { return _iter; }
operator typename VersionContainer::const_iterator() { return typename VersionContainer::const_iterator(_iter); }
inline iterator& operator++() { ++_iter; return *this; }
inline iterator operator++(int) { iterator tmp(*this); operator++(); return tmp; }
- inline bool operator!=(iterator const &i) const { return _iter != i._iter; };
- inline bool operator==(iterator const &i) const { return _iter == i._iter; };
- inline iterator& operator=(iterator const &i) { _iter = i._iter; return *this; };
- inline iterator& operator=(typename Container::iterator const &i) { _iter = i; return *this; };
+ inline bool operator!=(iterator const &i) const { return _iter != i._iter; }
+ inline bool operator==(iterator const &i) const { return _iter == i._iter; }
+ inline iterator& operator=(iterator const &i) { _iter = i._iter; return *this; }
+ inline iterator& operator=(typename Container::iterator const &i) { _iter = i; return *this; }
friend std::ostream& operator<<(std::ostream& out, iterator i) { return operator<<(out, *i); }
};
/*}}}*/
- bool insert(pkgCache::VerIterator const &V) { if (V.end() == true) return false; _cont.insert(V); return true; };
- template void insert(VersionContainer const &vercont) { _cont.insert((typename Cont::const_iterator)vercont.begin(), (typename Cont::const_iterator)vercont.end()); };
- void insert(const_iterator begin, const_iterator end) { _cont.insert(begin, end); };
- bool empty() const { return _cont.empty(); };
- void clear() { return _cont.clear(); };
+ bool insert(pkgCache::VerIterator const &V) { if (V.end() == true) return false; _cont.insert(V); return true; }
+ template void insert(VersionContainer const &vercont) { _cont.insert((typename Cont::const_iterator)vercont.begin(), (typename Cont::const_iterator)vercont.end()); }
+ void insert(const_iterator begin, const_iterator end) { _cont.insert(begin, end); }
+ bool empty() const { return _cont.empty(); }
+ void clear() { return _cont.clear(); }
//FIXME: on ABI break, replace the first with the second without bool
- void erase(iterator position) { _cont.erase((typename Container::iterator)position); };
- iterator& erase(iterator &position, bool) { return position = _cont.erase((typename Container::iterator)position); };
- size_t erase(const pkgCache::VerIterator x) { return _cont.erase(x); };
- void erase(iterator first, iterator last) { _cont.erase(first, last); };
- size_t size() const { return _cont.size(); };
-
- const_iterator begin() const { return const_iterator(_cont.begin()); };
- const_iterator end() const { return const_iterator(_cont.end()); };
- iterator begin() { return iterator(_cont.begin()); };
- iterator end() { return iterator(_cont.end()); };
- const_iterator find(pkgCache::VerIterator const &V) const { return const_iterator(_cont.find(V)); };
+ void erase(iterator position) { _cont.erase((typename Container::iterator)position); }
+ iterator& erase(iterator &position, bool) { return position = _cont.erase((typename Container::iterator)position); }
+ size_t erase(const pkgCache::VerIterator x) { return _cont.erase(x); }
+ void erase(iterator first, iterator last) { _cont.erase(first, last); }
+ size_t size() const { return _cont.size(); }
+
+ const_iterator begin() const { return const_iterator(_cont.begin()); }
+ const_iterator end() const { return const_iterator(_cont.end()); }
+ iterator begin() { return iterator(_cont.begin()); }
+ iterator end() { return iterator(_cont.end()); }
+ const_iterator find(pkgCache::VerIterator const &V) const { return const_iterator(_cont.find(V)); }
/** \brief returns all versions specified on the commandline
@@ -659,7 +659,7 @@ public: /*{{{*/
template<> template void VersionContainer >::insert(VersionContainer const &vercont) {
for (typename VersionContainer::const_iterator v = vercont.begin(); v != vercont.end(); ++v)
_cont.push_back(*v);
-};
+}
// these two are 'inline' as otherwise the linker has problems with seeing these untemplated
// specializations again and again - but we need to see them, so that library users can use them
template<> inline bool VersionContainer >::insert(pkgCache::VerIterator const &V) {
@@ -667,11 +667,11 @@ template<> inline bool VersionContainer >::inse
return false;
_cont.push_back(V);
return true;
-};
+}
template<> inline void VersionContainer >::insert(const_iterator begin, const_iterator end) {
for (const_iterator v = begin; v != end; ++v)
_cont.push_back(*v);
-};
+}
typedef VersionContainer > VersionSet;
typedef VersionContainer > VersionList;
}
diff --git a/apt-pkg/cdrom.cc b/apt-pkg/cdrom.cc
index 3ae1e8b1d..838c8887a 100644
--- a/apt-pkg/cdrom.cc
+++ b/apt-pkg/cdrom.cc
@@ -933,10 +933,10 @@ pkgUdevCdromDevices::Dlopen() /*{{{*/
// convenience interface, this will just call ScanForRemovable
vector
pkgUdevCdromDevices::Scan()
-{
+{
bool CdromOnly = _config->FindB("APT::cdrom::CdromOnly", true);
- return ScanForRemovable(CdromOnly);
-};
+ return ScanForRemovable(CdromOnly);
+}
/*}}}*/
/*{{{*/
vector
diff --git a/apt-pkg/contrib/configuration.cc b/apt-pkg/contrib/configuration.cc
index 8eddd56d4..003fd01d8 100644
--- a/apt-pkg/contrib/configuration.cc
+++ b/apt-pkg/contrib/configuration.cc
@@ -43,8 +43,7 @@ Configuration::Configuration() : ToFree(true)
}
Configuration::Configuration(const Item *Root) : Root((Item *)Root), ToFree(false)
{
-};
-
+}
/*}}}*/
// Configuration::~Configuration - Destructor /*{{{*/
// ---------------------------------------------------------------------
diff --git a/apt-pkg/contrib/error.cc b/apt-pkg/contrib/error.cc
index d457781c3..2d25f5ed9 100644
--- a/apt-pkg/contrib/error.cc
+++ b/apt-pkg/contrib/error.cc
@@ -223,7 +223,7 @@ void GlobalError::DumpErrors(std::ostream &out, MsgType const &threshold,
void GlobalError::Discard() {
Messages.clear();
PendingFlag = false;
-};
+}
/*}}}*/
// GlobalError::empty - does our error list include anything? /*{{{*/
bool GlobalError::empty(MsgType const &trashhold) const {
diff --git a/apt-pkg/contrib/gpgv.h b/apt-pkg/contrib/gpgv.h
index 1d79a52ac..d9712d6a8 100644
--- a/apt-pkg/contrib/gpgv.h
+++ b/apt-pkg/contrib/gpgv.h
@@ -45,7 +45,7 @@ inline void ExecGPGV(std::string const &File, std::string const &FileSig,
int const &statusfd = -1) {
int fd[2];
ExecGPGV(File, FileSig, statusfd, fd);
-};
+}
#undef APT_noreturn
diff --git a/apt-pkg/contrib/progress.cc b/apt-pkg/contrib/progress.cc
index 916e1d730..9d74ed495 100644
--- a/apt-pkg/contrib/progress.cc
+++ b/apt-pkg/contrib/progress.cc
@@ -125,14 +125,14 @@ bool OpProgress::CheckChange(float Interval)
// OpTextProgress::OpTextProgress - Constructor /*{{{*/
// ---------------------------------------------------------------------
/* */
-OpTextProgress::OpTextProgress(Configuration &Config) :
- NoUpdate(false), NoDisplay(false), LastLen(0)
+OpTextProgress::OpTextProgress(Configuration &Config) :
+ NoUpdate(false), NoDisplay(false), LastLen(0)
{
if (Config.FindI("quiet",0) >= 1 || Config.FindB("quiet::NoUpdate", false) == true)
NoUpdate = true;
if (Config.FindI("quiet",0) >= 2)
NoDisplay = true;
-};
+}
/*}}}*/
// OpTextProgress::Done - Clean up the display /*{{{*/
// ---------------------------------------------------------------------
@@ -150,12 +150,12 @@ void OpTextProgress::Done()
cout << endl;
OldOp = string();
}
-
+
if (NoUpdate == true && NoDisplay == false && OldOp.empty() == false)
{
OldOp = string();
- cout << endl;
- }
+ cout << endl;
+ }
}
/*}}}*/
// OpTextProgress::Update - Simple text spinner /*{{{*/
diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc
index f8bb3890d..0d85b4fd3 100644
--- a/apt-pkg/contrib/strutl.cc
+++ b/apt-pkg/contrib/strutl.cc
@@ -153,7 +153,7 @@ char *_strrstrip(char *String)
End++;
*End = 0;
return String;
-};
+}
/*}}}*/
// strtabexpand - Converts tabs into 8 spaces /*{{{*/
// ---------------------------------------------------------------------
diff --git a/apt-pkg/contrib/strutl.h b/apt-pkg/contrib/strutl.h
index 8d746f10e..3a6d38b75 100644
--- a/apt-pkg/contrib/strutl.h
+++ b/apt-pkg/contrib/strutl.h
@@ -37,8 +37,8 @@ namespace APT {
namespace String {
std::string Strip(const std::string &s);
bool Endswith(const std::string &s, const std::string &ending);
- };
-};
+ }
+}
bool UTF8ToCodeset(const char *codeset, const std::string &orig, std::string *dest);
@@ -104,17 +104,17 @@ int tolower_ascii(int const c) __attrib_const __hot;
std::string StripEpoch(const std::string &VerStr);
#define APT_MKSTRCMP(name,func) \
-inline int name(const char *A,const char *B) {return func(A,A+strlen(A),B,B+strlen(B));}; \
-inline int name(const char *A,const char *AEnd,const char *B) {return func(A,AEnd,B,B+strlen(B));}; \
-inline int name(const std::string& A,const char *B) {return func(A.c_str(),A.c_str()+A.length(),B,B+strlen(B));}; \
-inline int name(const std::string& A,const std::string& B) {return func(A.c_str(),A.c_str()+A.length(),B.c_str(),B.c_str()+B.length());}; \
-inline int name(const std::string& A,const char *B,const char *BEnd) {return func(A.c_str(),A.c_str()+A.length(),B,BEnd);};
+inline int name(const char *A,const char *B) {return func(A,A+strlen(A),B,B+strlen(B));} \
+inline int name(const char *A,const char *AEnd,const char *B) {return func(A,AEnd,B,B+strlen(B));} \
+inline int name(const std::string& A,const char *B) {return func(A.c_str(),A.c_str()+A.length(),B,B+strlen(B));} \
+inline int name(const std::string& A,const std::string& B) {return func(A.c_str(),A.c_str()+A.length(),B.c_str(),B.c_str()+B.length());} \
+inline int name(const std::string& A,const char *B,const char *BEnd) {return func(A.c_str(),A.c_str()+A.length(),B,BEnd);}
#define APT_MKSTRCMP2(name,func) \
-inline int name(const char *A,const char *AEnd,const char *B) {return func(A,AEnd,B,B+strlen(B));}; \
-inline int name(const std::string& A,const char *B) {return func(A.begin(),A.end(),B,B+strlen(B));}; \
-inline int name(const std::string& A,const std::string& B) {return func(A.begin(),A.end(),B.begin(),B.end());}; \
-inline int name(const std::string& A,const char *B,const char *BEnd) {return func(A.begin(),A.end(),B,BEnd);};
+inline int name(const char *A,const char *AEnd,const char *B) {return func(A,AEnd,B,B+strlen(B));} \
+inline int name(const std::string& A,const char *B) {return func(A.begin(),A.end(),B,B+strlen(B));} \
+inline int name(const std::string& A,const std::string& B) {return func(A.begin(),A.end(),B.begin(),B.end());} \
+inline int name(const std::string& A,const char *B,const char *BEnd) {return func(A.begin(),A.end(),B,BEnd);}
int stringcmp(const char *A,const char *AEnd,const char *B,const char *BEnd);
int stringcasecmp(const char *A,const char *AEnd,const char *B,const char *BEnd);
@@ -132,18 +132,18 @@ int stringcasecmp(std::string::const_iterator A,std::string::const_iterator AEnd
int stringcasecmp(std::string::const_iterator A,std::string::const_iterator AEnd,
std::string::const_iterator B,std::string::const_iterator BEnd);
-inline int stringcmp(std::string::const_iterator A,std::string::const_iterator Aend,const char *B) {return stringcmp(A,Aend,B,B+strlen(B));};
-inline int stringcasecmp(std::string::const_iterator A,std::string::const_iterator Aend,const char *B) {return stringcasecmp(A,Aend,B,B+strlen(B));};
+inline int stringcmp(std::string::const_iterator A,std::string::const_iterator Aend,const char *B) {return stringcmp(A,Aend,B,B+strlen(B));}
+inline int stringcasecmp(std::string::const_iterator A,std::string::const_iterator Aend,const char *B) {return stringcasecmp(A,Aend,B,B+strlen(B));}
#endif
-APT_MKSTRCMP2(stringcmp,stringcmp);
-APT_MKSTRCMP2(stringcasecmp,stringcasecmp);
+APT_MKSTRCMP2(stringcmp,stringcmp)
+APT_MKSTRCMP2(stringcasecmp,stringcasecmp)
// Return the length of a NULL-terminated string array
size_t strv_length(const char **str_array);
-inline const char *DeNull(const char *s) {return (s == 0?"(null)":s);};
+inline const char *DeNull(const char *s) {return (s == 0?"(null)":s);}
class URI
{
@@ -159,13 +159,13 @@ class URI
unsigned int Port;
operator std::string();
- inline void operator =(const std::string &From) {CopyFrom(From);};
+ inline void operator =(const std::string &From) {CopyFrom(From);}
inline bool empty() {return Access.empty();};
static std::string SiteOnly(const std::string &URI);
static std::string NoUserPassword(const std::string &URI);
- URI(std::string Path) {CopyFrom(Path);};
- URI() : Port(0) {};
+ URI(std::string Path) {CopyFrom(Path);}
+ URI() : Port(0) {}
};
struct SubstVar
diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc
index a12e6963d..90d0c9314 100644
--- a/apt-pkg/depcache.cc
+++ b/apt-pkg/depcache.cc
@@ -1686,9 +1686,9 @@ bool pkgDepCache::Policy::IsImportantDep(DepIterator const &Dep)
/*}}}*/
// Policy::GetPriority - Get the priority of the package pin /*{{{*/
signed short pkgDepCache::Policy::GetPriority(pkgCache::PkgIterator const &Pkg)
-{ return 0; };
+{ return 0; }
signed short pkgDepCache::Policy::GetPriority(pkgCache::PkgFileIterator const &File)
-{ return 0; };
+{ return 0; }
/*}}}*/
pkgDepCache::InRootSetFunc *pkgDepCache::GetRootSetFunc() /*{{{*/
{
diff --git a/apt-pkg/indexcopy.cc b/apt-pkg/indexcopy.cc
index 9ea244139..89c9d531f 100644
--- a/apt-pkg/indexcopy.cc
+++ b/apt-pkg/indexcopy.cc
@@ -646,12 +646,12 @@ bool SigVerify::RunGPGV(std::string const &File, std::string const &FileOut,
int const &statusfd, int fd[2]) {
ExecGPGV(File, FileOut, statusfd, fd);
return false;
-};
+}
bool SigVerify::RunGPGV(std::string const &File, std::string const &FileOut,
int const &statusfd) {
ExecGPGV(File, FileOut, statusfd);
return false;
-};
+}
/*}}}*/
bool TranslationsCopy::CopyTranslations(string CDROM,string Name, /*{{{*/
vector &List, pkgCdromStatus *log)
diff --git a/apt-pkg/install-progress.cc b/apt-pkg/install-progress.cc
index a3a4cc0e1..aec744360 100644
--- a/apt-pkg/install-progress.cc
+++ b/apt-pkg/install-progress.cc
@@ -371,5 +371,5 @@ bool PackageManagerText::StatusChanged(std::string PackageName,
-}; // namespace progress
-}; // namespace apt
+} // namespace progress
+} // namespace apt
diff --git a/apt-pkg/install-progress.h b/apt-pkg/install-progress.h
index 8a5b68a8f..8bcc32927 100644
--- a/apt-pkg/install-progress.h
+++ b/apt-pkg/install-progress.h
@@ -24,7 +24,7 @@ namespace Progress {
int last_reported_progress;
public:
- PackageManager()
+ PackageManager()
: percentage(0.0), last_reported_progress(-1) {};
virtual ~PackageManager() {};
@@ -32,8 +32,8 @@ namespace Progress {
virtual void Start(int child_pty=-1) {};
virtual void Stop() {};
- /* When dpkg is invoked (may happen multiple times for each
- * install/remove block
+ /* When dpkg is invoked (may happen multiple times for each
+ * install/remove block
*/
virtual void StartDpkg() {};
@@ -44,18 +44,18 @@ namespace Progress {
return 500000;
};
- virtual bool StatusChanged(std::string PackageName,
+ virtual bool StatusChanged(std::string PackageName,
unsigned int StepsDone,
unsigned int TotalSteps,
- std::string HumanReadableAction) ;
- virtual void Error(std::string PackageName,
+ std::string HumanReadableAction);
+ virtual void Error(std::string PackageName,
unsigned int StepsDone,
unsigned int TotalSteps,
- std::string ErrorMessage) {};
+ std::string ErrorMessage) {}
virtual void ConffilePrompt(std::string PackageName,
unsigned int StepsDone,
unsigned int TotalSteps,
- std::string ConfMessage) {};
+ std::string ConfMessage) {}
};
class PackageManagerProgressFd : public PackageManager
@@ -72,11 +72,11 @@ namespace Progress {
virtual void StartDpkg();
virtual void Stop();
- virtual bool StatusChanged(std::string PackageName,
+ virtual bool StatusChanged(std::string PackageName,
unsigned int StepsDone,
unsigned int TotalSteps,
std::string HumanReadableAction);
- virtual void Error(std::string PackageName,
+ virtual void Error(std::string PackageName,
unsigned int StepsDone,
unsigned int TotalSteps,
std::string ErrorMessage);
@@ -101,11 +101,11 @@ namespace Progress {
virtual void StartDpkg();
virtual void Stop();
- virtual bool StatusChanged(std::string PackageName,
+ virtual bool StatusChanged(std::string PackageName,
unsigned int StepsDone,
unsigned int TotalSteps,
std::string HumanReadableAction);
- virtual void Error(std::string PackageName,
+ virtual void Error(std::string PackageName,
unsigned int StepsDone,
unsigned int TotalSteps,
std::string ErrorMessage);
@@ -134,7 +134,7 @@ namespace Progress {
~PackageManagerFancy();
virtual void Start(int child_pty=-1);
virtual void Stop();
- virtual bool StatusChanged(std::string PackageName,
+ virtual bool StatusChanged(std::string PackageName,
unsigned int StepsDone,
unsigned int TotalSteps,
std::string HumanReadableAction);
@@ -143,14 +143,14 @@ namespace Progress {
class PackageManagerText : public PackageManager
{
public:
- virtual bool StatusChanged(std::string PackageName,
+ virtual bool StatusChanged(std::string PackageName,
unsigned int StepsDone,
unsigned int TotalSteps,
std::string HumanReadableAction);
};
-}; // namespace Progress
-}; // namespace APT
+} // namespace Progress
+} // namespace APT
#endif
diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc
index 67a2a709d..7d57640c5 100644
--- a/apt-pkg/pkgcache.cc
+++ b/apt-pkg/pkgcache.cc
@@ -414,7 +414,7 @@ pkgCache::PkgIterator pkgCache::GrpIterator::NextPkg(pkgCache::PkgIterator const
// GrpIterator::operator ++ - Postfix incr /*{{{*/
// ---------------------------------------------------------------------
/* This will advance to the next logical group in the hash table. */
-void pkgCache::GrpIterator::operator ++(int)
+void pkgCache::GrpIterator::operator ++(int)
{
// Follow the current links
if (S != Owner->GrpP)
@@ -426,12 +426,12 @@ void pkgCache::GrpIterator::operator ++(int)
HashIndex++;
S = Owner->GrpP + Owner->HeaderP->GrpHashTable[HashIndex];
}
-};
+}
/*}}}*/
// PkgIterator::operator ++ - Postfix incr /*{{{*/
// ---------------------------------------------------------------------
/* This will advance to the next logical package in the hash table. */
-void pkgCache::PkgIterator::operator ++(int)
+void pkgCache::PkgIterator::operator ++(int)
{
// Follow the current links
if (S != Owner->PkgP)
@@ -443,7 +443,7 @@ void pkgCache::PkgIterator::operator ++(int)
HashIndex++;
S = Owner->PkgP + Owner->HeaderP->PkgHashTable[HashIndex];
}
-};
+}
/*}}}*/
// PkgIterator::State - Check the State of the package /*{{{*/
// ---------------------------------------------------------------------
@@ -475,26 +475,26 @@ pkgCache::PkgIterator::OkState pkgCache::PkgIterator::State() const
// ---------------------------------------------------------------------
/* Return string representing of the candidate version. */
const char *
-pkgCache::PkgIterator::CandVersion() const
+pkgCache::PkgIterator::CandVersion() const
{
//TargetVer is empty, so don't use it.
VerIterator version = pkgPolicy(Owner).GetCandidateVer(*this);
if (version.IsGood())
return version.VerStr();
return 0;
-};
+}
/*}}}*/
// PkgIterator::CurVersion - Returns the current version string /*{{{*/
// ---------------------------------------------------------------------
/* Return string representing of the current version. */
const char *
-pkgCache::PkgIterator::CurVersion() const
+pkgCache::PkgIterator::CurVersion() const
{
VerIterator version = CurrentVer();
if (version.IsGood())
return CurrentVer().VerStr();
return 0;
-};
+}
/*}}}*/
// ostream operator to handle string representation of a package /*{{{*/
// ---------------------------------------------------------------------
@@ -978,7 +978,7 @@ string pkgCache::PkgFileIterator::RelStr()
/*}}}*/
// VerIterator::TranslatedDescription - Return the a DescIter for locale/*{{{*/
// ---------------------------------------------------------------------
-/* return a DescIter for the current locale or the default if none is
+/* return a DescIter for the current locale or the default if none is
* found
*/
pkgCache::DescIterator pkgCache::VerIterator::TranslatedDescription() const
@@ -1012,7 +1012,7 @@ pkgCache::DescIterator pkgCache::VerIterator::TranslatedDescription() const
if (strcmp(Desc.LanguageCode(), "") == 0)
return Desc;
return DescriptionList();
-};
+}
/*}}}*/
// PrvIterator::IsMultiArchImplicit - added by the cache generation /*{{{*/
diff --git a/apt-pkg/pkgcache.h b/apt-pkg/pkgcache.h
index 669904c84..9a88246a1 100644
--- a/apt-pkg/pkgcache.h
+++ b/apt-pkg/pkgcache.h
@@ -176,13 +176,13 @@ class pkgCache /*{{{*/
char *StrP;
virtual bool ReMap(bool const &Errorchecks = true);
- inline bool Sync() {return Map.Sync();};
- inline MMap &GetMap() {return Map;};
- inline void *DataEnd() {return ((unsigned char *)Map.Data()) + Map.Size();};
+ inline bool Sync() {return Map.Sync();}
+ inline MMap &GetMap() {return Map;}
+ inline void *DataEnd() {return ((unsigned char *)Map.Data()) + Map.Size();}
// String hashing function (512 range)
- inline unsigned long Hash(const std::string &S) const {return sHash(S);};
- inline unsigned long Hash(const char *S) const {return sHash(S);};
+ inline unsigned long Hash(const std::string &S) const {return sHash(S);}
+ inline unsigned long Hash(const char *S) const {return sHash(S);}
// Useful transformation things
const char *Priority(unsigned char Priority);
@@ -192,7 +192,7 @@ class pkgCache /*{{{*/
PkgIterator FindPkg(const std::string &Name);
PkgIterator FindPkg(const std::string &Name, const std::string &Arch);
- Header &Head() {return *HeaderP;};
+ Header &Head() {return *HeaderP;}
inline GrpIterator GrpBegin();
inline GrpIterator GrpEnd();
inline PkgIterator PkgBegin();
@@ -200,7 +200,7 @@ class pkgCache /*{{{*/
inline PkgFileIterator FileBegin();
inline PkgFileIterator FileEnd();
- inline bool MultiArchCache() const { return MultiArchEnabled; };
+ inline bool MultiArchCache() const { return MultiArchEnabled; }
inline char const * const NativeArch() const;
// Make me a function
@@ -212,7 +212,7 @@ class pkgCache /*{{{*/
static const char *DepType(unsigned char Dep);
pkgCache(MMap *Map,bool DoMap = true);
- virtual ~pkgCache() {};
+ virtual ~pkgCache() {}
private:
bool MultiArchEnabled;
@@ -662,26 +662,26 @@ struct pkgCache::StringItem
inline char const * const pkgCache::NativeArch() const
- { return StrP + HeaderP->Architecture; };
+ { return StrP + HeaderP->Architecture; }
#include
-inline pkgCache::GrpIterator pkgCache::GrpBegin()
- {return GrpIterator(*this);};
-inline pkgCache::GrpIterator pkgCache::GrpEnd()
- {return GrpIterator(*this,GrpP);};
-inline pkgCache::PkgIterator pkgCache::PkgBegin()
- {return PkgIterator(*this);};
-inline pkgCache::PkgIterator pkgCache::PkgEnd()
- {return PkgIterator(*this,PkgP);};
+inline pkgCache::GrpIterator pkgCache::GrpBegin()
+ {return GrpIterator(*this);}
+inline pkgCache::GrpIterator pkgCache::GrpEnd()
+ {return GrpIterator(*this,GrpP);}
+inline pkgCache::PkgIterator pkgCache::PkgBegin()
+ {return PkgIterator(*this);}
+inline pkgCache::PkgIterator pkgCache::PkgEnd()
+ {return PkgIterator(*this,PkgP);}
inline pkgCache::PkgFileIterator pkgCache::FileBegin()
- {return PkgFileIterator(*this,PkgFileP + HeaderP->FileList);};
+ {return PkgFileIterator(*this,PkgFileP + HeaderP->FileList);}
inline pkgCache::PkgFileIterator pkgCache::FileEnd()
- {return PkgFileIterator(*this,PkgFileP);};
+ {return PkgFileIterator(*this,PkgFileP);}
// Oh I wish for Real Name Space Support
class pkgCache::Namespace /*{{{*/
-{
+{
public:
typedef pkgCache::GrpIterator GrpIterator;
typedef pkgCache::PkgIterator PkgIterator;
@@ -690,7 +690,7 @@ class pkgCache::Namespace /*{{{*/
typedef pkgCache::DepIterator DepIterator;
typedef pkgCache::PrvIterator PrvIterator;
typedef pkgCache::PkgFileIterator PkgFileIterator;
- typedef pkgCache::VerFileIterator VerFileIterator;
+ typedef pkgCache::VerFileIterator VerFileIterator;
typedef pkgCache::Version Version;
typedef pkgCache::Description Description;
typedef pkgCache::Package Package;
diff --git a/apt-pkg/upgrade.h b/apt-pkg/upgrade.h
index c4973472f..436d38300 100644
--- a/apt-pkg/upgrade.h
+++ b/apt-pkg/upgrade.h
@@ -15,7 +15,7 @@ namespace APT {
// FIXME: make this "enum class UpgradeMode {" once we enable c++11
enum UpgradeMode {
FORBID_REMOVE_PACKAGES = 1,
- FORBID_INSTALL_NEW_PACKAGES = 2,
+ FORBID_INSTALL_NEW_PACKAGES = 2
};
bool Upgrade(pkgDepCache &Cache, int UpgradeMode);
}
diff --git a/apt-private/acqprogress.cc b/apt-private/acqprogress.cc
index d25ffef75..66e1600f1 100644
--- a/apt-private/acqprogress.cc
+++ b/apt-private/acqprogress.cc
@@ -42,12 +42,12 @@ AcqTextStatus::AcqTextStatus(unsigned int &ScreenWidth,unsigned int const Quiet)
// AcqTextStatus::Start - Downloading has started /*{{{*/
// ---------------------------------------------------------------------
/* */
-void AcqTextStatus::Start()
+void AcqTextStatus::Start()
{
- pkgAcquireStatus::Start();
+ pkgAcquireStatus::Start();
BlankLine[0] = 0;
ID = 1;
-};
+}
/*}}}*/
// AcqTextStatus::IMSHit - Called when an item got a HIT response /*{{{*/
// ---------------------------------------------------------------------
@@ -58,14 +58,14 @@ void AcqTextStatus::IMSHit(pkgAcquire::ItemDesc &Itm)
return;
if (Quiet <= 0)
- cout << '\r' << BlankLine << '\r';
-
+ cout << '\r' << BlankLine << '\r';
+
cout << _("Hit ") << Itm.Description;
if (Itm.Owner->FileSize != 0)
cout << " [" << SizeToStr(Itm.Owner->FileSize) << "B]";
cout << endl;
Update = true;
-};
+}
/*}}}*/
// AcqTextStatus::Fetch - An item has started to download /*{{{*/
// ---------------------------------------------------------------------
@@ -75,20 +75,20 @@ void AcqTextStatus::Fetch(pkgAcquire::ItemDesc &Itm)
Update = true;
if (Itm.Owner->Complete == true)
return;
-
+
Itm.Owner->ID = ID++;
-
+
if (Quiet > 1)
return;
if (Quiet <= 0)
cout << '\r' << BlankLine << '\r';
-
+
cout << _("Get:") << Itm.Owner->ID << ' ' << Itm.Description;
if (Itm.Owner->FileSize != 0)
cout << " [" << SizeToStr(Itm.Owner->FileSize) << "B]";
cout << endl;
-};
+}
/*}}}*/
// AcqTextStatus::Done - Completed a download /*{{{*/
// ---------------------------------------------------------------------
@@ -96,7 +96,7 @@ void AcqTextStatus::Fetch(pkgAcquire::ItemDesc &Itm)
void AcqTextStatus::Done(pkgAcquire::ItemDesc &Itm)
{
Update = true;
-};
+}
/*}}}*/
// AcqTextStatus::Fail - Called when an item fails to download /*{{{*/
// ---------------------------------------------------------------------
@@ -109,10 +109,10 @@ void AcqTextStatus::Fail(pkgAcquire::ItemDesc &Itm)
// Ignore certain kinds of transient failures (bad code)
if (Itm.Owner->Status == pkgAcquire::Item::StatIdle)
return;
-
+
if (Quiet <= 0)
cout << '\r' << BlankLine << '\r';
-
+
if (Itm.Owner->Status == pkgAcquire::Item::StatDone)
{
cout << _("Ign ") << Itm.Description << endl;
@@ -122,9 +122,9 @@ void AcqTextStatus::Fail(pkgAcquire::ItemDesc &Itm)
cout << _("Err ") << Itm.Description << endl;
cout << " " << Itm.Owner->ErrorText << endl;
}
-
+
Update = true;
-};
+}
/*}}}*/
// AcqTextStatus::Stop - Finished downloading /*{{{*/
// ---------------------------------------------------------------------
@@ -154,12 +154,12 @@ void AcqTextStatus::Stop()
bool AcqTextStatus::Pulse(pkgAcquire *Owner)
{
pkgAcquireStatus::Pulse(Owner);
-
+
if (Quiet > 0)
return true;
-
+
enum {Long = 0,Medium,Short} Mode = Medium;
-
+
char Buffer[sizeof(BlankLine)];
char *End = Buffer + sizeof(Buffer);
char *S = Buffer;
@@ -174,8 +174,8 @@ bool AcqTextStatus::Pulse(pkgAcquire *Owner)
I = Owner->WorkerStep(I))
{
S += strlen(S);
-
- // There is no item running
+
+ // There is no item running
if (I->CurrentItem == 0)
{
if (I->Status.empty() == false)
@@ -183,12 +183,12 @@ bool AcqTextStatus::Pulse(pkgAcquire *Owner)
snprintf(S,End-S," [%s]",I->Status.c_str());
Shown = true;
}
-
+
continue;
}
Shown = true;
-
+
// Add in the short description
if (I->CurrentItem->Owner->ID != 0)
snprintf(S,End-S," [%lu %s",I->CurrentItem->Owner->ID,
@@ -203,7 +203,7 @@ bool AcqTextStatus::Pulse(pkgAcquire *Owner)
snprintf(S,End-S," %s",I->CurrentItem->Owner->Mode);
S += strlen(S);
}
-
+
// Add the current progress
if (Mode == Long)
snprintf(S,End-S," %llu",I->CurrentSize);
@@ -213,7 +213,7 @@ bool AcqTextStatus::Pulse(pkgAcquire *Owner)
snprintf(S,End-S," %sB",SizeToStr(I->CurrentSize).c_str());
}
S += strlen(S);
-
+
// Add the total size and percent
if (I->TotalSize > 0 && I->CurrentItem->Owner->Complete == false)
{
@@ -223,7 +223,7 @@ bool AcqTextStatus::Pulse(pkgAcquire *Owner)
else
snprintf(S,End-S,"/%sB %.0f%%",SizeToStr(I->TotalSize).c_str(),
(I->CurrentSize*100.0)/I->TotalSize);
- }
+ }
S += strlen(S);
snprintf(S,End-S,"]");
}
@@ -231,26 +231,26 @@ bool AcqTextStatus::Pulse(pkgAcquire *Owner)
// Show something..
if (Shown == false)
snprintf(S,End-S,_(" [Working]"));
-
+
/* Put in the ETA and cps meter, block off signals to prevent strangeness
during resizing */
sigset_t Sigs,OldSigs;
sigemptyset(&Sigs);
sigaddset(&Sigs,SIGWINCH);
sigprocmask(SIG_BLOCK,&Sigs,&OldSigs);
-
+
if (CurrentCPS != 0)
- {
+ {
char Tmp[300];
unsigned long long ETA = (TotalBytes - CurrentBytes)/CurrentCPS;
sprintf(Tmp," %sB/s %s",SizeToStr(CurrentCPS).c_str(),TimeToStr(ETA).c_str());
unsigned int Len = strlen(Buffer);
unsigned int LenT = strlen(Tmp);
if (Len + LenT < ScreenWidth)
- {
+ {
memset(Buffer + Len,' ',ScreenWidth - Len);
strcpy(Buffer + ScreenWidth - LenT,Tmp);
- }
+ }
}
Buffer[ScreenWidth] = 0;
BlankLine[ScreenWidth] = 0;
@@ -268,7 +268,7 @@ bool AcqTextStatus::Pulse(pkgAcquire *Owner)
memset(BlankLine,' ',strlen(Buffer));
BlankLine[strlen(Buffer)] = 0;
-
+
Update = false;
return true;
diff --git a/cmdline/apt-cdrom.cc b/cmdline/apt-cdrom.cc
index 20c6e8892..9aaebefd7 100644
--- a/cmdline/apt-cdrom.cc
+++ b/cmdline/apt-cdrom.cc
@@ -54,7 +54,7 @@ class pkgCdromTextStatus : public pkgCdromStatus /*{{{*/
{
protected:
OpTextProgress Progress;
- void Prompt(const char *Text);
+ void Prompt(const char *Text);
string PromptLine(const char *Text);
bool AskCdromName(string &name);
@@ -64,12 +64,12 @@ public:
virtual OpProgress* GetOpProgress();
};
-void pkgCdromTextStatus::Prompt(const char *Text)
+void pkgCdromTextStatus::Prompt(const char *Text)
{
char C;
cout << Text << ' ' << flush;
if (read(STDIN_FILENO,&C,1) < 0)
- _error->Errno("pkgCdromTextStatus::Prompt",
+ _error->Errno("pkgCdromTextStatus::Prompt",
"Failed to read from standard input (not a terminal?)");
if (C != '\n')
cout << endl;
@@ -78,37 +78,37 @@ void pkgCdromTextStatus::Prompt(const char *Text)
string pkgCdromTextStatus::PromptLine(const char *Text)
{
cout << Text << ':' << endl;
-
+
string Res;
getline(cin,Res);
return Res;
}
-bool pkgCdromTextStatus::AskCdromName(string &name)
+bool pkgCdromTextStatus::AskCdromName(string &name)
{
cout << _("Please provide a name for this Disc, such as 'Debian 5.0.3 Disk 1'") << flush;
name = PromptLine("");
-
+
return true;
}
-
-void pkgCdromTextStatus::Update(string text, int current)
+
+void pkgCdromTextStatus::Update(string text, int current)
{
if(text.size() > 0)
cout << text << flush;
}
-bool pkgCdromTextStatus::ChangeCdrom()
+bool pkgCdromTextStatus::ChangeCdrom()
{
Prompt(_("Please insert a Disc in the drive and press enter"));
return true;
}
-OpProgress* pkgCdromTextStatus::GetOpProgress()
-{
- return &Progress;
-};
+OpProgress* pkgCdromTextStatus::GetOpProgress()
+{
+ return &Progress;
+}
/*}}}*/
// SetupAutoDetect /*{{{*/
bool AutoDetectCdrom(pkgUdevCdromDevices &UdevCdroms, unsigned int &i, bool &automounted)
diff --git a/ftparchive/override.cc b/ftparchive/override.cc
index d2130db8a..82cbc4c19 100644
--- a/ftparchive/override.cc
+++ b/ftparchive/override.cc
@@ -201,7 +201,7 @@ bool Override::ReadExtraOverride(string const &File,bool const &Source)
}
/*}}}*/
-// Override::GetItem - Get a architecture specific item /*{{{*/
+// Override::GetItem - Get a architecture specific item /*{{{*/
// ---------------------------------------------------------------------
/* Returns a override item for the given package and the given architecture.
* Treats "all" special
@@ -232,10 +232,10 @@ Override::Item* Override::GetItem(string const &Package, string const &Architect
{
result->FieldOverride[foI->first] = foI->second;
}
- }
- }
+ }
+ }
return result;
-};
+}
// Override::Item::SwapMaint - Swap the maintainer field if necessary /*{{{*/
diff --git a/methods/cdrom.cc b/methods/cdrom.cc
index 22d4b9164..3c14d9dfb 100644
--- a/methods/cdrom.cc
+++ b/methods/cdrom.cc
@@ -62,7 +62,7 @@ CDROMMethod::CDROMMethod() : pkgAcqMethod("1.0",SingleInstance | LocalOnly |
MountedByApt(false)
{
UdevCdroms.Dlopen();
-};
+}
/*}}}*/
// CDROMMethod::Exit - Unmount the disc if necessary /*{{{*/
// ---------------------------------------------------------------------
diff --git a/methods/http.cc b/methods/http.cc
index 42b31beeb..16c6d19e1 100644
--- a/methods/http.cc
+++ b/methods/http.cc
@@ -61,7 +61,7 @@ unsigned long long CircleBuf::BwReadLimit=0;
unsigned long long CircleBuf::BwTickReadData=0;
struct timeval CircleBuf::BwReadTick={0,0};
const unsigned int CircleBuf::BW_HZ=10;
-
+
// CircleBuf::CircleBuf - Circular input buffer /*{{{*/
// ---------------------------------------------------------------------
/* */
@@ -87,8 +87,8 @@ void CircleBuf::Reset()
{
delete Hash;
Hash = new Hashes;
- }
-};
+ }
+}
/*}}}*/
// CircleBuf::Read - Read from a FD into the circular buffer /*{{{*/
// ---------------------------------------------------------------------
diff --git a/methods/https.cc b/methods/https.cc
index febe6a0f0..b0c7ee71d 100644
--- a/methods/https.cc
+++ b/methods/https.cc
@@ -432,7 +432,7 @@ bool HttpsMethod::Fetch(FetchItem *Itm)
delete File;
return true;
-};
+}
int main()
{
diff --git a/methods/mirror.cc b/methods/mirror.cc
index 085f3717b..977eddcf5 100644
--- a/methods/mirror.cc
+++ b/methods/mirror.cc
@@ -60,7 +60,7 @@ using namespace std;
MirrorMethod::MirrorMethod()
: HttpMethod(), DownloadedMirrorFile(false), Debug(false)
{
-};
+}
// HttpMethod::Configuration - Handle a configuration message /*{{{*/
// ---------------------------------------------------------------------
@@ -90,17 +90,17 @@ bool MirrorMethod::Clean(string Dir)
pkgSourceList list;
list.ReadMainList();
- DIR *D = opendir(Dir.c_str());
+ DIR *D = opendir(Dir.c_str());
if (D == 0)
return _error->Errno("opendir",_("Unable to read %s"),Dir.c_str());
-
+
string StartDir = SafeGetCWD();
if (chdir(Dir.c_str()) != 0)
{
closedir(D);
return _error->Errno("chdir",_("Unable to change to %s"),Dir.c_str());
}
-
+
for (struct dirent *Dir = readdir(D); Dir != 0; Dir = readdir(D))
{
// Skip some files..
@@ -123,23 +123,23 @@ bool MirrorMethod::Clean(string Dir)
// nothing found, nuke it
if (I == list.end())
unlink(Dir->d_name);
- };
+ }
closedir(D);
if (chdir(StartDir.c_str()) != 0)
return _error->Errno("chdir",_("Unable to change to %s"),StartDir.c_str());
- return true;
+ return true;
}
bool MirrorMethod::DownloadMirrorFile(string mirror_uri_str)
{
- // not that great to use pkgAcquire here, but we do not have
+ // not that great to use pkgAcquire here, but we do not have
// any other way right now
string fetch = BaseUri;
fetch.replace(0,strlen("mirror://"),"http://");
-#if 0 // no need for this, the getArchitectures() will also include the main
+#if 0 // no need for this, the getArchitectures() will also include the main
// arch
// append main architecture
fetch += "?arch=" + _config->Find("Apt::Architecture");
@@ -173,7 +173,7 @@ bool MirrorMethod::DownloadMirrorFile(string mirror_uri_str)
if(Debug)
clog << "MirrorMethod::DownloadMirrorFile() success: " << res << endl;
-
+
return res;
}
@@ -187,13 +187,13 @@ bool MirrorMethod::RandomizeMirrorFile(string mirror_file)
if (!FileExists(mirror_file))
return false;
- // read
+ // read
ifstream in(mirror_file.c_str());
while ( !in.eof() ) {
getline(in, line);
content.push_back(line);
}
-
+
// we want the file to be random for each different machine, but also
// "stable" on the same machine. this is to avoid running into out-of-sync
// issues (i.e. Release/Release.gpg different on each mirror)
@@ -422,10 +422,10 @@ bool MirrorMethod::Fetch(FetchItem *Itm)
if(Debug)
clog << "Fetch: " << Itm->Uri << endl << endl;
-
+
// now run the real fetcher
return HttpMethod::Fetch(Itm);
-};
+}
void MirrorMethod::Fail(string Err,bool Transient)
{
@@ -437,7 +437,7 @@ void MirrorMethod::Fail(string Err,bool Transient)
// try the next mirror on fail (if its not a expected failure,
// e.g. translations are ok to ignore)
- if (!Queue->FailIgnore && TryNextMirror())
+ if (!Queue->FailIgnore && TryNextMirror())
return;
// all mirrors failed, so bail out
diff --git a/methods/rsh.cc b/methods/rsh.cc
index 550f77eca..f065f6b89 100644
--- a/methods/rsh.cc
+++ b/methods/rsh.cc
@@ -368,7 +368,7 @@ RSHMethod::RSHMethod() : pkgAcqMethod("1.0",SendConfig)
signal(SIGINT,SigTerm);
Server = 0;
FailFd = -1;
-};
+}
/*}}}*/
// RSHMethod::Configuration - Handle a configuration message /*{{{*/
// ---------------------------------------------------------------------
diff --git a/methods/server.cc b/methods/server.cc
index ef90c809c..90e83d1af 100644
--- a/methods/server.cc
+++ b/methods/server.cc
@@ -119,10 +119,10 @@ bool ServerState::HeaderLine(string Line)
string::size_type Pos2 = Pos;
while (Pos2 < Line.length() && isspace(Line[Pos2]) != 0)
Pos2++;
-
+
string Tag = string(Line,0,Pos);
string Val = string(Line,Pos2);
-
+
if (stringcasecmp(Tag.c_str(),Tag.c_str()+4,"HTTP") == 0)
{
// Evil servers return no version
@@ -159,14 +159,14 @@ bool ServerState::HeaderLine(string Line)
}
return true;
- }
-
+ }
+
if (stringcasecmp(Tag,"Content-Length:") == 0)
{
if (Encoding == Closes)
Encoding = Stream;
HaveContent = true;
-
+
// The length is already set from the Content-Range header
if (StartPos != 0)
return true;
@@ -184,7 +184,7 @@ bool ServerState::HeaderLine(string Line)
HaveContent = true;
return true;
}
-
+
if (stringcasecmp(Tag,"Content-Range:") == 0)
{
HaveContent = true;
@@ -201,12 +201,12 @@ bool ServerState::HeaderLine(string Line)
return _error->Error(_("This HTTP server has broken range support"));
return true;
}
-
+
if (stringcasecmp(Tag,"Transfer-Encoding:") == 0)
{
HaveContent = true;
if (stringcasecmp(Val,"chunked") == 0)
- Encoding = Chunked;
+ Encoding = Chunked;
return true;
}
@@ -218,7 +218,7 @@ bool ServerState::HeaderLine(string Line)
Persistent = true;
return true;
}
-
+
if (stringcasecmp(Tag,"Last-Modified:") == 0)
{
if (RFC1123StrToTime(Val.c_str(), Date) == false)
@@ -413,7 +413,7 @@ bool ServerMethod::Fetch(FetchItem *)
}
return true;
-};
+}
/*}}}*/
// ServerMethod::Loop - Main loop /*{{{*/
int ServerMethod::Loop()
diff --git a/methods/server.h b/methods/server.h
index 2b81e6173..f1db9adf7 100644
--- a/methods/server.h
+++ b/methods/server.h
@@ -62,7 +62,7 @@ struct ServerState
/** \brief IO error while retrieving */
RUN_HEADERS_IO_ERROR,
/** \brief Parse error after retrieving */
- RUN_HEADERS_PARSE_ERROR,
+ RUN_HEADERS_PARSE_ERROR
};
/** \brief Get the headers before the data */
RunHeadersResult RunHeaders(FileFd * const File);
--
cgit v1.2.3-70-g09d2
From cf4ff3b78dc347188949370db914fe6329be6c99 Mon Sep 17 00:00:00 2001
From: David Kalnischkies
Date: Thu, 27 Feb 2014 01:54:10 +0100
Subject: warning: cast from type A to type B casts away qualifiers
[-Wcast-qual]
Git-Dch: Ignore
Reported-By: gcc -Wcast-qual
---
apt-inst/contrib/extracttar.cc | 6 +++---
apt-pkg/cacheiterators.h | 2 +-
apt-pkg/contrib/fileutl.cc | 4 ++--
apt-pkg/contrib/hashes.h | 2 +-
apt-pkg/contrib/hashsum_template.h | 42 +++++++++++++++++++-------------------
apt-pkg/pkgcachegen.cc | 14 ++++++-------
6 files changed, 35 insertions(+), 35 deletions(-)
(limited to 'apt-pkg')
diff --git a/apt-inst/contrib/extracttar.cc b/apt-inst/contrib/extracttar.cc
index 41301d1a6..41c509809 100644
--- a/apt-inst/contrib/extracttar.cc
+++ b/apt-inst/contrib/extracttar.cc
@@ -120,7 +120,7 @@ bool ExtractTar::StartGzip()
int Pipes[2];
if (pipe(Pipes) != 0)
return _error->Errno("pipe",_("Failed to create pipes"));
-
+
// Fork off the process
GZPid = ExecFork();
@@ -136,9 +136,9 @@ bool ExtractTar::StartGzip()
dup2(Fd,STDERR_FILENO);
close(Fd);
SetCloseExec(STDOUT_FILENO,false);
- SetCloseExec(STDIN_FILENO,false);
+ SetCloseExec(STDIN_FILENO,false);
SetCloseExec(STDERR_FILENO,false);
-
+
const char *Args[3];
string confvar = string("dir::bin::") + DecompressProg;
string argv0 = _config->Find(confvar.c_str(),DecompressProg.c_str());
diff --git a/apt-pkg/cacheiterators.h b/apt-pkg/cacheiterators.h
index ca8bc5ca0..64fec5daa 100644
--- a/apt-pkg/cacheiterators.h
+++ b/apt-pkg/cacheiterators.h
@@ -79,7 +79,7 @@ template class pkgCache::Iterator :
void ReMap(void const * const oldMap, void const * const newMap) {
if (Owner == 0 || S == 0)
return;
- S += (Str*)(newMap) - (Str*)(oldMap);
+ S += (Str const * const)(newMap) - (Str const * const)(oldMap);
}
// Constructors - look out for the variable assigning
diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc
index 52411a762..17833f090 100644
--- a/apt-pkg/contrib/fileutl.cc
+++ b/apt-pkg/contrib/fileutl.cc
@@ -1400,7 +1400,7 @@ bool FileFd::Write(const void *From,unsigned long long Size)
return FileFdErrno("write",_("Write error"));
}
- From = (char *)From + Res;
+ From = (char const *)From + Res;
Size -= Res;
if (d != NULL)
d->seekpos += Res;
@@ -1424,7 +1424,7 @@ bool FileFd::Write(int Fd, const void *From, unsigned long long Size)
if (Res < 0)
return _error->Errno("write",_("Write error"));
- From = (char *)From + Res;
+ From = (char const *)From + Res;
Size -= Res;
}
while (Res > 0 && Size > 0);
diff --git a/apt-pkg/contrib/hashes.h b/apt-pkg/contrib/hashes.h
index 0a8bcd259..636cad257 100644
--- a/apt-pkg/contrib/hashes.h
+++ b/apt-pkg/contrib/hashes.h
@@ -77,7 +77,7 @@ class Hashes
{
return MD5.Add(Data,Size) && SHA1.Add(Data,Size) && SHA256.Add(Data,Size) && SHA512.Add(Data,Size);
};
- inline bool Add(const char *Data) {return Add((unsigned char *)Data,strlen(Data));};
+ inline bool Add(const char *Data) {return Add((unsigned char const *)Data,strlen(Data));};
inline bool AddFD(int const Fd,unsigned long long Size = 0)
{ return AddFD(Fd, Size, true, true, true, true); };
bool AddFD(int const Fd, unsigned long long Size, bool const addMD5,
diff --git a/apt-pkg/contrib/hashsum_template.h b/apt-pkg/contrib/hashsum_template.h
index 9bf160b2b..97b6a4ad9 100644
--- a/apt-pkg/contrib/hashsum_template.h
+++ b/apt-pkg/contrib/hashsum_template.h
@@ -28,18 +28,18 @@ template
class HashSumValue
{
unsigned char Sum[N/8];
-
+
public:
// Accessors
bool operator ==(const HashSumValue &rhs) const
{
return memcmp(Sum,rhs.Sum,sizeof(Sum)) == 0;
- };
+ }
bool operator !=(const HashSumValue &rhs) const
{
return memcmp(Sum,rhs.Sum,sizeof(Sum)) != 0;
- };
+ }
std::string Value() const
{
@@ -49,7 +49,7 @@ class HashSumValue
};
char Result[((N/8)*2)+1];
Result[(N/8)*2] = 0;
-
+
// Convert each char into two letters
int J = 0;
int I = 0;
@@ -59,31 +59,31 @@ class HashSumValue
Result[I + 1] = Conv[Sum[J] & 0xF];
}
return std::string(Result);
- };
-
+ }
+
inline void Value(unsigned char S[N/8])
{
- for (int I = 0; I != sizeof(Sum); I++)
+ for (int I = 0; I != sizeof(Sum); ++I)
S[I] = Sum[I];
- };
+ }
- inline operator std::string() const
+ inline operator std::string() const
{
return Value();
- };
+ }
- bool Set(std::string Str)
+ bool Set(std::string Str)
{
return Hex2Num(Str,Sum,sizeof(Sum));
- };
+ }
- inline void Set(unsigned char S[N/8])
+ inline void Set(unsigned char S[N/8])
{
- for (int I = 0; I != sizeof(Sum); I++)
+ for (int I = 0; I != sizeof(Sum); ++I)
Sum[I] = S[I];
- };
+ }
- HashSumValue(std::string Str)
+ HashSumValue(std::string Str)
{
memset(Sum,0,sizeof(Sum));
Set(Str);
@@ -99,17 +99,17 @@ class SummationImplementation
public:
virtual bool Add(const unsigned char *inbuf, unsigned long long inlen) = 0;
inline bool Add(const char *inbuf, unsigned long long const inlen)
- { return Add((unsigned char *)inbuf, inlen); };
+ { return Add((const unsigned char *)inbuf, inlen); }
inline bool Add(const unsigned char *Data)
- { return Add(Data, strlen((const char *)Data)); };
+ { return Add(Data, strlen((const char *)Data)); }
inline bool Add(const char *Data)
- { return Add((const unsigned char *)Data, strlen((const char *)Data)); };
+ { return Add((const unsigned char *)Data, strlen((const char *)Data)); }
inline bool Add(const unsigned char *Beg, const unsigned char *End)
- { return Add(Beg, End - Beg); };
+ { return Add(Beg, End - Beg); }
inline bool Add(const char *Beg, const char *End)
- { return Add((const unsigned char *)Beg, End - Beg); };
+ { return Add((const unsigned char *)Beg, End - Beg); }
bool AddFD(int Fd, unsigned long long Size = 0);
bool AddFD(FileFd &Fd, unsigned long long Size = 0);
diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc
index 7ce7aba7b..96b35f669 100644
--- a/apt-pkg/pkgcachegen.cc
+++ b/apt-pkg/pkgcachegen.cc
@@ -118,11 +118,11 @@ void pkgCacheGenerator::ReMap(void const * const oldMap, void const * const newM
Cache.ReMap(false);
- CurrentFile += (pkgCache::PackageFile*) newMap - (pkgCache::PackageFile*) oldMap;
+ CurrentFile += (pkgCache::PackageFile const * const) newMap - (pkgCache::PackageFile const * const) oldMap;
for (size_t i = 0; i < _count(UniqHash); ++i)
if (UniqHash[i] != 0)
- UniqHash[i] += (pkgCache::StringItem*) newMap - (pkgCache::StringItem*) oldMap;
+ UniqHash[i] += (pkgCache::StringItem const * const) newMap - (pkgCache::StringItem const * const) oldMap;
for (std::vector::const_iterator i = Dynamic::toReMap.begin();
i != Dynamic::toReMap.end(); ++i)
@@ -398,7 +398,7 @@ bool pkgCacheGenerator::MergeListVersion(ListParser &List, pkgCache::PkgIterator
Pkg.Name(), "NewVersion", 1);
if (oldMap != Map.Data())
- LastVer += (map_ptrloc*) Map.Data() - (map_ptrloc*) oldMap;
+ LastVer += (map_ptrloc const * const) Map.Data() - (map_ptrloc const * const) oldMap;
*LastVer = verindex;
if (unlikely(List.NewVersion(Ver) == false))
@@ -909,7 +909,7 @@ bool pkgCacheGenerator::NewDepends(pkgCache::PkgIterator &Pkg,
if (unlikely(index == 0))
return false;
if (OldDepLast != 0 && oldMap != Map.Data())
- OldDepLast += (map_ptrloc*) Map.Data() - (map_ptrloc*) oldMap;
+ OldDepLast += (map_ptrloc const * const) Map.Data() - (map_ptrloc const * const) oldMap;
}
}
return NewDepends(Pkg, Ver, index, Op, Type, OldDepLast);
@@ -948,7 +948,7 @@ bool pkgCacheGenerator::NewDepends(pkgCache::PkgIterator &Pkg,
for (pkgCache::DepIterator D = Ver.DependsList(); D.end() == false; ++D)
OldDepLast = &D->NextDepends;
} else if (oldMap != Map.Data())
- OldDepLast += (map_ptrloc*) Map.Data() - (map_ptrloc*) oldMap;
+ OldDepLast += (map_ptrloc const * const) Map.Data() - (map_ptrloc const * const) oldMap;
Dep->NextDepends = *OldDepLast;
*OldDepLast = Dep.Index();
@@ -1125,8 +1125,8 @@ unsigned long pkgCacheGenerator::WriteUniqString(const char *S,
if (unlikely(idxString == 0))
return 0;
if (oldMap != Map.Data()) {
- Last += (map_ptrloc*) Map.Data() - (map_ptrloc*) oldMap;
- I += (pkgCache::StringItem*) Map.Data() - (pkgCache::StringItem*) oldMap;
+ Last += (map_ptrloc const * const) Map.Data() - (map_ptrloc const * const) oldMap;
+ I += (pkgCache::StringItem const * const) Map.Data() - (pkgCache::StringItem const * const) oldMap;
}
*Last = Item;
--
cgit v1.2.3-70-g09d2
From e788a834ce421042e727b72e43177edaa47e53a7 Mon Sep 17 00:00:00 2001
From: David Kalnischkies
Date: Thu, 27 Feb 2014 02:18:11 +0100
Subject: warning: useless cast to type A [-Wuseless-cast]
Git-Dch: Ignore
Reported-By: gcc -Wuseless-cast
---
apt-pkg/acquire-item.cc | 12 ++++++------
apt-pkg/algorithms.cc | 4 ++--
apt-pkg/cdrom.cc | 8 ++++----
apt-pkg/contrib/fileutl.cc | 4 ++--
apt-pkg/contrib/hashsum_template.h | 2 +-
apt-pkg/contrib/mmap.cc | 2 +-
apt-pkg/contrib/netrc.cc | 2 +-
apt-pkg/deb/debsrcrecords.cc | 2 +-
apt-pkg/indexcopy.cc | 12 ++++++------
apt-pkg/indexrecords.cc | 4 ++--
10 files changed, 26 insertions(+), 26 deletions(-)
(limited to 'apt-pkg')
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc
index de03011bf..88b10d4b1 100644
--- a/apt-pkg/acquire-item.cc
+++ b/apt-pkg/acquire-item.cc
@@ -709,7 +709,7 @@ bool pkgAcqIndexDiffs::QueueNextDiff() /*{{{*/
}
// queue the right diff
- Desc.URI = string(RealURI) + ".diff/" + available_patches[0].file + ".gz";
+ Desc.URI = RealURI + ".diff/" + available_patches[0].file + ".gz";
Desc.Description = Description + " " + available_patches[0].file + string(".pdiff");
DestFile = _config->FindDir("Dir::State::lists") + "partial/";
DestFile += URItoFileName(RealURI + ".diff/" + available_patches[0].file);
@@ -797,7 +797,7 @@ pkgAcqIndexMergeDiffs::pkgAcqIndexMergeDiffs(pkgAcquire *Owner,
Desc.Owner = this;
Desc.ShortDesc = ShortDesc;
- Desc.URI = string(RealURI) + ".diff/" + patch.file + ".gz";
+ Desc.URI = RealURI + ".diff/" + patch.file + ".gz";
Desc.Description = Description + " " + patch.file + string(".pdiff");
DestFile = _config->FindDir("Dir::State::lists") + "partial/";
DestFile += URItoFileName(RealURI + ".diff/" + patch.file);
@@ -1558,7 +1558,7 @@ void pkgAcqMetaIndex::QueueIndexes(bool verify) /*{{{*/
{
std::vector types = APT::Configuration::getCompressionTypes();
for (std::vector::const_iterator t = types.begin(); t != types.end(); ++t)
- if (MetaIndexParser->Exists(string((*Target)->MetaKey).append(".").append(*t)) == true)
+ if (MetaIndexParser->Exists((*Target)->MetaKey + "." + *t) == true)
{
compressedAvailable = true;
break;
@@ -1596,7 +1596,7 @@ void pkgAcqMetaIndex::QueueIndexes(bool verify) /*{{{*/
else if (transInRelease == false || Record != NULL || compressedAvailable == true)
{
if (_config->FindB("Acquire::PDiffs",true) == true && transInRelease == true &&
- MetaIndexParser->Exists(string((*Target)->MetaKey).append(".diff/Index")) == true)
+ MetaIndexParser->Exists((*Target)->MetaKey + ".diff/Index") == true)
new pkgAcqDiffIndex(Owner, (*Target)->URI, (*Target)->Description,
(*Target)->ShortDesc, ExpectedIndexHash);
else
@@ -1610,7 +1610,7 @@ void pkgAcqMetaIndex::QueueIndexes(bool verify) /*{{{*/
in the Meta-Index file. Ideal would be if pkgAcqDiffIndex would test this
instead, but passing the required info to it is to much hassle */
if(_config->FindB("Acquire::PDiffs",true) == true && (verify == false ||
- MetaIndexParser->Exists(string((*Target)->MetaKey).append(".diff/Index")) == true))
+ MetaIndexParser->Exists((*Target)->MetaKey + ".diff/Index") == true))
new pkgAcqDiffIndex(Owner, (*Target)->URI, (*Target)->Description,
(*Target)->ShortDesc, ExpectedIndexHash);
else
@@ -1635,7 +1635,7 @@ bool pkgAcqMetaIndex::VerifyVendor(string Message) /*{{{*/
missingkeys += (Fingerprint);
}
if(!missingkeys.empty())
- _error->Warning("%s", string(msg+missingkeys).c_str());
+ _error->Warning("%s", (msg + missingkeys).c_str());
string Transformed = MetaIndexParser->GetExpectedDist();
diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc
index 8320e7ef0..2e167119d 100644
--- a/apt-pkg/algorithms.cc
+++ b/apt-pkg/algorithms.cc
@@ -885,8 +885,8 @@ bool pkgProblemResolver::ResolveInternal(bool const BrokenFix)
}
if (Debug == true)
- clog << " Considering " << Pkg.FullName(false) << ' ' << (int)Scores[Pkg->ID] <<
- " as a solution to " << I.FullName(false) << ' ' << (int)Scores[I->ID] << endl;
+ clog << " Considering " << Pkg.FullName(false) << ' ' << Scores[Pkg->ID] <<
+ " as a solution to " << I.FullName(false) << ' ' << Scores[I->ID] << endl;
/* Try to fix the package under consideration rather than
fiddle with the VList package */
diff --git a/apt-pkg/cdrom.cc b/apt-pkg/cdrom.cc
index 838c8887a..ea5ed7e92 100644
--- a/apt-pkg/cdrom.cc
+++ b/apt-pkg/cdrom.cc
@@ -440,7 +440,7 @@ bool pkgCdrom::WriteDatabase(Configuration &Cnf)
Out.close();
if (FileExists(DFile) == true)
- rename(DFile.c_str(), string(DFile + '~').c_str());
+ rename(DFile.c_str(), (DFile + '~').c_str());
if (rename(NewFile.c_str(),DFile.c_str()) != 0)
return _error->Errno("rename","Failed to rename %s.new to %s",
DFile.c_str(),DFile.c_str());
@@ -553,7 +553,7 @@ bool pkgCdrom::WriteSourceList(string Name,vector &List,bool Source)
Out.close();
- rename(File.c_str(),string(File + '~').c_str());
+ rename(File.c_str(), (File + '~').c_str());
if (rename(NewFile.c_str(),File.c_str()) != 0)
return _error->Errno("rename","Failed to rename %s.new to %s",
File.c_str(),File.c_str());
@@ -737,7 +737,7 @@ bool pkgCdrom::Add(pkgCdromStatus *log) /*{{{*/
if (InfoDir.empty() == false &&
FileExists(InfoDir + "/info") == true)
{
- ifstream F(string(InfoDir + "/info").c_str());
+ ifstream F((InfoDir + "/info").c_str());
if (!F == 0)
getline(F,Name);
@@ -981,7 +981,7 @@ pkgUdevCdromDevices::ScanForRemovable(bool CdromOnly)
cdrom.DeviceName = string(devnode);
if (mountpath != "") {
cdrom.MountPath = mountpath;
- string s = string(mountpath);
+ string s = mountpath;
cdrom.Mounted = IsMounted(s);
} else {
cdrom.Mounted = false;
diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc
index 17833f090..464950abd 100644
--- a/apt-pkg/contrib/fileutl.cc
+++ b/apt-pkg/contrib/fileutl.cc
@@ -891,7 +891,7 @@ bool FileFd::Open(string FileName,unsigned int const Mode,CompressMode Compress,
{
for (; compressor != compressors.end(); ++compressor)
{
- std::string file = std::string(FileName).append(compressor->Extension);
+ std::string file = FileName + compressor->Extension;
if (FileExists(file) == false)
continue;
FileName = file;
@@ -1793,7 +1793,7 @@ bool FileFd::FileFdError(const char *Description,...) {
}
/*}}}*/
-gzFile FileFd::gzFd() { return (gzFile) d->gz; }
+gzFile FileFd::gzFd() { return d->gz; }
// Glob - wrapper around "glob()" /*{{{*/
diff --git a/apt-pkg/contrib/hashsum_template.h b/apt-pkg/contrib/hashsum_template.h
index 97b6a4ad9..f96188eb8 100644
--- a/apt-pkg/contrib/hashsum_template.h
+++ b/apt-pkg/contrib/hashsum_template.h
@@ -104,7 +104,7 @@ class SummationImplementation
inline bool Add(const unsigned char *Data)
{ return Add(Data, strlen((const char *)Data)); }
inline bool Add(const char *Data)
- { return Add((const unsigned char *)Data, strlen((const char *)Data)); }
+ { return Add((const unsigned char *)Data, strlen(Data)); }
inline bool Add(const unsigned char *Beg, const unsigned char *End)
{ return Add(Beg, End - Beg); }
diff --git a/apt-pkg/contrib/mmap.cc b/apt-pkg/contrib/mmap.cc
index 51e8eb30f..37acba340 100644
--- a/apt-pkg/contrib/mmap.cc
+++ b/apt-pkg/contrib/mmap.cc
@@ -198,7 +198,7 @@ bool MMap::Sync(unsigned long Start,unsigned long Stop)
{
#ifdef _POSIX_SYNCHRONIZED_IO
unsigned long long const PSize = sysconf(_SC_PAGESIZE);
- if (msync((char *)Base+(unsigned long long)(Start/PSize)*PSize,Stop - Start,MS_SYNC) < 0)
+ if (msync((char *)Base+(Start/PSize)*PSize, Stop - Start, MS_SYNC) < 0)
return _error->Errno("msync", _("Unable to synchronize mmap"));
#endif
}
diff --git a/apt-pkg/contrib/netrc.cc b/apt-pkg/contrib/netrc.cc
index de95aa4ab..32b146581 100644
--- a/apt-pkg/contrib/netrc.cc
+++ b/apt-pkg/contrib/netrc.cc
@@ -198,7 +198,7 @@ void maybe_add_auth (URI &Uri, string NetRCFile)
// if host did not work, try Host+Path next, this will trigger
// a lookup uri.startswith(host) in the netrc file parser (because
// of the "/"
- char *hostpath = strdup(string(Uri.Host+Uri.Path).c_str());
+ char *hostpath = strdup((Uri.Host + Uri.Path).c_str());
if (hostpath && parsenetrc_string(hostpath, login, password, netrcfile) == 0)
{
if (_config->FindB("Debug::Acquire::netrc", false) == true)
diff --git a/apt-pkg/deb/debsrcrecords.cc b/apt-pkg/deb/debsrcrecords.cc
index 90182b4a4..daa54d036 100644
--- a/apt-pkg/deb/debsrcrecords.cc
+++ b/apt-pkg/deb/debsrcrecords.cc
@@ -57,7 +57,7 @@ const char **debSrcRecordParser::Binaries()
} while (*bin != '\0');
StaticBinList.push_back(NULL);
- return (const char **) &StaticBinList[0];
+ return &StaticBinList[0];
}
/*}}}*/
// SrcRecordParser::BuildDepends - Return the Build-Depends information /*{{{*/
diff --git a/apt-pkg/indexcopy.cc b/apt-pkg/indexcopy.cc
index 89c9d531f..38356df18 100644
--- a/apt-pkg/indexcopy.cc
+++ b/apt-pkg/indexcopy.cc
@@ -65,7 +65,7 @@ bool IndexCopy::CopyPackages(string CDROM,string Name,vector &List,
for (std::vector::const_iterator c = compressor.begin();
c != compressor.end(); ++c)
{
- if (stat(std::string(file + c->Extension).c_str(), &Buf) != 0)
+ if (stat((file + c->Extension).c_str(), &Buf) != 0)
continue;
found = true;
break;
@@ -160,7 +160,7 @@ bool IndexCopy::CopyPackages(string CDROM,string Name,vector &List,
// Get the size
struct stat Buf;
- if (stat(string(CDROM + Prefix + File).c_str(),&Buf) != 0 ||
+ if (stat((CDROM + Prefix + File).c_str(),&Buf) != 0 ||
Buf.st_size == 0)
{
bool Mangled = false;
@@ -175,7 +175,7 @@ bool IndexCopy::CopyPackages(string CDROM,string Name,vector &List,
}
if (Mangled == false ||
- stat(string(CDROM + Prefix + File).c_str(),&Buf) != 0)
+ stat((CDROM + Prefix + File).c_str(),&Buf) != 0)
{
if (Debug == true)
clog << "Missed(2): " << OrigFile << endl;
@@ -286,7 +286,7 @@ bool IndexCopy::ReconstructPrefix(string &Prefix,string OrigPath,string CD,
while (1)
{
struct stat Buf;
- if (stat(string(CD + MyPrefix + File).c_str(),&Buf) != 0)
+ if (stat((CD + MyPrefix + File).c_str(),&Buf) != 0)
{
if (Debug == true)
cout << "Failed, " << CD + MyPrefix + File << endl;
@@ -315,7 +315,7 @@ bool IndexCopy::ReconstructChop(unsigned long &Chop,string Dir,string File)
while (1)
{
struct stat Buf;
- if (stat(string(Dir + File).c_str(),&Buf) != 0)
+ if (stat((Dir + File).c_str(),&Buf) != 0)
{
File = ChopDirs(File,1);
Depth++;
@@ -676,7 +676,7 @@ bool TranslationsCopy::CopyTranslations(string CDROM,string Name, /*{{{*/
for (std::vector::const_iterator c = compressor.begin();
c != compressor.end(); ++c)
{
- if (stat(std::string(file + c->Extension).c_str(), &Buf) != 0)
+ if (stat((file + c->Extension).c_str(), &Buf) != 0)
continue;
found = true;
break;
diff --git a/apt-pkg/indexrecords.cc b/apt-pkg/indexrecords.cc
index f8097c3c6..c1c397e31 100644
--- a/apt-pkg/indexrecords.cc
+++ b/apt-pkg/indexrecords.cc
@@ -129,10 +129,10 @@ bool indexRecords::Load(const string Filename) /*{{{*/
// get the user settings for this archive and use what expires earlier
int MaxAge = _config->FindI("Acquire::Max-ValidTime", 0);
if (Label.empty() == false)
- MaxAge = _config->FindI(string("Acquire::Max-ValidTime::" + Label).c_str(), MaxAge);
+ MaxAge = _config->FindI(("Acquire::Max-ValidTime::" + Label).c_str(), MaxAge);
int MinAge = _config->FindI("Acquire::Min-ValidTime", 0);
if (Label.empty() == false)
- MinAge = _config->FindI(string("Acquire::Min-ValidTime::" + Label).c_str(), MinAge);
+ MinAge = _config->FindI(("Acquire::Min-ValidTime::" + Label).c_str(), MinAge);
if(MaxAge == 0 &&
(MinAge == 0 || ValidUntil == 0)) // No user settings, use the one from the Release file
--
cgit v1.2.3-70-g09d2
From c3ccac9232c2684b15f75fa8622a9a290aeca123 Mon Sep 17 00:00:00 2001
From: David Kalnischkies
Date: Thu, 27 Feb 2014 03:11:54 +0100
Subject: warning: no previous declaration for foobar()
[-Wmissing-declarations]
Git-Dch: Ignore
Reported-By: gcc -Wmissing-declarations
---
apt-pkg/depcache.cc | 2 +-
apt-private/private-cmndline.cc | 14 ++++-----
apt-private/private-download.cc | 1 +
apt-private/private-install.cc | 2 +-
apt-private/private-list.cc | 2 +-
apt-private/private-moo.cc | 4 +--
apt-private/private-output.cc | 16 +++++-----
apt-private/private-show.cc | 3 +-
apt-private/private-update.cc | 1 +
cmdline/apt-cache.cc | 48 +++++++++++++++---------------
cmdline/apt-cdrom.cc | 8 ++---
cmdline/apt-config.cc | 6 ++--
cmdline/apt-dump-solver.cc | 2 +-
cmdline/apt-extracttemplates.cc | 8 ++---
cmdline/apt-get.cc | 36 +++++++++++-----------
cmdline/apt-helper.cc | 4 +--
cmdline/apt-internal-solver.cc | 2 +-
cmdline/apt-mark.cc | 12 ++++----
cmdline/apt-sortpkgs.cc | 4 +--
cmdline/apt.cc | 2 +-
debian/libapt-pkg4.12.symbols | 1 -
ftparchive/apt-ftparchive.cc | 18 +++++------
test/interactive-helper/aptwebserver.cc | 30 +++++++++----------
test/interactive-helper/extract-control.cc | 2 +-
test/interactive-helper/testdeb.cc | 2 +-
test/libapt/assert.h | 9 ++++++
test/libapt/compareversion_test.cc | 6 ++--
test/libapt/sourcelist_test.cc | 2 +-
test/libapt/tagfile_test.cc | 2 +-
29 files changed, 130 insertions(+), 119 deletions(-)
(limited to 'apt-pkg')
diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc
index 90d0c9314..946c1e254 100644
--- a/apt-pkg/depcache.cc
+++ b/apt-pkg/depcache.cc
@@ -889,7 +889,7 @@ bool pkgDepCache::IsDeleteOkProtectInstallRequests(PkgIterator const &Pkg,
and prevents mode changes for packages on hold for example.
If you want to check Mode specific stuff you can use the virtual public
IsOk methods instead */
-char const* PrintMode(char const mode)
+static char const* PrintMode(char const mode)
{
switch (mode)
{
diff --git a/apt-private/private-cmndline.cc b/apt-private/private-cmndline.cc
index b99443210..132da04d5 100644
--- a/apt-private/private-cmndline.cc
+++ b/apt-private/private-cmndline.cc
@@ -14,7 +14,7 @@
#include
/*}}}*/
-bool strcmp_match_in_list(char const * const Cmd, ...) /*{{{*/
+static bool strcmp_match_in_list(char const * const Cmd, ...) /*{{{*/
{
va_list args;
bool found = false;
@@ -33,7 +33,7 @@ bool strcmp_match_in_list(char const * const Cmd, ...) /*{{{*/
/*}}}*/
#define addArg(w,x,y,z) Args.push_back(CommandLine::MakeArgs(w,x,y,z))
#define CmdMatches(...) strcmp_match_in_list(Cmd, __VA_ARGS__, NULL)
-bool addArgumentsAPTCache(std::vector &Args, char const * const Cmd)/*{{{*/
+static bool addArgumentsAPTCache(std::vector &Args, char const * const Cmd)/*{{{*/
{
if (CmdMatches("depends", "rdepends", "xvcg", "dotty"))
{
@@ -82,7 +82,7 @@ bool addArgumentsAPTCache(std::vector &Args, char const * con
return true;
}
/*}}}*/
-bool addArgumentsAPTCDROM(std::vector &Args, char const * const Cmd)/*{{{*/
+static bool addArgumentsAPTCDROM(std::vector