Hello community, here is the log from the commit of package rarian checked in at Fri Apr 25 16:42:35 CEST 2008. -------- --- GNOME/rarian/rarian.changes 2008-04-23 01:52:34.000000000 +0200 +++ /mounts/work_src_done/STABLE/rarian/rarian.changes 2008-04-24 14:16:24.602196000 +0200 @@ -1,0 +2,7 @@ +Thu Apr 24 14:20:47 CEST 2008 - vuntz@suse.de + +- Add rarian-opensuse-manuals.patch to list openSUSE manuals. This + is a temporary fix, until we can get the manuals packages to + install rarian metadata files. + +------------------------------------------------------------------- New: ---- rarian-opensuse-manuals.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rarian.spec ++++++ --- /var/tmp/diff_new_pack.x11808/_old 2008-04-25 16:42:05.000000000 +0200 +++ /var/tmp/diff_new_pack.x11808/_new 2008-04-25 16:42:05.000000000 +0200 @@ -15,10 +15,12 @@ BuildRequires: docbook_4 gcc-c++ intltool libxslt-devel perl-XML-Parser pkg-config sgml-skel Summary: Rarian is designed to be a replacement for scrollkeeper. Version: 0.7.1 -Release: 10 +Release: 12 Source0: %{name}-%{version}.tar.bz2 Patch1: rarian-0.5.6-reg-parse-bugs.patch Patch3: rarian-0.5.6-docs-from-desktop-entries-and-bundles.patch +# PATCH-FIX-OPENSUSE rarian-opensuse-manuals.patch vuntz@novell.com -- Find openSUSE manuals +Patch4: rarian-opensuse-manuals.patch License: GPL v2 or later; LGPL v2.1 or later Group: Development/Libraries/C and C++ BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -66,6 +68,7 @@ #%setup -q -a 1 %patch1 -p1 %patch3 -p1 +%patch4 -p1 %build %configure --disable-scrollkeeper-compat @@ -99,6 +102,10 @@ %{_libdir}/pkgconfig/*.pc %changelog +* Thu Apr 24 2008 vuntz@suse.de +- Add rarian-opensuse-manuals.patch to list openSUSE manuals. This + is a temporary fix, until we can get the manuals packages to + install rarian metadata files. * Wed Apr 23 2008 vuntz@suse.de - Update rarian-0.5.6-docs-from-desktop-entries-and-bundles.patch to use help: URI instead of ghelp: URI when creating an entry ++++++ rarian-opensuse-manuals.patch ++++++ diff -aurp rarian-0.7.1/librarian/rarian-main.c rarian-0.7.1-patched/librarian/rarian-main.c --- rarian-0.7.1/librarian/rarian-main.c 2008-04-24 13:49:01.000000000 +0200 +++ rarian-0.7.1-patched/librarian/rarian-main.c 2008-04-24 13:45:49.000000000 +0200 @@ -76,6 +76,7 @@ static void process_locale_dirs (char * #if ENABLE_OMF_READ static void process_omf_dir (char *dir); #endif +void scan_opensuse_manuals (); void rrn_set_language (char *lang_code) @@ -245,6 +246,8 @@ past: "%s/help-bundle", int_path); scan_directory (check_path); + scan_opensuse_manuals (); + if (int_path && *int_path) { free (int_path); } @@ -639,3 +642,90 @@ rrn_shutdown () head = tail = NULL; return; } + +typedef struct +{ + char *meta_path; + char *doc_path; +} +SuseDocRef; + +static const SuseDocRef suse_docs [] = +{ + { "/usr/share/susehelp/meta/release-notes-openSUSE.desktop", NULL }, + { "/usr/share/susehelp/meta/opensuse-manual_%s/.directory", "/usr/share/doc/manual/opensuse-manual_%s/manual/index.html" }, + { "/usr/share/susehelp/meta/opensuse-gnomeuser_%s/.directory", NULL }, + { "/usr/share/susehelp/meta/opensuse-manual_%s/book_apparmor_admin/.directory", NULL }, + { "/usr/share/susehelp/meta/opensuse-manual_%s/book_opensuse_aaquick/.directory", NULL }, + { "/usr/share/susehelp/meta/opensuse-manual_%s/book_opensuse_gnomequick/.directory", NULL }, + { "/usr/share/susehelp/meta/opensuse-manual_%s/book_opensuse_kdequick/.directory", NULL }, + { "/usr/share/susehelp/meta/opensuse-manual_%s/book_opensuse_kdeuser/.directory", NULL }, + { "/usr/share/susehelp/meta/opensuse-manual_%s/book_opensuse_reference/.directory", NULL }, + { "/usr/share/susehelp/meta/opensuse-manual_%s/book_opensuse_startup/.directory", NULL }, + { NULL, NULL } +}; + +static void +process_opensuse_file (char *filename, char *docpath, char *language) +{ + RrnReg *reg; + Link *link; + char *localized; + + localized = malloc (sizeof (char)*(strlen(filename)+strlen(language) + 1)); + snprintf (localized, sizeof (char)*(strlen(filename)+strlen(language) + 1), filename, language); + + reg = rrn_reg_parse_suse_manual (localized, docpath, language); + free (localized); + + if (!reg) + return; + + if (handle_duplicate (reg)) { + return; + } + + link = malloc (sizeof (Link)); + link->reg.reg = reg; + link->next = NULL; + + if (!tail) { + if (head) { + fprintf (stderr, "ERROR: Tail not pointing anywhere. Aborting"); + exit (3); + } + head = link; + tail = link; + } else { + tail->next = link; + tail = link; + + } +} + +void scan_opensuse_manuals () +{ + int i, j; + + static char *language [] = + { + "cs", "de", "en", "es", "fr", "it", "ja", "pt_BR", "zh_CN", "zh_TW", NULL + }; + + for (i = 0; language [i]; i++) { + for (j = 0; suse_docs [j].meta_path; j++) { + SuseDocRef *doc_ref = (SuseDocRef *) &suse_docs [j]; + + if (!strchr (doc_ref->meta_path, '%') && + strcmp (language [i], "en")) { + /* This package doesn't have per-language desktop files. + * Only print its desktop file once. */ + continue; + } + + process_opensuse_file (doc_ref->meta_path, doc_ref->doc_path, language [i]); + } + } + + insert_orphans (); +} diff -aurp rarian-0.7.1/librarian/rarian-reg-utils.c rarian-0.7.1-patched/librarian/rarian-reg-utils.c --- rarian-0.7.1/librarian/rarian-reg-utils.c 2008-04-24 13:49:01.000000000 +0200 +++ rarian-0.7.1-patched/librarian/rarian-reg-utils.c 2008-04-24 13:25:25.000000000 +0200 @@ -37,6 +37,7 @@ static void process_sect_pair (RrnSe static int rrn_reg_add_sect (RrnReg *reg, RrnSect *sect); static void process_path (RrnReg *reg); static void process_section_path (char *owner_path, RrnSect *section); +static char **process_categories (char *cat_string); RrnReg * @@ -65,6 +66,120 @@ rrn_reg_new () } RrnReg * +rrn_reg_parse_suse_manual (char *filename, char *docpath, char *language) +{ + RrnReg *reg = NULL; + int parse_line = 0; + FILE *file; + char *buf; + + if (access(filename, R_OK)) { + fprintf (stderr, "WARNING: cannot access file %s\n", filename); + return NULL; + } + reg = rrn_reg_new (); + + /* First, figure out it's ghelp name */ + { + char *dot = strrchr (filename, '.'); + char *sep = strrchr (filename, '/'); + if (!dot || !sep) { + fprintf (stderr, "Error parsing file %s for ghelp name. Ignoring\n", filename); + } else { + sep++; + reg->ghelp_name = rrn_strndup (sep, dot-sep); + } + } + + file = fopen (filename, "r"); + if (!file) { + rrn_reg_free (reg); + return NULL; + } + + buf = malloc (sizeof (char) * 1024); + while (fgets (buf, 1023, file)) { + char *real = NULL; + while (buf[strlen(buf)-1] != '\n') { + char *tmp; + char *result = NULL; + tmp = strdup (buf); + if (fgets (buf, 1023, file)) { + result = malloc (sizeof (char) * (strlen(tmp)+strlen(buf)+2)); + strcpy (result, tmp); + strcat (result, buf); + free (tmp); + free (buf); + buf = result; + } else { + free (buf); + buf = tmp; + break; + } + } + real = buf; + while (*real && isspace(*real) && *real != '\n') { + real++; + } + if (!real || real[0] == '\n' || real[0] == '#') { + /* Black Line or comment. Ignore. */ + } else if (real[0] == '[') { + if (!strncmp (real, "[Desktop Entry]", 15) || + !strncmp (real, "[KDE Desktop Entry]", 19)) { + parse_line = 1; + } else { + parse_line = 0; + fprintf (stderr, "Unknown section header: %s. Ignoring\n", real); + } + } else if (strchr ( real, '=') && parse_line) { + process_line (buf, reg); + } else { + fprintf (stdout, "WARNING: Don't know how to handle line: %s\n", buf); + } + } + free (buf); + fclose (file); + + reg->categories = process_categories ("Core;"); + + if (docpath) { + if (reg->uri) + free (reg->uri); + reg->uri = malloc (sizeof (char)*(strlen(docpath)+strlen(language) + 1)); + snprintf (reg->uri, sizeof (char)*(strlen(docpath)+strlen(language) + 1), docpath, language); + } + + if (!reg->name || !reg->uri || !reg->categories ) { + rrn_reg_free (reg); + reg = NULL; + } + + if (reg && !reg->identifier) { + char *last; + char *sep; + char *basename; + + sep = strrchr (filename, '/'); + last = strrchr (filename, '.'); + if (!last || !sep || last < sep) { + fprintf (stderr, "Error: Can't cut put basename properly\n"); + rrn_reg_free (reg); + return NULL; + } + basename = rrn_strndup (sep + 1, last - (sep + 1)); + reg->identifier = malloc (sizeof (char)*(strlen(basename)+11)); + sprintf (reg->identifier, "org.other.%s", basename); + free (basename); + printf ("identifier is %s\n", reg->identifier); + + } + if (reg) + process_path (reg); + + return reg; +} + +RrnReg * rrn_reg_parse_file (char *filename) { RrnReg *reg = NULL; @@ -386,6 +501,12 @@ process_pair (RrnReg *reg, char *key, ch reg->default_section = strdup (value); } else if (!strcmp (key, "Icon")) { reg->icon = strdup (value); + } else if (!strcmp (key, "X-DOC-DocumentType")) { + reg->type = strdup (value); + } else if (!strcmp (key, "X-DOC-Identifier")) { + reg->identifier = strdup (value); + } else if (!strcmp (key, "X-DOC-Weight")) { + reg->weight = atoi (value); } else { fprintf (stderr, "WARNING: Unknown element %s: %s\n", key, value); } diff -aurp rarian-0.7.1/librarian/rarian-reg-utils.h rarian-0.7.1-patched/librarian/rarian-reg-utils.h --- rarian-0.7.1/librarian/rarian-reg-utils.h 2008-01-07 23:21:51.000000000 +0100 +++ rarian-0.7.1-patched/librarian/rarian-reg-utils.h 2008-04-24 13:17:41.000000000 +0200 @@ -73,6 +73,7 @@ RrnSect * rrn_sect_new (); RrnReg * rrn_reg_parse_file (char *filename); RrnSect * rrn_sect_parse_file (char *filename); +RrnReg * rrn_reg_parse_suse_manual (char *filename, char *docpath, char *language); RrnSect * rrn_reg_add_sections (RrnReg *reg, RrnSect *sects); ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... --------------------------------------------------------------------- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org