diff -urN apt-0.5.4.orig/apt-inst/makefile apt-0.5.4/apt-inst/makefile --- apt-0.5.4.orig/apt-inst/makefile 2001-02-27 13:16:05.000000000 +0900 +++ apt-0.5.4/apt-inst/makefile 2005-03-08 13:00:37.000000000 +0900 @@ -10,6 +10,7 @@ include ../buildlib/defaults.mak # The library name +LDFLAGS += -L../apt-pkg -lapt-pkg LIBRARY=apt-inst LIBEXT=$(GLIBC_VER)$(LIBSTDCPP_VER) MAJOR=1.0 diff -urN apt-0.5.4.orig/apt-pkg/contrib/mmap.cc apt-0.5.4/apt-pkg/contrib/mmap.cc --- apt-0.5.4.orig/apt-pkg/contrib/mmap.cc 2001-05-27 14:19:30.000000000 +0900 +++ apt-0.5.4/apt-pkg/contrib/mmap.cc 2005-03-08 13:00:37.000000000 +0900 @@ -41,7 +41,7 @@ // --------------------------------------------------------------------- /* */ MMap::MMap(FileFd &F,unsigned long Flags) : Flags(Flags), iSize(0), - Base(0) + Base(0), iFd(0) { if ((Flags & NoImmMap) != NoImmMap) Map(F); @@ -51,7 +51,7 @@ // --------------------------------------------------------------------- /* */ MMap::MMap(unsigned long Flags) : Flags(Flags), iSize(0), - Base(0) + Base(0), iFd(0) { } /*}}}*/ @@ -68,6 +68,7 @@ /* */ bool MMap::Map(FileFd &Fd) { + iFd = &Fd; iSize = Fd.Size(); // Set the permissions. @@ -81,10 +82,19 @@ if (iSize == 0) return _error->Error(_("Can't mmap an empty file")); +#ifndef EMULATE_MMAP // Map it. Base = mmap(0,iSize,Prot,Map,Fd.Fd(),0); if (Base == (void *)-1) return _error->Errno("mmap",_("Couldn't make mmap of %lu bytes"),iSize); +#else + Base = new unsigned char[iSize]; + if (Base == NULL) + return _error->Errno("mmap",_("Couldn't allocate %lu bytes to emulate mmap"),iSize); + + Fd.Seek(0); + Fd.Read(Base, iSize, true); +#endif return true; } @@ -100,8 +110,16 @@ if (DoSync == true) Sync(); +#ifndef EMULATE_MMAP if (munmap((char *)Base,iSize) != 0) _error->Warning("Unable to munmap"); +#else + if ((Flags & ReadOnly) != ReadOnly && iFd != 0) { + iFd->Seek(0); + iFd->Write(Base, iSize); + } + delete [] (unsigned char *)Base; +#endif iSize = 0; Base = 0; @@ -117,11 +135,13 @@ if ((Flags & UnMapped) == UnMapped) return true; +#ifndef EMULATE_MMAP #ifdef _POSIX_SYNCHRONIZED_IO if ((Flags & ReadOnly) != ReadOnly) if (msync((char *)Base,iSize,MS_SYNC) != 0) return _error->Errno("msync","Unable to write mmap"); #endif +#endif return true; } /*}}}*/ @@ -133,12 +153,14 @@ if ((Flags & UnMapped) == UnMapped) return true; +#ifndef EMULATE_MMAP #ifdef _POSIX_SYNCHRONIZED_IO unsigned long PSize = sysconf(_SC_PAGESIZE); if ((Flags & ReadOnly) != ReadOnly) if (msync((char *)Base+(int)(Start/PSize)*PSize,Stop - Start,MS_SYNC) != 0) return _error->Errno("msync","Unable to write mmap"); #endif +#endif return true; } /*}}}*/ diff -urN apt-0.5.4.orig/apt-pkg/contrib/mmap.h apt-0.5.4/apt-pkg/contrib/mmap.h --- apt-0.5.4.orig/apt-pkg/contrib/mmap.h 2001-05-14 14:16:43.000000000 +0900 +++ apt-0.5.4/apt-pkg/contrib/mmap.h 2005-03-08 13:00:38.000000000 +0900 @@ -46,6 +46,7 @@ unsigned long Flags; unsigned long iSize; void *Base; + FileFd *iFd; bool Map(FileFd &Fd); bool Close(bool DoSync = true); diff -urN apt-0.5.4.orig/apt-pkg/deb/debindexfile.cc apt-0.5.4/apt-pkg/deb/debindexfile.cc --- apt-0.5.4.orig/apt-pkg/deb/debindexfile.cc 2001-04-29 14:13:51.000000000 +0900 +++ apt-0.5.4/apt-pkg/deb/debindexfile.cc 2005-03-08 13:00:38.000000000 +0900 @@ -505,3 +505,11 @@ } /*}}}*/ +void init_deb2() +{ + (void)_apt_DebType; + (void)_apt_DebSrcType; + (void)_apt_Src; + (void)_apt_Pkg; + (void)_apt_Status; +} diff -urN apt-0.5.4.orig/apt-pkg/deb/debsystem.cc apt-0.5.4/apt-pkg/deb/debsystem.cc --- apt-0.5.4.orig/apt-pkg/deb/debsystem.cc 2001-04-29 14:13:51.000000000 +0900 +++ apt-0.5.4/apt-pkg/deb/debsystem.cc 2005-03-08 13:50:12.000000000 +0900 @@ -27,6 +27,109 @@ #include #include /*}}}*/ +/* FINK LOCAL begin */ +#include +#include +#include +#include + +extern void init_deb2(); +extern void init_deb3(); + +#define FINKSTATUSFILE "/tmp/finkaptstatus" + +struct versionrevision { + unsigned long epoch; + const char *version; + const char *revision; +}; + +struct versionrevision darwin_version = {0,NULL,NULL}; +struct versionrevision macosx_version = {0,NULL,NULL}; + +static void finkinit() +{ + Boolean status; + SInt32 errorCode; + CFURLRef fileURL = NULL; + CFDataRef resourceData = NULL; + CFPropertyListRef propertyList = NULL; + CFStringRef string; + static char buffer[256]; // This is static, to ensure the buffer stays around + + static struct utsname ver; // This is static, to ensure the buffer stays around + + /* Determine system version */ + /* TODO - should maybe check if this is really Darwin? */ + if (!uname(&ver)) { + darwin_version.version = ver.release; + } + + /* Check whether this is Mac OS X, and which version of it */ + + fileURL = CFURLCreateWithFileSystemPath( NULL, + CFSTR("/System/Library/CoreServices/SystemVersion.plist"), + kCFURLPOSIXPathStyle, + false ); + if (!fileURL) + goto BAIL; + + /* Read the XML */ + status = CFURLCreateDataAndPropertiesFromResource( + NULL, + fileURL, + &resourceData, + NULL, + NULL, + &errorCode); + if (!status || errorCode != 0) + goto BAIL; + + /* Reconstitute the dictionary using the XML data. */ + propertyList = CFPropertyListCreateFromXMLData( NULL, + resourceData, + kCFPropertyListImmutable, + &string); + if (!propertyList) + goto BAIL; + + /* Try to read the system version from it. */ + status = CFDictionaryGetValueIfPresent( + (CFDictionaryRef) propertyList, + (const void *) CFSTR("ProductVersion"), + (const void**) &string); + if (!status) + goto BAIL; + + /* Convert into a C string */ + status = CFStringGetCString( string, + buffer, + sizeof(buffer), + kCFStringEncodingISOLatin1); + if (!status) + goto BAIL; + + /* Finally link the buffer into the macosx_version struct. */ + macosx_version.version = buffer; + +BAIL: + // Release all of the CF objects we're responsible for. + if (fileURL) + CFRelease(fileURL); + if (resourceData) + CFRelease(resourceData); + if (propertyList) + CFRelease(propertyList); +} + +void initDebSystem() +{ + finkinit(); + (void)debSys; + init_deb2(); + init_deb3(); +} +/* FINK LOCAL end */ debSystem debSys; @@ -48,6 +151,8 @@ debSystem::~debSystem() { delete StatusFile; + delete FinkStatusFile; + unlink(FINKSTATUSFILE); } /*}}}*/ // System::Lock - Get the lock /*{{{*/ @@ -161,8 +266,8 @@ which is yet to be determined. The functions in pkgcachegen should be the only users of these */ Cnf.CndSet("Dir::State::userstatus","status.user"); // Defunct - Cnf.CndSet("Dir::State::status","/var/lib/dpkg/status"); - Cnf.CndSet("Dir::Bin::dpkg","/usr/bin/dpkg"); + Cnf.CndSet("Dir::State::status","@PREFIX@/var/lib/dpkg/status"); + Cnf.CndSet("Dir::Bin::dpkg","@PREFIX@/bin/dpkg"); return true; } @@ -185,9 +290,9 @@ signed debSystem::Score(Configuration const &Cnf) { signed Score = 0; - if (FileExists(Cnf.FindFile("Dir::State::status","/var/lib/dpkg/status")) == true) + if (FileExists(Cnf.FindFile("Dir::State::status","@PREFIX@/var/lib/dpkg/status")) == true) Score += 10; - if (FileExists(Cnf.FindFile("Dir::Bin::dpkg","/usr/bin/dpkg")) == true) + if (FileExists(Cnf.FindFile("Dir::Bin::dpkg","@PREFIX@/bin/dpkg")) == true) Score += 10; if (FileExists("/etc/debian_version") == true) Score += 10; @@ -202,6 +307,44 @@ if (StatusFile == 0) StatusFile = new debStatusIndex(_config->FindFile("Dir::State::status")); List.push_back(StatusFile); +/* FINK LOCAL begin */ + + if (FinkStatusFile == 0) { + struct stat unused_sbuf; + int sys_ok=0; + unlink(FINKSTATUSFILE); + if ( 0 == stat("@PREFIX@/bin/fink-virtual-pkgs",&unused_sbuf)) { + if ( 0 == system("@PREFIX@/bin/fink-virtual-pkgs --apt")) sys_ok=1; + } + if (stat(FINKSTATUSFILE, &unused_sbuf) || !sys_ok) { + std::ofstream finkstatus(FINKSTATUSFILE); + if(macosx_version.version != 0) + { + finkstatus << "Package: macosx" << endl; + finkstatus << "Status: install ok installed" << endl; + finkstatus << "Priority: optional" << endl; + finkstatus << "Section: base" << endl; + finkstatus << "Maintainer: None" << endl; + finkstatus << "Source: macosx" << endl; + finkstatus << "Version: " << macosx_version.version << endl; + finkstatus << "Description: Pseudo package representing Mac OS X" << endl; + finkstatus << " Pseudo package representing Mac OS X" << endl << endl; + } + finkstatus << "Package: darwin" << endl; + finkstatus << "Status: install ok installed" << endl; + finkstatus << "Priority: optional" << endl; + finkstatus << "Section: base" << endl; + finkstatus << "Maintainer: None" << endl; + finkstatus << "Source: darwin" << endl; + finkstatus << "Version: " << darwin_version.version << endl; + finkstatus << "Description: Pseudo package representing Darwin" << endl; + finkstatus << " Pseudo package representing Darwin" << endl << endl; + finkstatus.close(); + } + FinkStatusFile = new debStatusIndex(FINKSTATUSFILE); + } + List.push_back(FinkStatusFile); +/* FINK LOCAL end */ return true; } /*}}}*/ @@ -217,6 +360,10 @@ { Found = StatusFile; return true; + } else if ((FinkStatusFile != 0) && (FinkStatusFile->FindInCache(*File.Cache()) == File)) + { + Found = FinkStatusFile; + return true; } return false; diff -urN apt-0.5.4.orig/apt-pkg/deb/debsystem.h apt-0.5.4/apt-pkg/deb/debsystem.h --- apt-0.5.4.orig/apt-pkg/deb/debsystem.h 2001-04-29 14:13:51.000000000 +0900 +++ apt-0.5.4/apt-pkg/deb/debsystem.h 2005-03-08 13:00:38.000000000 +0900 @@ -25,6 +25,7 @@ bool CheckUpdates(); debStatusIndex *StatusFile; + debStatusIndex *FinkStatusFile; public: diff -urN apt-0.5.4.orig/apt-pkg/deb/debversion.cc apt-0.5.4/apt-pkg/deb/debversion.cc --- apt-0.5.4.orig/apt-pkg/deb/debversion.cc 2001-05-07 14:14:53.000000000 +0900 +++ apt-0.5.4/apt-pkg/deb/debversion.cc 2005-03-08 13:00:38.000000000 +0900 @@ -24,6 +24,11 @@ debVersioningSystem debVS; +void init_deb3() +{ + (void)debVS; +} + // debVS::debVersioningSystem - Constructor /*{{{*/ // --------------------------------------------------------------------- /* */ diff -urN apt-0.5.4.orig/apt-pkg/init.cc apt-0.5.4/apt-pkg/init.cc --- apt-0.5.4.orig/apt-pkg/init.cc 2001-03-13 15:51:46.000000000 +0900 +++ apt-0.5.4/apt-pkg/init.cc 2005-03-08 13:00:38.000000000 +0900 @@ -15,6 +15,8 @@ #include #include #include + +extern void initDebSystem(); /*}}}*/ #define Stringfy_(x) # x @@ -39,7 +41,7 @@ Cnf.Set("APT::Architecture",COMMON_CPU); else Cnf.Set("APT::Architecture",COMMON_OS "-" COMMON_CPU); - Cnf.Set("Dir","/"); + Cnf.Set("Dir","@PREFIX@/"); // State Cnf.Set("Dir::State","var/lib/apt/"); @@ -68,7 +70,7 @@ Cnf.Set("Dir::Etc::main","apt.conf"); Cnf.Set("Dir::Etc::parts","apt.conf.d"); Cnf.Set("Dir::Etc::preferences","preferences"); - Cnf.Set("Dir::Bin::methods","/usr/lib/apt/methods"); + Cnf.Set("Dir::Bin::methods","@PREFIX@/lib/apt/methods"); bool Res = true; @@ -101,6 +103,8 @@ /* */ bool pkgInitSystem(Configuration &Cnf,pkgSystem *&Sys) { + initDebSystem(); + Sys = 0; string Label = Cnf.Find("Apt::System",""); if (Label.empty() == false) diff -urN apt-0.5.4.orig/apt-pkg/policy.cc apt-0.5.4/apt-pkg/policy.cc --- apt-0.5.4.orig/apt-pkg/policy.cc 2001-05-28 08:40:56.000000000 +0900 +++ apt-0.5.4/apt-pkg/policy.cc 2005-03-08 13:00:38.000000000 +0900 @@ -183,7 +183,7 @@ Pin *P = 0; if (Name.empty() == true) - P = &*Defaults.insert(Defaults.end()); + P = &*Defaults.insert(Defaults.end(),PkgPin()); else { // Get a spot to put the pin @@ -197,7 +197,7 @@ P = &*I; if (P == 0) - P = &*Unmatched.insert(Unmatched.end()); + P = &*Unmatched.insert(Unmatched.end(), PkgPin()); } else { diff -urN apt-0.5.4.orig/apt-pkg/tagfile.cc apt-0.5.4/apt-pkg/tagfile.cc --- apt-0.5.4.orig/apt-pkg/tagfile.cc 2001-05-14 14:56:26.000000000 +0900 +++ apt-0.5.4/apt-pkg/tagfile.cc 2005-03-08 13:00:38.000000000 +0900 @@ -197,7 +197,7 @@ return false; TagCount = 0; - while (TagCount < sizeof(Indexes)/sizeof(Indexes[0]) && Stop < End) + while (TagCount+1 < sizeof(Indexes)/sizeof(Indexes[0]) && Stop < End) { // Start a new index and add it to the hash if (isspace(Stop[0]) == 0) @@ -211,13 +211,13 @@ if (Stop == 0) return false; - for (; Stop[1] == '\r' && Stop+1 < End; Stop++); + for (; Stop+1 < End && Stop[1] == '\r'; Stop++); // Double newline marks the end of the record if (Stop+1 < End && Stop[1] == '\n') { Indexes[TagCount] = Stop - Section; - for (; (Stop[0] == '\n' || Stop[0] == '\r') && Stop < End; Stop++); + for (; Stop < End && (Stop[0] == '\n' || Stop[0] == '\r'); Stop++); return true; } diff -urN apt-0.5.4.orig/apt-pkg/tagfile.h apt-0.5.4/apt-pkg/tagfile.h --- apt-0.5.4.orig/apt-pkg/tagfile.h 2001-04-22 14:42:52.000000000 +0900 +++ apt-0.5.4/apt-pkg/tagfile.h 2005-03-08 13:00:38.000000000 +0900 @@ -34,7 +34,7 @@ // We have a limit of 256 tags per section. unsigned short Indexes[256]; - unsigned short AlphaIndexes[0xff]; + unsigned short AlphaIndexes[0x100]; unsigned int TagCount; diff -urN apt-0.5.4.orig/buildlib/environment.mak.in apt-0.5.4/buildlib/environment.mak.in --- apt-0.5.4.orig/buildlib/environment.mak.in 2001-05-29 14:11:03.000000000 +0900 +++ apt-0.5.4/buildlib/environment.mak.in 2005-03-08 13:00:38.000000000 +0900 @@ -11,8 +11,8 @@ LIBSTDCPP_VER = @LIBSTDCPP_VER@ # Linker stuff -PICFLAGS+= -fPIC -DPIC -LFLAGS+= @LDFLAGS@ +PICFLAGS+= -fno-common -DPIC +LFLAGS+= @LDFLAGS@ -framework CoreFoundation LEFLAGS+= SOCKETLIBS:= @SOCKETLIBS@ AR:=@AR@ @@ -47,11 +47,13 @@ # Shared library things HOST_OS = @host_os@ -ifneq ($(words $(filter linux-gnu gnu%,$(HOST_OS))),0) - SONAME_MAGIC=-Wl,-soname -Wl, - LFLAGS_SO= -else - # Do not know how to create shared libraries here. - ONLYSTATICLIBS = yes -endif +#ifneq ($(words $(filter linux-gnu gnu%,$(HOST_OS))),0) +# SONAME_MAGIC=-Wl,-soname -Wl, +# LFLAGS_SO= +#else +# # Do not know how to create shared libraries here. +# ONLYSTATICLIBS = yes +#endif +SONAME_MAGIC=-install_name @PREFIX@/lib/ +LFLAGS_SO=-dynamiclib diff -urN apt-0.5.4.orig/buildlib/library.mak apt-0.5.4/buildlib/library.mak --- apt-0.5.4.orig/buildlib/library.mak 2001-02-27 13:16:05.000000000 +0900 +++ apt-0.5.4/buildlib/library.mak 2005-03-08 13:00:38.000000000 +0900 @@ -15,17 +15,17 @@ # See defaults.mak for information about LOCAL # Some local definitions -LOCAL := lib$(LIBRARY)$(LIBEXT).so.$(MAJOR).$(MINOR) +LOCAL := lib$(LIBRARY)$(LIBEXT).$(MAJOR).$(MINOR).dylib $(LOCAL)-OBJS := $(addprefix $(OBJ)/,$(addsuffix .opic,$(notdir $(basename $(SOURCE))))) $(LOCAL)-DEP := $(addprefix $(DEP)/,$(addsuffix .opic.d,$(notdir $(basename $(SOURCE))))) $(LOCAL)-HEADERS := $(addprefix $(INCLUDE)/,$(HEADERS)) -$(LOCAL)-SONAME := lib$(LIBRARY)$(LIBEXT).so.$(MAJOR) +$(LOCAL)-SONAME := lib$(LIBRARY)$(LIBEXT).$(MAJOR).dylib $(LOCAL)-SLIBS := $(SLIBS) $(LOCAL)-LIBRARY := $(LIBRARY) # Install the command hooks headers: $($(LOCAL)-HEADERS) -library: $(LIB)/lib$(LIBRARY).so $(LIB)/lib$(LIBRARY)$(LIBEXT).so.$(MAJOR) +library: $(LIB)/lib$(LIBRARY).dylib $(LIB)/lib$(LIBRARY)$(LIBEXT).$(MAJOR).dylib clean: clean/$(LOCAL) veryclean: veryclean/$(LOCAL) @@ -37,21 +37,23 @@ clean/$(LOCAL): -rm -f $($(@F)-OBJS) $($(@F)-DEP) veryclean/$(LOCAL): clean/$(LOCAL) - -rm -f $($(@F)-HEADERS) $(LIB)/lib$($(@F)-LIBRARY)*.so* + -rm -f $($(@F)-HEADERS) $(LIB)/lib$($(@F)-LIBRARY)*.dylib # Build rules for the two symlinks -.PHONY: $(LIB)/lib$(LIBRARY)$(LIBEXT).so.$(MAJOR) $(LIB)/lib$(LIBRARY).so -$(LIB)/lib$(LIBRARY)$(LIBEXT).so.$(MAJOR): $(LIB)/lib$(LIBRARY)$(LIBEXT).so.$(MAJOR).$(MINOR) +.PHONY: $(LIB)/lib$(LIBRARY)$(LIBEXT).$(MAJOR).dylib $(LIB)/lib$(LIBRARY).dylib +$(LIB)/lib$(LIBRARY)$(LIBEXT).$(MAJOR).dylib: $(LIB)/lib$(LIBRARY)$(LIBEXT).$(MAJOR).$(MINOR).dylib ln -sf $( /dev/null +$(LIB)/lib$(LIBRARY)$(LIBEXT).$(MAJOR).$(MINOR).dylib: $($(LOCAL)-HEADERS) $($(LOCAL)-OBJS) + -rm -f $(LIB)/lib$($(@F)-LIBRARY)*.dylib 2> /dev/null echo Building shared library $@ $(CXX) $(CXXFLAGS) $(LDFLAGS) $(PICFLAGS) $(LFLAGS) $(LFLAGS_SO)\ - -o $@ $(SONAME_MAGIC)$($(@F)-SONAME) -shared \ + -o $@ $(SONAME_MAGIC)$($(@F)-SONAME) \ + -compatibility_version $(MAJOR).$(MINOR) \ + -current_version $(MAJOR).$(MINOR) \ $(filter %.opic,$^) \ $($(@F)-SLIBS) diff -urN apt-0.5.4.orig/buildlib/ostable apt-0.5.4/buildlib/ostable --- apt-0.5.4.orig/buildlib/ostable 2001-02-20 16:03:17.000000000 +0900 +++ apt-0.5.4/buildlib/ostable 2005-03-08 13:00:38.000000000 +0900 @@ -14,6 +14,7 @@ hp-hpux[^-]* hp-ux sun-solaris[^-]* solaris [^-]*-openbsd[^-]* openbsd +[^-]*-darwin[^-]* darwin # Catch all .* unknown diff -urN apt-0.5.4.orig/cmdline/apt-cache.cc apt-0.5.4/cmdline/apt-cache.cc --- apt-0.5.4.orig/cmdline/apt-cache.cc 2001-07-02 09:10:32.000000000 +0900 +++ apt-0.5.4/cmdline/apt-cache.cc 2005-03-08 13:00:38.000000000 +0900 @@ -374,8 +374,10 @@ if (ReadPinFile(Plcy) == false) return false; - pkgCache::VerFile **VFList = new pkgCache::VerFile *[Cache.HeaderP->PackageCount]; - memset(VFList,0,sizeof(*VFList)*Cache.HeaderP->PackageCount); + // Make sure we have a sentinel for the list. + unsigned long Count = Cache.HeaderP->PackageCount+1; + pkgCache::VerFile **VFList = new pkgCache::VerFile *[Count]; + memset(VFList,0,sizeof(*VFList)*Count); // Map versions that we want to write out onto the VerList array. for (pkgCache::PkgIterator P = Cache.PkgBegin(); P.end() == false; P++) @@ -428,7 +430,7 @@ VFList[P->ID] = VF; } - LocalitySort(VFList,Cache.HeaderP->PackageCount,sizeof(*VFList)); + LocalitySort(VFList,Count,sizeof(*VFList)); // Iterate over all the package files and write them out. char *Buffer = new char[Cache.HeaderP->MaxVerFileSize+10]; diff -urN apt-0.5.4.orig/cmdline/apt-get.cc apt-0.5.4/cmdline/apt-get.cc --- apt-0.5.4.orig/cmdline/apt-get.cc 2001-07-02 07:59:04.000000000 +0900 +++ apt-0.5.4/cmdline/apt-get.cc 2005-03-08 13:00:38.000000000 +0900 @@ -113,6 +113,8 @@ return true; } + fflush(NULL); + char C = 0; char Jnk = 0; if (read(STDIN_FILENO,&C,1) != 1) @@ -281,7 +283,14 @@ if (Cache[Targ].CandidateVerIter(Cache).end() == true) { if (Targ->ProvidesList == 0) - out << _("but it is not installable"); + { + out << _("but it is not installable. For Fink users, "); + out << _("this often means that you have attempted "); + out << _("to install a package from the binary distribution "); + out << _("which depends on a \"Restrictive\" package. "); + out << _("See , "); + out << _(""); + } else out << _("but it is a virtual package"); } @@ -569,7 +578,9 @@ return false; // Nothing is broken - if (DCache->BrokenCount() == 0 || AllowBroken == true) + // FINK LOCAL added APT::Get::Ignore-Breakage test + if (DCache->BrokenCount() == 0 || AllowBroken == true + || _config->FindB("APT::Get::Ignore-Breakage") == true) return true; // Attempt to fix broken things @@ -634,7 +645,9 @@ Stats(c1out,Cache); // Sanity check - if (Cache->BrokenCount() != 0) + // FINK LOCAL added APT::Get::Ignore-Breakage test + if (Cache->BrokenCount() != 0 + && _config->FindB("APT::Get::Ignore-Breakage",false) == false) { ShowBroken(c1out,Cache,false); return _error->Error("Internal Error, InstallPackages was called with broken packages!"); @@ -1019,7 +1032,9 @@ ExpectedInst++; // Install it with autoinstalling enabled. - if (State.InstBroken() == true && BrokenFix == false) + // FINK LOCAL added APT::Get::Ignore-Breakage test + if (State.InstBroken() == true && BrokenFix == false + && _config->FindB("APT::Get::Ignore-Breakage") == false) Cache.MarkInstall(Pkg,true); return true; } @@ -1366,7 +1381,9 @@ /* If we are in the Broken fixing mode we do not attempt to fix the problems. This is if the user invoked install without -f and gave packages */ - if (BrokenFix == true && Cache->BrokenCount() != 0) + // FINK LOCAL added APT::Get::Ignore-Breakage test + if (BrokenFix == true && Cache->BrokenCount() != 0 + && _config->FindB("APT::Get::Ignore-Breakage") == false) { c1out << _("You might want to run `apt-get -f install' to correct these:") << endl; ShowBroken(c1out,Cache,false); @@ -1376,11 +1393,13 @@ // Call the scored problem resolver Fix.InstallProtect(); - if (Fix.Resolve(true) == false) + // FINK LOCAL added APT::Get::Ignore-Breakage test + if (_config->FindB("APT::Get::Ignore-Breakage") == false && Fix.Resolve(true) == false) _error->Discard(); // Now we check the state of the packages, - if (Cache->BrokenCount() != 0) + // FINK LOCAL added APT::Get::Ignore-Breakage test + if (Cache->BrokenCount() != 0 && _config->FindB("APT::Get::Ignore-Breakage") == false) { c1out << _("Some packages could not be installed. This may mean that you have\n" @@ -2057,6 +2076,8 @@ _config->Set("APT::Get::Simulate",false); _config->Set("APT::Get::Assume-Yes",false); _config->Set("APT::Get::Fix-Broken",false); + // FINK LOCAL added APT::Get::Ignore-Breakage + _config->Set("APT::Get::Ignore-Breakage",false); _config->Set("APT::Get::Force-Yes",false); _config->Set("APT::Get::APT::Get::No-List-Cleanup",true); } @@ -2094,6 +2115,8 @@ {'y',"yes","APT::Get::Assume-Yes",0}, {'y',"assume-yes","APT::Get::Assume-Yes",0}, {'f',"fix-broken","APT::Get::Fix-Broken",0}, + // FINK LOCAL added APT::Get::Ignore-Breakage + {0,"ignore-breakage","APT::Get::Ignore-Breakage",0}, {'u',"show-upgraded","APT::Get::Show-Upgraded",0}, {'m',"ignore-missing","APT::Get::Fix-Missing",0}, {'t',"target-release","APT::Default-Release",CommandLine::HasArg}, @@ -2151,6 +2174,22 @@ ShowHelp(CmdL); return 0; } + + /* FINK LOCAL begin */ + if (_config->FindB("APT::Get::Ignore-Breakage",false) == true) { + if (_config->FindB("APT::Get::Print-URIs",false) == false && + _config->FindB("APT::Get::Download-Only",false) == false) { + _error->Error("--ignore-breakage can only be used with --print-uris or --download-only"); + _error->DumpErrors(); + return 100; + } + if (strcmp(CmdL.FileList[0],"install") != 0) { + _error->Error("--ignore-breakage can only be used with apt-get install"); + _error->DumpErrors(); + return 100; + } + } + /* FINK LOCAL end */ // Deal with stdout not being a tty if (ttyname(STDOUT_FILENO) == 0 && _config->FindI("quiet",0) < 1) diff -urN apt-0.5.4.orig/configure apt-0.5.4/configure --- apt-0.5.4.orig/configure 2001-08-19 09:46:43.000000000 +0900 +++ apt-0.5.4/configure 2005-03-08 13:00:38.000000000 +0900 @@ -2394,7 +2394,7 @@ ac_given_srcdir=$srcdir -trap 'rm -fr `echo "environment.mak:buildlib/environment.mak.in makefile:buildlib/makefile.in include/config.h:buildlib/config.h.in include/apti18n.h:buildlib/apti18n.h.in" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +trap 'rm -fr `echo "environment.mak:buildlib/environment.mak.in makefile.wrap:buildlib/makefile.in include/config.h:buildlib/config.h.in include/apti18n.h:buildlib/apti18n.h.in" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then @@ -2670,7 +2670,7 @@ EOF cat >> $CONFIG_STATUS <<\EOF -make -s dirs +make -f makefile.wrap -s dirs exit 0 EOF chmod +x $CONFIG_STATUS diff -urN apt-0.5.4.orig/configure.in apt-0.5.4/configure.in --- apt-0.5.4.orig/configure.in 2001-06-18 14:56:32.000000000 +0900 +++ apt-0.5.4/configure.in 2005-03-08 13:00:38.000000000 +0900 @@ -163,4 +163,4 @@ rc_LIBSTDCPP_VER ah_GCC3DEP -AC_OUTPUT(environment.mak:buildlib/environment.mak.in makefile:buildlib/makefile.in,make -s dirs) +AC_OUTPUT(environment.mak:buildlib/environment.mak.in makefile.wrap:buildlib/makefile.in,make -f makefile.wrap -s dirs) diff -urN apt-0.5.4.orig/doc/apt-cache.8 apt-0.5.4/doc/apt-cache.8 --- apt-0.5.4.orig/doc/apt-cache.8 2001-08-19 09:48:24.000000000 +0900 +++ apt-0.5.4/doc/apt-cache.8 2005-03-08 13:00:38.000000000 +0900 @@ -277,16 +277,16 @@ option. The syntax is \fB-o Foo::Bar=bar\fR. .SH "FILES" .TP -\fB\fI/etc/apt/sources.list\fB\fR +\fB\fI@PREFIX@/etc/apt/sources.list\fB\fR locations to fetch packages from. Configuration Item: Dir::Etc::SourceList. .TP -\fB\fI/var/lib/apt/lists/\fB\fR +\fB\fI@PREFIX@/var/lib/apt/lists/\fB\fR storage area for state information for each package resource specified in \fB\fIsources.list\fB\fR(5) Configuration Item: Dir::State::Lists. .TP -\fB\fI/var/lib/apt/lists/partial/\fB\fR +\fB\fI@PREFIX@/var/lib/apt/lists/partial/\fB\fR storage area for state information in transit. Configuration Item: Dir::State::Lists (implicit partial). .SH "SEE ALSO" diff -urN apt-0.5.4.orig/doc/apt-cdrom.8 apt-0.5.4/doc/apt-cdrom.8 --- apt-0.5.4.orig/doc/apt-cdrom.8 2001-08-19 09:48:25.000000000 +0900 +++ apt-0.5.4/doc/apt-cdrom.8 2005-03-08 13:00:38.000000000 +0900 @@ -32,7 +32,7 @@ APT uses a CDROM ID to track which disc is currently in the drive and maintains a database of these IDs in -\fI/var/lib/apt/cdroms.list\fR +\fI@PREFIX@/var/lib/apt/cdroms.list\fR .TP \fBident\fR A debugging tool to report the identity of the current disc as well diff -urN apt-0.5.4.orig/doc/apt-config.8 apt-0.5.4/doc/apt-config.8 --- apt-0.5.4.orig/doc/apt-config.8 2001-08-19 09:48:27.000000000 +0900 +++ apt-0.5.4/doc/apt-config.8 2005-03-08 13:00:38.000000000 +0900 @@ -13,7 +13,7 @@ .PP \fBapt-config\fR is an internal program used by various portions of the APT suite to provide consistent configurability. It accesses the main -configuarion file \fI/etc/apt/apt.conf\fR in a manner that is +configuarion file \fI@PREFIX@/etc/apt/apt.conf\fR in a manner that is easy to use by scripted applications. .PP Unless the \fB-h\fR, or \fB--help\fR option is given one of the diff -urN apt-0.5.4.orig/doc/apt-get.8 apt-0.5.4/doc/apt-get.8 --- apt-0.5.4.orig/doc/apt-get.8 2001-08-19 09:48:25.000000000 +0900 +++ apt-0.5.4/doc/apt-get.8 2005-03-08 13:00:38.000000000 +0900 @@ -20,7 +20,7 @@ \fBupdate\fR update is used to resynchronize the package index files from their sources. The indexes of available packages are fetched from the -location(s) specified in \fI/etc/apt/sources.list\fR. +location(s) specified in \fI@PREFIX@/etc/apt/sources.list\fR. For example, when using a Debian archive, this command retrieves and scans the \fIPackages.gz\fR files, so that information about new and updated packages is available. An update should always be @@ -31,7 +31,7 @@ \fBupgrade\fR upgrade is used to install the newest versions of all packages currently installed on the system from the sources enumerated in -\fI/etc/apt/sources.list\fR. Packages currently installed with +\fI@PREFIX@/etc/apt/sources.list\fR. Packages currently installed with new versions available are retrieved and upgraded; under no circumstances are currently installed packages removed, or packages not already installed retrieved and installed. New versions of currently installed packages that @@ -54,7 +54,7 @@ with new versions of packages; \fBapt-get\fR has a "smart" conflict resolution system, and it will attempt to upgrade the most important packages at the expense of less important ones if necessary. -The \fI/etc/apt/sources.list\fR file contains a list of locations +The \fI@PREFIX@/etc/apt/sources.list\fR file contains a list of locations from which to retrieve desired package files. .TP \fBinstall\fR @@ -63,7 +63,7 @@ filename (for instance, in a Debian GNU/Linux system, libc6 would be the argument provided, not em(libc6_1.9.6-2.deb)). All packages required by the package(s) specified for installation will also be retrieved and -installed. The \fI/etc/apt/sources.list\fR file is used to locate +installed. The \fI@PREFIX@/etc/apt/sources.list\fR file is used to locate the desired packages. If a hyphen is appended to the package name (with no intervening space), the identified package will be removed if it is installed. Similarly a plus sign can be used to designate a package to @@ -75,7 +75,7 @@ to select. This will cause that version to be located and selected for install. Alternatively a specific distribution can be selected by following the package name with a slash and the version of the -distribution or the Archive name (stable, frozen, unstable). +distribution or the Archive name (@DIST@/release or @DIST@/current). Both of the version selection mechanisms can downgrade packages and must be used with care. @@ -126,8 +126,8 @@ \fBclean\fR clean clears out the local repository of retrieved package files. It removes everything but the lock file from -\fI/var/cache/apt/archives/\fR and -\fI/var/cache/apt/archive/partial/\fR. When APT is used as a +\fI@PREFIX@/var/cache/apt/archives/\fR and +\fI@PREFIX@/var/cache/apt/archive/partial/\fR. When APT is used as a \fBdselect\fR(8) method, clean is run automatically. Those who do not use dselect will likely want to run apt-get clean from time to time to free up disk space. @@ -169,6 +169,17 @@ error in some situations. Configuration Item: APT::Get::Fix-Broken. .TP +\fB--ignore-breakage\fR +For mode \fBinstall\fR, ignore dependency problems. This option is +useful if you want to perform actions on just a particular package, +not its whole dependency tree. It must be used in conjunction with +\fB--download-only\fR or \fB--print-uris\fR. Configuration Item: +APT::Get::Ignore-Breakage. + +Note: The \fB--ignore-breakage\fR option was added by The Fink Project +and hence is only available in the \fBapt-get\fR provided by Fink's +\fBapt\fR package. +.TP \fB-m\fR .TP \fB--ignore-missing\fR @@ -284,7 +295,7 @@ \fB--list-cleanup\fR This option defaults to on, use --no-list-cleanup to turn it off. When on \fBapt-get\fR will automatically manage the contents of -\fI/var/lib/apt/lists\fR to ensure that obsolete files are erased. +\fI@PREFIX@/var/lib/apt/lists\fR to ensure that obsolete files are erased. The only reason to turn it off is if you frequently change your source list. Configuration Item: APT::Get::List-Cleanup. @@ -349,36 +360,36 @@ option. The syntax is \fB-o Foo::Bar=bar\fR. .SH "FILES" .TP -\fB\fI/etc/apt/sources.list\fB\fR +\fB\fI@PREFIX@/etc/apt/sources.list\fB\fR locations to fetch packages from. Configuration Item: Dir::Etc::SourceList. .TP -\fB\fI/etc/apt/apt.conf\fB\fR +\fB\fI@PREFIX@/etc/apt/apt.conf\fB\fR APT configuration file. Configuration Item: Dir::Etc::Main. .TP -\fB\fI/etc/apt/apt.conf.d/\fB\fR +\fB\fI@PREFIX@/etc/apt/apt.conf.d/\fB\fR APT configuration file fragments Configuration Item: Dir::Etc::Parts. .TP -\fB\fI/etc/apt/preferences\fB\fR +\fB\fI@PREFIX@/etc/apt/preferences\fB\fR version preferences file Configuration Item: Dir::Etc::Preferences. .TP -\fB\fI/var/cache/apt/archives/\fB\fR +\fB\fI@PREFIX@/var/cache/apt/archives/\fB\fR storage area for retrieved package files. Configuration Item: Dir::Cache::Archives. .TP -\fB\fI/var/cache/apt/archives/partial/\fB\fR +\fB\fI@PREFIX@/var/cache/apt/archives/partial/\fB\fR storage area for package files in transit. Configuration Item: Dir::Cache::Archives (implicit partial). .TP -\fB\fI/var/lib/apt/lists/\fB\fR +\fB\fI@PREFIX@/var/lib/apt/lists/\fB\fR storage area for state information for each package resource specified in \fB\fIsources.list\fB\fR(5) Configuration Item: Dir::State::Lists. .TP -\fB\fI/var/lib/apt/lists/partial/\fB\fR +\fB\fI@PREFIX@/var/lib/apt/lists/partial/\fB\fR storage area for state information in transit. Configuration Item: Dir::State::Lists (implicit partial). .SH "SEE ALSO" diff -urN apt-0.5.4.orig/doc/apt_preferences.5 apt-0.5.4/doc/apt_preferences.5 --- apt-0.5.4.orig/doc/apt_preferences.5 2001-08-19 09:48:28.000000000 +0900 +++ apt-0.5.4/doc/apt_preferences.5 2005-03-08 13:00:38.000000000 +0900 @@ -12,7 +12,7 @@ It is meant to be user editable and manipulatable from software. The file consists of a number of records formed like the dpkg status file, space seperated sections of text with at the start of each line tags seperated -by a colon. It is stored in \fI/etc/apt/preferences\fR. +by a colon. It is stored in \fI@PREFIX@/etc/apt/preferences\fR. .SH "VERSIONING" .PP One purpose of the preferences file is to let the user select which version diff -urN apt-0.5.4.orig/doc/sources.list.5 apt-0.5.4/doc/sources.list.5 --- apt-0.5.4.orig/doc/sources.list.5 2001-08-19 09:48:26.000000000 +0900 +++ apt-0.5.4/doc/sources.list.5 2005-03-08 13:00:38.000000000 +0900 @@ -11,7 +11,7 @@ The package resource list is used to locate archives of the package distribution system in use on the system. At this time, this manual page documents only the packaging system used by the Debian GNU/Linux system. -This control file is located in \fI/etc/apt/sources.list\fR +This control file is located in \fI@PREFIX@/etc/apt/sources.list\fR .PP The source list is designed to support any number of active sources and a variety of source media. The file lists one source per line, with the @@ -25,9 +25,8 @@ .PP The deb type describes a typical two-level Debian archive, \fIdistribution/component\fR. Typically, distribution is -generally one of stable, unstable, or -frozen, while component is one of main, -contrib, non-free, or non-us. The +generally one of @DIST@/release or @DIST@/current, +while component is one of main or crypto. The deb-src type describes a debian distribution's source code in the same form as the deb type. A deb-src line is required to fetch source indexes. diff -urN apt-0.5.4.orig/dselect/install apt-0.5.4/dselect/install --- apt-0.5.4.orig/dselect/install 2001-02-20 16:03:17.000000000 +0900 +++ apt-0.5.4/dselect/install 2005-03-08 13:00:38.000000000 +0900 @@ -3,8 +3,8 @@ # Get the configuration from /etc/apt/apt.conf CLEAN="prompt" OPTS="-f" -APTGET="/usr/bin/apt-get" -DPKG="/usr/bin/dpkg" +APTGET="@PREFIX@/bin/apt-get" +DPKG="@PREFIX@/bin/dpkg" DPKG_OPTS="--admindir=$1" APT_OPT0="-oDir::State::status=$1/status" APT_OPT1="-oDPkg::Options::=$DPKG_OPTS" diff -urN apt-0.5.4.orig/dselect/setup apt-0.5.4/dselect/setup --- apt-0.5.4.orig/dselect/setup 2000-01-27 13:15:10.000000000 +0900 +++ apt-0.5.4/dselect/setup 2005-03-08 13:00:38.000000000 +0900 @@ -23,15 +23,17 @@ my $vardir=$ARGV[0]; my $method=$ARGV[1]; my $option=$ARGV[2]; -my $config_file = '/etc/apt/sources.list'; +my $config_file = '@PREFIX@/etc/apt/sources.list'; -my $boldon=`setterm -bold on`; -my $boldoff=`setterm -bold off`; +my $boldon=`setterm -bold on 2>/dev/null`; +my $boldoff=`setterm -bold off 2>/dev/null`; +$boldon = "" unless defined $boldon; +$boldoff = "" unless defined $boldon; my @known_types = ('deb'); my @known_access = ('http', 'ftp', 'file'); -my @typical_distributions = ('stable', 'unstable', 'frozen', 'non-US'); -my @typical_components = ('main', 'contrib', 'non-free'); +my @typical_distributions = ('@DIST@/release', '@DIST@/current'); +my @typical_components = ('main', 'crypto'); my %known_access = map {($_,$_)} @known_access; my %typical_distributions = map {($_,$_)} @typical_distributions; @@ -118,9 +120,9 @@ } $type = 'deb'; - $urn = "http://http.us.debian.org/debian" unless $urn; - $distribution = "stable" unless $distribution; - $components = "main contrib non-free" unless $components; + $urn = "http://us.dl.sourceforge.net/fink/direct_download" unless $urn; + $distribution = "@DIST@/release" unless $distribution; + $components = "main" unless $components; $rec->{'Type'} = 'deb'; @@ -222,19 +224,13 @@ print "\t$boldon Set up a list of distribution source locations $boldoff \n"; print "\n"; - print " Please give the base URL of the debian distribution.\n"; + print " Please give the base URL of the Fink distribution.\n"; print " The access schemes I know about are:$boldon "; print join (' ', @known_access), "$boldoff\n"; -# print " The mirror scheme is special that it does not specify the\n"; -# print " location of a debian archive but specifies the location\n"; -# print " of a list of mirrors to use to access the archive.\n"; print "\n"; print " For example:\n"; - print " file:/mnt/debian,\n"; - print " ftp://ftp.debian.org/debian,\n"; - print " http://ftp.de.debian.org/debian,\n"; -# print " and the special mirror scheme,\n"; -# print " mirror:http://www.debian.org/archivemirrors \n"; + print " file:@PREFIX@/fink,\n"; + print " http://us.dl.sourceforge.net/fink/direct_download\n"; print "\n"; my $index = 0; @@ -269,7 +265,10 @@ print "-" x 72, "\n"; &print_config('Config' => \@Oldconfig); print "-" x 72, "\n"; - print "$boldon Do you wish to change (overwrite) it?[y/N]$boldoff "; + print "$boldon In most cases, this file was installed by Fink or by apt," + ." and$boldoff\n"; + print "$boldon should NOT be changed. " . + "Do you wish to change (overwrite) it?[y/N]$boldoff "; my $answer = ; chomp ($answer); $answer =~ s/\s+/ /og; diff -urN apt-0.5.4.orig/dselect/update apt-0.5.4/dselect/update --- apt-0.5.4.orig/dselect/update 2001-03-13 10:45:36.000000000 +0900 +++ apt-0.5.4/dselect/update 2005-03-08 13:00:38.000000000 +0900 @@ -4,13 +4,13 @@ # Get the configuration from /etc/apt/apt.conf CLEAN="prompt" OPTS="-f" -APTGET="/usr/bin/apt-get" -APTCACHE="/usr/bin/apt-cache" -DPKG="/usr/bin/dpkg" +APTGET="@PREFIX@/bin/apt-get" +APTCACHE="@PREFIX@/bin/apt-cache" +DPKG="@PREFIX@/bin/dpkg" DPKG_OPTS="--admindir=$1" APT_OPT0="-oDir::State::status=$1/status" APT_OPT1="-oDPkg::Options::=$DPKG_OPTS" -CACHEDIR="/var/cache/apt" +CACHEDIR="@PREFIX@/var/cache/apt" PROMPT="false" RES=`apt-config shell CLEAN DSelect::Clean OPTS DSelect::UpdateOptions \ DPKG Dir::Bin::dpkg/f APTGET Dir::Bin::apt-get/f \ diff -urN apt-0.5.4.orig/methods/connect.cc apt-0.5.4/methods/connect.cc --- apt-0.5.4.orig/methods/connect.cc 2001-02-20 16:03:18.000000000 +0900 +++ apt-0.5.4/methods/connect.cc 2005-03-08 13:10:40.000000000 +0900 @@ -90,7 +90,11 @@ // Check the socket for an error condition unsigned int Err; - unsigned int Len = sizeof(Err); +#ifndef HAVE_SOCKLEN_T + int Len = sizeof(Err); +#else + socklen_t Len = sizeof(Err); +#endif if (getsockopt(Fd,SOL_SOCKET,SO_ERROR,&Err,&Len) != 0) return _error->Errno("getsockopt","Failed"); diff -urN apt-0.5.4.orig/methods/ftp.cc apt-0.5.4/methods/ftp.cc --- apt-0.5.4.orig/methods/ftp.cc 2001-05-22 13:02:00.000000000 +0900 +++ apt-0.5.4/methods/ftp.cc 2005-03-08 13:09:26.000000000 +0900 @@ -694,7 +694,11 @@ if (WaitFd(DataFd,true,TimeOut) == false) return _error->Error("Could not connect data socket, connection timed out"); unsigned int Err; - unsigned int Len = sizeof(Err); +#ifndef HAVE_SOCKLEN_T + int Len = sizeof(Err); +#else + socklen_t Len = sizeof(Err); +#endif if (getsockopt(DataFd,SOL_SOCKET,SO_ERROR,&Err,&Len) != 0) return _error->Errno("getsockopt","Failed"); if (Err != 0) diff -urN apt-0.5.4.orig/methods/rfc2553emu.h apt-0.5.4/methods/rfc2553emu.h --- apt-0.5.4.orig/methods/rfc2553emu.h 2000-06-18 15:04:45.000000000 +0900 +++ apt-0.5.4/methods/rfc2553emu.h 2005-03-08 13:00:38.000000000 +0900 @@ -26,6 +26,11 @@ #include #include +// Always use full emulation on Darwin: +// netdb.h has the structures and constants, but getnameinfo() is missing +// and getaddrinfo() seems to be broken +#ifndef __APPLE__ + // Autosense getaddrinfo #if defined(AI_PASSIVE) && defined(EAI_NONAME) #define HAVE_GETADDRINFO @@ -36,6 +41,8 @@ #define HAVE_GETNAMEINFO #endif +#endif /* __APPLE__ */ + // getaddrinfo support? #ifndef HAVE_GETADDRINFO // Renamed to advoid type clashing.. (for debugging) @@ -101,6 +108,9 @@ #define NI_NAMEREQD (1<<3) #define NI_DATAGRAM (1<<4) #endif + #ifndef NI_DATAGRAM + #define NI_DATAGRAM NI_DGRAM + #endif #define sockaddr_storage sockaddr_in #endif diff -urN apt-0.5.4.orig/patch_flush apt-0.5.4/patch_flush --- apt-0.5.4.orig/patch_flush 1970-01-01 09:00:00.000000000 +0900 +++ apt-0.5.4/patch_flush 2005-03-08 13:00:38.000000000 +0900 @@ -0,0 +1,11 @@ +#!/bin/sh +set -e + +files=`find . -name '*.cc' -print | xargs grep -l 'flush;'` + +for i in $files ; do + sed 's/<< flush;/<< flush, fflush(NULL);/g' <$i >$i.tmp + mv $i.tmp $i +done + +exit 0 diff -urN apt-0.5.4/apt-inst/contrib/extracttar.cc apt-new/apt-inst/contrib/extracttar.cc --- apt-0.5.4/apt-inst/contrib/extracttar.cc 2001-05-27 19:47:09.000000000 -0400 +++ apt-new/apt-inst/contrib/extracttar.cc 2005-11-25 06:27:24.000000000 -0500 @@ -144,6 +144,18 @@ return true; } /*}}}*/ + +// Handle the ridiculous way that tar stores large numbers +static bool TarUIDToNum(const char *Str, unsigned long &Res, unsigned Len) { + switch (*Str) { + case '\200': + Res = ntohl(*((unsigned long *)(Str + Len - sizeof(unsigned long)))); + return true; + default: + return StrToNum(Str+1, Res, Len-1, 8); + } +} + // ExtractTar::Go - Perform extraction /*{{{*/ // --------------------------------------------------------------------- /* This reads each 512 byte block from the archive and extracts the header @@ -193,8 +205,8 @@ unsigned long UID; unsigned long GID; if (StrToNum(Tar->Mode,Itm.Mode,sizeof(Tar->Mode),8) == false || - StrToNum(Tar->UserID,UID,sizeof(Tar->UserID),8) == false || - StrToNum(Tar->GroupID,GID,sizeof(Tar->GroupID),8) == false || + TarUIDToNum(Tar->UserID,Itm.UID,sizeof(Tar->UserID)) == false || + TarUIDToNum(Tar->GroupID,Itm.GID,sizeof(Tar->GroupID)) == false || StrToNum(Tar->Size,Itm.Size,sizeof(Tar->Size),8) == false || StrToNum(Tar->MTime,Itm.MTime,sizeof(Tar->MTime),8) == false || StrToNum(Tar->Major,Itm.Major,sizeof(Tar->Major),8) == false ||