From: David Kalnischkies Date: Tue, 22 Feb 2011 14:05:01 +0000 (+0100) Subject: * ftparchive/multicompress.cc, apt-inst/deb/debfile.cc: X-Git-Tag: 0.8.12~4^2~13 X-Git-Url: https://git.saurik.com/apt.git/commitdiff_plain/b7080ced608f012aee2566afc724c3727e75fc1b?hp=-c * ftparchive/multicompress.cc, apt-inst/deb/debfile.cc: - support xz compressor to create xz-compressed Indexes and be able to open data.tar.xz files * ftparchive/writer.cc: - include xz-compressed Packages and Sources files in Release file --- b7080ced608f012aee2566afc724c3727e75fc1b diff --combined debian/changelog index bbb973b8f,ebea1dac8..92ae058c5 --- a/debian/changelog +++ b/debian/changelog @@@ -1,212 -1,25 +1,216 @@@ -apt (0.8.10.3+squeeze1) UNRELEASED; urgency=low - - [ Michael Vogt ] - * debian/control: - - make Vcs-Bzr point to http://bzr.debian.org/apt/apt/debian-squeeze - branch +apt (0.8.11.6) UNRELEASED; urgency=low [ Christian Perrier ] * Fix error in French translation of manpages (apt_preferences(5)). Merci, Rémi Vanicat. Closes: #613689 + * Complete French manpage translation [ David Kalnischkies ] - * apt-pkg/contrib/fileutl.cc: - - reorder the loaded filesize bytes for big endian (Closes: #612986) - Thanks to Jörg Sommer for the detailed analyse! + * ftparchive/multicompress.cc, apt-inst/deb/debfile.cc: + - support xz compressor to create xz-compressed Indexes and be able + to open data.tar.xz files * ftparchive/writer.cc: + - ensure that Date and Valid-Until time strings are not localised + - add options to disable specific checksums for Indexes + - include xz-compressed Packages and Sources files in Release file - -- David Kalnischkies Tue, 22 Feb 2011 14:48:21 +0100 - -- David Kalnischkies Tue, 22 Feb 2011 14:51:32 +0100 ++ -- David Kalnischkies Tue, 22 Feb 2011 14:59:51 +0100 + +apt (0.8.11.5) unstable; urgency=low + + [ Christian Perrier ] + * Add missing dot in French translation of manpages. Merci, Olivier + Humbert. + * French translation update + * French manpages translation update + + [ David Kalnischkies ] + * apt-pkg/depcache.cc: + - party revert fix in 0.8.11.2 which marked all packages as manual + installed if the FromUser bit is set in the MarkInstall call. + The default for this bit is true and aptitude depends on the old + behavior so the package is only marked as manual if its not marked + ("old" behavior) or if automatic installation is enabled - which + aptitude disables always (see also #613775) + + -- David Kalnischkies Thu, 17 Feb 2011 15:16:31 +0100 + +apt (0.8.11.4) unstable; urgency=low + + [ David Kalnischkies ] + * apt-pkg/contrib/error.cc: + - ensure that va_list is not invalid in second try + * cmdline/apt-get.cc: + - don't remove new dependencies of garbage packages (Closes: #613420) + + [ Michael Vogt ] + * test/integration/* + - fix dashish in the integration tests + + -- Michael Vogt Wed, 16 Feb 2011 14:36:03 +0100 + +apt (0.8.11.3) unstable; urgency=low + + * apt-pkg/contrib/fileutl.cc: + - really detect bigendian machines by including config.h, + so we can really (Closes: #612986) + * apt-pkg/contrib/mmap.cc: + - Base has as 'valid' failure states 0 and -1 so add a simple + validData method to check for failure states + + -- David Kalnischkies Mon, 14 Feb 2011 16:58:03 +0100 + +apt (0.8.11.2) unstable; urgency=low + + [ Michael Vogt ] + * merged lp:~evfool/apt/fix641673: + - String-fix in the source and the translations for the grammatical + mistake reported in bug LP: #641673, thanks to Robert Roth + * merged lp:~evfool/apt/fix418552: + - Grammar fix for bug LP: #418552, thanks to Robert Roth + + [ David Kalnischkies ] + * cmdline/apt-get.cc: + - add --install-suggests option (Closes: #473089) + * apt-pkg/depcache.cc: + - mark a package which was requested to be installed on commandline + always as manual regardless if it is already marked or not as the + marker could be lost later by the removal of rdepends (Closes: #612557) + * methods/rred.cc: + - read patch into MMap only if we work on uncompressed patches + - update size of dynamic MMap as we write in from the outside + * apt-pkg/contrib/mmap.cc: + - do not try to free the mapping if its is unset + * apt-pkg/contrib/fileutl.cc: + - reorder the loaded filesize bytes for big endian (Closes: #612986) + Thanks to Jörg Sommer for the detailed analyse! + + -- Michael Vogt Mon, 14 Feb 2011 12:07:18 +0100 + +apt (0.8.11.1) unstable; urgency=low + + [ Stefan Lippers-Hollmann ] + * cmdline/apt-key: + - fix root test which prevented setting of trustdb-name + which lets gpg fail if it adds/remove keys from trusted.gpg + as it tries to open the (maybe) not existent /root/.gnupg + + [ David Kalnischkies ] + * debian/apt.symbols: + - add more arch dependent symbols + + -- Michael Vogt Wed, 09 Feb 2011 17:49:59 +0100 + +apt (0.8.11) unstable; urgency=low + + [ David Kalnischkies ] + * apt-pkg/depcache.cc: + - 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 + - show dependencies of essential packages which are going to remove + only if they cause the remove of this essential (Closes: #601961) + - keep not installed garbage packages uninstalled instead of showing + in the autoremove section and installing those (Closes: #604222) + - change pkg/release behavior to use the new SetCandidateRelease + 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 + - depend on dpkg-dev (>= 1.15.8) to have c++ symbol mangling + * apt-pkg/contrib/fileutl.cc: + - add a RealFileExists method and check that your configuration files + are real files to avoid endless loops if not (Closes: #604401) + - ignore non-regular files in GetListOfFilesInDir (Closes: #594694) + * apt-pkg/contrib/weakptr.h: + - include stddefs.h to fix compile error (undefined NULL) with gcc-4.6 + * methods/https.cc: + - fix CURLOPT_SSL_VERIFYHOST by really passing 2 to it if enabled + * deb/dpkgpm.cc: + - fix popen/fclose mismatch reported by cppcheck. Thanks to Petter + Reinholdtsen for report and patch! (Closes: #607803) + * doc/apt.conf.5.xml: + - fix multipl{y,e} spelling error reported by Jakub Wilk (Closes: #607636) + * apt-inst/contrib/extracttar.cc: + - let apt-utils work with encoded tar headers if uid/gid are large. + Thanks to Nobuhiro Hayashi for the patch! (Closes: #330162) + * apt-pkg/cacheiterator.h: + - do not segfault if cache is not build (Closes: #254770) + * doc/apt-get.8.xml: + - 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 + - show differences in the symbol files, but never fail + * pre-build.sh: + - remove as it is not needed for a working 'bzr bd' + * debian/{apt,apt-utils}.symbols: + - ship experimental unmangled c++ symbol files + * methods/rred.cc: + - operate optional on gzip compressed pdiffs + * apt-pkg/acquire-item.cc: + - don't uncompress downloaded pdiff files before feeding it to rred + - try downloading clearsigned InRelease before trying Release.gpg + - change the internal handling of Extensions in pkgAcqIndex + - add a special uncompressed compression type to prefer those files + - download and use i18n/Index to choose which Translations to download + * cmdline/apt-key: + - don't set trustdb-name as non-root so 'list' and 'finger' + can be used without being root (Closes: #393005, #592107) + * apt-pkg/deb/deblistparser.cc: + - rewrite LoadReleaseInfo to cope with clearsigned Releasefiles + * ftparchive/writer.cc: + - add config option to search for more patterns in release command + - include Index files by default in the Release file + * methods/{gzip,bzip}.cc: + - 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: + - do not hang if Acquire::http::ProxyAutoDetect can not be + executed or returns no data (LP: #654393) + * debian/apt.conf.autoremove: + - never autoremove the GNU/Hurd kernel (closes: #588423), thanks + to Guillem Jover + * apt-pkg/cdrom.cc, apt-pkg/init.cc, methods/cdrom.cc: + - use /media/cdrom as default mountoint (closes: #611569) + * cmdline/apt-get.cc: + - add apt-get changelog (closes: #526990) + - add apt-get download (closes: #82738) + + [ Martin Pitt ] + * test/integration/test-compressed-indexes, test/test-indexes.sh: + - Explicitly disable compressed indexes at the start. This ensures that we + will actually test uncompressed indexes regardless of the internal + default value of Acquire::GzipIndexes. + + -- Michael Vogt Tue, 08 Feb 2011 12:58:12 +0100 apt (0.8.10.3) unstable; urgency=low diff --combined ftparchive/writer.cc index d3a19ca28,086c44390..9462ebe27 --- a/ftparchive/writer.cc +++ b/ftparchive/writer.cc @@@ -59,10 -59,6 +59,10 @@@ FTWScanner::FTWScanner(string const &Ar { ErrorPrinted = false; NoLinkAct = !_config->FindB("APT::FTPArchive::DeLinkAct",true); + + DoMD5 = _config->FindB("APT::FTPArchive::MD5",true); + DoSHA1 = _config->FindB("APT::FTPArchive::SHA1",true); + DoSHA256 = _config->FindB("APT::FTPArchive::SHA256",true); } /*}}}*/ // FTWScanner::Scanner - FTW Scanner /*{{{*/ @@@ -310,11 -306,11 +310,11 @@@ PackagesWriter::PackagesWriter(string c Output = stdout; SetExts(".deb .udeb"); DeLinkLimit = 0; - + // Process the command line options - DoMD5 = _config->FindB("APT::FTPArchive::MD5",true); - DoSHA1 = _config->FindB("APT::FTPArchive::SHA1",true); - DoSHA256 = _config->FindB("APT::FTPArchive::SHA256",true); + DoMD5 = _config->FindB("APT::FTPArchive::Packages::MD5",DoMD5); + DoSHA1 = _config->FindB("APT::FTPArchive::Packages::SHA1",DoSHA1); + DoSHA256 = _config->FindB("APT::FTPArchive::Packages::SHA256",DoSHA256); DoAlwaysStat = _config->FindB("APT::FTPArchive::AlwaysStat", false); DoContents = _config->FindB("APT::FTPArchive::Contents",true); NoOverride = _config->FindB("APT::FTPArchive::NoOverrideMsg",false); @@@ -439,12 -435,9 +439,12 @@@ bool PackagesWriter::DoPackage(string F unsigned int End = 0; SetTFRewriteData(Changes[End++], "Size", Size); - SetTFRewriteData(Changes[End++], "MD5sum", Db.MD5Res.c_str()); - SetTFRewriteData(Changes[End++], "SHA1", Db.SHA1Res.c_str()); - SetTFRewriteData(Changes[End++], "SHA256", Db.SHA256Res.c_str()); + if (DoMD5 == true) + SetTFRewriteData(Changes[End++], "MD5sum", Db.MD5Res.c_str()); + if (DoSHA1 == true) + SetTFRewriteData(Changes[End++], "SHA1", Db.SHA1Res.c_str()); + if (DoSHA256 == true) + SetTFRewriteData(Changes[End++], "SHA256", Db.SHA256Res.c_str()); SetTFRewriteData(Changes[End++], "Filename", NewFileName.c_str()); SetTFRewriteData(Changes[End++], "Priority", OverItem->Priority.c_str()); SetTFRewriteData(Changes[End++], "Status", 0); @@@ -566,9 -559,6 +566,9 @@@ SourcesWriter::SourcesWriter(string con BufSize = 0; // Process the command line options + DoMD5 = _config->FindB("APT::FTPArchive::Sources::MD5",DoMD5); + DoSHA1 = _config->FindB("APT::FTPArchive::Sources::SHA1",DoSHA1); + DoSHA256 = _config->FindB("APT::FTPArchive::Sources::SHA256",DoSHA256); NoOverride = _config->FindB("APT::FTPArchive::NoOverrideMsg",false); // Read the override file @@@ -618,17 -608,13 +618,17 @@@ bool SourcesWriter::DoPackage(string Fi // Hash the file char *Start = Buffer; char *BlkEnd = Buffer + St.st_size; - MD5Summation MD5; - MD5.Add((unsigned char *)Start,BlkEnd - Start); + MD5Summation MD5; SHA1Summation SHA1; SHA256Summation SHA256; - SHA1.Add((unsigned char *)Start,BlkEnd - Start); - SHA256.Add((unsigned char *)Start,BlkEnd - Start); + + if (DoMD5 == true) + MD5.Add((unsigned char *)Start,BlkEnd - Start); + if (DoSHA1 == true) + SHA1.Add((unsigned char *)Start,BlkEnd - Start); + if (DoSHA256 == true) + SHA256.Add((unsigned char *)Start,BlkEnd - Start); // Add an extra \n to the end, just in case *BlkEnd++ = '\n'; @@@ -722,19 -708,19 +722,19 @@@ // Add the dsc to the files hash list string const strippedName = flNotDir(FileName); std::ostringstream ostreamFiles; - if (Tags.Exists("Files")) + if (DoMD5 == true && Tags.Exists("Files")) ostreamFiles << "\n " << string(MD5.Result()) << " " << St.st_size << " " << strippedName << "\n " << Tags.FindS("Files"); string const Files = ostreamFiles.str(); std::ostringstream ostreamSha1; - if (Tags.Exists("Checksums-Sha1")) + if (DoSHA1 == true && Tags.Exists("Checksums-Sha1")) ostreamSha1 << "\n " << string(SHA1.Result()) << " " << St.st_size << " " << strippedName << "\n " << Tags.FindS("Checksums-Sha1"); string const ChecksumsSha1 = ostreamSha1.str(); std::ostringstream ostreamSha256; - if (Tags.Exists("Checksums-Sha256")) + if (DoSHA256 == true && Tags.Exists("Checksums-Sha256")) ostreamSha256 << "\n " << string(SHA256.Result()) << " " << St.st_size << " " << strippedName << "\n " << Tags.FindS("Checksums-Sha256"); string const ChecksumsSha256 = ostreamSha256.str(); @@@ -788,12 -774,9 +788,12 @@@ unsigned int End = 0; SetTFRewriteData(Changes[End++],"Source",Package.c_str(),"Package"); - SetTFRewriteData(Changes[End++],"Files",Files.c_str()); - SetTFRewriteData(Changes[End++],"Checksums-Sha1",ChecksumsSha1.c_str()); - SetTFRewriteData(Changes[End++],"Checksums-Sha256",ChecksumsSha256.c_str()); + if (Files.empty() == false) + SetTFRewriteData(Changes[End++],"Files",Files.c_str()); + if (ChecksumsSha1.empty() == false) + SetTFRewriteData(Changes[End++],"Checksums-Sha1",ChecksumsSha1.c_str()); + if (ChecksumsSha256.empty() == false) + SetTFRewriteData(Changes[End++],"Checksums-Sha256",ChecksumsSha256.c_str()); if (Directory != "./") SetTFRewriteData(Changes[End++],"Directory",Directory.c_str()); SetTFRewriteData(Changes[End++],"Priority",BestPrio.c_str()); @@@ -924,27 -907,21 +924,29 @@@ bool ContentsWriter::ReadFromPkgs(strin /* */ ReleaseWriter::ReleaseWriter(string const &DB) { - AddPattern("Packages"); - AddPattern("Packages.gz"); - AddPattern("Packages.bz2"); - AddPattern("Packages.lzma"); - AddPattern("Packages.xz"); - AddPattern("Sources"); - AddPattern("Sources.gz"); - AddPattern("Sources.bz2"); - AddPattern("Sources.lzma"); - AddPattern("Sources.xz"); - AddPattern("Release"); - AddPattern("md5sum.txt"); + if (_config->FindB("APT::FTPArchive::Release::Default-Patterns", true) == true) + { + AddPattern("Packages"); + AddPattern("Packages.gz"); + AddPattern("Packages.bz2"); + AddPattern("Packages.lzma"); ++ AddPattern("Packages.xz"); + AddPattern("Sources"); + AddPattern("Sources.gz"); + AddPattern("Sources.bz2"); + AddPattern("Sources.lzma"); ++ AddPattern("Sources.xz"); + AddPattern("Release"); + AddPattern("Index"); + AddPattern("md5sum.txt"); + } + AddPatterns(_config->FindVector("APT::FTPArchive::Release::Patterns")); Output = stdout; time_t const now = time(NULL); + + setlocale(LC_TIME, "C"); + char datestr[128]; if (strftime(datestr, sizeof(datestr), "%a, %d %b %Y %H:%M:%S UTC", gmtime(&now)) == 0) @@@ -961,8 -938,6 +963,8 @@@ validstr[0] = '\0'; } + setlocale(LC_TIME, ""); + map Fields; Fields["Origin"] = ""; Fields["Label"] = ""; @@@ -986,10 -961,6 +988,10 @@@ fprintf(Output, "%s: %s\n", (*I).first.c_str(), Value.c_str()); } + + DoMD5 = _config->FindB("APT::FTPArchive::Release::MD5",DoMD5); + DoSHA1 = _config->FindB("APT::FTPArchive::Release::SHA1",DoSHA1); + DoSHA256 = _config->FindB("APT::FTPArchive::Release::SHA256",DoSHA256); } /*}}}*/ // ReleaseWriter::DoPackage - Process a single package /*{{{*/ @@@ -1022,26 -993,19 +1024,26 @@@ bool ReleaseWriter::DoPackage(string Fi CheckSums[NewFileName].size = fd.Size(); - MD5Summation MD5; - MD5.AddFD(fd.Fd(), fd.Size()); - CheckSums[NewFileName].MD5 = MD5.Result(); - - fd.Seek(0); - SHA1Summation SHA1; - SHA1.AddFD(fd.Fd(), fd.Size()); - CheckSums[NewFileName].SHA1 = SHA1.Result(); - - fd.Seek(0); - SHA256Summation SHA256; - SHA256.AddFD(fd.Fd(), fd.Size()); - CheckSums[NewFileName].SHA256 = SHA256.Result(); + if (DoMD5 == true) + { + MD5Summation MD5; + MD5.AddFD(fd.Fd(), fd.Size()); + CheckSums[NewFileName].MD5 = MD5.Result(); + fd.Seek(0); + } + if (DoSHA1 == true) + { + SHA1Summation SHA1; + SHA1.AddFD(fd.Fd(), fd.Size()); + CheckSums[NewFileName].SHA1 = SHA1.Result(); + fd.Seek(0); + } + if (DoSHA256 == true) + { + SHA256Summation SHA256; + SHA256.AddFD(fd.Fd(), fd.Size()); + CheckSums[NewFileName].SHA256 = SHA256.Result(); + } fd.Close(); @@@ -1053,40 -1017,37 +1055,40 @@@ // --------------------------------------------------------------------- void ReleaseWriter::Finish() { - fprintf(Output, "MD5Sum:\n"); - for(map::const_iterator I = CheckSums.begin(); - I != CheckSums.end(); - ++I) + if (DoMD5 == true) { - fprintf(Output, " %s %16ld %s\n", - (*I).second.MD5.c_str(), - (*I).second.size, - (*I).first.c_str()); + fprintf(Output, "MD5Sum:\n"); + for(map::const_iterator I = CheckSums.begin(); + I != CheckSums.end(); ++I) + { + fprintf(Output, " %s %16ld %s\n", + (*I).second.MD5.c_str(), + (*I).second.size, + (*I).first.c_str()); + } } - - fprintf(Output, "SHA1:\n"); - for(map::const_iterator I = CheckSums.begin(); - I != CheckSums.end(); - ++I) + if (DoSHA1 == true) { - fprintf(Output, " %s %16ld %s\n", - (*I).second.SHA1.c_str(), - (*I).second.size, - (*I).first.c_str()); + fprintf(Output, "SHA1:\n"); + for(map::const_iterator I = CheckSums.begin(); + I != CheckSums.end(); ++I) + { + fprintf(Output, " %s %16ld %s\n", + (*I).second.SHA1.c_str(), + (*I).second.size, + (*I).first.c_str()); + } } - - fprintf(Output, "SHA256:\n"); - for(map::const_iterator I = CheckSums.begin(); - I != CheckSums.end(); - ++I) + if (DoSHA256 == true) { - fprintf(Output, " %s %16ld %s\n", - (*I).second.SHA256.c_str(), - (*I).second.size, - (*I).first.c_str()); + fprintf(Output, "SHA256:\n"); + for(map::const_iterator I = CheckSums.begin(); + I != CheckSums.end(); ++I) + { + fprintf(Output, " %s %16ld %s\n", + (*I).second.SHA256.c_str(), + (*I).second.size, + (*I).first.c_str()); + } } } - diff --combined test/integration/framework index 7e1d25e61,6545cf3ce..71e7e476c --- a/test/integration/framework +++ b/test/integration/framework @@@ -39,10 -39,6 +39,10 @@@ f if [ $MSGLEVEL -le 2 ]; then msgmsg() { true; } msgnmsg() { true; } + msgtest() { true; } + msgpass() { echo -n " ${CPASS}P${CNORMAL}" >&2; } + msgskip() { echo -n " ${CWARNING}S${CNORMAL}" >&2; } + msgfail() { echo -n " ${CFAIL}FAIL${CNORMAL}" >&2; } fi if [ $MSGLEVEL -le 3 ]; then msginfo() { true; } @@@ -79,24 -75,9 +79,24 @@@ aptcache() { runapt apt-cache $*; aptget() { runapt apt-get $*; } aptftparchive() { runapt apt-ftparchive $*; } aptkey() { runapt apt-key $*; } +aptmark() { runapt apt-mark $*; } dpkg() { $(which 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} $(which aptitude) $* + elif [ -f ../aptconfig.conf ]; then + APT_CONFIG=../aptconfig.conf LD_LIBRARY_PATH=${BUILDDIRECTORY} $(which aptitude) $* + else + LD_LIBRARY_PATH=${BUILDDIRECTORY} $(which aptitude) $* + fi +} + +addtrap() { + CURRENTTRAP="$CURRENTTRAP $1" + trap "$CURRENTTRAP" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM +} setupenvironment() { TMPWORKINGDIRECTORY=$(mktemp -d) @@@ -105,7 -86,8 +105,7 @@@ BUILDDIRECTORY="${TESTDIR}/../../build/bin" test -x "${BUILDDIRECTORY}/apt-get" || msgdie "You need to build tree first" local OLDWORKINGDIRECTORY=$(pwd) - CURRENTTRAP="cd /; rm -rf $TMPWORKINGDIRECTORY; cd $OLDWORKINGDIRECTORY" - trap "$CURRENTTRAP" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM + addtrap "cd /; rm -rf $TMPWORKINGDIRECTORY; cd $OLDWORKINGDIRECTORY;" cd $TMPWORKINGDIRECTORY mkdir rootdir aptarchive keys cd rootdir @@@ -125,10 -107,8 +125,10 @@@ local PACKAGESFILE=$(echo "$(basename $0)" | sed -e 's/^test-/Packages-/' -e 's/^skip-/Packages-/') if [ -f "${TESTDIR}/${PACKAGESFILE}" ]; then cp "${TESTDIR}/${PACKAGESFILE}" aptarchive/Packages - else - touch aptarchive/Packages + fi + local SOURCESSFILE=$(echo "$(basename $0)" | sed -e 's/^test-/Sources-/' -e 's/^skip-/Sources-/') + if [ -f "${TESTDIR}/${SOURCESSFILE}" ]; then + cp "${TESTDIR}/${SOURCESSFILE}" aptarchive/Sources fi cp $(find $TESTDIR -name '*.pub' -o -name '*.sec') keys/ ln -s ${TMPWORKINGDIRECTORY}/keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg @@@ -136,14 -116,12 +136,14 @@@ echo "Dir::state::status \"${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status\";" >> aptconfig.conf echo "Debug::NoLocking \"true\";" >> aptconfig.conf 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 "DPKG::options:: \"dpkg\";" >> aptconfig.conf echo "DPKG::options:: \"--root=${TMPWORKINGDIRECTORY}/rootdir\";" >> aptconfig.conf echo "DPKG::options:: \"--force-not-root\";" >> aptconfig.conf echo "DPKG::options:: \"--force-bad-path\";" >> aptconfig.conf echo "DPKG::options:: \"--log=${TMPWORKINGDIRECTORY}/rootdir/var/log/dpkg.log\";" >> aptconfig.conf + echo 'quiet::NoUpdate "true";' >> aptconfig.conf export LC_ALL=C msgdone "info" } @@@ -189,12 -167,8 +189,12 @@@ Maintainer: Joe Sixpack = 7) Standards-Version: 3.9.1 -Package: $NAME -Architecture: $ARCH" > debian/control +Package: $NAME" > debian/control + if [ "$ARCH" = 'all' ]; then + echo "Architecture: all" >> debian/control + else + echo "Architecture: any" >> debian/control + fi test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> debian/control if [ -z "$DESCRIPTION" ]; then echo "Description: an autogenerated dummy ${NAME}=${VERSION}/${RELEASE} @@@ -224,60 -198,9 +224,60 @@@ buildsimplenativepackage() else DISTSECTION="$(echo "$SECTION" | cut -d'/' -f 1)" fi - setupsimplenativepackage "$NAME" "$ARCH" "$VERSION" "$RELEASE" "$DEPENDENCIES" "$DESCRIPTION" "$SECTION" - buildpackage "incoming/${NAME}-${VERSION}" "$RELEASE" "$DISTSECTION" - rm -rf "incoming/${NAME}-${VERSION}" + local BUILDDIR=${TMPWORKINGDIRECTORY}/incoming/${NAME}-${VERSION} + + msgninfo "Build package ${NAME} in ${VERSION} for ${RELEASE} in ${DISTSECTION}… " + mkdir -p $BUILDDIR/debian/source + echo "* most suckless software product ever" > ${BUILDDIR}/FEATURES + echo "#!/bin/sh +echo '$NAME says \"Hello!\"'" > ${BUILDDIR}/${NAME} + + echo "Copyleft by Joe Sixpack $(date +%Y)" > ${BUILDDIR}/debian/copyright + echo "$NAME ($VERSION) $RELEASE; urgency=low + + * Initial release + + -- Joe Sixpack $(date -R)" > ${BUILDDIR}/debian/changelog + echo "Source: $NAME +Section: $SECTION +Priority: optional +Maintainer: Joe Sixpack +Standards-Version: 3.9.1 + +Package: $NAME" > ${BUILDDIR}/debian/control + if [ "$ARCH" = 'all' ]; then + echo "Architecture: all" >> ${BUILDDIR}/debian/control + else + echo "Architecture: any" >> ${BUILDDIR}/debian/control + fi + test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> ${BUILDDIR}/debian/control + if [ -z "$DESCRIPTION" ]; then + echo "Description: an autogenerated dummy ${NAME}=${VERSION}/${RELEASE} + If you find such a package installed on your system, + YOU did something horribly wrong! They are autogenerated + und used only by testcases for APT and surf no other propose…" >> ${BUILDDIR}/debian/control + else + echo "Description: $DESCRIPTION" >> ${BUILDIR}/debian/control + fi + echo '3.0 (native)' > ${BUILDDIR}/debian/source/format + local SRCS="$( (cd ${BUILDDIR}/..; dpkg-source -b ${NAME}-${VERSION} 2>&1) | grep '^dpkg-source: info: building' | grep -o '[a-z0-9._+~-]*$')" + + mkdir -p ${BUILDDIR}/debian/tmp/DEBIAN ${BUILDDIR}/debian/tmp/usr/share/doc/${NAME} ${BUILDDIR}/debian/tmp/usr/bin + cp ${BUILDDIR}/debian/copyright ${BUILDDIR}/debian/changelog ${BUILDDIR}/FEATURES ${BUILDDIR}/debian/tmp/usr/share/doc/${NAME} + cp ${BUILDDIR}/${NAME} ${BUILDDIR}/debian/tmp/usr/bin + (cd ${BUILDDIR}; dpkg-gencontrol -DArchitecture=$ARCH) + (cd ${BUILDDIR}/debian/tmp; md5sum $(find usr/ -type f) > DEBIAN/md5sums) + + 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" } buildpackage() { @@@ -328,11 -251,9 +328,11 @@@ createaptftparchiveconfig() echo -n '"; }; Default { - Packages::Compress ". gzip bzip2 lzma"; - Sources::Compress ". gzip bzip2 lzma"; - Contents::Compress ". gzip bzip2 lzma"; - Translation::Compress ". gzip bzip2 lzma"; + Packages::Compress ". gzip bzip2 lzma xz"; + Sources::Compress ". gzip bzip2 lzma xz"; + Contents::Compress ". gzip bzip2 lzma xz"; ++ Translation::Compress ". gzip bzip2 lzma xz"; + LongDescription "false"; }; TreeDefault { Directory "pool/"; @@@ -386,38 -307,6 +386,38 @@@ buildaptftparchivedirectorystructure() done } +insertpackage() { + local RELEASE="$1" + local NAME="$2" + local ARCH="$3" + local VERSION="$4" + local DEPENDENCIES="$5" + local ARCHS="$ARCH" + if [ "$ARCHS" = "all" ]; then + ARCHS="$(aptconfig dump | grep APT::Architecture | cut -d'"' -f 2 | sed '/^$/ d' | sort | uniq | tr '\n' ' ')" + fi + for BUILDARCH in $ARCHS; do + local PPATH="aptarchive/dists/${RELEASE}/main/binary-${BUILDARCH}" + mkdir -p $PPATH aptarchive/dists/${RELEASE}/main/source + touch aptarchive/dists/${RELEASE}/main/source/Sources + local FILE="${PPATH}/Packages" + echo "Package: $NAME +Priority: optional +Section: other +Installed-Size: 42 +Maintainer: Joe Sixpack +Architecture: $ARCH +Version: $VERSION +Filename: pool/main/${NAME}/${NAME}_${VERSION}_${ARCH}.deb" >> $FILE + test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> $FILE + echo "Description: an autogenerated dummy ${NAME}=${VERSION}/${RELEASE} + If you find such a package installed on your system, + YOU did something horribly wrong! They are autogenerated + und used only by testcases for APT and surf no other propose… +" >> $FILE + done +} + buildaptarchivefromincoming() { msginfo "Build APT archive for ${CCMD}$(basename $0)${CINFO} based on incoming packages…" cd aptarchive @@@ -426,47 -315,38 +426,48 @@@ [ -e dists ] || buildaptftparchivedirectorystructure msgninfo "\tGenerate Packages, Sources and Contents files… " aptftparchive -qq generate ftparchive.conf - msgdone "info" - msgninfo "\tGenerate Release files… " - for dir in $(find ./dists -mindepth 1 -maxdepth 1 -type d); do - aptftparchive -qq release $dir -o APT::FTPArchive::Release::Codename="$(echo "$dir" | cut -d'/' -f 3)" | sed -e '/0 Release$/ d' > $dir/Release # remove the self reference - done cd - > /dev/null msgdone "info" + generatereleasefiles } buildaptarchivefromfiles() { msginfo "Build APT archive for ${CCMD}$(basename $0)${CINFO} based on prebuild files…" - cd aptarchive - if [ -f Packages ]; then - msgninfo "\tPackages file… " - cat Packages | gzip > Packages.gz - cat Packages | bzip2 > Packages.bz2 - cat Packages | lzma > Packages.lzma - cat Packages | xz > Packages.xz + find aptarchive -name 'Packages' -o -name 'Sources' | while read line; do + msgninfo "\t${line} file… " + cat ${line} | gzip > ${line}.gz + cat ${line} | bzip2 > ${line}.bz2 + cat ${line} | lzma > ${line}.lzma ++ cat ${line} | xz > ${line}.xz msgdone "info" + done + generatereleasefiles +} + +generatereleasefiles() { + msgninfo "\tGenerate Release files… " + local DATE="${1:-now}" + if [ -e aptarchive/dists ]; then + for dir in $(find ./aptarchive/dists -mindepth 3 -maxdepth 3 -type d -name 'i18n'); do + aptftparchive -qq release $dir -o APT::FTPArchive::Release::Patterns::='Translation-*' > $dir/Index + done + for dir in $(find ./aptarchive/dists -mindepth 1 -maxdepth 1 -type d); do + local CODENAME="$(echo "$dir" | cut -d'/' -f 4)" + aptftparchive -qq release $dir -o APT::FTPArchive::Release::Suite="${CODENAME}" -o APT::FTPArchive::Release::Codename="${CODENAME}" | sed -e '/0 Release$/ d' > $dir/Release # remove the self reference + if [ "$CODENAME" = "experimental" -o "$CODENAME" = "experimental2" ]; then + sed -i '/^Date: / a\ +NotAutomatic: yes' $dir/Release + fi + done + else + aptftparchive -qq release ./aptarchive | sed -e '/0 Release$/ d' > aptarchive/Release # remove the self reference fi - if [ -f Sources ]; then - msgninfo "\tSources file… " - cat Sources | gzip > Sources.gz - cat Sources | bzip2 > Sources.bz2 - cat Sources | lzma > Sources.lzma - cat Sources | xz > Sources.xz - msgdone "info" + if [ "$DATE" != "now" ]; then + for release in $(find ./aptarchive -name 'Release'); do + touch -d "$1" $release + done fi - msgninfo "\tRelease file… " - aptftparchive -qq release . | sed -e '/0 Release$/ d' > Release # remove the self reference msgdone "info" - cd .. } setupdistsaptarchive() { @@@ -526,7 -406,6 +527,7 @@@ signreleasefiles() done for RELEASE in $(find aptarchive/ -name Release); do gpg --yes --no-default-keyring $SECKEYS $PUBKEYS --default-key "$SIGNER" -abs -o ${RELEASE}.gpg ${RELEASE} + gpg --yes --no-default-keyring $SECKEYS $PUBKEYS --default-key "$SIGNER" --clearsign -o "$(echo "${RELEASE}" | sed 's#/Release$#/InRelease#')" $RELEASE done msgdone "info" } @@@ -534,7 -413,8 +535,7 @@@ changetowebserver() { if which weborf > /dev/null; then weborf -xb aptarchive/ 2>&1 > /dev/null & - CURRENTTRAP="kill $(ps | grep weborf | sed -e 's#^[ ]*##' | cut -d' ' -f 1); $CURRENTTRAP" - trap "$CURRENTTRAP" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM + addtrap "kill $!;" local APTARCHIVE="file://$(readlink -f ./aptarchive)" for LIST in $(find rootdir/etc/apt/sources.list.d/ -name 'apt-test-*.list'); do sed -i $LIST -e "s#$APTARCHIVE#http://localhost:8080/#" @@@ -568,18 -448,17 +569,18 @@@ testfileequal() testequal() { local COMPAREFILE=$(mktemp) + addtrap "rm $COMPAREFILE;" echo "$1" > $COMPAREFILE shift msgtest "Test for equality of" "$*" $* 2>&1 | checkdiff $COMPAREFILE - && msgpass || msgfail - rm $COMPAREFILE } testequalor2() { local COMPAREFILE1=$(mktemp) local COMPAREFILE2=$(mktemp) local COMPAREAGAINST=$(mktemp) + addtrap "rm $COMPAREFILE1 $COMPAREFILE2 $COMPAREAGAINST;" echo "$1" > $COMPAREFILE1 echo "$2" > $COMPAREFILE2 shift 2 @@@ -590,15 -469,16 +591,15 @@@ ( echo "\n${CINFO}Diff against OR 1${CNORMAL}" "$(checkdiff $COMPAREFILE1 $COMPAREAGAINST)" \ "\n${CINFO}Diff against OR 2${CNORMAL}" "$(checkdiff $COMPAREFILE2 $COMPAREAGAINST)" && msgfail ) - rm $COMPAREFILE1 $COMPAREFILE2 $COMPAREAGAINST } testshowvirtual() { - local VIRTUAL="N: Can't select versions from package '$1' as it purely virtual" + local VIRTUAL="N: Can't select versions from package '$1' as it is purely virtual" local PACKAGE="$1" shift while [ -n "$1" ]; do VIRTUAL="${VIRTUAL} -N: Can't select versions from package '$1' as it purely virtual" +N: Can't select versions from package '$1' as it is purely virtual" PACKAGE="${PACKAGE} $1" shift done @@@ -606,11 -486,11 +607,11 @@@ VIRTUAL="${VIRTUAL} N: No packages found" local COMPAREFILE=$(mktemp) + addtrap "rm $COMPAREFILE;" local ARCH=$(dpkg-architecture -qDEB_HOST_ARCH_CPU) eval `apt-config shell ARCH APT::Architecture` echo "$VIRTUAL" | sed -e "s/:$ARCH//" -e 's/:all//' > $COMPAREFILE aptcache show -q=0 $PACKAGE 2>&1 | checkdiff $COMPAREFILE - && msgpass || msgfail - rm $COMPAREFILE } testnopackage() { @@@ -627,8 -507,8 +628,8 @@@ 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 @@@ -637,9 -517,9 +638,9 @@@ 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]' @@@ -648,16 -528,3 +649,16 @@@ fi msgpass } + +testmarkedauto() { + local COMPAREFILE=$(mktemp) + addtrap "rm $COMPAREFILE;" + if [ -n "$1" ]; then + msgtest 'Test for correctly marked as auto-installed' "$*" + while [ -n "$1" ]; do echo "$1"; shift; done | sort > $COMPAREFILE + else + msgtest 'Test for correctly marked as auto-installed' 'no package' + echo > $COMPAREFILE + fi + aptmark showauto 2>&1 | checkdiff $COMPAREFILE - && msgpass || msgfail +}