Browse Source

* apt-pkg/contrib/fileutl.cc:

- Fix the newly introduced method GetListOfFilesInDir to not
    accept every file if no extension is enforced
    (= restore old behaviour). (Closes: #565213)
* apt-pkg/policy.cc:
  - accept also partfiles with "pref" file extension as valid
* apt-pkg/contrib/configuration.cc:
  - accept also partfiles with "conf" file extension as valid
* doc/apt.conf.5.xml:
  - reorder description and split out syntax
  - add partfile name convention (Closes: #558348)
* doc/apt_preferences.conf.5.xml:
  - describe partfile name convention also here
* apt-pkg/deb/dpkgpm.cc:
  - don't segfault if term.log file can't be opened.
    Thanks Sam Brightman for the patch! (Closes: #475770)
* doc/*:
  - replace the per language addendum with a global addendum
  - add a explanation why translations include (maybe) english
    parts to the new global addendum (Closes: #561636)
* apt-pkg/contrib/strutl.cc:
  - fix malloc asseration fail with ja_JP.eucJP locale in
    apt-cache search. Thanks Kusanagi Kouichi! (Closes: #548884)
tags/devuan/2.0.1+devuan1
Michael Vogt 10 years ago
parent
commit
b39c18596d
31 changed files with 6167 additions and 4252 deletions
  1. +1
    -1
      apt-pkg/contrib/configuration.cc
  2. +6
    -4
      apt-pkg/contrib/error.h
  3. +79
    -5
      apt-pkg/contrib/fileutl.cc
  4. +5
    -0
      apt-pkg/contrib/fileutl.h
  5. +33
    -16
      apt-pkg/contrib/strutl.cc
  6. +22
    -0
      apt-pkg/contrib/system.h
  7. +4
    -3
      apt-pkg/deb/dpkgpm.cc
  8. +1
    -1
      apt-pkg/policy.cc
  9. +28
    -0
      debian/changelog
  10. +22
    -11
      doc/apt.conf.5.xml
  11. +19
    -0
      doc/apt.ent
  12. +7
    -0
      doc/apt_preferences.5.xml
  13. +0
    -6
      doc/de/addendum/debiandoc_de.add
  14. +0
    -6
      doc/de/addendum/xml_de.add
  15. +0
    -9
      doc/es/addendum/xml_es.add
  16. +0
    -7
      doc/fr/addendum/xml_fr.add
  17. +0
    -7
      doc/ja/addendum/xml_ja.add
  18. +555
    -392
      doc/po/apt-doc.pot
  19. +1082
    -738
      doc/po/de.po
  20. +624
    -417
      doc/po/es.po
  21. +1054
    -826
      doc/po/fr.po
  22. +548
    -395
      doc/po/it.po
  23. +638
    -418
      doc/po/ja.po
  24. +548
    -395
      doc/po/pl.po
  25. +560
    -396
      doc/po/pt_BR.po
  26. +13
    -26
      doc/po4a.conf
  27. +0
    -5
      doc/pt_BR/addendum/xml_pt_BR.add
  28. +5
    -0
      doc/xml.add
  29. +185
    -164
      po/apt-all.pot
  30. +82
    -0
      test/libapt/getlistoffilesindir_test.cc
  31. +46
    -4
      test/libapt/run-tests.sh

+ 1
- 1
apt-pkg/contrib/configuration.cc View File

@@ -832,7 +832,7 @@ bool ReadConfigFile(Configuration &Conf,const string &FName,bool AsSectional,
bool ReadConfigDir(Configuration &Conf,const string &Dir,
bool AsSectional, unsigned Depth)
{
vector<string> const List = GetListOfFilesInDir(Dir, "", true);
vector<string> const List = GetListOfFilesInDir(Dir, "conf", true, true);

// Read the files
for (vector<string>::const_iterator I = List.begin(); I != List.end(); I++)


+ 6
- 4
apt-pkg/contrib/error.h View File

@@ -53,6 +53,8 @@
#include <string>

#include <system.h>

using std::string;

class GlobalError
@@ -71,13 +73,13 @@ class GlobalError
public:

// Call to generate an error from a library call.
bool Errno(const char *Function,const char *Description,...) APT_MFORMAT2;
bool WarningE(const char *Function,const char *Description,...) APT_MFORMAT2;
bool Errno(const char *Function,const char *Description,...) APT_MFORMAT2 __cold;
bool WarningE(const char *Function,const char *Description,...) APT_MFORMAT2 __cold;

/* A warning should be considered less severe than an error, and may be
ignored by the client. */
bool Error(const char *Description,...) APT_MFORMAT1;
bool Warning(const char *Description,...) APT_MFORMAT1;
bool Error(const char *Description,...) APT_MFORMAT1 __cold;
bool Warning(const char *Description,...) APT_MFORMAT1 __cold;

// Simple accessors
inline bool PendingError() {return PendingFlag;};


+ 79
- 5
apt-pkg/contrib/fileutl.cc View File

@@ -202,8 +202,37 @@ bool FileExists(string File)
/* If an extension is given only files with this extension are included
in the returned vector, otherwise every "normal" file is included. */
std::vector<string> GetListOfFilesInDir(string const &Dir, string const &Ext,
bool const &SortList)
bool const &SortList)
{
return GetListOfFilesInDir(Dir, Ext, SortList, false);
}
std::vector<string> GetListOfFilesInDir(string const &Dir, string const &Ext,
bool const &SortList, bool const &AllowNoExt)
{
std::vector<string> ext;
ext.reserve(2);
if (Ext.empty() == false)
ext.push_back(Ext);
if (AllowNoExt == true && ext.empty() == false)
ext.push_back("");
return GetListOfFilesInDir(Dir, ext, SortList);
}
std::vector<string> GetListOfFilesInDir(string const &Dir, std::vector<string> const &Ext,
bool const &SortList)
{
// Attention debuggers: need to be set with the environment config file!
bool const Debug = _config->FindB("Debug::GetListOfFilesInDir", false);
if (Debug == true)
{
std::clog << "Accept in " << Dir << " only files with the following " << Ext.size() << " extensions:" << std::endl;
if (Ext.empty() == true)
std::clog << "\tNO extension" << std::endl;
else
for (std::vector<string>::const_iterator e = Ext.begin();
e != Ext.end(); ++e)
std::clog << '\t' << (e->empty() == true ? "NO" : *e) << " extension" << std::endl;
}

std::vector<string> List;
DIR *D = opendir(Dir.c_str());
if (D == 0)
@@ -214,28 +243,73 @@ std::vector<string> GetListOfFilesInDir(string const &Dir, string const &Ext,

for (struct dirent *Ent = readdir(D); Ent != 0; Ent = readdir(D))
{
// skip "hidden" files
if (Ent->d_name[0] == '.')
continue;

if (Ext.empty() == false && flExtension(Ent->d_name) != Ext)
continue;
// check for accepted extension:
// no extension given -> periods are bad as hell!
// extensions given -> "" extension allows no extension
if (Ext.empty() == false)
{
string d_ext = flExtension(Ent->d_name);
if (d_ext == Ent->d_name) // no extension
{
if (std::find(Ext.begin(), Ext.end(), "") == Ext.end())
{
if (Debug == true)
std::clog << "Bad file: " << Ent->d_name << " → no extension" << std::endl;
continue;
}
}
else if (std::find(Ext.begin(), Ext.end(), d_ext) == Ext.end())
{
if (Debug == true)
std::clog << "Bad file: " << Ent->d_name << " → bad extension »" << flExtension(Ent->d_name) << "«" << std::endl;
continue;
}
}

// Skip bad file names ala run-parts
// Skip bad filenames ala run-parts
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;
break;
}

// we don't reach the end of the name -> bad character included
if (*C != 0)
{
if (Debug == true)
std::clog << "Bad file: " << Ent->d_name << " → bad character »"
<< *C << "« in filename (period allowed: " << (Ext.empty() ? "no" : "yes") << ")" << std::endl;
continue;
}

// skip filenames which end with a period. These are never valid
if (*(C - 1) == '.')
{
if (Debug == true)
std::clog << "Bad file: " << Ent->d_name << " → Period as last character" << std::endl;
continue;
}

// Make sure it is a file and not something else
string const File = flCombine(Dir,Ent->d_name);
struct stat St;
if (stat(File.c_str(),&St) != 0 || S_ISREG(St.st_mode) == 0)
{
if (Debug == true)
std::clog << "Bad file: " << Ent->d_name << " → stat says not a good file" << std::endl;
continue;
}

if (Debug == true)
std::clog << "Accept file: " << Ent->d_name << " in " << Dir << std::endl;
List.push_back(File);
}
closedir(D);


+ 5
- 0
apt-pkg/contrib/fileutl.h View File

@@ -82,8 +82,13 @@ bool RunScripts(const char *Cnf);
bool CopyFile(FileFd &From,FileFd &To);
int GetLock(string File,bool Errors = true);
bool FileExists(string File);
// FIXME: next ABI-Break: merge the two method-headers
std::vector<string> GetListOfFilesInDir(string const &Dir, string const &Ext,
bool const &SortList);
std::vector<string> GetListOfFilesInDir(string const &Dir, string const &Ext,
bool const &SortList, bool const &AllowNoExt);
std::vector<string> GetListOfFilesInDir(string const &Dir, std::vector<string> const &Ext,
bool const &SortList);
string SafeGetCWD();
void SetCloseExec(int Fd,bool Close);
void SetNonBlock(int Fd,bool Block);


+ 33
- 16
apt-pkg/contrib/strutl.cc View File

@@ -43,9 +43,10 @@ bool UTF8ToCodeset(const char *codeset, const string &orig, string *dest)
{
iconv_t cd;
const char *inbuf;
char *inptr, *outbuf, *outptr;
size_t insize, outsize;
char *inptr, *outbuf;
size_t insize, bufsize;
dest->clear();

cd = iconv_open(codeset, "UTF-8");
if (cd == (iconv_t)(-1)) {
// Something went wrong
@@ -55,33 +56,49 @@ bool UTF8ToCodeset(const char *codeset, const string &orig, string *dest)
else
perror("iconv_open");
// Clean the destination string
*dest = "";
return false;
}

insize = outsize = orig.size();
insize = bufsize = orig.size();
inbuf = orig.data();
inptr = (char *)inbuf;
outbuf = new char[insize+1];
outptr = outbuf;
outbuf = new char[bufsize];
size_t lastError = -1;

while (insize != 0)
{
char *outptr = outbuf;
size_t outsize = bufsize;
size_t const err = iconv(cd, &inptr, &insize, &outptr, &outsize);
dest->append(outbuf, outptr - outbuf);
if (err == (size_t)(-1))
{
insize--;
outsize++;
inptr++;
*outptr = '?';
outptr++;
switch (errno)
{
case EILSEQ:
insize--;
inptr++;
// replace a series of unknown multibytes with a single "?"
if (lastError != insize) {
lastError = insize - 1;
dest->append("?");
}
break;
case EINVAL:
insize = 0;
break;
case E2BIG:
if (outptr == outbuf)
{
bufsize *= 2;
delete[] outbuf;
outbuf = new char[bufsize];
}
break;
}
}
}

*outptr = '\0';
*dest = outbuf;
delete[] outbuf;
iconv_close(cd);


+ 22
- 0
apt-pkg/contrib/system.h View File

@@ -55,4 +55,26 @@
#define CLRFLAG(v,f) ((v) &=~FLAG(f))
#define CHKFLAG(v,f) ((v) & FLAG(f) ? true : false)

// some nice optional GNUC features
#if __GNUC__ >= 3
#define __must_check __attribute__ ((warn_unused_result))
#define __deprecated __attribute__ ((deprecated))
/* likely() and unlikely() can be used to mark boolean expressions
as (not) likely true which will help the compiler to optimise */
#define likely(x) __builtin_expect (!!(x), 1)
#define unlikely(x) __builtin_expect (!!(x), 0)
#else
#define __must_check /* no warn_unused_result */
#define __deprecated /* no deprecated */
#define likely(x) (x)
#define unlikely(x) (x)
#endif

// cold functions are unlikely() to be called
#if (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) || __GNUC__ > 4
#define __cold __attribute__ ((__cold__))
#else
#define __cold /* no cold marker */
#endif

#endif

+ 4
- 3
apt-pkg/deb/dpkgpm.cc View File

@@ -561,15 +561,16 @@ bool pkgDPkgPM::OpenLog()
if (!logfile_name.empty())
{
term_out = fopen(logfile_name.c_str(),"a");
if (term_out == NULL)
return _error->WarningE(_("Could not open file '%s'"), logfile_name.c_str());

chmod(logfile_name.c_str(), 0600);
// output current time
char outstr[200];
time_t t = time(NULL);
struct tm *tmp = localtime(&t);
strftime(outstr, sizeof(outstr), "%F %T", tmp);
fprintf(term_out, "\nLog started: ");
fprintf(term_out, "%s", outstr);
fprintf(term_out, "\n");
fprintf(term_out, "\nLog started: %s\n", outstr);
}
return true;
}


+ 1
- 1
apt-pkg/policy.cc View File

@@ -280,7 +280,7 @@ bool ReadPinDir(pkgPolicy &Plcy,string Dir)
return true;
}

vector<string> const List = GetListOfFilesInDir(Dir, "", true);
vector<string> const List = GetListOfFilesInDir(Dir, "pref", true, true);

// Read the files
for (vector<string>::const_iterator I = List.begin(); I != List.end(); I++)


+ 28
- 0
debian/changelog View File

@@ -8,6 +8,34 @@ apt (0.7.25.2) UNRELEASED; urgency=low

-- Michael Vogt <michael.vogt@ubuntu.com> Fri, 22 Jan 2010 20:06:12 +0100

apt (0.7.25.2) UNRELEASED; urgency=low

* apt-pkg/contrib/fileutl.cc:
- Fix the newly introduced method GetListOfFilesInDir to not
accept every file if no extension is enforced
(= restore old behaviour). (Closes: #565213)
* apt-pkg/policy.cc:
- accept also partfiles with "pref" file extension as valid
* apt-pkg/contrib/configuration.cc:
- accept also partfiles with "conf" file extension as valid
* doc/apt.conf.5.xml:
- reorder description and split out syntax
- add partfile name convention (Closes: #558348)
* doc/apt_preferences.conf.5.xml:
- describe partfile name convention also here
* apt-pkg/deb/dpkgpm.cc:
- don't segfault if term.log file can't be opened.
Thanks Sam Brightman for the patch! (Closes: #475770)
* doc/*:
- replace the per language addendum with a global addendum
- add a explanation why translations include (maybe) english
parts to the new global addendum (Closes: #561636)
* apt-pkg/contrib/strutl.cc:
- fix malloc asseration fail with ja_JP.eucJP locale in
apt-cache search. Thanks Kusanagi Kouichi! (Closes: #548884)

-- David Kalnischkies <kalnischkies@gmail.com> Sat, 16 Jan 2010 21:06:38 +0100

apt (0.7.25.1) unstable; urgency=low

[ Christian Perrier ]


+ 22
- 11
doc/apt.conf.5.xml View File

@@ -21,7 +21,7 @@
&apt-email;
&apt-product;
<!-- The last update date -->
<date>18 September 2009</date>
<date>16 January 2010</date>
</refentryinfo>
<refmeta>
@@ -37,16 +37,27 @@
</refnamediv>
<refsect1><title>Description</title>
<para><filename>apt.conf</filename> is the main configuration file for the APT suite of
tools, all tools make use of the configuration file and a common command line
parser to provide a uniform environment. When an APT tool starts up it will
read the configuration specified by the <envar>APT_CONFIG</envar> environment
variable (if any) and then read the files in <literal>Dir::Etc::Parts</literal>
then read the main configuration file specified by
<literal>Dir::Etc::main</literal> then finally apply the
command line options to override the configuration directives, possibly
loading even more config files.</para>

<para><filename>apt.conf</filename> is the main configuration file for
the APT suite of tools, but by far not the only place changes to options
can be made. All tools therefore share the configuration files and also
use a common command line parser to provide a uniform environment.</para>
<orderedlist>
<para>When an APT tool starts up it will read the configuration files
in the following order:</para>
<listitem><para>the file specified by the <envar>APT_CONFIG</envar>
environment variable (if any)</para></listitem>
<listitem><para>all files in <literal>Dir::Etc::Parts</literal> in
alphanumeric ascending order which have no or "<literal>conf</literal>"
as filename extension and which only contain alphanumeric,
hyphen (-), underscore (_) and period (.) characters -
otherwise they will be silently ignored.</para></listitem>
<listitem><para>the main configuration file specified by
<literal>Dir::Etc::main</literal></para></listitem>
<listitem><para>the command line options are applied to override the
configuration directives or to load even more configuration files.</para></listitem>
</orderedlist>
</refsect1>
<refsect1><title>Syntax</title>
<para>The configuration file is organized in a tree with options organized into
functional groups. Option specification is given with a double colon
notation, for instance <literal>APT::Get::Assume-Yes</literal> is an option within


+ 19
- 0
doc/apt.ent View File

@@ -366,3 +366,22 @@
Configuration Item <literal>Dir::Etc::TrustedParts</literal>.</para></listitem>
</varlistentry>
">

<!ENTITY translation-title "TRANSLATION">

<!-- TRANSLATOR: This is a placeholder. You should write here who has constributed
to the translation in the past, who is responsible now and maybe further information
specially related to your translation. -->
<!ENTITY translation-holder "
The english translation was done by John Doe <email>john@doe.org</email> in 2009,
2010 and Daniela Acme <email>daniela@acme.us</email> in 2010 together with the
Debian Dummy l10n Team <email>debian-l10n-dummy@lists.debian.org</email>.
">

<!-- TRANSLATOR: As a translation is allowed to have 20% of untranslated/fuzzy strings
in a shipped manpage will maybe appear english parts. -->
<!ENTITY translation-english "
Note that this translated document may contain untranslated parts.
This is done on purpose, to avoid losing content when the
translation is lagging behind the original content.
">

+ 7
- 0
doc/apt_preferences.5.xml View File

@@ -53,6 +53,13 @@ earliest in the &sources-list; file.
The APT preferences file does not affect the choice of instance, only
the choice of version.</para>

<para>Note that the files in the <filename>/etc/apt/preferences.d</filename>
directory are parsed in alphanumeric ascending order and need to obey the
following naming convention: The files have no or "<literal>pref</literal>"
as filename extension and which only contain alphanumeric, hyphen (-),
underscore (_) and period (.) characters - otherwise they will be silently
ignored.</para>

<refsect2><title>APT's Default Priority Assignments</title>

<para>If there is no preferences file or if there is no entry in the file


+ 0
- 6
doc/de/addendum/debiandoc_de.add View File

@@ -1,6 +0,0 @@
PO4A-HEADER:mode=after;position=manbugs;beginboundary=^</refentry>
<refsect1><title>Übersetzung</title>
<para>Die deutsche Übersetzung wurde 2009 von Chris Leick <email>c.leick@vollbio.de</email> angefertigt
in Zusammenarbeit mit dem Debian German-l10n-Team <email>debian-l10n-german@lists.debian.org</email>.</para>
</refsect1>


+ 0
- 6
doc/de/addendum/xml_de.add View File

@@ -1,6 +0,0 @@
PO4A-HEADER:mode=after;position=manbugs;beginboundary=^</refentry>
<refsect1><title>Übersetzung</title>
<para>Die deutsche Übersetzung wurde 2009 von Chris Leick <email>c.leick@vollbio.de</email> angefertigt
in Zusammenarbeit mit dem Debian German-l10n-Team <email>debian-l10n-german@lists.debian.org</email>.</para>
</refsect1>


+ 0
- 9
doc/es/addendum/xml_es.add View File

@@ -1,9 +0,0 @@
PO4A-HEADER:mode=after;position=manbugs;beginboundary=^</refentry>
<refsect1><title>Translation</title>
<para>The spanish translation was written 2003 and 2004 by Ismael Fanlo (2003), Carlos Mestre (2003),
Rudy Godoy <email>rudy@kernel-panik.org</email> (2003),
Gustavo Saldumbide <email>gsal@adinet.com.uy</email> (2003),
Javier Fernández-Sanguino <email>jfs@computer.org</email> (2003)
and Rubén Porras Campo <email>nahoo@inicia.es</email> (2003, 2004)
under the aegis of the debian spanish-l10n-team <email>debian-l10n-spanish@lists.debian.org</email>.
</refsect1>

+ 0
- 7
doc/fr/addendum/xml_fr.add View File

@@ -1,7 +0,0 @@
PO4A-HEADER:mode=after;position=manbugs;beginboundary=^</refentry>
<refsect1><title>Traducteurs</title>
<para>Jérôme Marant, Philippe Batailler, Christian Perrier <email>bubulle@debian.org</email> (2000, 2005, 2009),
Équipe de traduction francophone de Debian <email>debian-l10n-french@lists.debian.org</email>
</para>
</refsect1>


+ 0
- 7
doc/ja/addendum/xml_ja.add View File

@@ -1,7 +0,0 @@
PO4A-HEADER:mode=after;position=manbugs;beginboundary=^</refentry>
<refsect1><title>訳者</title>
<para>倉澤 望 <email>nabetaro@debian.or.jp</email> (2003-2006,2009),
Debian JP Documentation ML <email>debian-doc@debian.or.jp</email>
</para>
</refsect1>


+ 555
- 392
doc/po/apt-doc.pot
File diff suppressed because it is too large
View File


+ 1082
- 738
doc/po/de.po
File diff suppressed because it is too large
View File


+ 624
- 417
doc/po/es.po
File diff suppressed because it is too large
View File


+ 1054
- 826
doc/po/fr.po
File diff suppressed because it is too large
View File


+ 548
- 395
doc/po/it.po
File diff suppressed because it is too large
View File


+ 638
- 418
doc/po/ja.po
File diff suppressed because it is too large
View File


+ 548
- 395
doc/po/pl.po
File diff suppressed because it is too large
View File


+ 560
- 396
doc/po/pt_BR.po
File diff suppressed because it is too large
View File


+ 13
- 26
doc/po4a.conf View File

@@ -7,32 +7,19 @@
# define source file and translated file (one file per line)
[type: man] apt.8 $lang:$lang/apt.$lang.8
[type: entity] apt.ent $lang:$lang/apt.ent
[type: docbook] apt-cache.8.xml $lang:$lang/apt-cache.$lang.8.xml \
add_$lang:$lang/addendum/xml_$lang.add
[type: docbook] apt-cdrom.8.xml $lang:$lang/apt-cdrom.$lang.8.xml \
add_$lang:$lang/addendum/xml_$lang.add
[type: docbook] apt-config.8.xml $lang:$lang/apt-config.$lang.8.xml \
add_$lang:$lang/addendum/xml_$lang.add
[type: docbook] apt-extracttemplates.1.xml $lang:$lang/apt-extracttemplates.$lang.1.xml \
add_$lang:$lang/addendum/xml_$lang.add
[type: docbook] apt-ftparchive.1.xml $lang:$lang/apt-ftparchive.$lang.1.xml \
add_$lang:$lang/addendum/xml_$lang.add
[type: docbook] apt-get.8.xml $lang:$lang/apt-get.$lang.8.xml \
add_$lang:$lang/addendum/xml_$lang.add
[type: docbook] apt-key.8.xml $lang:$lang/apt-key.$lang.8.xml \
add_$lang:$lang/addendum/xml_$lang.add
[type: docbook] apt-mark.8.xml $lang:$lang/apt-mark.$lang.8.xml \
add_$lang:$lang/addendum/xml_$lang.add
[type: docbook] apt-secure.8.xml $lang:$lang/apt-secure.$lang.8.xml \
add_$lang:$lang/addendum/xml_$lang.add
[type: docbook] apt-sortpkgs.1.xml $lang:$lang/apt-sortpkgs.$lang.1.xml \
add_$lang:$lang/addendum/xml_$lang.add
[type: docbook] apt.conf.5.xml $lang:$lang/apt.conf.$lang.5.xml \
add_$lang:$lang/addendum/xml_$lang.add
[type: docbook] apt_preferences.5.xml $lang:$lang/apt_preferences.$lang.5.xml \
add_$lang:$lang/addendum/xml_$lang.add
[type: docbook] sources.list.5.xml $lang:$lang/sources.list.$lang.5.xml \
add_$lang:$lang/addendum/xml_$lang.add
[type: docbook] apt-cache.8.xml $lang:$lang/apt-cache.$lang.8.xml add_$lang:xml.add
[type: docbook] apt-cdrom.8.xml $lang:$lang/apt-cdrom.$lang.8.xml add_$lang:xml.add
[type: docbook] apt-config.8.xml $lang:$lang/apt-config.$lang.8.xml add_$lang:xml.add
[type: docbook] apt-extracttemplates.1.xml $lang:$lang/apt-extracttemplates.$lang.1.xml add_$lang:xml.add
[type: docbook] apt-ftparchive.1.xml $lang:$lang/apt-ftparchive.$lang.1.xml add_$lang:xml.add
[type: docbook] apt-get.8.xml $lang:$lang/apt-get.$lang.8.xml add_$lang:xml.add
[type: docbook] apt-key.8.xml $lang:$lang/apt-key.$lang.8.xml add_$lang:xml.add
[type: docbook] apt-mark.8.xml $lang:$lang/apt-mark.$lang.8.xml add_$lang:xml.add
[type: docbook] apt-secure.8.xml $lang:$lang/apt-secure.$lang.8.xml add_$lang:xml.add
[type: docbook] apt-sortpkgs.1.xml $lang:$lang/apt-sortpkgs.$lang.1.xml add_$lang:xml.add
[type: docbook] apt.conf.5.xml $lang:$lang/apt.conf.$lang.5.xml add_$lang:xml.add
[type: docbook] apt_preferences.5.xml $lang:$lang/apt_preferences.$lang.5.xml add_$lang:xml.add
[type: docbook] sources.list.5.xml $lang:$lang/sources.list.$lang.5.xml add_$lang:xml.add

[type: sgml] guide.sgml $lang:$lang/guide.$lang.sgml
# add_$lang::$lang/addendum/debiandoc_$lang.add


+ 0
- 5
doc/pt_BR/addendum/xml_pt_BR.add View File

@@ -1,5 +0,0 @@
PO4A-HEADER:mode=after;position=manbugs;beginboundary=^</refentry>
<refsect1><title>Tradução</title>
Esta página de manual foi traduzida para o Português do Brasil por
André Luís Lopes <email>andrelop@ig.com.br</email>.
</refsect1>

+ 5
- 0
doc/xml.add View File

@@ -0,0 +1,5 @@
PO4A-HEADER:mode=after;position=manbugs;beginboundary=^</refentry>
<refsect1><title>&translation-title;</title>
<para>&translation-holder;</para>
<para>&translation-english;</para>
</refsect1>

+ 185
- 164
po/apt-all.pot
File diff suppressed because it is too large
View File


+ 82
- 0
test/libapt/getlistoffilesindir_test.cc View File

@@ -0,0 +1,82 @@
#include <apt-pkg/fileutl.h>

#include "assert.h"
#include <string>
#include <vector>

#include <stdio.h>
#include <iostream>

// simple helper to quickly output a vector of strings
void dumpVector(std::vector<std::string> vec) {
for (std::vector<std::string>::const_iterator v = vec.begin();
v != vec.end(); v++)
std::cout << *v << std::endl;
}

#define P(x) string(argv[1]).append("/").append(x)

int main(int argc,char *argv[])
{
if (argc != 2) {
std::cout << "One parameter expected - given " << argc << std::endl;
return 100;
}

// Files with no extension
std::vector<std::string> files = GetListOfFilesInDir(argv[1], "", true);
equals(files.size(), 2);
equals(files[0], P("01yet-anothernormalfile"));
equals(files[1], P("anormalfile"));

// Files with no extension - should be the same as above
files = GetListOfFilesInDir(argv[1], "", true, true);
equals(files.size(), 2);
equals(files[0], P("01yet-anothernormalfile"));
equals(files[1], P("anormalfile"));

// Files with impossible extension
files = GetListOfFilesInDir(argv[1], "impossible", true);
equals(files.size(), 0);

// Files with impossible or no extension
files = GetListOfFilesInDir(argv[1], "impossible", true, true);
equals(files.size(), 2);
equals(files[0], P("01yet-anothernormalfile"));
equals(files[1], P("anormalfile"));

// Files with list extension - nothing more
files = GetListOfFilesInDir(argv[1], "list", true);
equals(files.size(), 4);
equals(files[0], P("01yet-anotherapt.list"));
equals(files[1], P("anormalapt.list"));
equals(files[2], P("linkedfile.list"));
equals(files[3], P("multi.dot.list"));

// Files with conf or no extension
files = GetListOfFilesInDir(argv[1], "conf", true, true);
equals(files.size(), 5);
equals(files[0], P("01yet-anotherapt.conf"));
equals(files[1], P("01yet-anothernormalfile"));
equals(files[2], P("anormalapt.conf"));
equals(files[3], P("anormalfile"));
equals(files[4], P("multi.dot.conf"));

// Files with disabled extension - nothing more
files = GetListOfFilesInDir(argv[1], "disabled", true);
equals(files.size(), 3);
equals(files[0], P("disabledfile.conf.disabled"));
equals(files[1], P("disabledfile.disabled"));
equals(files[2], P("disabledfile.list.disabled"));

// Files with disabled or no extension
files = GetListOfFilesInDir(argv[1], "disabled", true, true);
equals(files.size(), 5);
equals(files[0], P("01yet-anothernormalfile"));
equals(files[1], P("anormalfile"));
equals(files[2], P("disabledfile.conf.disabled"));
equals(files[3], P("disabledfile.disabled"));
equals(files[4], P("disabledfile.list.disabled"));

return 0;
}

+ 46
- 4
test/libapt/run-tests.sh View File

@@ -1,10 +1,52 @@
#!/bin/sh
set -e

echo "Compiling the tests ..."
make
echo "Running all testcases ..."
PATH=$(pwd)/../../build/bin
for testapp in $(/bin/ls ${PATH}/*_libapt_test)
LDPATH=$(pwd)/../../build/bin
EXT="_libapt_test"
for testapp in $(ls ${LDPATH}/*$EXT)
do
echo -n "Testing with \033[1;35m$(/usr/bin/basename ${testapp})\033[0m ... "
LD_LIBRARY_PATH=${PATH} ${testapp} && echo "\033[1;32mOKAY\033[0m" || echo "\033[1;31mFAILED\033[0m"
name=$(basename ${testapp})
tmppath=""

if [ $name = "GetListOfFilesInDir${EXT}" ]; then
# TODO: very-low: move env creation to the actual test-app
echo "Prepare Testarea for \033[1;35m$name\033[0m ..."
tmppath=$(mktemp -d)
touch "${tmppath}/anormalfile" \
"${tmppath}/01yet-anothernormalfile" \
"${tmppath}/anormalapt.conf" \
"${tmppath}/01yet-anotherapt.conf" \
"${tmppath}/anormalapt.list" \
"${tmppath}/01yet-anotherapt.list" \
"${tmppath}/wrongextension.wron" \
"${tmppath}/wrong-extension.wron" \
"${tmppath}/strangefile." \
"${tmppath}/s.t.r.a.n.g.e.f.i.l.e" \
"${tmppath}/.hiddenfile" \
"${tmppath}/.hiddenfile.conf" \
"${tmppath}/.hiddenfile.list" \
"${tmppath}/multi..dot" \
"${tmppath}/multi.dot.conf" \
"${tmppath}/multi.dot.list" \
"${tmppath}/disabledfile.disabled" \
"${tmppath}/disabledfile.conf.disabled" \
"${tmppath}/disabledfile.list.disabled" \
"${tmppath}/invälid.conf" \
"${tmppath}/invalíd" \
"${tmppath}/01invalíd"
ln -s "${tmppath}/anormalfile" "${tmppath}/linkedfile.list"
ln -s "${tmppath}/non-existing-file" "${tmppath}/brokenlink.list"
fi

echo -n "Testing with \033[1;35m${name}\033[0m ... "
LD_LIBRARY_PATH=${LDPATH} ${testapp} ${tmppath} && echo "\033[1;32mOKAY\033[0m" || echo "\033[1;31mFAILED\033[0m"

if [ -n "$tmppath" -a -d "$tmppath" ]; then
echo "Cleanup Testarea after \033[1;35m$name\033[0m ..."
rm -rf "$tmppath"
fi

done

Loading…
Cancel
Save