apt.patch 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602
  1. Index: apt-pkg/deb/debsystem.cc
  2. --- apt-pkg/deb/debsystem.cc.orig 2003-11-24 17:58:46.000000000 +0100
  3. +++ apt-pkg/deb/debsystem.cc 2003-11-28 21:06:52.000000000 +0100
  4. @@ -162,7 +162,7 @@
  5. be the only users of these */
  6. Cnf.CndSet("Dir::State::userstatus","status.user"); // Defunct
  7. Cnf.CndSet("Dir::State::status","/var/lib/dpkg/status");
  8. - Cnf.CndSet("Dir::Bin::dpkg","/usr/bin/dpkg");
  9. + Cnf.CndSet("Dir::Bin::dpkg","@l_prefix@/bin/dpkg");
  10. return true;
  11. }
  12. @@ -187,7 +187,7 @@
  13. signed Score = 0;
  14. if (FileExists(Cnf.FindFile("Dir::State::status","/var/lib/dpkg/status")) == true)
  15. Score += 10;
  16. - if (FileExists(Cnf.FindFile("Dir::Bin::dpkg","/usr/bin/dpkg")) == true)
  17. + if (FileExists(Cnf.FindFile("Dir::Bin::dpkg","@l_prefix@/bin/dpkg")) == true)
  18. Score += 10;
  19. if (FileExists("/etc/debian_version") == true)
  20. Score += 10;
  21. Index: apt-pkg/init.cc
  22. --- apt-pkg/init.cc.orig 2003-11-24 17:58:44.000000000 +0100
  23. +++ apt-pkg/init.cc 2003-11-28 21:06:52.000000000 +0100
  24. @@ -45,10 +45,10 @@
  25. Cnf.Set("APT::Architecture",COMMON_OS "-" COMMON_CPU);
  26. // CNC:2002-09-10
  27. //Cnf.Set("APT::Build-Essential::", "build-essential");
  28. - Cnf.Set("Dir","/");
  29. + Cnf.Set("Dir","@l_prefix@");
  30. // State
  31. - Cnf.Set("Dir::State","var/lib/apt/");
  32. + Cnf.Set("Dir::State","var/@name@/lib/");
  33. /* Just in case something goes horribly wrong, we can fall back to the
  34. old /var/state paths.. */
  35. @@ -61,13 +61,13 @@
  36. Cnf.Set("Dir::State::cdroms","cdroms.list");
  37. // Cache
  38. - Cnf.Set("Dir::Cache","var/cache/apt/");
  39. + Cnf.Set("Dir::Cache","var/@name@/cache/");
  40. Cnf.Set("Dir::Cache::archives","archives/");
  41. Cnf.Set("Dir::Cache::srcpkgcache","srcpkgcache.bin");
  42. Cnf.Set("Dir::Cache::pkgcache","pkgcache.bin");
  43. // Configuration
  44. - Cnf.Set("Dir::Etc","etc/apt/");
  45. + Cnf.Set("Dir::Etc","etc/@name@/");
  46. Cnf.Set("Dir::Etc::sourcelist","sources.list");
  47. // CNC:2003-03-03
  48. Cnf.Set("Dir::Etc::sourceparts","sources.list.d");
  49. @@ -76,7 +76,7 @@
  50. Cnf.Set("Dir::Etc::main","apt.conf");
  51. Cnf.Set("Dir::Etc::parts","apt.conf.d");
  52. Cnf.Set("Dir::Etc::preferences","preferences");
  53. - Cnf.Set("Dir::Bin::methods",LIBDIR "/apt/methods");
  54. + Cnf.Set("Dir::Bin::methods","@l_prefix@/lib/apt/methods");
  55. Cnf.Set("Acquire::ComprExtension", ".bz2");
  56. bool Res = true;
  57. Index: apt-pkg/luaiface.cc
  58. --- apt-pkg/luaiface.cc.orig 2003-11-24 17:58:50.000000000 +0100
  59. +++ apt-pkg/luaiface.cc 2003-11-28 21:06:52.000000000 +0100
  60. @@ -61,7 +61,7 @@
  61. Lua::Lua()
  62. : DepCache(0), Cache(0), CacheControl(0), Fix(0), DontFix(0)
  63. {
  64. - _config->CndSet("Dir::Bin::scripts", "/usr/lib/apt/scripts");
  65. + _config->CndSet("Dir::Bin::scripts", "@l_prefix@/lib/apt/scripts");
  66. const luaL_reg lualibs[] = {
  67. {"base", luaopen_base},
  68. Index: apt-pkg/rpm/rpmhandler.h
  69. --- apt-pkg/rpm/rpmhandler.h.orig 2003-11-24 17:58:54.000000000 +0100
  70. +++ apt-pkg/rpm/rpmhandler.h 2003-11-28 21:06:52.000000000 +0100
  71. @@ -12,6 +12,7 @@
  72. #include <apt-pkg/fileutl.h>
  73. +#include <rpm/glob.h>
  74. #include <rpm/rpmlib.h>
  75. #include <rpm/rpmmacro.h>
  76. Index: apt-pkg/rpm/rpmindexfile.cc
  77. --- apt-pkg/rpm/rpmindexfile.cc.orig 2003-11-24 17:58:58.000000000 +0100
  78. +++ apt-pkg/rpm/rpmindexfile.cc 2003-11-28 21:06:52.000000000 +0100
  79. @@ -58,7 +58,7 @@
  80. Res = URI;
  81. }
  82. else
  83. - Res = URI + Dist + "/base/";
  84. + Res = URI + Dist + "/";
  85. Res += Type;
  86. @@ -145,7 +145,7 @@
  87. Res = URI;
  88. }
  89. else
  90. - Res = URI + Dist + "/base/";
  91. + Res = URI + Dist + "/";
  92. Res += Type + '.' + Section;
  93. @@ -277,8 +277,8 @@
  94. if (Repository->IsAuthenticated() == true &&
  95. Repository->HasRelease() == false)
  96. return true;
  97. - new pkgAcqIndex(Owner,Repository,IndexURI("srclist"),Info("srclist"),
  98. - "srclist");
  99. + new pkgAcqIndex(Owner,Repository,IndexURI("00INDEX.apt-srclist"),Info("00INDEX.apt-srclist"),
  100. + "00INDEX.apt-srclist");
  101. return true;
  102. }
  103. /*}}}*/
  104. @@ -347,10 +347,10 @@
  105. if (Repository->IsAuthenticated() == true &&
  106. Repository->HasRelease() == false)
  107. return true;
  108. - new pkgAcqIndex(Owner,Repository,IndexURI("pkglist"),Info("pkglist"),
  109. - "pkglist");
  110. - new pkgAcqIndexRel(Owner,Repository,IndexURI("release"),Info("release"),
  111. - "release");
  112. + new pkgAcqIndex(Owner,Repository,IndexURI("00INDEX.apt-pkglist"),Info("00INDEX.apt-pkglist"),
  113. + "00INDEX.apt-pkglist");
  114. + new pkgAcqIndexRel(Owner,Repository,IndexURI("00INDEX.apt-release"),Info("00INDEX.apt-release"),
  115. + "00INDEX.apt-release");
  116. return true;
  117. }
  118. /*}}}*/
  119. @@ -424,7 +424,7 @@
  120. return _error->Error(_("Problem opening %s"),PackageFile.c_str());
  121. }
  122. // We call SubProgress with Size(), since we won't call SelectFile() here.
  123. - Prog.SubProgress(Size(),Info("pkglist"));
  124. + Prog.SubProgress(Size(),Info("00INDEX.apt-pkglist"));
  125. if (Gen.MergeFileProvides(Parser) == false)
  126. return _error->Error(_("Problem with MergeFileProvides %s"),
  127. PackageFile.c_str());
  128. Index: apt-pkg/rpm/rpmindexfile.h
  129. --- apt-pkg/rpm/rpmindexfile.h.orig 2003-11-24 17:58:58.000000000 +0100
  130. +++ apt-pkg/rpm/rpmindexfile.h 2003-11-28 21:06:52.000000000 +0100
  131. @@ -140,7 +140,7 @@
  132. {
  133. protected:
  134. - virtual string MainType() const {return "srclist";}
  135. + virtual string MainType() const {return "00INDEX.apt-srclist";}
  136. public:
  137. Index: apt-pkg/rpm/rpmpackagedata.cc
  138. --- apt-pkg/rpm/rpmpackagedata.cc.orig 2003-11-24 17:58:55.000000000 +0100
  139. +++ apt-pkg/rpm/rpmpackagedata.cc 2003-11-28 21:06:52.000000000 +0100
  140. @@ -12,6 +12,7 @@
  141. #include <apti18n.h>
  142. +#include <rpm/glob.h>
  143. #include <rpm/rpmlib.h>
  144. RPMPackageData::RPMPackageData()
  145. Index: apt-pkg/rpm/rpmpm.cc
  146. --- apt-pkg/rpm/rpmpm.cc.orig 2003-11-24 17:58:53.000000000 +0100
  147. +++ apt-pkg/rpm/rpmpm.cc 2003-11-28 21:06:52.000000000 +0100
  148. @@ -34,6 +34,7 @@
  149. #include <stdio.h>
  150. #include <iostream>
  151. +#include <rpm/glob.h>
  152. #ifdef HAVE_RPM41
  153. #include <rpm/rpmdb.h>
  154. #define packagesTotal rpmcliPackagesTotal
  155. Index: apt-pkg/rpm/rpmpm.h
  156. --- apt-pkg/rpm/rpmpm.h.orig 2003-11-24 17:58:54.000000000 +0100
  157. +++ apt-pkg/rpm/rpmpm.h 2003-11-28 21:06:52.000000000 +0100
  158. @@ -11,6 +11,7 @@
  159. #ifndef PKGLIB_rpmPM_H
  160. #define PKGLIB_rpmPM_H
  161. +#include <rpm/glob.h>
  162. #include <rpm/rpmlib.h>
  163. #ifdef HAVE_RPM41
  164. #include <rpm/rpmts.h>
  165. Index: apt-pkg/rpm/rpmrecords.h
  166. --- apt-pkg/rpm/rpmrecords.h.orig 2003-11-24 17:58:57.000000000 +0100
  167. +++ apt-pkg/rpm/rpmrecords.h 2003-11-28 21:06:52.000000000 +0100
  168. @@ -21,6 +21,7 @@
  169. #include <apt-pkg/pkgrecords.h>
  170. #include <apt-pkg/fileutl.h>
  171. +#include <rpm/glob.h>
  172. #include <rpm/rpmlib.h>
  173. Index: apt-pkg/rpm/rpmsrcrecords.h
  174. --- apt-pkg/rpm/rpmsrcrecords.h.orig 2003-11-24 17:58:58.000000000 +0100
  175. +++ apt-pkg/rpm/rpmsrcrecords.h 2003-11-28 21:06:52.000000000 +0100
  176. @@ -17,6 +17,7 @@
  177. #include <apt-pkg/srcrecords.h>
  178. #include <apt-pkg/fileutl.h>
  179. +#include <rpm/glob.h>
  180. #include <rpm/rpmlib.h>
  181. Index: apt-pkg/rpm/rpmsystem.cc
  182. --- apt-pkg/rpm/rpmsystem.cc.orig 2003-11-24 17:58:54.000000000 +0100
  183. +++ apt-pkg/rpm/rpmsystem.cc 2003-11-28 21:06:52.000000000 +0100
  184. @@ -123,12 +123,12 @@
  185. /* These are the rpm specific configuration variables.. */
  186. bool rpmSystem::Initialize(Configuration &Cnf)
  187. {
  188. - Cnf.CndSet("Dir::Bin::rpm","/bin/rpm");
  189. + Cnf.CndSet("Dir::Bin::rpm","@l_bindir@/rpm");
  190. Cnf.CndSet("Dir::Etc::rpmpriorities", "rpmpriorities");
  191. Cnf.CndSet("Dir::Etc::translatelist", "translate.list");
  192. Cnf.CndSet("Dir::Etc::translateparts", "translate.list.d");
  193. Cnf.CndSet("Dir::State::prefetch", "prefetch");
  194. - Cnf.CndSet("Dir::Locale","/usr/share/locale");
  195. + Cnf.CndSet("Dir::Locale","@l_prefix@/share/locale");
  196. Cnf.CndSet("Acquire::DistroID","Conectiva"); // hee hee
  197. Cnf.CndSet("Acquire::CDROM::Mount", "/mnt/cdrom");
  198. Cnf.CndSet("Acquire::CDROM::Copy-All", "true");
  199. @@ -200,7 +200,7 @@
  200. if (FileExists(RPMDBHandler::DataPath(false)))
  201. Score += 10;
  202. - if (FileExists(Cnf.FindFile("Dir::Bin::rpm","/bin/rpm")) == true)
  203. + if (FileExists(Cnf.FindFile("Dir::Bin::rpm","@l_bindir@/rpm")) == true)
  204. Score += 10;
  205. return Score;
  206. Index: apt-pkg/rpm/rpmversion.cc
  207. --- apt-pkg/rpm/rpmversion.cc.orig 2003-11-24 17:58:55.000000000 +0100
  208. +++ apt-pkg/rpm/rpmversion.cc 2003-11-28 21:06:52.000000000 +0100
  209. @@ -22,6 +22,7 @@
  210. #include <apt-pkg/rpmversion.h>
  211. #include <apt-pkg/pkgcache.h>
  212. +#include <rpm/glob.h>
  213. #include <rpm/rpmlib.h>
  214. #include <rpm/misc.h>
  215. Index: apt-pkg/sourcelist.cc
  216. --- apt-pkg/sourcelist.cc.orig 2003-11-24 17:58:39.000000000 +0100
  217. +++ apt-pkg/sourcelist.cc 2003-11-28 21:06:52.000000000 +0100
  218. @@ -105,7 +105,7 @@
  219. // Check for an absolute dists specification.
  220. if (Dist.empty() == false && Dist[Dist.size() - 1] == '/')
  221. {
  222. - if (ParseQuoteWord(Buffer,Section) == true)
  223. + if (ParseQuoteWord(Buffer,Section) == false)
  224. return _error->Error(_("Malformed line %lu in source list %s (Absolute dist)"),CurLine,File.c_str());
  225. Dist = SubstVar(Dist,"$(ARCH)",_config->Find("APT::Architecture"));
  226. return CreateItem(List,URI,Dist,Section,Vendor);
  227. Index: configure.in
  228. --- configure.in.orig 2003-11-24 17:58:30.000000000 +0100
  229. +++ configure.in 2003-11-28 21:06:52.000000000 +0100
  230. @@ -48,14 +48,14 @@
  231. AC_CHECK_HEADER(rpm/rpmlib.h,
  232. [
  233. AC_CHECK_LIB(rpmdb,rpmdbOpen,
  234. - [RPMDBLIBS="-lrpmdb"],
  235. + [RPMDBLIBS="@rpmlibs@"],
  236. [RPMDBLIBS="-ldb-3.1"],
  237. - [-lrpm -lrpmio -lz -lbz2 -lpopt])
  238. + [@rpmlibs@ @l_rpmlibs@])
  239. AC_CHECK_LIB(rpm,rpmdbGetIteratorOffset,
  240. [AC_DEFINE_UNQUOTED(HAVE_RPM, 1)
  241. AC_DEFINE_UNQUOTED(HAVE_RPM4, 1)
  242. - RPMLIBS="-lrpm $RPMDBLIBS -lrpmio -lz -lbz2 -lpopt"
  243. + RPMLIBS="@rpmlibs@ $RPMDBLIBS @l_rpmlibs@"
  244. AC_CHECK_LIB(rpm, rpmtsUpdateDSI,
  245. [AC_DEFINE_UNQUOTED(HAVE_RPM41, 1)
  246. rpm_version="4.1"],
  247. @@ -64,11 +64,11 @@
  248. ],
  249. [AC_CHECK_LIB(rpm,rpmdbFirstRecNum,
  250. [AC_DEFINE_UNQUOTED(HAVE_RPM, 1)
  251. - RPMLIBS="-lrpm -ldb1 -lz -lbz2 -lpopt"
  252. + RPMLIBS="@rpmlibs@"
  253. rpm_version="3"],,
  254. - [-ldb1 -lz -lbz2 -lpopt])
  255. + [@rpmlibs@])
  256. ],
  257. - [$RPMDBLIBS -lrpmio -lz -lbz2 -lpopt])
  258. + [$RPMDBLIBS @rpmlibs@ @l_rpmlibs@])
  259. AC_SUBST(RPMLIBS)
  260. ])
  261. Index: methods/gpg.cc
  262. --- methods/gpg.cc.orig 2003-11-28 21:06:52.000000000 +0100
  263. +++ methods/gpg.cc 2003-11-28 21:07:38.000000000 +0100
  264. @@ -10,6 +10,11 @@
  265. #include <stdio.h>
  266. #include <sys/wait.h>
  267. +#ifdef OPENPKG_SOLARIS
  268. +#include <sys/syscall.h>
  269. +#include <sys/systm.h>
  270. +#endif
  271. +
  272. #include <apti18n.h>
  273. class GPGMethod : public pkgAcqMethod
  274. @@ -173,7 +178,81 @@
  275. }
  276. #undef STRCMP
  277. +#ifdef OPENPKG_SOLARIS
  278. +
  279. +static const char letters[] =
  280. +"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
  281. +
  282. +static int gen_tempname (char *tmpl)
  283. +{
  284. + int len;
  285. + char *XXXXXX;
  286. + static uint64_t value;
  287. + uint64_t random_time_bits;
  288. + int count, fd = -1;
  289. + int save_errno = errno;
  290. +
  291. + len = strlen(tmpl);
  292. + if ( len < 6 || strcmp (&tmpl[len - 6], "XXXXXX")) {
  293. + __set_errno(EINVAL);
  294. + return -1;
  295. + }
  296. +
  297. + XXXXXX = &tmpl[len - 6];
  298. + random_time_bits = time(NULL);
  299. + value += random_time_bits ^ getpid();
  300. +
  301. + for ( count = 0; count < TMP_MAX; value += 7777, ++count) {
  302. + uint64_t v = value;
  303. + XXXXXX[0] = letters[v % 62];
  304. + v /= 62;
  305. + XXXXXX[1] = letters[v % 62];
  306. + v /= 62;
  307. + XXXXXX[2] = letters[v % 62];
  308. + v /= 62;
  309. + XXXXXX[3] = letters[v % 62];
  310. + v /= 62;
  311. + XXXXXX[4] = letters[v % 62];
  312. + v /= 62;
  313. + XXXXXX[5] = letters[v % 62];
  314. +
  315. + fd = mkdir(tmpl, S_IRUSR | S_IWUSR | S_IXUSR);
  316. +
  317. + if ( fd > 0 ) {
  318. + __set_errno(save_errno);
  319. + return fd;
  320. + }
  321. + else if ( errno != EEXIST ) {
  322. + return -1;
  323. + }
  324. +
  325. + }
  326. +
  327. + __set_errno(EEXIST);
  328. + return -1;
  329. +}
  330. +
  331. +static char *mkdtemp(char *templat)
  332. +{
  333. + if (gen_tempname (templat))
  334. + return NULL;
  335. + else
  336. + return templat;
  337. +}
  338. +
  339. +static void unsetenv(char *varname)
  340. +{
  341. + char *tempstr = (char *)malloc(strlen(varname) + 2);
  342. + if ( tempstr == (char *)NULL ) {
  343. + return;
  344. + }
  345. + sprintf(tempstr, "%s=", varname);
  346. + tempstr[strlen(varname) + 1] = '\0';
  347. + putenv(tempstr);
  348. + free(tempstr);
  349. +}
  350. +#endif /* OPENPKG_SOLARIS */
  351. char *getFileSigner(const char *file, const char *sigfile,
  352. const char *outfile, string &signerKeyID)
  353. Index: test/scratch.cc
  354. --- test/scratch.cc.orig 2003-11-24 17:57:07.000000000 +0100
  355. +++ test/scratch.cc 2003-11-28 21:06:52.000000000 +0100
  356. @@ -51,7 +51,7 @@
  357. /* Db.GetFLCache().BeginDiverLoad();
  358. pkgFLCache::PkgIterator Pkg(Db.GetFLCache(),0);
  359. - if (Db.GetFLCache().AddDiversion(Pkg,"/usr/include/linux/kerneld.h","/usr/bin/nslookup") == false)
  360. + if (Db.GetFLCache().AddDiversion(Pkg,"/usr/include/linux/kerneld.h","@l_prefix@/bin/nslookup") == false)
  361. cerr << "Error!" << endl;
  362. const char *Tmp = "/usr/include/linux/kerneld.h";
  363. Index: tools/cached_md5.cc
  364. --- tools/cached_md5.cc.orig 2003-11-24 17:58:34.000000000 +0100
  365. +++ tools/cached_md5.cc 2003-11-28 21:06:52.000000000 +0100
  366. @@ -1,11 +1,11 @@
  367. /*
  368. * $Id: cached_md5.cc,v 1.4 2003/01/29 13:47:31 niemeyer Exp $
  369. */
  370. -#include <alloca.h>
  371. #include <ctype.h>
  372. #include <dirent.h>
  373. #include <errno.h>
  374. #include <fcntl.h>
  375. +#include <rpm/glob.h>
  376. #include <rpm/rpmlib.h>
  377. #include <stdlib.h>
  378. #include <string.h>
  379. Index: tools/genpkglist.cc
  380. --- tools/genpkglist.cc.orig 2003-11-24 17:58:36.000000000 +0100
  381. +++ tools/genpkglist.cc 2003-11-28 21:06:52.000000000 +0100
  382. @@ -1,11 +1,11 @@
  383. /*
  384. * $Id: genpkglist.cc,v 1.7 2003/01/30 17:18:21 niemeyer Exp $
  385. */
  386. -#include <alloca.h>
  387. #include <ctype.h>
  388. #include <dirent.h>
  389. #include <errno.h>
  390. #include <fcntl.h>
  391. +#include <rpm/glob.h>
  392. #include <rpm/rpmlib.h>
  393. #include <stdlib.h>
  394. #include <string.h>
  395. @@ -369,7 +369,7 @@
  396. }
  397. int scandir(const char * dir, struct dirent *** namelist,
  398. - int (* select)(struct dirent *),
  399. + int (* select)(const struct dirent *),
  400. int (* cmp)(const void *, const void *))
  401. {
  402. @@ -544,10 +544,10 @@
  403. rpmsdir = string(op_dir);
  404. }
  405. }
  406. - pkglist_path = string(rpmsdir);
  407. - rpmsdir = rpmsdir + "/RPMS." + string(op_suf);
  408. + pkglist_path = rpmsdir + "/" + string(op_suf);
  409. + rpmsdir = rpmsdir + "/" + string(op_suf);
  410. - string dirtag = "RPMS." + string(op_suf);
  411. + string dirtag = string(op_suf);
  412. entry_no = scandir(rpmsdir.c_str(), &dirEntries, selectDirent, alphasort);
  413. if (entry_no < 0) {
  414. @@ -559,9 +559,9 @@
  415. chdir(rpmsdir.c_str());
  416. if (pkgListSuffix != NULL)
  417. - pkglist_path = pkglist_path + "/base/pkglist." + pkgListSuffix;
  418. + pkglist_path = pkglist_path + "/00INDEX.apt-pkglist." + pkgListSuffix;
  419. else
  420. - pkglist_path = pkglist_path + "/base/pkglist." + op_suf;
  421. + pkglist_path = pkglist_path + "/00INDEX.apt-pkglist." + op_suf;
  422. if (pkgListAppend == true && FileExists(pkglist_path)) {
  423. Index: tools/gensrclist.cc
  424. --- tools/gensrclist.cc.orig 2003-11-24 17:58:34.000000000 +0100
  425. +++ tools/gensrclist.cc 2003-11-28 21:06:52.000000000 +0100
  426. @@ -1,11 +1,11 @@
  427. /*
  428. * $Id: gensrclist.cc,v 1.8 2003/01/30 17:18:21 niemeyer Exp $
  429. */
  430. -#include <alloca.h>
  431. #include <ctype.h>
  432. #include <dirent.h>
  433. #include <errno.h>
  434. #include <fcntl.h>
  435. +#include <rpm/glob.h>
  436. #include <rpm/rpmlib.h>
  437. #include <stdlib.h>
  438. #include <string.h>
  439. @@ -134,6 +134,89 @@
  440. }
  441. #endif
  442. +#ifndef HAVE_SCANDIR
  443. +// from glibc 1.09.1 mod'd by jmik, ins'd by asm, fix'd by sbi
  444. +int alphasort(const void * a, const void * b)
  445. +{
  446. + return strcmp ((*(struct dirent **) a)->d_name,
  447. + (*(struct dirent **) b)->d_name);
  448. +}
  449. +
  450. +int scandir(const char * dir, struct dirent *** namelist,
  451. + int (* select)(const struct dirent *),
  452. + int (* cmp)(const void *, const void *))
  453. +
  454. +{
  455. + DIR *dp = opendir (dir);
  456. + struct dirent **v = NULL;
  457. + size_t vsize = 0, i;
  458. + struct dirent *d;
  459. + int save;
  460. +
  461. + if (dp == NULL)
  462. + return -1;
  463. +
  464. + save = errno;
  465. + errno = 0;
  466. +
  467. + i = 0;
  468. + while ((d = readdir (dp)) != NULL)
  469. + {
  470. + if (select == NULL || (*select) (d))
  471. + {
  472. + if (i == vsize)
  473. + {
  474. + struct dirent **newv;
  475. + if (vsize == 0)
  476. + vsize = 10;
  477. + else
  478. + vsize *= 2;
  479. + newv = (struct dirent **) realloc (v, vsize * sizeof (*v));
  480. + if (newv == NULL)
  481. + {
  482. + lose:
  483. + errno = ENOMEM;
  484. + break;
  485. + }
  486. + v = newv;
  487. + }
  488. +
  489. + v[i] = (struct dirent *) malloc (d->d_reclen);
  490. + if (v[i] == NULL)
  491. + goto lose;
  492. +
  493. + // *v[i++] = *d;
  494. + memcpy(v[i], d, d->d_reclen);
  495. + i++;
  496. + }
  497. + }
  498. +
  499. + v[i] = NULL;
  500. +
  501. + if (errno != 0)
  502. + {
  503. + save = errno;
  504. + (void) closedir (dp);
  505. + while (i > 0)
  506. + free (v[--i]);
  507. + free (v);
  508. + errno = save;
  509. + return -1;
  510. + }
  511. +
  512. + (void) closedir (dp);
  513. + errno = save;
  514. +
  515. + /* Sort the list if we have a comparison function to sort with. */
  516. + if (cmp != NULL)
  517. + qsort (v, i, sizeof (struct dirent *), cmp);
  518. +
  519. + *namelist = v;
  520. + return i;
  521. +}
  522. +// end of new stuff from glibc
  523. +#endif
  524. +
  525. int main(int argc, char ** argv)
  526. {
  527. char buf[300];
  528. @@ -199,10 +282,10 @@
  529. } else
  530. strcpy(buf, arg_dir);
  531. - strcat(buf, "/SRPMS.");
  532. + strcat(buf, "/");
  533. strcat(buf, arg_suffix);
  534. - srpmdir = "SRPMS." + string(arg_suffix);
  535. + srpmdir = string(arg_suffix);
  536. #ifdef OLD_FLATSCHEME
  537. if (flatStructure) {
  538. // add the last component of the directory to srpmdir
  539. @@ -234,9 +317,9 @@
  540. chdir(buf);
  541. if (srcListSuffix != NULL)
  542. - sprintf(buf, "%s/srclist.%s", cwd, srcListSuffix);
  543. + sprintf(buf, "00INDEX.apt-srclist.%s", srcListSuffix);
  544. else
  545. - sprintf(buf, "%s/srclist.%s", cwd, arg_suffix);
  546. + sprintf(buf, "00INDEX.apt-srclist.%s", arg_suffix);
  547. if (srcListAppend == true && FileExists(buf)) {
  548. outfd = fdOpen(buf, O_WRONLY|O_APPEND, 0644);