SOURCES: deltarpm-3.4-multilib-include-colored.patch (NEW), deltar...

skibi skibi at pld-linux.org
Sun Sep 9 17:08:16 CEST 2007


Author: skibi                        Date: Sun Sep  9 15:08:16 2007 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- Patch for delta rpm

---- Files affected:
SOURCES:
   deltarpm-3.4-multilib-include-colored.patch (NONE -> 1.1)  (NEW), deltarpm-3.4-multilib-workaround.patch (NONE -> 1.1)  (NEW), deltarpm-3.4-no-skip-doc.patch (NONE -> 1.1)  (NEW), deltarpm-3.4-pld.patch (NONE -> 1.1)  (NEW), deltarpm-3.4-prelink-bugfix.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/deltarpm-3.4-multilib-include-colored.patch
diff -u /dev/null SOURCES/deltarpm-3.4-multilib-include-colored.patch:1.1
--- /dev/null	Sun Sep  9 17:08:16 2007
+++ SOURCES/deltarpm-3.4-multilib-include-colored.patch	Sun Sep  9 17:08:11 2007
@@ -0,0 +1,113 @@
+diff -ur deltarpm-3.4/makedeltarpm.c deltarpm/makedeltarpm.c
+--- deltarpm-3.4/makedeltarpm.c	2007-03-06 08:35:55.000000000 -0500
++++ deltarpm/makedeltarpm.c	2007-05-30 11:43:19.000000000 -0400
+@@ -413,6 +413,21 @@
+     }
+ }
+ 
++static int 
++in_multilib_dir(char *fn)
++{
++  char *dirs[] = { "lib/", "lib64/", "lib32/", NULL };
++  int i;
++
++  for (i=0; dirs[i] != NULL; i++)
++    {
++      if (strstr(fn, dirs[i]) != NULL)
++	return 1;
++    }
++
++  return 0;
++}
++
+ int
+ main(int argc, char **argv)
+ {
+@@ -422,7 +437,7 @@
+   char *nevr;
+   int filecnt;
+   char **filenames, **filemd5s, **filelinktos;
+-  unsigned int *fileflags, *filemodes, *filerdevs, *filesizes, *fileverify;
++  unsigned int *fileflags, *filemodes, *filerdevs, *filesizes, *fileverify, *filecolors;
+   int i, fd, l, l2, l3;
+   struct cfile *bfd;
+   struct cpiophys cph;
+@@ -439,6 +454,7 @@
+   int skipped_badsize = 0;
+   int skipped_fileflags = 0;
+   int skipped_verifyflags = 0;
++  int skipped_multilib = 0;
+   int skipped_all = 0;
+   int pinfo = 0;
+   struct rpmlfile *files1 = 0;
+@@ -735,6 +751,7 @@
+   filemodes = headint16(h, TAG_FILEMODES, (int *)0);
+   fileverify = headint32(h, TAG_FILEVERIFY, (int *)0);
+   filelinktos = headstringarray(h, TAG_FILELINKTOS, (int *)0);
++  filecolors = headint32(h, TAG_FILECOLORS, (int *)0);
+ 
+   if (alone)
+     {
+@@ -893,6 +910,12 @@
+ 		    fprintf(vfp, "skipping %s: bad verify flags %x\n", np, fileverify[i]);
+ 		  skipped_verifyflags++;
+ 		}
++	      else if (filecolors && (filecolors[i] & (RPMFC_ELF32 | RPMFC_ELF64)) != 0 && !in_multilib_dir(np))
++		{
++		  if (verbose > 1)
++		    fprintf(vfp, "skipping %s: colored file in non-multilib dir\n", np);
++		  skipped_multilib++;
++		}
+ 	      else
+ 		{
+ 		  if (verbose > 1)
+@@ -1049,6 +1072,8 @@
+ 	    fprintf(vfp, "  file flags:   %4d/%d = %.1f%%\n", skipped_fileflags, skipped_all, skipped_fileflags * 100. / skipped_all);
+ 	  if (skipped_verifyflags)
+ 	    fprintf(vfp, "  verify flags: %4d/%d = %.1f%%\n", skipped_verifyflags, skipped_all, skipped_verifyflags * 100. / skipped_all);
++	  if (skipped_multilib)
++	    fprintf(vfp, "  colored-not-in-multidir: %4d/%d = %.1f%%\n", skipped_multilib, skipped_all, skipped_multilib * 100. / skipped_all);
+ 	}
+       addtoseq(-1);
+       if (verbose > 1)
+@@ -1073,6 +1098,7 @@
+   fileverify = xfree(fileverify);
+   filelinktos = xfree(filelinktos);
+   filenames = xfree(filenames);
++  filecolors = xfree(filecolors);
+   if (!alone)
+     h = xfree(h);
+ 
+diff -ur deltarpm-3.4/Makefile deltarpm/Makefile
+--- deltarpm-3.4/Makefile	2007-03-06 08:35:55.000000000 -0500
++++ deltarpm/Makefile	2007-05-30 11:14:31.000000000 -0400
+@@ -3,7 +3,7 @@
+ mandir=$(prefix)/man
+ rpmdumpheader=$(bindir)/rpmdumpheader
+ zlibdir=zlib-1.2.2.f-rsyncable
+-CFLAGS = -O2 -Wall
++CFLAGS = -O2 -Wall -g
+ CPPFLAGS = -DDELTARPM_64BIT -DBSDIFF_NO_SUF -DRPMDUMPHEADER=\"$(rpmdumpheader)\" -I$(zlibdir)
+ LDLIBS = -lbz2 $(zlibdir)/libz.a
+ LDFLAGS =
+diff -ur deltarpm-3.4/rpmhead.h deltarpm/rpmhead.h
+--- deltarpm-3.4/rpmhead.h	2007-03-06 08:35:55.000000000 -0500
++++ deltarpm/rpmhead.h	2007-05-30 11:14:31.000000000 -0400
+@@ -27,6 +27,7 @@
+ #define TAG_DIRNAMES    1118
+ #define TAG_PAYLOADFORMAT 1124
+ #define TAG_PAYLOADCOMPRESSOR 1125
++#define TAG_FILECOLORS  1140
+ 
+ #define SIGTAG_SIZE     1000
+ #define SIGTAG_MD5      1004
+@@ -42,6 +43,9 @@
+ #define VERIFY_MD5      (1 << 0)
+ #define VERIFY_FILESIZE (1 << 1)
+ 
++#define RPMFC_ELF32     (1 << 0)
++#define RPMFC_ELF64     (1 << 1)
++
+ #define devmajor(rdev) (((rdev) >> 8) & 0xfff)
+ #define devminor(rdev) (((rdev) & 0xff) | (((rdev) >> 12) & 0xfff00))
+ 

================================================================
Index: SOURCES/deltarpm-3.4-multilib-workaround.patch
diff -u /dev/null SOURCES/deltarpm-3.4-multilib-workaround.patch:1.1
--- /dev/null	Sun Sep  9 17:08:16 2007
+++ SOURCES/deltarpm-3.4-multilib-workaround.patch	Sun Sep  9 17:08:11 2007
@@ -0,0 +1,74 @@
+--- ./applydeltarpm.c.orig	2007-03-20 16:17:29.291156000 +0000
++++ ./applydeltarpm.c	2007-04-23 15:37:12.959694000 +0000
+@@ -1115,8 +1115,9 @@ main(int argc, char **argv)
+   int seqmatches = 1;
+   FILE *vfp;
+   struct deltarpm d;
++  char *arch = 0;
+ 
+-  while ((c = getopt(argc, argv, "cCisvpr:")) != -1)
++  while ((c = getopt(argc, argv, "cCisvpr:a:")) != -1)
+     {
+       switch(c)
+ 	{
+@@ -1144,6 +1145,9 @@ main(int argc, char **argv)
+ 	  checkflags = SEQCHECK_SIZE;
+ 	  check = 1;
+ 	  break;
++	case 'a':
++	  arch = optarg;
++	  break;
+ 	default:
+ 	  fprintf(stderr, "usage: applydeltarpm [-r <rpm>] deltarpm rpm\n");
+           exit(1);
+@@ -1328,7 +1332,10 @@ main(int argc, char **argv)
+ 	      dup2(pi[1], 1);
+ 	      close(pi[1]);
+ 	    }
+-	  execlp(RPMDUMPHEADER, RPMDUMPHEADER, d.nevr, (char *)0);
++	  if (arch)
++	    execlp(RPMDUMPHEADER, RPMDUMPHEADER, "-a", arch, d.nevr, (char *)0);
++	  else
++	    execlp(RPMDUMPHEADER, RPMDUMPHEADER, d.nevr, (char *)0);
+ 	  perror(RPMDUMPHEADER);
+ 	  _exit(1);
+ 	}
+--- ./rpmdumpheader.c.orig	2007-03-02 13:53:59.600823000 +0000
++++ ./rpmdumpheader.c	2007-04-23 15:40:34.057415000 +0000
+@@ -23,7 +23,14 @@ int main(int argc, char **argv)
+   char *e;
+   char *v;
+   char *r;
++  char *a = NULL;
+ 
++  if (argc > 2 && !strcmp(argv[1], "-a"))
++    {
++      a = argv[2];
++      argc -= 2;
++      argv += 2;
++    }
+   if (argc != 2)
+     {
+       fprintf(stderr, "usage: rpmdumpheader package\n");
+@@ -62,6 +69,9 @@ int main(int argc, char **argv)
+   rpmdbSetIteratorRE(mi, RPMTAG_EPOCH, RPMMIRE_STRCMP, e);
+   rpmdbSetIteratorRE(mi, RPMTAG_VERSION, RPMMIRE_STRCMP, v);
+   rpmdbSetIteratorRE(mi, RPMTAG_RELEASE, RPMMIRE_STRCMP, r);
++  if (a)
++    rpmdbSetIteratorRE(mi, RPMTAG_ARCH, RPMMIRE_STRCMP, a);
++
+   if ((h = rpmdbNextIterator(mi)) != NULL)
+     {
+       fdo = Fopen("-", "w.ufdio");
+@@ -70,9 +80,9 @@ int main(int argc, char **argv)
+   else
+     {
+       if (e)
+-	fprintf(stderr, "%s-%s:%s-%s is not installed\n", n, e, v, r);
++	fprintf(stderr, "%s-%s:%s-%s%s%s is not installed\n", n, e, v, r, a ? "." : "", a ? a : "");
+       else
+-	fprintf(stderr, "%s-%s-%s is not installed\n", n, v, r);
++	fprintf(stderr, "%s-%s-%s%s%s is not installed\n", n, v, r, a ? "." : "", a ? a : "");
+       ret = 1;
+     }
+   mi = rpmdbFreeIterator(mi);

================================================================
Index: SOURCES/deltarpm-3.4-no-skip-doc.patch
diff -u /dev/null SOURCES/deltarpm-3.4-no-skip-doc.patch:1.1
--- /dev/null	Sun Sep  9 17:08:16 2007
+++ SOURCES/deltarpm-3.4-no-skip-doc.patch	Sun Sep  9 17:08:11 2007
@@ -0,0 +1,28 @@
+diff -ur deltarpm-3.4b/makedeltarpm.c deltarpm-3.4a/makedeltarpm.c
+--- deltarpm-3.4b/makedeltarpm.c	2007-03-06 15:35:55.000000000 +0200
++++ deltarpm-3.4a/makedeltarpm.c	2007-04-04 21:13:04.000000000 +0300
+@@ -887,6 +887,13 @@
+ 		    fprintf(vfp, "skipping %s: bad file flags\n", np);
+ 		  skipped_fileflags++;
+ 		}
++	      else if ((fileflags[i] & FILE_DOC) != 0)
++		{
++		  if (verbose > 1)
++		    fprintf(vfp, "USING DOC %s\n", np);
++		  lsize = size;
++		  skip = 0;
++		}
+ 	      else if ((fileverify[i] & (VERIFY_MD5|VERIFY_FILESIZE)) != (VERIFY_MD5|VERIFY_FILESIZE))
+ 		{
+ 		  if (verbose > 1) 
+diff -ur deltarpm-3.4b/rpmhead.h deltarpm-3.4a/rpmhead.h
+--- deltarpm-3.4b/rpmhead.h	2007-03-06 15:35:55.000000000 +0200
++++ deltarpm-3.4a/rpmhead.h	2007-04-04 21:12:05.000000000 +0300
+@@ -35,6 +35,7 @@
+ #define SIGTAG_SHA1     269
+ 
+ #define FILE_CONFIG     (1 << 0)
++#define FILE_DOC        (1 << 1)
+ #define FILE_MISSINGOK  (1 << 3)
+ #define FILE_GHOST      (1 << 6)
+ #define FILE_UNPATCHED  (1 << 10)

================================================================
Index: SOURCES/deltarpm-3.4-pld.patch
diff -u /dev/null SOURCES/deltarpm-3.4-pld.patch:1.1
--- /dev/null	Sun Sep  9 17:08:16 2007
+++ SOURCES/deltarpm-3.4-pld.patch	Sun Sep  9 17:08:11 2007
@@ -0,0 +1,12 @@
+diff -ruN deltarpm-3.4/Makefile deltarpm-3.4.new/Makefile
+--- deltarpm-3.4/Makefile	2007-09-09 14:28:40.228449568 +0000
++++ deltarpm-3.4.new/Makefile	2007-09-09 14:29:42.218992621 +0000
+@@ -1,6 +1,6 @@
+-prefix=/usr/local
++prefix=/usr
+ bindir=$(prefix)/bin
+-mandir=$(prefix)/man
++mandir=$(prefix)/share/man
+ rpmdumpheader=$(bindir)/rpmdumpheader
+ zlibdir=zlib-1.2.2.f-rsyncable
+ CFLAGS = -O2 -Wall -g

================================================================
Index: SOURCES/deltarpm-3.4-prelink-bugfix.patch
diff -u /dev/null SOURCES/deltarpm-3.4-prelink-bugfix.patch:1.1
--- /dev/null	Sun Sep  9 17:08:16 2007
+++ SOURCES/deltarpm-3.4-prelink-bugfix.patch	Sun Sep  9 17:08:11 2007
@@ -0,0 +1,131 @@
+diff -ur deltarpm-3.4a/applydeltarpm.c deltarpm-3.4b/applydeltarpm.c
+--- deltarpm-3.4a/applydeltarpm.c	2007-03-06 15:35:16.000000000 +0200
++++ deltarpm-3.4b/applydeltarpm.c	2007-07-11 17:36:59.000000000 +0300
+@@ -394,10 +394,7 @@
+ 	    {
+ 	      if (fd != -1)
+ 		{
+-		  if (isp)
+-		    prelinked_close(fd);
+-		  else
+-		    close(fd);
++		  close(fd);
+ 		  fd = -1;
+ 		}
+ 	      sd++;
+@@ -486,10 +483,7 @@
+ 		{
+ 		  if (fd)
+ 		    {
+-		      if (isp)
+-			prelinked_close(fd);
+-		      else
+-			close(fd);
++		      close(fd);
+ 		      fd = -1;
+ 		    }
+ 		  l2 = l > sd->datalen - o ? sd->datalen - o : l;
+@@ -996,7 +990,7 @@
+       rpmMD5Update(&ctx, buf, l);
+       size -= l;
+     }
+-  prelinked_close(fd);
++  close(fd);
+   rpmMD5Final(md5, &ctx);
+   if (memcmp(md5, hmd5, 16))
+     {
+diff -ur deltarpm-3.4a/prelink.c deltarpm-3.4b/prelink.c
+--- deltarpm-3.4a/prelink.c	2005-06-06 15:41:07.000000000 +0300
++++ deltarpm-3.4b/prelink.c	2007-07-11 17:42:49.000000000 +0300
+@@ -7,6 +7,7 @@
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <sys/wait.h>
++#include <fcntl.h>
+ 
+ static inline int
+ elf16(unsigned char *buf, int le)
+@@ -122,9 +123,10 @@
+ prelinked_open(char *name)
+ {
+   pid_t pid;
+-  int status;
++  int fd, status;
+   int p[2];
+   struct stat stb;
++  char template[21];
+ 
+   if (stat("/usr/sbin/prelink", &stb))
+     {
+@@ -132,49 +134,33 @@
+       fprintf(stderr, "prelink not installed, cannot undo prelinking");
+       exit(1);
+     }
+-  if (prelink_pid != (pid_t)-1)
++  strcpy(template, "/tmp/deltarpm.XXXXXX");
++  if ((fd = mkstemp(template)) == -1)
+     {
+-      waitpid(prelink_pid, &status, WNOHANG);
+-      prelink_pid = (pid_t)-1;
+-    }
+-  if (pipe(p))
+-    {
+-      perror("pipe");
++      perror("mkstemp");
+       exit(1);
+     }
++  close(fd);    /* prelink renames another tmpfile over our file */
+   pid = fork();
+   if (pid == (pid_t)(-1))
+     {
+       perror("fork");
+       exit(1);
+     }
+-  if (pid)
++  if (!pid)
+     {
+-      prelink_pid = pid;
+-      close(p[1]);
+-      return p[0];
++      execl("/usr/sbin/prelink", "prelink", "-o", template, "-u", name, (char *)0);
++      perror("/usr/sbin/prelink");
++      _exit(1);
+     }
+-  close(p[0]);
+-  if (p[1] != 1)
++  while (waitpid(pid, &status, 0) == (pid_t)-1)
++    ;
++  if ((fd = open(template, O_RDONLY)) == -1)
+     {
+-      dup2(p[1], 1);
+-      close(p[1]);
++      perror(template);
++      exit(1);
+     }
+-  execl("/usr/sbin/prelink", "prelink", "-y", name, (char *)0);
+-  perror("/usr/sbin/prelink");
+-  _exit(1);
++  unlink(template);
++  return fd; 
+ }
+ 
+-void
+-prelinked_close(int fd)
+-{
+-  int status;
+-
+-  close(fd);
+-  if (prelink_pid != (pid_t)-1)
+-    {
+-      kill(prelink_pid, SIGPIPE);
+-      if (waitpid(prelink_pid, &status, 0) == prelink_pid)
+-	prelink_pid = (pid_t)-1;
+-    }
+-}
+diff -ur deltarpm-3.4a/prelink.h deltarpm-3.4b/prelink.h
+--- deltarpm-3.4a/prelink.h	2005-06-02 20:01:07.000000000 +0300
++++ deltarpm-3.4b/prelink.h	2007-07-11 17:36:59.000000000 +0300
+@@ -1,3 +1,2 @@
+ extern int is_prelinked(int fd, unsigned char *buf, int l);
+ extern int prelinked_open(char *name);
+-extern void prelinked_close(int fd);
================================================================


More information about the pld-cvs-commit mailing list