From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Sat, 11 Aug 2007 20:26:47 +0400 From: Alexey Tourbin To: ALT Devel discussion list Message-ID: <20070811162647.GE7530@solemn.turbinal> Mail-Followup-To: ALT Devel discussion list References: <20070806222048.GH7530@solemn.turbinal> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="eDyw1yV8HuEtd7LH" Content-Disposition: inline In-Reply-To: <20070806222048.GH7530@solemn.turbinal> Subject: Re: [devel] symlinks.req: semi-unmets X-BeenThere: devel@lists.altlinux.org X-Mailman-Version: 2.1.9rc1 Precedence: list Reply-To: ALT Devel discussion list List-Id: ALT Devel discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Aug 2007 08:22:48 -0000 Archived-At: List-Archive: List-Post: --eDyw1yV8HuEtd7LH Content-Type: multipart/mixed; boundary="H7BnLk9CMipoMykF" Content-Disposition: inline --H7BnLk9CMipoMykF Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Aug 07, 2007 at 02:20:48AM +0400, Alexey Tourbin wrote: > On Mon, Aug 06, 2007 at 03:08:04PM +0400, Alexey Tourbin wrote: > =FA=E1=EF=F3=F4=F2=F1=E0 =F0=F2=EF=E2=EC=E5=ED=F5 "=F0=EF=EC=F5-=E1=EE=ED= =E5=F4=EF=F7". >=20 >=20 > =FC=D4=CF =D0=D2=CF=C2=CC=C5=CD=C1 =D0=D2=CF=D1=D7=CC=D1=C5=D4=D3=D1 =D4= =CF=C7=C4=C1, =CB=CF=C7=C4=C1 =DA=C1=D7=C9=D3=C9=CD=CF=D3=D4=D8 =C9=CD=C5= =C5=D4 =D7=C9=C4 /=F0=F5=F4=F8, > =CE=CF =D5 =D3=CF=CF=D4=D7=C5=D4=D3=D4=D7=D5=C0=DD=C5=C7=CF =D0=C1=CB=C5= =D4=C1 =CE=C5 =D3=D4=C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F "=CF=D0=D4=C9=CD=C9=DA=C9=D2=D5=C0= =D4=D3=D1". >=20 > =E4=D7=C1 =D0=D2=CF=D3=D4=D9=C8 =D7=C1=D2=C9=C1=CE=D4=C1 =D2=C5=DB=C5=CE= =C9=D1 =DC=D4=CF =D0=D2=CF=C2=CC=C5=CD=D9: >=20 > 1) =E7=C5=CE=C5=D2=C9=D2=CF=D7=C1=D4=D8 =C2=CF=CC=C5=C5 =D0=CF=CC=CE=D9= =CA content_index =C4=CC=D1 hasher, =DE=D4=CF=C2=D9 =CC=C0=C2=CF=CA =D0=D5= =D4=D8 > =C2=CF=CC=C5=C5 =C7=C1=D2=C1=CE=D4=C9=D2=CF=D7=C1=CE=CE=CF =D4=D2=C1=CE= =D3=C6=CF=D2=CD=C9=D2=CF=D7=C1=CC=D3=D1 =D7 =CE=C1=DA=D7=C1=CE=C9=C5 =D0=C1= =CB=C5=D4=C1 (=CE=C1=D3=CB=CF=CC=D8=CB=CF > =C2=CF=CC=C5=C5 =D0=CF=CC=CE=D9=CA/=C7=C1=D2=C1=CE=D4=C9=D2=CF=D7=C1=CE= =CE=CF?). >=20 > 2) =F7=CF=D3=D3=D4=C1=CE=CF=D7=C9=D4=D8 =C6=C1=CA=CC=CF=D7=D9=C5 =CC=C9= =D3=D4=D9 =C4=CC=D1 =C1=D0=D4. =EE=C1=D3=CB=CF=CC=D8=CB=CF =D0=CF=D4=D1=D6= =C5=CC=C5=C5=D4 > pkglist.classic.bz2? =F1 =CE=C5=CD=CE=CF=C7=CF =DA=C1=C8=C1=DE=C9=CC =C1=D0=D4, =CE=CF =DC=D4=CF= =D7=D3=A3 =D2=C1=D7=CE=CF =CB=C1=CB =D3=CC=C5=C4=D5=C5=D4 =CE=C5 =D2=C1=C2= =CF=D4=C1=C5=D4, =D3=CD. =CE=C9=D6=C5. commit 30e27b0f1c74b4f67354a6035fae3e210131bca1 Author: Alexey Tourbin Date: Sat Aug 11 20:01:05 2007 +0400 apt-0.5.15lorg2-alt-genpkglist-reqfiles.patch =20 genpkglist strips file lists by default (without --bloat option). It keeps only some "useful files" by using a few ad hoc patterns. =20 This can break file-level dependencies. Consider pkgA requires /usr/lib/foo1/bar, and pkgB owns this file without explicitly providing it. Now if genpkglist strips /usr/lib/foo1/bar from pkgB file list, this is going to be an unmet dependency. =20 This patch changes genpkglist behaviour, so that, when genpkglist is invoked without --bloat option, it first finds all file-level dependencies (something like "rpm -qaR |grep ^/"). This requires a separate pass. The list of file-level dependencies is saved into "reqfiles" global variable. And on the second (normal) pass, the function usefulFile() is modified to check the "reqfiles" variable; that is, it should keep a file in the file list if it's been required by some package in the repo. =20 (Unfortunately, this patch does not solve all of the problems I want it to solve; we have separate repos for i586 and noarch -- inter-repo file-level dependencies cannot be resolved this way.) --H7BnLk9CMipoMykF Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="apt-0.5.15lorg2-alt-genpkglist-reqfiles.patch" Content-Transfer-Encoding: quoted-printable --- apt-0.5.15lorg2/tools/genpkglist.cc- 2007-08-11 15:10:54 +0400 +++ apt-0.5.15lorg2/tools/genpkglist.cc 2007-08-11 19:36:03 +0400 @@ -18,6 +18,8 @@ #include #include =20 +#include + #include #include #include @@ -77,20 +79,30 @@ typedef struct { string url; } UpdateInfo; =20 +static std::tr1::unordered_set reqfiles; =20 -static inline int usefullFile(char *a) +static int usefulFile(const char *dir, const char *basename) { - int l =3D strlen(a); - =20 - if (strstr(a, "bin") || strstr(a, "/etc") || strncmp(a, "/lib", 4) =3D= =3D 0) - return 1; - =20 - if (l < 3) - return 0; + if (strstr(dir, "bin/")) + return 1; + if (strstr(dir, "/etc/")) + return 1; =20 - if (strcmp(a + l - 3, ".so") =3D=3D 0 - || strstr(a, ".so.")) - return 1; + const char *pos =3D strstr(basename, ".so"); + if (pos > basename) { + int c =3D pos[3]; + if (c =3D=3D '.' || c =3D=3D '\0') + return 1; + } + + if (reqfiles.size() > 0) { + char fullname[strlen(dir) + strlen(basename) + 1]; + strcpy(fullname, dir); + strcat(fullname, basename); + if (reqfiles.find(fullname) !=3D reqfiles.end()) + return 2; + } + return 0; } =20 @@ -133,9 +145,8 @@ static void copyStrippedFileList(Header=20 { int ok =3D 0; =20 - ok =3D usefullFile(basenames[i]); - if (!ok)=20 - ok =3D usefullFile(dirnames[dirindexes[i]]); + ok =3D usefulFile(dirnames[dirindexes[i]], basenames[i]); + // if (ok > 1) cerr << "useful file: " << dirnames[dirindexes[i]] <<= basenames[i] <d_name, O_RDONLY, 0666); + if (!fd) + continue; + int rc; + Header h; +#if RPM_VERSION >=3D 0x040100 + rc =3D rpmReadPackageFile(ts, fd, dirEntries[entry_cur]->d_name, = &h); + if (rc =3D=3D RPMRC_OK || rc =3D=3D RPMRC_NOTTRUSTED || rc =3D=3D= RPMRC_NOKEY) { +#else + rc =3D rpmReadPackageHeader(fd, &h, &isSource, NULL, NULL); + if (rc =3D=3D 0) { +#endif + int reqtype; + const char **requires; + int nreq; + rc =3D headerGetEntry(h, RPMTAG_REQUIRENAME, &reqtype, (void**= )&requires, &nreq); + if (rc =3D=3D 1 && reqtype =3D=3D RPM_STRING_ARRAY_TYPE) { + int i; + for (i =3D 0; i < nreq; i++) { + const char *req =3D requires[i]; + if (*req =3D=3D '/') { + // cerr << dirEntries[entry_cur]->d_name << " require= s " << req << endl; + reqfiles.insert(req); + } + } + } + headerFree(h); + } + Fclose(fd); + } + } for (entry_cur =3D 0; entry_cur < entry_no; entry_cur++) { struct stat sb; =20 --H7BnLk9CMipoMykF-- --eDyw1yV8HuEtd7LH Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (GNU/Linux) iD8DBQFGveNHfBKgtDjnu0YRAv5AAJ9j7B6iS6+nT0xeXy1mDfTqeMKbAgCgxHTB KQGNRuz9I7U0oLvDpZw/8tA= =gaTd -----END PGP SIGNATURE----- --eDyw1yV8HuEtd7LH--