[Pkg-ocaml-maint-commits] [SCM] dose2 packaging branch, master, updated. debian/1.4.2-1-1-g6f4f567
Ralf Treinen
treinen at free.fr
Wed Feb 3 21:20:43 UTC 2010
The following commit has been merged in the master branch:
commit 5eaa5528f0be364d8f37aade436835f6f5c8c507
Author: Ralf Treinen <treinen at free.fr>
Date: Tue Jun 16 20:34:50 2009 +0200
use ocamlrpm_stubs.c from upstream
diff --git a/debian/changelog b/debian/changelog
index 5dafa26..97746e0 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+dose2 (1.4.1-3) unstable; urgency=low
+
+ * Merge in latest ocamlrpm/ocamlrpm_stubs.c from upstream svn to solve
+ an issue with fdOpen and fdClose calls
+
+ -- Ralf Treinen <treinen at debian.org> Tue, 16 Jun 2009 20:34:25 +0200
+
dose2 (1.4.1-2) unstable; urgency=low
* Remove reference to the lead datastructure from rpm 4.4 (closes: #533165).
diff --git a/ocamlrpm/ocamlrpm_stubs.c b/ocamlrpm/ocamlrpm_stubs.c
index a3c5da3..66da4dd 100644
--- a/ocamlrpm/ocamlrpm_stubs.c
+++ b/ocamlrpm/ocamlrpm_stubs.c
@@ -48,6 +48,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "dmalloc.h"
#endif
+/* #define DEBUG */
+
#define NAPKIN_PK_UNIT 0
#define NAPKIN_PK_VERSION 1
#define NAPKIN_PK_ARCHITECTURE 2
@@ -57,15 +59,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#define NAPKIN_PK_SOURCE 6
#define NAPKIN_PK_PROVIDES 7
#define NAPKIN_PK_CONFLICTS 8
-#define NAPKIN_PK_REPLACES 9
-#define NAPKIN_PK_DEPENDS 10
-#define NAPKIN_PK_PRE_DEPENDS 11
-#define NAPKIN_PK_SUGGESTS 12
-#define NAPKIN_PK_RECOMMENDS 13
-#define NAPKIN_PK_ENHANCES 14
-#define NAPKIN_PK_ESSENTIAL 15
-#define NAPKIN_PK_BUILD_ESSENTIAL 16
-#define NAPKIN_NR_FIELDS 17
+#define NAPKIN_PK_BREAKS 9
+#define NAPKIN_PK_REPLACES 10
+#define NAPKIN_PK_DEPENDS 11
+#define NAPKIN_PK_PRE_DEPENDS 12
+#define NAPKIN_PK_SUGGESTS 13
+#define NAPKIN_PK_RECOMMENDS 14
+#define NAPKIN_PK_ENHANCES 15
+#define NAPKIN_PK_ESSENTIAL 16
+#define NAPKIN_PK_BUILD_ESSENTIAL 17
+#define NAPKIN_NR_FIELDS 18
/* Selectors */
#define SEL_LEQ 0
@@ -105,6 +108,9 @@ value ocamlize_rpm_dependency_list (char *pkgname, char *type, int length, char
tl = Val_int (0);
for (i = 0; i < length; i++)
{
+#ifdef DEBUG
+ fprintf (stderr, "%s: %s[%d] is %s %s\n", pkgname, type, i, names[i], versions[i]);
+#endif
if (versions [i][0] == '%')
fprintf (stderr, "[%s] Erroneous version found in %s: %s'%s\n", pkgname, type, names [i], versions [i]);
if (strncmp (names [i], "rpmlib", 6) == 0)
@@ -157,14 +163,22 @@ value ocamlize_header (Header header, char *locale)
uint32_t tag, type, count;
void *data;
#endif
- uint32_t epoch = 0, *dirindexes = NULL, nr_di = 0, nr_bn = 0, nr_dn = 0, nr_md5s = 0, nr_modes = 0, nr_p = 0, nr_d = 0, nr_c = 0, nr_o = 0, i, *p_flags = NULL, *d_flags = NULL, *c_flags = NULL, *o_flags = NULL, nr_locales = 0, my_locale = 0;
+ uint32_t epoch = 0, *dirindexes = NULL, nr_di = 0, nr_bn = 0, nr_dn = 0, nr_md5s = 0, nr_modes = 0, nr_p = 0, nr_d = 0, nr_c = 0, nr_o = 0, nr_s = 0, i;
+ uint32_t *p_flags = NULL, *d_flags = NULL, *c_flags = NULL, *o_flags = NULL, *s_flags = NULL, nr_locales = 0, my_locale = 0;
uint32_t installed_size, archive_size, date = 0;
- char *version = NULL, *release = NULL, **basenames = NULL, **dirnames = NULL, *version_string, **p_names = NULL, **p_versions = NULL, **d_names = NULL, **d_versions = NULL, **c_names = NULL, **c_versions = NULL, **o_names = NULL, **o_versions = NULL, **locales = NULL, *name = NULL, *pkgname = NULL, **md5s = NULL, *arch = NULL, *maintainer = NULL, *category = NULL, *source_package = NULL, *homepage = NULL, *summary = NULL, *description = NULL, *license = NULL, *distribution = NULL, *vendor = NULL, *os = NULL;
+ char *version = NULL, *release = NULL, **basenames = NULL, **dirnames = NULL, *version_string;
+ char **p_names = NULL, **p_versions = NULL;
+ char **d_names = NULL, **d_versions = NULL;
+ char **c_names = NULL, **c_versions = NULL;
+ char **o_names = NULL, **o_versions = NULL;
+ char **s_names = NULL, **s_versions = NULL;
+ char **locales = NULL, *name = NULL, *pkgname = NULL, **md5s = NULL, *arch = NULL, *maintainer = NULL, *category = NULL, *source_package = NULL, *homepage = NULL, *summary = NULL, *description = NULL, *license = NULL, *distribution = NULL, *vendor = NULL, *os = NULL;
uint16_t *modes = NULL;
CAMLparam0 ();
CAMLlocal5 (napkin, v0, v1, v2, v3);
CAMLlocal2 (hd, tl);
CAMLlocal4 (depends_hd, depends_tl, pre_depends_hd, pre_depends_tl);
+ CAMLlocal2 (suggests_hd, suggests_tl);
napkin = caml_alloc (NAPKIN_NR_FIELDS, 0);
#if RPM_FORMAT_VERSION >= 5
@@ -393,6 +407,45 @@ value ocamlize_header (Header header, char *locale)
else
caml_failwith ("OBSOLETEFLAGS tag without string type");
break;
+ case RPMTAG_SUGGESTSNAME:
+ if (TYPE == RPM_STRING_ARRAY_TYPE)
+ {
+ nr_s = COUNT;
+ s_names = (char **) malloc (nr_s * sizeof (char *));
+ for (i = 0; i < nr_s; i++)
+ s_names [i] = strdup (DATA(i));
+ }
+ else
+ caml_failwith ("SUGGESTSNAME tag without string type");
+ break;
+ case RPMTAG_SUGGESTSVERSION:
+ if (TYPE == RPM_STRING_ARRAY_TYPE)
+ {
+ if (nr_s == 0)
+ nr_s = COUNT;
+ else if (COUNT != nr_s)
+ caml_failwith ("The number of SUGGESTSVERSIONS is not consistent");
+ s_versions = (char **) malloc (nr_s * sizeof (char *));
+ for (i = 0; i < nr_s; i++)
+ s_versions [i] = strdup (DATA(i));
+ }
+ else
+ caml_failwith ("SUGGESTSVERSION tag without string type");
+ break;
+ case RPMTAG_SUGGESTSFLAGS:
+ if (TYPE == RPM_UINT32_TYPE)
+ {
+ if (nr_s == 0)
+ nr_s = COUNT;
+ else if (COUNT != nr_s)
+ caml_failwith ("The number of SUGGESTSFLAGS is not consistent");
+ s_flags = (int32_t *) malloc (nr_s * sizeof (int32_t));
+ for (i = 0; i < nr_s; i++)
+ s_flags [i] = UINT32(i);
+ }
+ else
+ caml_failwith ("SUGGESTSFLAGS tag without string type");
+ break;
case RPMTAG_ARCH: /* string type */
if (TYPE == RPM_STRING_TYPE)
arch = strdup (DATA_STR);
@@ -552,7 +605,7 @@ value ocamlize_header (Header header, char *locale)
headerFreeIterator (hi);
#endif
for (i = 0; i < nr_locales; i++)
- free (locales [i]);
+ free (localesg [i]);
free (locales);
#ifdef DEBUG
fprintf (stderr, "- finished with header.\n");
@@ -726,9 +779,61 @@ value ocamlize_header (Header header, char *locale)
free (d_names [i]); free (d_versions [i]);
}
free (d_names); free (d_versions); free (d_flags);
+ /* suggests, like depends */
+ suggests_tl = Val_int (0);
+ for (i = 0; i < nr_s; i++)
+ {
+ if (s_versions [i][0] == '%')
+ fprintf (stderr, "Warning: [%s] suggests erroneous version: %s'%s\n", pkgname, s_names [i], s_versions [i]);
+ if (strncmp (s_names [i], "rpmlib", 6) == 0)
+ continue;
+ switch (s_flags [i] % 16)
+ {
+ case 2: // < x
+ v3 = caml_alloc (1, SEL_LT);
+ Store_field (v3, 0, caml_copy_string (s_versions [i]));
+ break;
+ case 4: // > x
+ v3 = caml_alloc (1, SEL_GT);
+ Store_field (v3, 0, caml_copy_string (s_versions [i]));
+ break;
+ case 8: // = x
+ v3 = caml_alloc (1, SEL_EQ);
+ Store_field (v3, 0, caml_copy_string (s_versions [i]));
+ break;
+ case 10: // <= x
+ v3 = caml_alloc (1, SEL_LEQ);
+ Store_field (v3, 0, caml_copy_string (s_versions [i]));
+ break;
+ case 12: // >= x
+ v3 = caml_alloc (1, SEL_GEQ);
+ Store_field (v3, 0, caml_copy_string (s_versions [i]));
+ break;
+ default: // any
+ v3 = SEL_ANY;
+ }
+ v2 = caml_alloc_tuple (2); // (name, versioned)
+ Store_field (v2, 0, caml_copy_string (s_names [i]));
+ Store_field (v2, 1, v3);
+ v1 = caml_alloc (1, NAME_VERSION); // instead of glob_pattern
+ Store_field (v1, 0, v2);
+ v0 = caml_alloc (2, 0);
+ Store_field (v0, 0, v1);
+ Store_field (v0, 1, Val_int (0));
+ suggests_hd = caml_alloc (2, 0); // versioned list
+ Store_field (suggests_hd, 0, v0);
+ Store_field (suggests_hd, 1, suggests_tl);
+ suggests_tl = suggests_hd;
+ }
+ Store_field (napkin, NAPKIN_PK_SUGGESTS, suggests_tl);
+ for (i = 0; i < nr_s; i++)
+ {
+ free (s_names [i]); free (s_versions [i]);
+ }
+ free (s_names); free (s_versions); free (s_flags);
/* RPM doesn't know suggests, recommends, enhances, essential and/or
* build-essential */
- Store_field (napkin, NAPKIN_PK_SUGGESTS, Val_int (0));
+ Store_field (napkin, NAPKIN_PK_BREAKS, Val_int (0));
Store_field (napkin, NAPKIN_PK_RECOMMENDS, Val_int (0));
Store_field (napkin, NAPKIN_PK_ENHANCES, Val_int (0));
Store_field (napkin, NAPKIN_PK_ESSENTIAL, Val_int (0));
@@ -750,6 +855,9 @@ value ocamlize_header (Header header, char *locale)
asprintf (&t, "%s%s/", dirnames [dirindexes [i]], basenames [i]);
else
asprintf (&t, "%s%s", dirnames [dirindexes [i]], basenames [i]);
+#ifdef DEBUG
+ fprintf (stderr, "file[%d]: %s\n", i, t);
+#endif
v0 = caml_alloc (2, 0);
Store_field (v0, 0, caml_copy_string (t));
Store_field (v0, 1, caml_copy_string (nr_md5s == 0 ? "" : md5s [i]));
@@ -782,16 +890,23 @@ value ocamlrpm_read_package (value locale, value file_name)
{
FD_t fd;
Header header;
-
+#if RPM_FORMAT_VERSION < 5
+ struct rpmlead lead;
+#endif
CAMLparam2 (locale, file_name);
CAMLlocal1 (retval);
- fd = fdOpen (String_val (file_name), O_RDONLY, 0);
+ fd = Fopen (String_val (file_name), "r");
if (!fd)
caml_failwith (strerror (errno));
+#if RPM_FORMAT_VERSION < 5
+ readLead (fd, &lead);
+ rpmReadSignature (fd, NULL, lead.signature_type);
+ header = headerRead (fd, lead.major >= 3 ? HEADER_MAGIC_YES : HEADER_MAGIC_NO);
+#endif
retval = ocamlize_header (header, String_val (locale));
- fdClose (fd);
+ Fclose (fd);
CAMLreturn (retval);
}
@@ -804,7 +919,7 @@ value ocamlrpm_read_hdlist (value locale, value file_name)
CAMLparam2 (locale, file_name);
CAMLlocal2 (hd, tl);
- fd = fdOpen (String_val (file_name), O_RDONLY, 0);
+ fd = Fopen (String_val (file_name), "r");
if (!fd)
caml_failwith (strerror (errno));
#if RPM_FORMAT_VERSION >= 5
@@ -876,6 +991,6 @@ value ocamlrpm_read_hdlist (value locale, value file_name)
#if RPM_FORMAT_VERSION >= 5
free (ei);
#endif /* RPM_FORMAT_VERSION */
- fdClose (fd);
+ Fclose (fd);
CAMLreturn (tl);
}
--
dose2 packaging
More information about the Pkg-ocaml-maint-commits
mailing list