From 330463dd2374bd11757c6f2662f279fc31f035a0 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Thu, 24 Jun 2010 10:57:45 +0200 Subject: methods/ftp.h: Handle different logins are on the same server (Closes: #586904). --- debian/changelog | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'debian') diff --git a/debian/changelog b/debian/changelog index d29705d24..037dfa7bd 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +apt (0.7.26~exp8) experimental; urgency=low + + * methods/ftp.h: + - Handle different logins are on the same server (Closes: #586904). + + -- Julian Andres Klode Thu, 24 Jun 2010 10:56:39 +0200 + apt (0.7.26~exp7) experimental; urgency=low * apt-pkg/cachefile.h: -- cgit v1.2.3-70-g09d2 From d4af23c2d81116b8f7557ee795059bca126ae9f4 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sat, 26 Jun 2010 20:56:44 +0200 Subject: * apt-pkg/deb/deblistparser.cc: - Handle architecture wildcards (Closes: #547724). --- apt-pkg/deb/deblistparser.cc | 10 +++++++++- debian/changelog | 2 ++ 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'debian') diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc index 83c5b8d2e..ddbd0d31a 100644 --- a/apt-pkg/deb/deblistparser.cc +++ b/apt-pkg/deb/deblistparser.cc @@ -19,6 +19,7 @@ #include #include +#include #include /*}}}*/ @@ -572,8 +573,15 @@ const char *debListParser::ParseDepends(const char *Start,const char *Stop, I++; } - if (stringcmp(arch,I,End) == 0) + if (stringcmp(arch,I,End) == 0) { Found = true; + } else { + std::string wildcard = SubstVar(string(I, End), "any", "*"); + if (fnmatch(wildcard.c_str(), arch.c_str(), 0) == 0) + Found = true; + else if (fnmatch(wildcard.c_str(), ("linux-" + arch).c_str(), 0) == 0) + Found = true; + } if (*End++ == ']') { I = End; diff --git a/debian/changelog b/debian/changelog index 037dfa7bd..8de7d18e3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,8 @@ apt (0.7.26~exp8) experimental; urgency=low * methods/ftp.h: - Handle different logins are on the same server (Closes: #586904). + * apt-pkg/deb/deblistparser.cc: + - Handle architecture wildcards (Closes: #547724). -- Julian Andres Klode Thu, 24 Jun 2010 10:56:39 +0200 -- cgit v1.2.3-70-g09d2 From 7ecb5be707d7365df3af157a122b52667b96ace9 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sat, 26 Jun 2010 21:16:20 +0200 Subject: debian/changelog: Fix a typo --- debian/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'debian') diff --git a/debian/changelog b/debian/changelog index 8de7d18e3..105936177 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,7 +1,7 @@ apt (0.7.26~exp8) experimental; urgency=low * methods/ftp.h: - - Handle different logins are on the same server (Closes: #586904). + - Handle different logins on the same server (Closes: #586904). * apt-pkg/deb/deblistparser.cc: - Handle architecture wildcards (Closes: #547724). -- cgit v1.2.3-70-g09d2 From ae4a4f91e90fb09a8de1699f18f3b28d095c4d73 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 28 Jun 2010 17:21:14 +0200 Subject: * apt-pkg/versionmatch.cc: - Support matching pins by regular expressions or glob() like patterns, regular expressions have to be put between to slashes; for example, /.*/. --- apt-pkg/versionmatch.cc | 58 +++++++++++++++++++++++++++++++++++++++---------- apt-pkg/versionmatch.h | 2 ++ debian/changelog | 4 ++++ 3 files changed, 52 insertions(+), 12 deletions(-) (limited to 'debian') diff --git a/apt-pkg/versionmatch.cc b/apt-pkg/versionmatch.cc index e5f0fafd2..72c9bff2d 100644 --- a/apt-pkg/versionmatch.cc +++ b/apt-pkg/versionmatch.cc @@ -18,6 +18,10 @@ #include #include +#include +#include +#include + /*}}}*/ // VersionMatch::pkgVersionMatch - Constructor /*{{{*/ @@ -162,6 +166,36 @@ pkgCache::VerIterator pkgVersionMatch::Find(pkgCache::PkgIterator Pkg) // This will be Ended by now. return Ver; } + +#ifndef FNM_CASEFOLD +#define FNM_CASEFOLD 0 +#endif + +bool pkgVersionMatch::ExpressionMatches(const char *pattern, const char *string) +{ + std::cerr << "MATCH " << pattern; + if (pattern[0] == '/') { + bool res = false; + size_t length = strlen(pattern); + if (pattern[length - 1] == '/') { + regex_t preg; + char *regex = strdup(pattern + 1); + regex[length - 2] = '\0'; + if (regcomp(&preg, regex, REG_EXTENDED | REG_ICASE) != 0) { + std::cerr << "E: Invalid regular expression: " << regex << "\n"; + } else if (regexec(&preg, string, 0, NULL, 0) == 0) { + res = true; + } + free(regex); + return res; + } + } + return fnmatch(pattern, string, FNM_CASEFOLD) == 0; +} +bool pkgVersionMatch::ExpressionMatches(const std::string& pattern, const char *string) +{ + return ExpressionMatches(pattern.c_str(), string); +} /*}}}*/ // VersionMatch::FileMatch - Match against an index file /*{{{*/ // --------------------------------------------------------------------- @@ -185,37 +219,37 @@ bool pkgVersionMatch::FileMatch(pkgCache::PkgFileIterator File) if (RelVerStr.empty() == false) if (File->Version == 0 || - MatchVer(File.Version(),RelVerStr,RelVerPrefixMatch) == false) + (MatchVer(File.Version(),RelVerStr,RelVerPrefixMatch) == false && + ExpressionMatches(RelVerStr, File.Version()) == false)) return false; if (RelOrigin.empty() == false) - if (File->Origin == 0 || - stringcasecmp(RelOrigin,File.Origin()) != 0) + if (File->Origin == 0 || !ExpressionMatches(RelOrigin,File.Origin())) return false; if (RelArchive.empty() == false) if (File->Archive == 0 || - stringcasecmp(RelArchive,File.Archive()) != 0) + !ExpressionMatches(RelArchive,File.Archive())) return false; if (RelCodename.empty() == false) if (File->Codename == 0 || - stringcasecmp(RelCodename,File.Codename()) != 0) + !ExpressionMatches(RelCodename,File.Codename())) return false; if (RelRelease.empty() == false) if ((File->Archive == 0 || - stringcasecmp(RelRelease,File.Archive()) != 0) && + !ExpressionMatches(RelRelease,File.Archive())) && (File->Codename == 0 || - stringcasecmp(RelRelease,File.Codename()) != 0)) + !ExpressionMatches(RelRelease,File.Codename()))) return false; if (RelLabel.empty() == false) if (File->Label == 0 || - stringcasecmp(RelLabel,File.Label()) != 0) + !ExpressionMatches(RelLabel,File.Label())) return false; if (RelComponent.empty() == false) if (File->Component == 0 || - stringcasecmp(RelComponent,File.Component()) != 0) + !ExpressionMatches(RelComponent,File.Component())) return false; if (RelArchitecture.empty() == false) if (File->Architecture == 0 || - stringcasecmp(RelArchitecture,File.Architecture()) != 0) + !ExpressionMatches(RelArchitecture,File.Architecture())) return false; return true; } @@ -223,12 +257,12 @@ bool pkgVersionMatch::FileMatch(pkgCache::PkgFileIterator File) if (Type == Origin) { if (OrSite.empty() == false) { - if (File->Site == 0 || OrSite != File.Site()) + if (File->Site == 0 || !ExpressionMatches(OrSite, File.Site())) return false; } else // so we are talking about file:// or status file if (strcmp(File.Site(),"") == 0 && File->Archive != 0) // skip the status file return false; - return (OrSite == File.Site()); /* both strings match */ + return (ExpressionMatches(OrSite, File.Site())); /* both strings match */ } return false; diff --git a/apt-pkg/versionmatch.h b/apt-pkg/versionmatch.h index a8da072ae..39639a23d 100644 --- a/apt-pkg/versionmatch.h +++ b/apt-pkg/versionmatch.h @@ -67,6 +67,8 @@ class pkgVersionMatch enum MatchType {None = 0,Version,Release,Origin} Type; bool MatchVer(const char *A,string B,bool Prefix); + bool ExpressionMatches(const char *pattern, const char *string); + bool ExpressionMatches(const std::string& pattern, const char *string); bool FileMatch(pkgCache::PkgFileIterator File); pkgCache::VerIterator Find(pkgCache::PkgIterator Pkg); diff --git a/debian/changelog b/debian/changelog index 105936177..659facb37 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,10 @@ apt (0.7.26~exp8) experimental; urgency=low - Handle different logins on the same server (Closes: #586904). * apt-pkg/deb/deblistparser.cc: - Handle architecture wildcards (Closes: #547724). + * apt-pkg/versionmatch.cc: + - Support matching pins by regular expressions or glob() like patterns, + regular expressions have to be put between to slashes; for example, + /.*/. -- Julian Andres Klode Thu, 24 Jun 2010 10:56:39 +0200 -- cgit v1.2.3-70-g09d2 From 9055046760d4e276914e10b96c6065fb885f118b Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 29 Jun 2010 15:21:24 +0200 Subject: debian/control: Set Standards-Version to 3.9.0 --- debian/changelog | 2 ++ debian/control | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'debian') diff --git a/debian/changelog b/debian/changelog index 659facb37..3a0fcd83d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,6 +8,8 @@ apt (0.7.26~exp8) experimental; urgency=low - Support matching pins by regular expressions or glob() like patterns, regular expressions have to be put between to slashes; for example, /.*/. + * debian/control: + - Set Standards-Version to 3.9.0 -- Julian Andres Klode Thu, 24 Jun 2010 10:56:39 +0200 diff --git a/debian/control b/debian/control index 9ac0d582e..8bc43568f 100644 --- a/debian/control +++ b/debian/control @@ -5,7 +5,7 @@ Maintainer: APT Development Team Uploaders: Michael Vogt , Otavio Salvador , Christian Perrier , Daniel Burrows , Luca Bruno , Julian Andres Klode -Standards-Version: 3.8.4 +Standards-Version: 3.9.0 Build-Depends: debhelper (>= 5.0), libdb-dev, gettext (>= 0.12), libcurl4-gnutls-dev | libcurl3-gnutls-dev (>= 7.15.5), debiandoc-sgml, xsltproc, docbook-xsl, po4a (>= 0.34-2), autotools-dev, autoconf, automake, doxygen, intltool Build-Conflicts: autoconf2.13, automake1.4 -- cgit v1.2.3-70-g09d2 From 3010fb0e069d2fd4c7a6ade4559bfb659bf8f2fb Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 29 Jun 2010 17:23:24 +0200 Subject: * apt-pkg/contrib/fileutl.cc: - Make FileFd replace files atomically in WriteTemp mode (for cache, etc). --- apt-pkg/contrib/fileutl.cc | 20 +++++++++++++++----- apt-pkg/contrib/fileutl.h | 3 ++- debian/changelog | 2 ++ 3 files changed, 19 insertions(+), 6 deletions(-) (limited to 'debian') diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc index 16f7ce929..0b0739cda 100644 --- a/apt-pkg/contrib/fileutl.cc +++ b/apt-pkg/contrib/fileutl.cc @@ -27,6 +27,7 @@ #include #include +#include #include #include @@ -654,10 +655,11 @@ bool FileFd::Open(string FileName,OpenMode Mode, unsigned long Perms) case WriteEmpty: { - struct stat Buf; - if (lstat(FileName.c_str(),&Buf) == 0 && S_ISLNK(Buf.st_mode)) - unlink(FileName.c_str()); - iFd = open(FileName.c_str(),O_RDWR | O_CREAT | O_TRUNC,Perms); + Flags |= Replace; + char *name = strdup((FileName + ".XXXXXX").c_str()); + TemporaryFileName = string(mktemp(name)); + iFd = open(TemporaryFileName.c_str(),O_RDWR | O_CREAT | O_EXCL,Perms); + free(name); break; } @@ -839,11 +841,19 @@ bool FileFd::Close() if (iFd >= 0 && close(iFd) != 0) Res &= _error->Errno("close",_("Problem closing the file")); iFd = -1; - + + if ((Flags & Replace) == Replace) { + FileName = TemporaryFileName; // for the unlink() below. + if (rename(TemporaryFileName.c_str(), FileName.c_str()) != 0) + Res &= _error->Errno("rename",_("Problem renaming the file")); + } + if ((Flags & Fail) == Fail && (Flags & DelOnFail) == DelOnFail && FileName.empty() == false) if (unlink(FileName.c_str()) != 0) Res &= _error->WarningE("unlnk",_("Problem unlinking the file")); + + return Res; } /*}}}*/ diff --git a/apt-pkg/contrib/fileutl.h b/apt-pkg/contrib/fileutl.h index 003bd9b83..528725f89 100644 --- a/apt-pkg/contrib/fileutl.h +++ b/apt-pkg/contrib/fileutl.h @@ -34,9 +34,10 @@ class FileFd int iFd; enum LocalFlags {AutoClose = (1<<0),Fail = (1<<1),DelOnFail = (1<<2), - HitEof = (1<<3)}; + HitEof = (1<<3), Replace = (1<<4) }; unsigned long Flags; string FileName; + string TemporaryFileName; public: enum OpenMode {ReadOnly,WriteEmpty,WriteExists,WriteAny,WriteTemp}; diff --git a/debian/changelog b/debian/changelog index 3a0fcd83d..1bf6815a5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,6 +8,8 @@ apt (0.7.26~exp8) experimental; urgency=low - Support matching pins by regular expressions or glob() like patterns, regular expressions have to be put between to slashes; for example, /.*/. + * apt-pkg/contrib/fileutl.cc: + - Make FileFd replace files atomically in WriteTemp mode (for cache, etc). * debian/control: - Set Standards-Version to 3.9.0 -- cgit v1.2.3-70-g09d2