diff options
author | Michael Vogt <mvo@debian.org> | 2011-02-08 10:35:39 +0100 |
---|---|---|
committer | Michael Vogt <mvo@debian.org> | 2011-02-08 10:35:39 +0100 |
commit | 33e46bc7032c2bcab654ab3f6a0a10ad82264ead (patch) | |
tree | b0117e8152475b94551bfe993460be64fcf3343b | |
parent | 09b8bd3226a68272f98e4020d10348ff26642500 (diff) | |
parent | 7376837d338fd9399cfa4820b6f9bacbb2634d46 (diff) |
merged lp:~donkult/apt/sid
-rw-r--r-- | apt-pkg/algorithms.cc | 23 | ||||
-rw-r--r-- | apt-pkg/contrib/error.cc | 31 | ||||
-rw-r--r-- | apt-pkg/depcache.cc | 2 | ||||
-rw-r--r-- | apt-pkg/pkgcachegen.cc | 18 | ||||
-rw-r--r-- | cmdline/apt-cache.cc | 59 | ||||
-rw-r--r-- | cmdline/apt-get.cc | 96 | ||||
-rw-r--r-- | debian/changelog | 19 | ||||
-rw-r--r-- | doc/apt-cache.8.xml | 10 | ||||
-rw-r--r-- | doc/apt.conf.5.xml | 6 | ||||
-rw-r--r-- | doc/apt_preferences.5.xml | 6 | ||||
-rw-r--r-- | doc/sources.list.5.xml | 4 | ||||
-rw-r--r-- | test/integration/framework | 16 | ||||
-rwxr-xr-x | test/integration/test-apt-get-autoremove (renamed from test/integration/test-autoremove) | 6 | ||||
-rwxr-xr-x | test/integration/test-apt-get-changelog | 36 | ||||
-rwxr-xr-x | test/integration/test-apt-get-download | 29 | ||||
-rwxr-xr-x | test/integration/test-bug-549968-install-depends-of-not-installed | 26 | ||||
-rwxr-xr-x | test/integration/test-bug-611729-mark-as-manual | 105 | ||||
-rwxr-xr-x | test/integration/test-bug-612099-multiarch-conflicts | 209 | ||||
-rwxr-xr-x | test/integration/test-changelog | 34 | ||||
-rwxr-xr-x | test/integration/test-ubuntu-bug-365611-long-package-names | 11 |
20 files changed, 587 insertions, 159 deletions
diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc index 0fbce3c2a..0d26f8f66 100644 --- a/apt-pkg/algorithms.cc +++ b/apt-pkg/algorithms.cc @@ -162,7 +162,28 @@ bool pkgSimulate::Configure(PkgIterator iPkg) } } -// Sim.MarkInstall(Pkg,false); + if (Sim[Pkg].InstBroken() == true) + { + /* We don't call Configure for Pseudo packages and if the 'all' is already installed + the simulation will think the pseudo package is not installed, so if something is + broken we walk over the dependencies and search for not installed pseudo packages */ + for (pkgCache::DepIterator D = Sim[Pkg].InstVerIter(Sim).DependsList(); D.end() == false; D++) + { + if (Sim.IsImportantDep(D) == false || + (Sim[D] & pkgDepCache::DepInstall) != 0) + continue; + pkgCache::PkgIterator T = D.TargetPkg(); + if (T.end() == true || T->CurrentVer != 0 || Flags[T->ID] != 0) + continue; + pkgCache::PkgIterator A = T.Group().FindPkg("all"); + if (A.end() == true || A->VersionList == 0 || A->CurrentVer == 0 || + Cache.VS().CheckDep(A.CurVersion(), pkgCache::Dep::Equals, T.CandVersion()) == false) + continue; + Sim.MarkInstall(T, false); + Flags[T->ID] = 2; + } + } + if (Sim[Pkg].InstBroken() == true) { cout << "Conf " << Pkg.FullName(false) << " broken" << endl; diff --git a/apt-pkg/contrib/error.cc b/apt-pkg/contrib/error.cc index e2e8d6e57..7dad11689 100644 --- a/apt-pkg/contrib/error.cc +++ b/apt-pkg/contrib/error.cc @@ -18,6 +18,7 @@ #include <iostream> #include <errno.h> #include <stdio.h> +#include <stdlib.h> #include <unistd.h> #include <string> @@ -103,10 +104,21 @@ bool GlobalError::InsertErrno(MsgType const &type, const char *Function, // GlobalError::InsertErrno - formats an error message with the errno /*{{{*/ bool GlobalError::InsertErrno(MsgType type, const char* Function, const char* Description, va_list &args) { - char S[400]; - snprintf(S, sizeof(S), "%s - %s (%i: %s)", Description, - Function, errno, strerror(errno)); - return Insert(type, S, args); + int const errsv = errno; + char* S = (char*) malloc(400); + size_t const Ssize = snprintf(S, 400, "%s - %s (%i: %s)", Description, + Function, errsv, strerror(errsv)) + 1; + + if (Ssize > 400) { + free(S); + S = (char*) malloc(Ssize); + snprintf(S, Ssize, "%s - %s (%i: %s)", Description, + Function, errsv, strerror(errsv)); + } + + bool const geins = Insert(type, S, args); + free(S); + return geins; } /*}}}*/ // GlobalError::Fatal - Add a fatal error to the list /*{{{*/ @@ -157,8 +169,14 @@ bool GlobalError::Insert(MsgType const &type, const char *Description,...) // GlobalError::Insert - Insert a new item at the end /*{{{*/ bool GlobalError::Insert(MsgType type, const char* Description, va_list &args) { - char S[400]; - vsnprintf(S,sizeof(S),Description,args); + char* S = (char*) malloc(400); + size_t const Ssize = vsnprintf(S, 400, Description, args) + 1; + + if (Ssize > 400) { + free(S); + S = (char*) malloc(Ssize); + vsnprintf(S, Ssize, Description, args); + } Item const m(S, type); Messages.push_back(m); @@ -169,6 +187,7 @@ bool GlobalError::Insert(MsgType type, const char* Description, if (type == FATAL || type == DEBUG) std::clog << m << std::endl; + free(S); return false; } /*}}}*/ diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc index 5f59b6d49..7c09d3a38 100644 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@ -339,7 +339,7 @@ bool pkgDepCache::CheckDep(DepIterator Dep,int Type,PkgIterator &Res) /* Check simple depends. A depends -should- never self match but we allow it anyhow because dpkg does. Technically it is a packaging bug. Conflicts may never self match */ - if (Dep.TargetPkg()->Group != Dep.ParentPkg()->Group || + if (Dep.TargetPkg() != Dep.ParentPkg() || (Dep->Type != Dep::Conflicts && Dep->Type != Dep::DpkgBreaks && Dep->Type != Dep::Obsoletes)) { PkgIterator Pkg = Dep.TargetPkg(); diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc index ed35174bb..5b943cca1 100644 --- a/apt-pkg/pkgcachegen.cc +++ b/apt-pkg/pkgcachegen.cc @@ -638,21 +638,19 @@ bool pkgCacheGenerator::FinishCache(OpProgress *Progress) Dynamic<pkgCache::PkgIterator> DynP(P); for (; P.end() != true; P = G.NextPkg(P)) { - if (strcmp(P.Arch(),"all") == 0) - continue; pkgCache::PkgIterator allPkg; Dynamic<pkgCache::PkgIterator> DynallPkg(allPkg); pkgCache::VerIterator V = P.VersionList(); Dynamic<pkgCache::VerIterator> DynV(V); for (; V.end() != true; V++) { - string const Arch = V.Arch(true); + char const * const Arch = P.Arch(); map_ptrloc *OldDepLast = NULL; /* MultiArch handling introduces a lot of implicit Dependencies: - MultiArch: same → Co-Installable if they have the same version - Architecture: all → Need to be Co-Installable for internal reasons - All others conflict with all other group members */ - bool const coInstall = (V->MultiArch == pkgCache::Version::All || + bool const coInstall = ((V->MultiArch == pkgCache::Version::All && strcmp(Arch, "all") != 0) || V->MultiArch == pkgCache::Version::Same); if (V->MultiArch == pkgCache::Version::All && allPkg.end() == true) allPkg = G.FindPkg("all"); @@ -686,9 +684,15 @@ bool pkgCacheGenerator::FinishCache(OpProgress *Progress) } } else { // Conflicts: ${self}:other - NewDepends(D, V, "", - pkgCache::Dep::NoOp, pkgCache::Dep::Conflicts, - OldDepLast); + if (strcmp(Arch, "all") == 0) { + NewDepends(D, V, V.VerStr(), + pkgCache::Dep::NotEquals, pkgCache::Dep::Conflicts, + OldDepLast); + } else { + NewDepends(D, V, "", + pkgCache::Dep::NoOp, pkgCache::Dep::Conflicts, + OldDepLast); + } } } } diff --git a/cmdline/apt-cache.cc b/cmdline/apt-cache.cc index 45ea50433..34070ba9b 100644 --- a/cmdline/apt-cache.cc +++ b/cmdline/apt-cache.cc @@ -1118,58 +1118,6 @@ bool Dotty(CommandLine &CmdL) return true; } /*}}}*/ -// DoAdd - Perform an adding operation /*{{{*/ -// --------------------------------------------------------------------- -/* */ -bool DoAdd(CommandLine &CmdL) -{ - return _error->Error("Unimplemented"); -#if 0 - // Make sure there is at least one argument - if (CmdL.FileSize() <= 1) - return _error->Error("You must give at least one file name"); - - // Open the cache - FileFd CacheF(_config->FindFile("Dir::Cache::pkgcache"),FileFd::WriteAny); - if (_error->PendingError() == true) - return false; - - DynamicMMap Map(CacheF,MMap::Public); - if (_error->PendingError() == true) - return false; - - OpTextProgress Progress(*_config); - pkgCacheGenerator Gen(Map,Progress); - if (_error->PendingError() == true) - return false; - - unsigned long Length = CmdL.FileSize() - 1; - for (const char **I = CmdL.FileList + 1; *I != 0; I++) - { - Progress.OverallProgress(I - CmdL.FileList,Length,1,"Generating cache"); - Progress.SubProgress(Length); - - // Do the merge - FileFd TagF(*I,FileFd::ReadOnly); - debListParser Parser(TagF); - if (_error->PendingError() == true) - return _error->Error("Problem opening %s",*I); - - if (Gen.SelectFile(*I,"") == false) - return _error->Error("Problem with SelectFile"); - - if (Gen.MergeList(Parser) == false) - return _error->Error("Problem with MergeList"); - } - - Progress.Done(); - GCache = &Gen.GetCache(); - Stats(CmdL); - - return true; -#endif -} - /*}}}*/ // DisplayRecord - Displays the complete record for the package /*{{{*/ // --------------------------------------------------------------------- /* This displays the package record from the proper package index file. @@ -1743,15 +1691,13 @@ bool ShowHelp(CommandLine &Cmd) cout << _("Usage: apt-cache [options] command\n" - " apt-cache [options] add file1 [file2 ...]\n" " apt-cache [options] showpkg pkg1 [pkg2 ...]\n" " apt-cache [options] showsrc pkg1 [pkg2 ...]\n" "\n" - "apt-cache is a low-level tool used to manipulate APT's binary\n" - "cache files, and query information from them\n" + "apt-cache is a low-level tool used to query information\n" + "from APT's binary cache files\n" "\n" "Commands:\n" - " add - Add a package file to the source cache\n" " gencaches - Build both the package and source cache\n" " showpkg - Show some general information for a single package\n" " showsrc - Show source records\n" @@ -1811,7 +1757,6 @@ int main(int argc,const char *argv[]) /*{{{*/ {0,"enhances","APT::Cache::ShowEnhances",0}, {0,0,0,0}}; CommandLine::Dispatch CmdsA[] = {{"help",&ShowHelp}, - {"add",&DoAdd}, {"gencaches",&GenCaches}, {"showsrc",&ShowSrcPackage}, {0,0}}; diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index e93d12c2b..878313212 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -895,7 +895,11 @@ struct TryToRemove { if ((Pkg->CurrentVer == 0 && PurgePkgs == false) || (PurgePkgs == true && Pkg->CurrentState == pkgCache::State::NotInstalled)) + { ioprintf(c1out,_("Package %s is not installed, so not removed\n"),Pkg.FullName(true).c_str()); + // MarkInstall refuses to install packages on hold + Pkg->SelectedState = pkgCache::State::Hold; + } else Cache->GetDepCache()->MarkDelete(Pkg, PurgePkgs); } @@ -1790,14 +1794,7 @@ bool DoInstall(CommandLine &CmdL) return false; } - unsigned short order[] = { 0, 0, 0 }; - if (fallback == MOD_INSTALL) { - order[0] = MOD_INSTALL; - order[1] = MOD_REMOVE; - } else { - order[0] = MOD_REMOVE; - order[1] = MOD_INSTALL; - } + unsigned short const order[] = { MOD_REMOVE, MOD_INSTALL, 0 }; TryToInstall InstallAction(Cache, Fix, BrokenFix); TryToRemove RemoveAction(Cache, Fix); @@ -2211,13 +2208,15 @@ bool DoDownload(CommandLine &CmdL) APT::CacheSetHelper helper(c0out); APT::VersionSet verset = APT::VersionSet::FromCommandLine(Cache, CmdL.FileList + 1, APT::VersionSet::CANDIDATE, helper); - pkgAcquire Fetcher; - AcqTextStatus Stat(ScreenWidth, _config->FindI("quiet",0)); - Fetcher.Setup(&Stat); if (verset.empty() == true) return false; + pkgAcquire Fetcher; + AcqTextStatus Stat(ScreenWidth, _config->FindI("quiet",0)); + if (_config->FindB("APT::Get::Print-URIs") == true) + Fetcher.Setup(&Stat); + pkgRecords Recs(Cache); pkgSourceList *SrcList = Cache.GetSourceList(); for (APT::VersionSet::const_iterator Ver = verset.begin(); @@ -2248,9 +2247,18 @@ bool DoDownload(CommandLine &CmdL) // get the file new pkgAcqFile(&Fetcher, uri, hash.toStr(), (*Ver)->Size, descr, Pkg.Name(), "."); } - bool result = (Fetcher.Run() == pkgAcquire::Continue); - return result; + // Just print out the uris and exit if the --print-uris flag was used + if (_config->FindB("APT::Get::Print-URIs") == true) + { + pkgAcquire::UriIterator I = Fetcher.UriBegin(); + for (; I != Fetcher.UriEnd(); I++) + cout << '\'' << I->URI << "' " << flNotDir(I->Owner->DestFile) << ' ' << + I->Owner->FileSize << ' ' << I->Owner->HashSum() << endl; + return true; + } + + return (Fetcher.Run() == pkgAcquire::Continue); } /*}}}*/ // DoCheck - Perform the check operation /*{{{*/ @@ -2879,6 +2887,7 @@ bool GuessThirdPartyChangelogUri(CacheFile &Cache, // now strip away the filename and add srcpkg_srcver.changelog return true; } + /*}}}*/ // DownloadChangelog - Download the changelog /*{{{*/ // --------------------------------------------------------------------- bool DownloadChangelog(CacheFile &CacheFile, pkgAcquire &Fetcher, @@ -2903,13 +2912,19 @@ bool DownloadChangelog(CacheFile &CacheFile, pkgAcquire &Fetcher, "http://packages.debian.org/changelogs"); path = GetChangelogPath(CacheFile, Pkg, Ver); strprintf(changelog_uri, "%s/%s/changelog", server.c_str(), path.c_str()); + if (_config->FindB("APT::Get::Print-URIs", false) == true) + { + std::cout << '\'' << changelog_uri << '\'' << std::endl; + return true; + } + strprintf(descr, _("Changelog for %s (%s)"), Pkg.Name(), changelog_uri.c_str()); // queue it new pkgAcqFile(&Fetcher, changelog_uri, "", 0, descr, Pkg.Name(), "ignored", targetfile); - // try downloading it, if that fails, they third-party-changelogs location - // FIXME: res is "Continue" even if I get a 404?!? - int res = Fetcher.Run(); + // try downloading it, if that fails, try third-party-changelogs location + // FIXME: Fetcher.Run() is "Continue" even if I get a 404?!? + Fetcher.Run(); if (!FileExists(targetfile)) { string third_party_uri; @@ -2917,7 +2932,7 @@ bool DownloadChangelog(CacheFile &CacheFile, pkgAcquire &Fetcher, { strprintf(descr, _("Changelog for %s (%s)"), Pkg.Name(), third_party_uri.c_str()); new pkgAcqFile(&Fetcher, third_party_uri, "", 0, descr, Pkg.Name(), "ignored", targetfile); - res = Fetcher.Run(); + Fetcher.Run(); } } @@ -2957,30 +2972,53 @@ bool DoChangelog(CommandLine &CmdL) APT::CacheSetHelper helper(c0out); APT::VersionSet verset = APT::VersionSet::FromCommandLine(Cache, CmdL.FileList + 1, APT::VersionSet::CANDIDATE, helper); + if (verset.empty() == true) + return false; pkgAcquire Fetcher; + + if (_config->FindB("APT::Get::Print-URIs", false) == true) + for (APT::VersionSet::const_iterator Ver = verset.begin(); + Ver != verset.end(); ++Ver) + return DownloadChangelog(Cache, Fetcher, Ver, ""); + AcqTextStatus Stat(ScreenWidth, _config->FindI("quiet",0)); Fetcher.Setup(&Stat); - if (verset.empty() == true) - return false; - char *tmpdir = mkdtemp(strdup("/tmp/apt-changelog-XXXXXX")); - if (tmpdir == NULL) { - return _error->Errno("mkdtemp", "mkdtemp failed"); + bool const downOnly = _config->FindB("APT::Get::Download-Only", false); + + char tmpname[100]; + char* tmpdir = NULL; + if (downOnly == false) + { + const char* const tmpDir = getenv("TMPDIR"); + if (tmpDir != NULL && *tmpDir != '\0') + snprintf(tmpname, sizeof(tmpname), "%s/apt-changelog-XXXXXX", tmpDir); + else + strncpy(tmpname, "/tmp/apt-changelog-XXXXXX", sizeof(tmpname)); + tmpdir = mkdtemp(tmpname); + if (tmpdir == NULL) + return _error->Errno("mkdtemp", "mkdtemp failed"); } - + for (APT::VersionSet::const_iterator Ver = verset.begin(); Ver != verset.end(); ++Ver) { - string changelogfile = string(tmpdir) + "changelog"; - if (DownloadChangelog(Cache, Fetcher, Ver, changelogfile)) + string changelogfile; + if (downOnly == false) + changelogfile.append(tmpname).append("changelog"); + else + changelogfile.append(Ver.ParentPkg().Name()).append(".changelog"); + if (DownloadChangelog(Cache, Fetcher, Ver, changelogfile) && downOnly == false) + { DisplayFileInPager(changelogfile); - // cleanup temp file - unlink(changelogfile.c_str()); + // cleanup temp file + unlink(changelogfile.c_str()); + } } // clenaup tmp dir - rmdir(tmpdir); - free(tmpdir); + if (tmpdir != NULL) + rmdir(tmpdir); return true; } /*}}}*/ diff --git a/debian/changelog b/debian/changelog index 525654732..9e14c562c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,6 +5,7 @@ apt (0.8.11) UNRELEASED; urgency=low - add SetCandidateRelease() to set a candidate version and the candidates of dependencies if needed to a specified release (Closes: #572709) + - allow conflicts in the same group again (Closes: #612099) * cmdline/apt-get.cc: - if --print-uris is used don't setup downloader as we don't need progress, lock nor the directories it would create otherwise @@ -16,6 +17,8 @@ apt (0.8.11) UNRELEASED; urgency=low so installing packages from experimental or backports is easier - really do not show packages in the extra section if they were requested on the commandline, e.g. with a modifier (Closes: #184730) + - always do removes first and set not installed remove packages + on hold to prevent temporary installation later (Closes: #549968) * debian/control: - add Vcs-Browser now that loggerhead works again (Closes: #511168) - depend on debhelper 7 to raise compat level @@ -42,6 +45,7 @@ apt (0.8.11) UNRELEASED; urgency=low - remove duplicated mentioning of --install-recommends * doc/sources.list.5.xml: - remove obsolete references to non-us (Closes: #594495) + - a notice is printed for ignored files (Closes: #597615) * debian/rules: - use -- instead of deprecated -u for dh_gencontrol - remove shlibs.local creation and usage @@ -70,6 +74,19 @@ apt (0.8.11) UNRELEASED; urgency=low - print a good error message if FileSize() is zero * apt-pkg/aptconfiguration.cc: - remove the inbuilt Translation files whitelist + * cmdline/apt-cache.cc: + - remove not implemented 'apt-cache add' command + * doc/apt-cache.8.xml: + - describe reality as apt-cache just queries and doesn't manipulate + the caches. Thanks to Enrico Zini for spotting it! (Closes: #612009) + * apt-pkg/algorithms.cc: + - mark pseudo packages of installed all packages as configured + in the simulation as we don't call configure for these packages + * apt-pkg/pkgcachegen.cc: + - in multiarch, let :all packages conflict with :any packages + with a different version to be sure + * apt-pkg/contrib/error.cc: + - remove 400 char size limit of error messages (LP: #365611) [ Michael Vogt ] * methods/http.cc: @@ -87,7 +104,7 @@ apt (0.8.11) UNRELEASED; urgency=low will actually test uncompressed indexes regardless of the internal default value of Acquire::GzipIndexes. - -- David Kalnischkies <kalnischkies@gmail.com> Fri, 28 Jan 2011 12:22:25 +0100 + -- David Kalnischkies <kalnischkies@gmail.com> Mon, 07 Feb 2011 22:14:09 +0100 apt (0.8.10.3) unstable; urgency=low diff --git a/doc/apt-cache.8.xml b/doc/apt-cache.8.xml index 359d210ea..9c6c64dac 100644 --- a/doc/apt-cache.8.xml +++ b/doc/apt-cache.8.xml @@ -18,7 +18,7 @@ &apt-email; &apt-product; <!-- The last update date --> - <date>29 February 2004</date> + <date>04 February 2011</date> </refentryinfo> <refmeta> @@ -30,7 +30,7 @@ <!-- Man page title --> <refnamediv> <refname>apt-cache</refname> - <refpurpose>APT package handling utility -- cache manipulator</refpurpose> + <refpurpose>query the APT cache</refpurpose> </refnamediv> <!-- Arguments --> @@ -41,7 +41,6 @@ <arg><option>-o=<replaceable>config string</replaceable></option></arg> <arg><option>-c=<replaceable>file</replaceable></option></arg> <group choice="req"> - <arg>add <arg choice="plain" rep="repeat"><replaceable>file</replaceable></arg></arg> <arg>gencaches</arg> <arg>showpkg <arg choice="plain" rep="repeat"><replaceable>pkg</replaceable></arg></arg> <arg>showsrc <arg choice="plain" rep="repeat"><replaceable>pkg</replaceable></arg></arg> @@ -72,11 +71,6 @@ commands below must be present.</para> <variablelist> - <varlistentry><term>add <replaceable>file(s)</replaceable></term> - <listitem><para><literal>add</literal> adds the named package index files to the package cache. - This is for debugging only.</para></listitem> - </varlistentry> - <varlistentry><term>gencaches</term> <listitem><para><literal>gencaches</literal> performs the same operation as <command>apt-get check</command>. It builds the source and package caches from diff --git a/doc/apt.conf.5.xml b/doc/apt.conf.5.xml index a423dac24..477507598 100644 --- a/doc/apt.conf.5.xml +++ b/doc/apt.conf.5.xml @@ -52,8 +52,10 @@ <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> + hyphen (-), underscore (_) and period (.) characters. + Otherwise APT will print a notice that it has ignored a file if the file + doesn't match a pattern in the <literal>Dir::Ignore-Files-Silently</literal> + configuration list - in this case it 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 diff --git a/doc/apt_preferences.5.xml b/doc/apt_preferences.5.xml index 54c01100c..0d22d0413 100644 --- a/doc/apt_preferences.5.xml +++ b/doc/apt_preferences.5.xml @@ -71,8 +71,10 @@ You have been warned.</para> 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> +underscore (_) and period (.) characters. +Otherwise APT will print a notice that it has ignored a file if the file +doesn't match a pattern in the <literal>Dir::Ignore-Files-Silently</literal> +configuration list - in this case it will be silently ignored.</para> <refsect2><title>APT's Default Priority Assignments</title> diff --git a/doc/sources.list.5.xml b/doc/sources.list.5.xml index 212ed6d98..837f07683 100644 --- a/doc/sources.list.5.xml +++ b/doc/sources.list.5.xml @@ -57,7 +57,9 @@ File names need to end with <filename>.list</filename> and may only contain letters (a-z and A-Z), digits (0-9), underscore (_), hyphen (-) and period (.) characters. - Otherwise they will be silently ignored.</para> + Otherwise APT will print a notice that it has ignored a file if the file + doesn't match a pattern in the <literal>Dir::Ignore-Files-Silently</literal> + configuration list - in this case it will be silently ignored.</para> </refsect1> <refsect1><title>The deb and deb-src types</title> diff --git a/test/integration/framework b/test/integration/framework index fe1db14bc..e10709079 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -137,7 +137,6 @@ setupenvironment() { echo "APT::Get::Show-User-Simulation-Note \"false\";" >> aptconfig.conf echo "Dir::Bin::Methods \"${BUILDDIRECTORY}/methods\";" >> aptconfig.conf echo "Dir::Bin::dpkg \"fakeroot\";" >> aptconfig.conf - echo "Dir::Bin::methods \"${BUILDDIRECTORY}/methods\";" >> aptconfig.conf echo "DPKG::options:: \"dpkg\";" >> aptconfig.conf echo "DPKG::options:: \"--root=${TMPWORKINGDIRECTORY}/rootdir\";" >> aptconfig.conf echo "DPKG::options:: \"--force-not-root\";" >> aptconfig.conf @@ -268,11 +267,14 @@ Package: $NAME" > ${BUILDDIR}/debian/control (cd ${BUILDDIR}; dpkg-gencontrol -DArchitecture=$ARCH) (cd ${BUILDDIR}/debian/tmp; md5sum $(find usr/ -type f) > DEBIAN/md5sums) - dpkg-deb --build ${BUILDDIR}/debian/tmp ${BUILDDIR}/.. > /dev/null + dpkg-deb --build ${BUILDDIR}/debian/tmp ${BUILDDIR}/.. 2> /dev/null > /dev/null echo "pool/${NAME}_${VERSION}_${ARCH}.deb" >> ${BUILDDIR}/../${RELEASE}.${DISTSECTION}.pkglist for SRC in $SRCS; do echo "pool/${SRC}" >> ${BUILDDIR}/../${RELEASE}.${DISTSECTION}.srclist done + mkdir -p ${BUILDDIR}/../${NAME}_${VERSION} + cp ${BUILDDIR}/debian/changelog ${BUILDDIR}/../${NAME}_${VERSION}/ + cp ${BUILDDIR}/debian/changelog ${BUILDDIR}/../${NAME}_${VERSION}.changelog rm -rf "${BUILDDIR}" msgdone "info" } @@ -624,8 +626,8 @@ testnopackage() { testdpkginstalled() { msgtest "Test for correctly installed package(s) with" "dpkg -l $*" - local PKGS="$(dpkg -l $* | grep '^[a-z]' | grep '^[^i]' | wc -l)" - if [ "$PKGS" != 0 ]; then + local PKGS="$(dpkg -l $* | grep '^i' | wc -l)" + if [ "$PKGS" != $# ]; then echo $PKGS dpkg -l $* | grep '^[a-z]' msgfail @@ -634,9 +636,9 @@ testdpkginstalled() { msgpass } -testdpkgnoninstalled() { - msgtest "Test for correctly non-installed package(s) with" "dpkg -l $*" - local PKGS="$(dpkg -l $* | grep '^[a-z]' | grep '^[^u]' | wc -l)" +testdpkgnotinstalled() { + msgtest "Test for correctly not-installed package(s) with" "dpkg -l $*" + local PKGS="$(dpkg -l $* 2> /dev/null | grep '^i' | wc -l)" if [ "$PKGS" != 0 ]; then echo dpkg -l $* | grep '^[a-z]' diff --git a/test/integration/test-autoremove b/test/integration/test-apt-get-autoremove index 1ca325b29..9dfab19f5 100755 --- a/test/integration/test-autoremove +++ b/test/integration/test-apt-get-autoremove @@ -19,8 +19,8 @@ Architecture: i386 Auto-Installed: 1 ' aptget remove debhelper -y -qq 2>&1 > /dev/null -testdpkgnoninstalled 'debhelper' -testdpkginstalled 'po-debconf unrelated' +testdpkgnotinstalled 'debhelper' +testdpkginstalled 'po-debconf' 'unrelated' echo 'APT::NeverAutoRemove { "^debc.*nf$"; };' > rootdir/etc/apt/apt.conf.d/00autoremove testequal 'Reading package lists... @@ -42,7 +42,7 @@ testdpkginstalled "po-debconf" rm rootdir/etc/apt/apt.conf.d/00autoremove aptget autoremove -y -qq 2>&1 > /dev/null -testdpkgnoninstalled 'po-debconf' +testdpkgnotinstalled 'po-debconf' testfileequal 'rootdir/var/lib/apt/extended_states' '' diff --git a/test/integration/test-apt-get-changelog b/test/integration/test-apt-get-changelog new file mode 100755 index 000000000..0a80cc08c --- /dev/null +++ b/test/integration/test-apt-get-changelog @@ -0,0 +1,36 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture "i386" + +buildsimplenativepackage 'apt' 'all' '1.0' 'stable' + +setupaptarchive +changetowebserver +aptget update -qq + +echo 'Apt::Changelogs::Server "http://localhost:8080/";' >> ./aptconfig.conf + +testequal "'http://localhost:8080//pool/apt_1.0/changelog'" aptget changelog apt --print-uris + +aptget changelog apt -qq > apt.changelog +testfileequal 'apt.changelog' "$(cat aptarchive/pool/apt_1.0/changelog)" +rm apt.changelog + +aptget changelog apt -d -qq +testfileequal 'apt.changelog' "$(cat aptarchive/pool/apt_1.0/changelog)" +rm apt.changelog aptarchive/pool/apt_1.0/changelog + +aptget changelog apt -qq -o APT::Changelogs::Server='http://not-on-the-main-server:8080/' > apt.changelog +testfileequal 'apt.changelog' "$(cat aptarchive/pool/apt_1.0.changelog)" +rm apt.changelog + +aptget changelog apt -d -qq +testfileequal 'apt.changelog' "$(cat aptarchive/pool/apt_1.0.changelog)" +rm apt.changelog aptarchive/pool/apt_1.0.changelog + +testequal 'E: changelog download failed' aptget changelog apt -qq -o APT::Changelogs::Server='http://not-on-the-main-server:8080/' diff --git a/test/integration/test-apt-get-download b/test/integration/test-apt-get-download new file mode 100755 index 000000000..7db93c32f --- /dev/null +++ b/test/integration/test-apt-get-download @@ -0,0 +1,29 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture "i386" + +buildsimplenativepackage 'apt' 'all' '1.0' 'stable' +buildsimplenativepackage 'apt' 'all' '2.0' 'unstable' + +setupaptarchive + +testdownload() { + msgtest 'Test download of package file' $1 + if [ -z "$3" ]; then + aptget download ${2} + else + aptget download ${2}/${3} + fi + test -f $1 && msgpass || msgfail +} + +testdownload apt_1.0_all.deb apt stable +testdownload apt_2.0_all.deb apt + +DEBFILE="$(readlink -f aptarchive)/pool/apt_2.0_all.deb" +testequal "'file://${DEBFILE}' apt_2.0_all.deb $(stat -c%s $DEBFILE) sha256:$(sha256sum $DEBFILE | cut -d' ' -f 1)" aptget download apt --print-uris diff --git a/test/integration/test-bug-549968-install-depends-of-not-installed b/test/integration/test-bug-549968-install-depends-of-not-installed new file mode 100755 index 000000000..864dd340a --- /dev/null +++ b/test/integration/test-bug-549968-install-depends-of-not-installed @@ -0,0 +1,26 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture "i386" + +insertpackage 'unstable' 'libc6' 'all' '1.0' +insertpackage 'unstable' 'coolstuff' 'all' '1.0' 'Recommends: extracoolstuff' +insertpackage 'unstable' 'extracoolstuff' 'all' '1.0' 'Depends: libc6' + +setupaptarchive + +# We check the Markers here as the autoremove nuker will also +# prevent it, but to late - its better to fail earlier +testequal 'Reading package lists... +Building dependency tree... + MarkInstall coolstuff [ i386 ] < none -> 1.0 > ( other ) FU=1 + Hold prevents MarkInstall of extracoolstuff [ i386 ] < none -> 1.0 > ( other ) FU=0 +Package extracoolstuff is not installed, so not removed +The following NEW packages will be installed: + coolstuff +0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +Inst coolstuff (1.0 unstable [all]) +Conf coolstuff (1.0 unstable [all])' aptget install coolstuff extracoolstuff- -o Debug::pkgDepCache::Marker=1 -s diff --git a/test/integration/test-bug-611729-mark-as-manual b/test/integration/test-bug-611729-mark-as-manual new file mode 100755 index 000000000..9c1cd3d1b --- /dev/null +++ b/test/integration/test-bug-611729-mark-as-manual @@ -0,0 +1,105 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture "i386" + +buildsimplenativepackage "peace-dpkg" "all" "1.0" "stable" + +buildsimplenativepackage "a" "all" "1.0" "stable" "Depends: b" +buildsimplenativepackage "b" "all" "1.0" "stable" +buildsimplenativepackage "c" "all" "1.0" "stable" "Depends: b" + +setupaptarchive + +# dpkg freaks out if the last package is removed so keep one around +aptget install peace-dpkg -y -qq 2>&1 > /dev/null +testdpkginstalled peace-dpkg +testfileequal 'rootdir/var/lib/apt/extended_states' '' + +aptget install a -y -qq 2>&1 > /dev/null +testdpkginstalled a b +testdpkgnotinstalled c +testfileequal 'rootdir/var/lib/apt/extended_states' 'Package: b +Architecture: i386 +Auto-Installed: 1 +' + +aptget remove a -y -qq 2>&1 > /dev/null +testdpkgnotinstalled a c +testdpkginstalled b +testfileequal 'rootdir/var/lib/apt/extended_states' 'Package: b +Architecture: i386 +Auto-Installed: 1 +' + +aptget install c -y -qq 2>&1 > /dev/null +testdpkgnotinstalled a +testdpkginstalled b c +testfileequal 'rootdir/var/lib/apt/extended_states' 'Package: b +Architecture: i386 +Auto-Installed: 1 +' + +testequal 'Reading package lists... +Building dependency tree... +Reading state information... +b is already the newest version. +0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget install b --only-upgrade +testfileequal 'rootdir/var/lib/apt/extended_states' 'Package: b +Architecture: i386 +Auto-Installed: 1 +' + +testequal 'Reading package lists... +Building dependency tree... +Reading state information... +b is already the newest version. +0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget install b -d +testfileequal 'rootdir/var/lib/apt/extended_states' 'Package: b +Architecture: i386 +Auto-Installed: 1 +' + +aptget install b --reinstall -y -qq 2>&1 > /dev/null +testdpkgnotinstalled a +testdpkginstalled b c +testfileequal 'rootdir/var/lib/apt/extended_states' 'Package: b +Architecture: i386 +Auto-Installed: 1 +' + +testequal 'Reading package lists... +Building dependency tree... +Reading state information... +b is already the newest version. +b set to manually installed. +0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget install b +testfileequal 'rootdir/var/lib/apt/extended_states' 'Package: b +Architecture: i386 +Auto-Installed: 0 +' + +aptget remove b -y -qq 2>&1 > /dev/null +testdpkgnotinstalled a b c +testfileequal 'rootdir/var/lib/apt/extended_states' '' + +aptget install a b -y -qq 2>&1 > /dev/null +testdpkginstalled a b +testdpkgnotinstalled c +testfileequal 'rootdir/var/lib/apt/extended_states' '' + +aptget purge a b -y -qq 2>&1 > /dev/null +testdpkgnotinstalled a b c +testfileequal 'rootdir/var/lib/apt/extended_states' '' + +aptget install b c -y -qq 2>&1 > /dev/null +testdpkgnotinstalled a +testdpkginstalled b c +testfileequal 'rootdir/var/lib/apt/extended_states' '' + +aptget install a -y -qq 2>&1 > /dev/null +testdpkginstalled a b c +testfileequal 'rootdir/var/lib/apt/extended_states' '' diff --git a/test/integration/test-bug-612099-multiarch-conflicts b/test/integration/test-bug-612099-multiarch-conflicts new file mode 100755 index 000000000..caac75db4 --- /dev/null +++ b/test/integration/test-bug-612099-multiarch-conflicts @@ -0,0 +1,209 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture "i386" "amd64" + +buildsimplenativepackage 'peace-dpkg' 'all' '1.0' 'stable' + +buildsimplenativepackage 'libc6' 'i386' '1.0' 'stable' +buildsimplenativepackage 'libc6' 'amd64' '1.0' 'stable' +buildsimplenativepackage 'libc6' 'all' '2.0' 'testing' + +buildsimplenativepackage 'foobar' 'i386' '1.0' 'stable' 'Depends: libc6' +buildsimplenativepackage 'foobar' 'amd64' '1.0' 'stable' 'Depends: libc6' + +setupaptarchive + +aptget install peace-dpkg:i386 -y -qq 2>&1 > /dev/null +testdpkginstalled peace-dpkg + +aptget install libc6:i386 -t stable -y -qq 2>&1 > /dev/null +testdpkginstalled libc6 +testequal 'Reading package lists... +Building dependency tree... +Reading state information... +The following packages will be REMOVED: + libc6 +The following NEW packages will be installed: + libc6:amd64 +0 upgraded, 1 newly installed, 1 to remove and 0 not upgraded. +Remv libc6 [1.0] +Inst libc6:amd64 (1.0 stable [amd64]) +Conf libc6:amd64 (1.0 stable [amd64])' aptget install libc6:amd64 -s -t stable + +testequal 'Reading package lists... +Building dependency tree... +Reading state information... +The following NEW packages will be installed: + foobar +0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +Inst foobar (1.0 stable [i386]) +Conf foobar (1.0 stable [i386])' aptget install foobar -st stable + +testequal 'Reading package lists... +Building dependency tree... +Reading state information... +The following extra packages will be installed: + libc6:amd64 +The following packages will be REMOVED: + libc6 +The following NEW packages will be installed: + foobar:amd64 libc6:amd64 +0 upgraded, 2 newly installed, 1 to remove and 0 not upgraded. +Remv libc6 [1.0] +Inst libc6:amd64 (1.0 stable [amd64]) +Inst foobar:amd64 (1.0 stable [amd64]) +Conf libc6:amd64 (1.0 stable [amd64]) +Conf foobar:amd64 (1.0 stable [amd64])' aptget install foobar:amd64 -st stable + +# FIXME: libc6:i386 is installed, we are switching to libc6:all +testequal 'Reading package lists... +Building dependency tree... +Reading state information... +The following extra packages will be installed: + libc6 +The following NEW packages will be installed: + foobar libc6 +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst libc6 (2.0 testing, testing [all]) +Inst foobar (1.0 stable [i386]) +Conf libc6 (2.0 testing, testing [all]) +Conf foobar (1.0 stable [i386])' aptget install foobar/stable libc6 -st testing + +# FIXME: libc6:i386 is installed, we are switching to libc6:all +testequal 'Reading package lists... +Building dependency tree... +Reading state information... +The following NEW packages will be installed: + libc6 +0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +Inst libc6 (2.0 testing, testing [all]) +Conf libc6 (2.0 testing, testing [all])' aptget upgrade -t testing -s +aptget upgrade -y -qq 2>&1 > /dev/null +testdpkginstalled libc6 + +testequal 'Reading package lists... +Building dependency tree... +Reading state information... +The following NEW packages will be installed: + foobar +0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +Inst foobar (1.0 stable [i386]) [] +Conf foobar (1.0 stable [i386])' aptget install foobar/stable -st testing + +testequal 'Reading package lists... +Building dependency tree... +Reading state information... +The following NEW packages will be installed: + foobar:amd64 +0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +Inst foobar:amd64 (1.0 stable [amd64]) +Conf foobar:amd64 (1.0 stable [amd64])' aptget install foobar:amd64/stable -st testing + + +# FIXME: the display is a strange (its a downgrade), but the handling itself correct +testequal "Reading package lists... +Building dependency tree... +Reading state information... +Selected version '1.0' (stable [i386]) for 'libc6' +The following packages will be REMOVED: + libc6 +The following NEW packages will be installed: + libc6 +0 upgraded, 1 newly installed, 2 to remove and 0 not upgraded. +Remv libc6 [2.0] +Inst libc6 (1.0 stable [i386]) +Conf libc6 (1.0 stable [i386])" aptget install libc6/stable -s -q=0 + + +buildsimplenativepackage 'libc6-same' 'i386' '1.0' 'stable' 'Multi-Arch: same' +buildsimplenativepackage 'libc6-same' 'amd64' '1.0' 'stable' 'Multi-Arch: same' +buildsimplenativepackage 'libc6-same' 'all' '2.0' 'testing' + +buildsimplenativepackage 'foobar-same' 'i386' '1.0' 'stable' 'Depends: libc6-same' +buildsimplenativepackage 'foobar-same' 'amd64' '1.0' 'stable' 'Depends: libc6-same' + +setupaptarchive + +aptget install libc6-same:i386 -t stable -y -qq 2>&1 > /dev/null +testdpkginstalled libc6-same + +testequal 'Reading package lists... +Building dependency tree... +Reading state information... +The following NEW packages will be installed: + foobar-same +0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +Inst foobar-same (1.0 stable [i386]) +Conf foobar-same (1.0 stable [i386])' aptget install foobar-same -st stable + +testequal 'Reading package lists... +Building dependency tree... +Reading state information... +The following extra packages will be installed: + libc6-same:amd64 +The following NEW packages will be installed: + foobar-same:amd64 libc6-same:amd64 +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst libc6-same:amd64 (1.0 stable [amd64]) +Inst foobar-same:amd64 (1.0 stable [amd64]) +Conf libc6-same:amd64 (1.0 stable [amd64]) +Conf foobar-same:amd64 (1.0 stable [amd64])' aptget install foobar-same:amd64 -st stable + +testequal 'Reading package lists... +Building dependency tree... +Reading state information... +The following NEW packages will be installed: + libc6-same:amd64 +0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +Inst libc6-same:amd64 (1.0 stable [amd64]) +Conf libc6-same:amd64 (1.0 stable [amd64])' aptget install libc6-same:amd64 -s -t stable + +# FIXME: We should test installing libc6-same:amd64 here, but dpkg doesn't allow it currently + +# FIXME: upgrade any to all as above +testequal 'Reading package lists... +Building dependency tree... +Reading state information... +The following NEW packages will be installed: + libc6-same +0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +Inst libc6-same (2.0 testing, testing [all]) +Conf libc6-same (2.0 testing, testing [all])' aptget upgrade -t testing -s +aptget upgrade -y -qq 2>&1 > /dev/null +testdpkginstalled libc6-same + +# FIXME: the display is a strange (its a downgrade), but the handling itself correct +testequal "Reading package lists... +Building dependency tree... +Reading state information... +Selected version '1.0' (stable [i386]) for 'libc6-same' +The following packages will be REMOVED: + libc6-same +The following NEW packages will be installed: + libc6-same +0 upgraded, 1 newly installed, 2 to remove and 0 not upgraded. +Remv libc6-same [2.0] +Inst libc6-same (1.0 stable [i386]) +Conf libc6-same (1.0 stable [i386])" aptget install libc6-same/stable -s -q=0 + +testequal 'Reading package lists... +Building dependency tree... +Reading state information... +The following NEW packages will be installed: + foobar-same +0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +Inst foobar-same (1.0 stable [i386]) [] +Conf foobar-same (1.0 stable [i386])' aptget install foobar-same/stable -st testing + +testequal 'Reading package lists... +Building dependency tree... +Reading state information... +The following NEW packages will be installed: + foobar-same:amd64 +0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +Inst foobar-same:amd64 (1.0 stable [amd64]) +Conf foobar-same:amd64 (1.0 stable [amd64])' aptget install foobar-same:amd64/stable -st testing diff --git a/test/integration/test-changelog b/test/integration/test-changelog deleted file mode 100755 index 292df6e32..000000000 --- a/test/integration/test-changelog +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh -set -e - -TESTDIR=$(readlink -f $(dirname $0)) -. $TESTDIR/framework - -setupenvironment -configarchitecture "i386" - -# this will be valid until ubuntu lucid is EOL (04/2015) -pkgchangelogtest="Package: apt -Architecture: i386 -Version: 0.7.25.3ubuntu7 -Filename: pool/main/a/apt/apt_0.7.25.3ubuntu7_i386.deb -Section: admin -" -cat <<-EOF >aptarchive/Packages -$pkgchangelogtest -EOF - -setupaptarchive - -echo "Apt::Changelogs::Server \"http://changelogs.ubuntu.com/\";" >> ./aptconfig.conf -msgnmsg "apt-get changelog: " -aptget changelog apt -qq > downloaded-changelog -expected="apt (0.7.25.3ubuntu7) lucid; urgency=low" -got="$(head -n1 downloaded-changelog)" -if [ -s downloaded-changelog ] && [ "$got" = "$expected" ]; then - msgpass -else - msgfail - msgwarn "$got != $expected" -fi - diff --git a/test/integration/test-ubuntu-bug-365611-long-package-names b/test/integration/test-ubuntu-bug-365611-long-package-names new file mode 100755 index 000000000..28b55df3b --- /dev/null +++ b/test/integration/test-ubuntu-bug-365611-long-package-names @@ -0,0 +1,11 @@ +#!/bin/sh +set -e + +local TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture "i386" +setupaptarchive + +aptget install $(for i in $(seq 0 1000); do echo -n 'a'; done) 2> longpackagename.log > /dev/null || true +testfileequal 'longpackagename.log' "E: Unable to locate package $(for i in $(seq 0 1000); do echo -n 'a'; done)" |