/* * tl2rpm 0.0.1, TeX Live to RPM converter. * * Copyright (C) 2009 Jindrich Novy (jnovy@users.sf.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define _GNU_SOURCE //#define PACKAGE_SOURCE #define PACKAGE_DOCS //#define MERGE_DOCS #define SRPMS //#define SHORTEN_FILELISTS #define UNPACK "xz" #define STY_DEPS #define REQ_POSTTRANS "Requires: " #ifndef TL2010 # define CTAN_URL "ftp://ftp.ctex.org/mirrors/CTAN/systems/texlive/tlnet/archive/" #else # define CTAN_URL "" #endif #include #include #include #include #include #include char arch[] = "i386-linux"; char *m; off_t size, pos; typedef struct { char *token; int num; size_t s; } match; enum {CAT_COLLECTION, CAT_DOCUMENTATION, CAT_PACKAGE, CAT_SCHEME, CAT_TLCORE, CAT_CONTEXT}; match category[] = { {"Collection", CAT_COLLECTION}, {"Documentation", CAT_DOCUMENTATION}, {"Package", CAT_PACKAGE}, {"Scheme", CAT_SCHEME}, {"TLCore", CAT_TLCORE}, {"ConTeXt", CAT_CONTEXT}, {NULL, 0} }; enum { LIC_GPL = 1<<0, LIC_LPPL = 1<<1, LIC_OTHER_FREE = 1<<2, LIC_PD = 1<<3, LIC_LGPL = 1<<4, LIC_GFSL = 1<<5, LIC_BSD = 1<<6, LIC_GFL = 1<<7, LIC_ARTISTIC2 = 1<<8, LIC_FDL = 1<<9, LIC_COLLECTION = 1<<10, LIC_OTHER = 1<<11, LIC_OFL = 1<<12, LIC_APACHE2 = 1<<13, LIC_NOINFO = 1<<14, LIC_UNKNOWN = 1<<15, LIC_KNUTH = 1<<16, LIC_ARTISTIC = 1<<17, LIC_NOSOURCE = 1<<18, LIC_NOSELL = 1<<19, LIC_NOCOMMERCIAL= 1<<20, LIC_GPL2 = 1<<21, LIC_GPL3 = 1<<22, LIC_LPPL12 = 1<<23, LIC_LPPL13 = 1<<24, }; #define LIC_PROBLEMATIC (LIC_NOINFO | LIC_UNKNOWN | LIC_ARTISTIC | LIC_NOSOURCE | LIC_NOSELL | LIC_NOCOMMERCIAL | LIC_OTHER) #define LIC_NOTALLOWED 0 match license[] = { {"gpl3", LIC_GPL3}, {"gpl2", LIC_GPL2}, {"gpl", LIC_GPL}, {"lppl1.3", LIC_LPPL13}, {"lppl1.2", LIC_LPPL12}, {"lppl1", LIC_LPPL}, {"lppl", LIC_LPPL}, {"other-free", LIC_OTHER_FREE}, {"pd", LIC_PD}, {"noinfo", LIC_NOINFO}, {"lgpl2.1", LIC_LGPL}, {"lgpl", LIC_LGPL}, {"gfsl", LIC_GFSL}, {"bsd", LIC_BSD}, {"knuth", LIC_KNUTH}, {"unknown", LIC_UNKNOWN}, {"gfl", LIC_GFL}, {"artistic2", LIC_ARTISTIC2}, {"fdl", LIC_FDL}, {"collection", LIC_COLLECTION}, {"artistic", LIC_ARTISTIC}, {"other-nonfree", LIC_OTHER}, {"other", LIC_OTHER}, {"ofl", LIC_OFL}, {"apache2", LIC_APACHE2}, {"nosource", LIC_NOSOURCE}, {"nosell", LIC_NOSOURCE}, {"nocommercial", LIC_NOCOMMERCIAL}, {NULL, 0} }; match spec_license[] = { {"GPL+", LIC_GPL}, {"GPLv2+", LIC_GPL2}, {"GPLv3+", LIC_GPL3}, {"LPPL", LIC_LPPL}, {"Freely redistributable without restriction", LIC_OTHER_FREE}, {"Public Domain", LIC_PD}, {"No Info", LIC_NOINFO}, {"LGPLv2+", LIC_LGPL}, {"GFSL", LIC_GFSL}, {"BSD", LIC_BSD}, {"Knuth", LIC_KNUTH}, {"Unknown", LIC_UNKNOWN}, {"LPPL", LIC_GFL}, {"Artistic 2.0", LIC_ARTISTIC2}, {"GFDL", LIC_FDL}, {"Public Domain", LIC_COLLECTION}, {"Artistic", LIC_ARTISTIC}, {"Other", LIC_OTHER}, {"OFSFLD", LIC_OFL}, {"ASL 2.0", LIC_APACHE2}, {"No Source", LIC_NOSOURCE}, {"No Sell", LIC_NOSOURCE}, {"Non-commercial", LIC_NOCOMMERCIAL}, {NULL, 0} }; typedef struct pk { char *name; unsigned long namehash; int category; char *shortdesc; char **longdesc; int longdesc_lines; char **runf; int runfs; char **docf; int docfs; char **srcf; int srcfs; char **binf; int binfs; char *revision; char *catalogue_ctan; int catalogue_license; char *catalogue_date; char *catalogue_version; char **dep; struct pk **req; int reqs; #ifdef STY_DEPS char **sty_prov; int sty_provs; char **sty_req; int sty_reqs; #endif char **exe; int exes; int reloc; int has_man; int has_info; } package; typedef struct { char *dir; unsigned long dirhash; char **pkg; unsigned long *pkghash; int *lic; int pkgs; } dir_type; dir_type *dir; int dirs; package *pkg; int p = 0; #ifdef STY_DEPS char *sty_notreq[] = { "amsjpa", // amscls "exerquiz", // eCards, eqexam "html", // harvard "linenox0", // ednotes "xetex-inputenc", // luainputenc "axodraw", // hep "marn", // margbib "xhj", // xdoc "web", // eqexam, eCards "gradient", // HA-prosper, prosper "lucidabr", // libertine "slope", // prosper "MinionPro", // classicthesis-2009 "mathtime", // mtgreek, kluwer "tree-dvips", // linguex [noinfo license] "lucasual", // rmpage "lhelpx", // lhelp "eforms", // fancytooltips "lgrind", // listings "lucida-helvetica", // rmpage //"pictex", // pictex2 [noinfo license] "inpmath", // oberdiek "emlines2", // struktex "inicap", // amscls "galley2", // xdoc "ifetex", // widetable "graphicxsp", // cookybooky "newcommand", // xoptarg //"a4wide", // [noinfo license] "keyreader", // xwatermark "ocg", // asymptote dependency "switcheml", // pracjourn "futurans", // nostarch "calendar", // timesht "tkzexample", // tkz-doc "csbulutf8", // csbulletin "ccmap", // thuthesis, seuthesis "mygoth", // timesht "dogma", // nostarch "pscyr", // eskd "SpecChar", // csbulletin "nbaskerv", // nostarch "thsmc", // nostarch "wrisym", // ebsthesis "csbulobalka", // csbulletin //"undolabl", // pageslts //"translator", // beamer, glossaries "luximono", // dtk "latexml", // stex "mapleenv", // maple "cmcyr", // cmcyralt "arial", // thuthesis "sty", // fileinfo "fontaxes", // ptsans "europs", // g-brief (iffileexists) "eurofont", // hc "undertilde", // rec-thy "tkz-arith", // tkz-berge "classicthesis-ldpkg", // arsclassica "pagesLTS", // turnthepage NULL, }; #endif /* Packages to be ignored and not included */ char *pkg_blacklist[] = { // "dvipdfm", // "dvipdfmx", "getafm", // "lcdftypetools", "psutils", "t1utils", // "xdvi", // "dvipng", "texworks", "xindy", "asymptote", // not shipped in sources "asymptote.i386-linux", "asymptote-by-example-zh-cn", "asymptote-faq-zh-cn", "asymptote-manual-zh-cn", // "dvisvgm", "latex-tds", // only source "dvi2tty", "biber", // no binary NULL, }; char *input_blacklist[] = { "xtextblock.sty", // xpackages -> head.sty "pgflibrarytikzbackgrounds.code.tex", // pgf -> pgflibrarytikzbackgrounds.sty "pgflibrarytikztrees.code.tex", // pgf -> pgflibrarytikztrees.sty "pgflibrarytikzautomata.code.tex", // pgf -> pgflibrarytikzautomata.sty "cwebbase.tex", // cweb-latex -> cweb.cls (cwebbase.tex in doc) "colortab.tex", // colortab -> colortab.sty (colortab.tex in doc) "xcomment.tex", // xcomment -> xcomment.sty "versatim.tex", // apl -> apl.sty "chemfig.tex", // chemfix.tex present in chemfig-doc "pst-plot97.tex", // pst-plot - oldversion req only "pst-node97.tex", // pst-node - oldversion req only NULL }; char *rem[] = { /* any file beginning with this will be removed */ // "texmf/scripts/tlgs/gswin32", "texmf/doc/info/kpathsea.info", "tlpkg/", NULL, }; char *get_line() { if ( postoken; m++ ) { if ( m->num == t ) return m->token; } return NULL; } unsigned long hash(char *str) { unsigned long hash = 5381; int c; while ((c = *str++)) hash = ((hash << 5) + hash) + c; /* hash * 33 + c */ return hash; } enum {FT_NONE, FT_DOC, FT_RUN, FT_SRC, FT_BIN}; void skipspace(char **sp) { char *s = *sp; while (*s == ' ' || *s == '\t' || *s == '\n' || *s == '\r') s++; while (*s == '%') { while ( *s != '\n' ) s++; while (*s == ' ' || *s == '\t' || *s == '\n' || *s == '\r') s++; } *sp = s; } void parse() { char *l; int filetype = FT_NONE; while ( (l=get_line()) ) { if ( !*l ) continue; if ( *l == ' ' ) { char pkgname[0x100]; unsigned long pkghash; char *end = strchr(++l, ' '); if ( end ) { *end = '\0'; } if ( pkg[p-1].reloc ) { char *rel = strstr(l, "RELOC"); char *new_l = NULL; asprintf(&new_l, "texmf-dist%s", rel+5); l = new_l; } if (!strncmp(l, "texmf/doc/man/man", 17)) { /* does package have any man pages? */ pkg[p-1].has_man = 1; if ( l[strlen(l)-2] == '.' && l[strlen(l)-1] >= '0' && l[strlen(l)-1] <= '9' ) { pkg[p-1].runf = realloc(pkg[p-1].runf, (pkg[p-1].runfs+1)*sizeof(char *)); pkg[p-1].runf[pkg[p-1].runfs] = l; pkg[p-1].runfs++; snprintf(pkgname, sizeof(pkgname), "%s", pkg[p-1].name); goto skip; } goto skip; } if (!strncmp(l, "texmf/doc/info/", 15)) { /* does package have any info pages? */ pkg[p-1].has_info = 1; if ( !strncmp(&l[strlen(l)-5], ".info", 5) ) { pkg[p-1].runf = realloc(pkg[p-1].runf, (pkg[p-1].runfs+1)*sizeof(char *)); pkg[p-1].runf[pkg[p-1].runfs] = l; pkg[p-1].runfs++; snprintf(pkgname, sizeof(pkgname), "%s", pkg[p-1].name); goto skip; } goto skip; } /* if ( strstr(l, "win32") || strstr(l, "Win32") || strstr(l, "tlmgr") ) { printf("*** %s\n", l); goto skip; } for (i=0; rem[i]; i++) { if ( !strncmp(l, rem[i], strlen(rem[i])) ) { printf("*** %s\n", l); goto skip; } } */ switch ( filetype ) { case FT_RUN: #ifdef PACKAGE_DOCS #ifdef MERGE_DOCS case FT_DOC: #endif #endif pkg[p-1].runf = realloc(pkg[p-1].runf, (pkg[p-1].runfs+1)*sizeof(char *)); pkg[p-1].runf[pkg[p-1].runfs] = l; pkg[p-1].runfs++; snprintf(pkgname, sizeof(pkgname), "%s", pkg[p-1].name); break; #ifdef PACKAGE_DOCS #ifndef MERGE_DOCS case FT_DOC: pkg[p-1].docf = realloc(pkg[p-1].docf, (pkg[p-1].docfs+1)*sizeof(char *)); pkg[p-1].docf[pkg[p-1].docfs] = l; pkg[p-1].docfs++; snprintf(pkgname, sizeof(pkgname), "%s-doc", pkg[p-1].name); break; #endif #else case FT_DOC: pkg[p-1].docf = realloc(pkg[p-1].docf, (pkg[p-1].docfs+1)*sizeof(char *)); pkg[p-1].docf[pkg[p-1].docfs] = l; pkg[p-1].docfs++; snprintf(pkgname, sizeof(pkgname), "%s-doc", pkg[p-1].name); continue; #endif case FT_SRC: pkg[p-1].srcf = realloc(pkg[p-1].srcf, (pkg[p-1].srcfs+1)*sizeof(char *)); pkg[p-1].srcf[pkg[p-1].srcfs] = l; pkg[p-1].srcfs++; snprintf(pkgname, sizeof(pkgname), "%s-source", pkg[p-1].name); #ifndef PACKAGE_SOURCE continue; #endif break; case FT_BIN: pkg[p-1].binf = realloc(pkg[p-1].binf, (pkg[p-1].binfs+1)*sizeof(char *)); pkg[p-1].binf[pkg[p-1].binfs] = l; pkg[p-1].binfs++; snprintf(pkgname, sizeof(pkgname), "%s", pkg[p-1].name); break; default: fprintf(stderr, "No filetype: %s\n", l); exit(1); } skip: pkghash = hash(pkgname); end = strrchr(l, '/'); if (!end) end = l; if ( end ) { int i; unsigned long h; char saved = *end; *end = '\0'; h = hash(l); for ( i=0; i sarch && !strncmp(&(l+5)[sname-sarch], arch, sarch) ) { pkg[p-1].name = calloc(sname-sarch+5, 1); memcpy(pkg[p-1].name, l+5, sname-sarch); memcpy(&pkg[p-1].name[sname-sarch], "ARCH", 4); } else { pkg[p-1].name = l+5; } pkg[p-1].namehash = hash(pkg[p-1].name); filetype = FT_NONE; /* look for license first */ { off_t opos = pos; while ( (l=get_line()) ) { m[pos] = '\n'; if ( !strncmp(l, "name ", 5) ) break; if ( !strncmp(l,"catalogue-license ", 18) ) { pkg[p-1].catalogue_license = get_token(l+18, license); if ( pkg[p-1].catalogue_license & LIC_PROBLEMATIC ) printf("L: %s - %s\n", pkg[p-1].name, put_token(pkg[p-1].catalogue_license, spec_license)); break; } } pos = opos; } continue; } if ( !strncmp(l,"category ", 9) ) { pkg[p-1].category = get_token(l+9, category); continue; } if ( !strncmp(l,"shortdesc ", 10) ) { size_t len; pkg[p-1].shortdesc = l+10; len = strlen(pkg[p-1].shortdesc); if ( pkg[p-1].shortdesc[len-1] == '.' ) pkg[p-1].shortdesc[len-1] = '\0'; continue; } if ( !strncmp(l,"longdesc ", 9) ) { pkg[p-1].longdesc = realloc(pkg[p-1].longdesc, (pkg[p-1].longdesc_lines+1)*sizeof(char *)); pkg[p-1].longdesc[pkg[p-1].longdesc_lines] = l+9; pkg[p-1].longdesc_lines++; continue; } if ( !strncmp(l,"docfiles ", 9) ) { filetype = FT_DOC; continue; } if ( !strncmp(l,"relocated 1", 11) ) { pkg[p-1].reloc = 1; continue; } if ( !strncmp(l,"runfiles ", 9) ) { filetype = FT_RUN; continue; } if ( !strncmp(l,"srcfiles ", 9) ) { filetype = FT_SRC; continue; } if ( !strncmp(l,"binfiles ", 9) ) { filetype = FT_BIN; continue; } if ( !strncmp(l,"depend ", 7) ) { pkg[p-1].dep = realloc(pkg[p-1].dep, (pkg[p-1].reqs+1)*sizeof(char *)); pkg[p-1].req = realloc(pkg[p-1].req, (pkg[p-1].reqs+1)*sizeof(package *)); pkg[p-1].dep[pkg[p-1].reqs] = l+7; pkg[p-1].req[pkg[p-1].reqs] = NULL; pkg[p-1].reqs++; continue; } if ( !strncmp(l,"execute ", 8) ) { pkg[p-1].exe = realloc(pkg[p-1].exe, (pkg[p-1].exes+1)*sizeof(char *)); pkg[p-1].exe[pkg[p-1].exes] = l+8; pkg[p-1].exes++; continue; } if ( !strncmp(l,"catalogue-ctan ", 15) ) { pkg[p-1].catalogue_ctan = l+15; continue; } if ( !strncmp(l,"catalogue-license ", 18) ) { pkg[p-1].catalogue_license = get_token(l+18, license); continue; } if ( !strncmp(l,"catalogue-date ", 15) ) { pkg[p-1].catalogue_date = l+15; continue; } if ( !strncmp(l,"catalogue-version ", 18) ) { pkg[p-1].catalogue_version = l+18; /* substitute unallowed '/', '-', ' ', '~' characters with '_' */ { char *v; for ( v=pkg[p-1].catalogue_version; *v; v++ ) { if ( *v == '/' || *v == '-' || *v == ' ' || *v == '~' || *v == ',' || *v == '(' || *v == ')') *v = '_'; } } continue; } if ( !strncmp(l,"revision ", 9) ) { pkg[p-1].revision = l+9; continue; } if ( !strncmp(l,"containersize ", 14) || !strncmp(l,"containermd5 ", 13) || !strncmp(l,"doccontainersize ", 17) || !strncmp(l,"doccontainermd5 ", 16) || !strncmp(l,"srccontainersize ", 17) || !strncmp(l,"srccontainermd5 ", 16) || !strncmp(l,"catalogue ", 10) ) { continue; } fprintf(stderr, "unknown token: '%s'\n", l); } } package **inst; int installed, srcno=4, mainsrcno = 1000, mainpkg; FILE *fpack, *ffile, *funpack, *fsrc, *fremove, *ffont; char *cnf_files[] = { "texmf/web2c/fmtutil.cnf", "texmf/web2c/updmap.cfg", "texmf/web2c/texmf.cnf", "texmf/web2c/context.cnf", "texmf/web2c/mktex.cnf", NULL, }; int main_written; void append_filelist( char *pkg, char *pkgsuf, int files, char **filelist, char *pkglicense ) { char pkgname[0x100]; unsigned long pkghash; int x, y, n, bin = 0; char *binpos; strncpy(pkgname, pkg, sizeof(pkgname)); if ( pkgsuf && *pkgsuf ) { strcat(pkgname, "-"); strcat(pkgname, pkgsuf); } pkghash = hash(pkgname); if ( (binpos=strstr(pkgname, ".ARCH")) ) { bin = 1; *binpos = '\0'; strcat(binpos, "-bin"); } if ( pkglicense && !(get_token(pkglicense, license)&LIC_PROBLEMATIC) ) { fprintf(ffile, "%%files %s\n%%defattr(-,root,root)\n%%doc %s.txt\n", mainpkg?(!main_written?"":pkgsuf):pkgname, pkglicense); } else { fprintf(ffile, "%%files %s\n%%defattr(-,root,root)\n", mainpkg?(!main_written?"":pkgsuf):pkgname); } if ( bin ) { *binpos = '\0'; strcat(binpos, ".ARCH"); } for (y=0; y= '0' && man[sz-1] <= '9') { fprintf(ffile, "%%{_mandir}/%s*\n", &filelist[n][bin_index+14]); } goto next; } if (!strncmp(&filelist[n][bin_index], "texmf/doc/info", 14)) { /* relocate path for info files, ignore all other files such as 'dir' */ if (!strncmp(&filelist[n][strlen(filelist[n])-5], ".info", 5)) { fprintf(ffile, "%%{_infodir}/%s*\n", &filelist[n][bin_index+15]); } goto next; } if (!strcmp(&filelist[n][bin_index], "texmf/web2c/updmap.cfg")) { fprintf(fremove, "\n# disable all Maps/MixedMaps we add them by scriptlets\n"); fprintf(fremove, "sed -i '/^M/d' %%{buildroot}%%{_texdir}/texmf/web2c/updmap.cfg\n"); } else if (!strcmp(&filelist[n][bin_index], "texmf/web2c/fmtutil.cnf")) { fprintf(fremove, "\n# disable all formats\n"); fprintf(fremove, "sed -i '/^[a-z].*$/s/^/\\#\\!\\ /' %%{buildroot}%%{_texdir}/texmf/web2c/fmtutil.cnf\n"); } else if (!strcmp(&filelist[n][bin_index], "texmf/tex/generic/config/language.us")) { fprintf(fremove, "\n# disable all hyphenations\n"); fprintf(fremove, "cp -f %%{buildroot}%%{_texdir}/texmf/tex/generic/config/language.us %%{buildroot}%%{_texdir}/texmf/tex/generic/config/language.dat\n"); } else if (!strcmp(&filelist[n][bin_index], "texmf/tex/generic/config/language.us.def")) { fprintf(fremove, "\n# disable all hyphenations\n"); fprintf(fremove, "cp -f %%{buildroot}%%{_texdir}/texmf/tex/generic/config/language.us.def %%{buildroot}%%{_texdir}/texmf/tex/generic/config/language.def\n"); } { /* add %config(noreplace) for config files */ int i; for ( i=0; cnf_files[i]; i++ ) { if ( !strcmp(&filelist[n][bin_index], cnf_files[i]) ) { fprintf(ffile, "%%config(noreplace) "); break; } } } fprintf(ffile, "%s/%s\n", bin?"%{_bindir}":"%{_texdir}", &filelist[n][bin_index]); } next: *end = saved; } } } } } fprintf(ffile, "\n"); } void provide_file(package *p, char *suf) { int n; for (n=0; nrunfs; n++) { if ( !strncmp(&p->runf[n][strlen(p->runf[n])-strlen(suf)], suf, strlen(suf)) ) { fprintf(fpack, "Provides: tex(%s)\n", strrchr(p->runf[n], '/')+1); } } } int level; void solve(char *name) { unsigned long h; int i, found = 0, reqs; char **req; #ifdef SRPMS FILE *ofpack = NULL, *offile = NULL, *ofunpack = NULL, *ofsrc = NULL, *ofremove = NULL, *offont = NULL; #endif h = hash(name); if ( !fpack ) { fpack = fopen("_packages.spec", "wt"); } if ( !ffile ) { ffile = fopen("_files.spec", "wt"); } if ( !funpack ) { funpack = fopen("_unpack.spec", "wt"); } if ( !fsrc ) { fsrc = fopen("_sources.spec", "wt"); } if ( !fremove ) { fremove = fopen("_remove.spec", "wt"); } if ( !ffont ) { ffont = fopen("_font.spec", "wt"); } for (i=0; inamehash == h && !strcmp(inst[i]->name, name) ) { return; } } for (i=0; i %s\n", pkg[i].exe[n]); } } #ifdef SRPMS /* is it collection or scheme? then don't create a separate package for it and put it to main one */ if ( !strncmp(name, "collection-", 11) || !strncmp(name, "scheme-", 7) ) { fprintf(funpack, UNPACK" -dc %%{SOURCE%d} | tar x -C %%{buildroot}%%{_texdir}%s\n", mainsrcno, pkg[i].reloc?"/texmf-dist":""); fprintf(fpack, "%%package %s\n", name); if ( pkg[i].shortdesc ) { fprintf(fpack, "Summary: %s\n", pkg[i].shortdesc); } else { fprintf(fpack, "Summary: %s package\n", name); } fprintf(fpack, "Version: %%{tl_version}\n"); fprintf(fpack, "Release: "); // if ( pkg[i].catalogue_version ) fprintf(fpack, "%%{tl_noarch_release}.%s.svn%s%%{?dist}\n", pkg[i].catalogue_version, pkg[i].revision ); else fprintf(fpack, "%%{tl_noarch_release}.svn%s%%{?dist}\n", pkg[i].revision); if ( pkg[i].catalogue_version ) fprintf(fpack, "%%{tl_release}.%s.svn%s%%{?dist}\n", pkg[i].catalogue_version, pkg[i].revision ); else fprintf(fpack, "%%{tl_release}.svn%s%%{?dist}\n", pkg[i].revision); fprintf(fpack, "BuildArch: noarch\n"); fprintf(fsrc, "Source%d: "CTAN_URL"%s.tar."UNPACK"\n", mainsrcno++, name); fprintf(fpack, "Requires: texlive-base = %%{tl_version}\n"); for (n=0; ncatalogue_license & LIC_NOTALLOWED ) { continue; } if ( pkg[i].req[n]->reqs || pkg[i].req[n]->runfs || pkg[i].req[n]->exes ) { fprintf(fpack, "Requires: texlive-%s = %%{tl_version}\n", pkg[i].dep[n]); continue; } #ifdef PACKAGE_DOCS if ( pkg[i].req[n]->docfs ) { fprintf(fpack, "Requires: texlive-%s-doc = %%{tl_version}\n", pkg[i].dep[n]); continue; } #endif #ifdef PACKAGE_SOURCE if ( pkg[i].req[n]->srcfs ) { fprintf(fpack, "Requires: texlive-%s-source = %%{tl_version}\n", pkg[i].dep[n]); continue; } #endif if ( pkg[i].req[n]->binfs ) { size_t spost = strlen(pkg[i].dep[n])-5; if (strcmp(&pkg[i].dep[n][spost], ".ARCH")) { printf("Doesn't have .ARCH suffix!\n"); exit(1); } pkg[i].dep[n][spost] = '\0'; fprintf(fpack, "Requires: texlive-%s-bin = %%{tl_version}\n", pkg[i].dep[n]); pkg[i].dep[n][spost] = '.'; continue; } } } /* write virtual provides */ if ( !strncmp(name, "collection-", 11) ) { if (!strcmp(name+11, "latex")) { fprintf(fpack, "Provides: tex(latex) = %%{tl_version}\n"); } else if (!strcmp(name+11, "basic")) { fprintf(fpack, "Provides: tex(tex) = %%{tl_version}, tex = %%{tl_version}\n"); fprintf(fpack, "Requires: dvipdfm, dvipdfmx, xdvik\n"); } else if (!strcmp(name+11, "langcjk")) { fprintf(fpack, "Provides: tex(japanese) = %%{tl_version}\n"); fprintf(fpack, "Provides: tex(east-asian) = %%{tl_version}\n"); fprintf(fpack, "Obsoletes: texlive-east-asian < %%{tl_version}\n"); fprintf(fpack, "Obsoletes: texlive-texmf-east-asian < %%{tl_version}\n"); } else if (!strcmp(name+11, "documentation-base")) { fprintf(fpack, "Provides: texlive-texmf-doc = %%{tl_version}\n"); fprintf(fpack, "Obsoletes: texlive-texmf-doc < %%{tl_version}\n"); } else if (!strcmp(name+11, "fontsrecommended")) { fprintf(fpack, "Provides: tetex-fonts = 3.1-99\n"); fprintf(fpack, "Obsoletes: tetex-fonts < 3.1-99\n"); fprintf(fpack, "Provides: texlive-texmf-fonts = %%{tl_version}\n"); fprintf(fpack, "Obsoletes: texlive-texmf-fonts < %%{tl_version}\n"); } else if (!strcmp(name+11, "binextra")) { fprintf(fpack, "Obsoletes: texlive-utils < %%{tl_version}\n"); // fprintf(fpack, "Requires: dvipng, dvisvgm\n"); fprintf(fpack, "Requires: dvipng\n"); } else if (!strcmp(name+11, "xetex")) { fprintf(fpack, "Provides: tex(xetex) = %%{tl_version}\n"); // fprintf(fpack, "Obsoletes: texlive-xetex < %%{tl_version}\n"); fprintf(fpack, "Obsoletes: texlive-texmf-xetex < %%{tl_version}\n"); } else if (!strcmp(name+11, "fontutils")) { fprintf(fpack, "Requires: t1utils, psutils, lcdf-typetools\n"); } } if ( !strcmp(name, "scheme-tetex") ) { fprintf(fpack, "Provides: tetex = 3.1-99\n"); fprintf(fpack, "Obsoletes: tetex < 3.1-99\n"); fprintf(fpack, "Obsoletes: texlive-dviutils < %%{tl_version}\n"); } if ( !strcmp(name, "scheme-context") ) { fprintf(fpack, "Provides: tex(context) = %%{tl_version}\n"); // fprintf(fpack, "Obsoletes: texlive-context < %%{tl_version}\n"); fprintf(fpack, "Obsoletes: texlive-texmf-context < %%{tl_version}\n"); } /* description */ fprintf(fpack, "\n%%description %s\n", name); for (n=0; ncatalogue_license & LIC_NOTALLOWED ) { continue; } if ( pkg[i].req[n]->reqs || pkg[i].req[n]->runfs || pkg[i].req[n]->exes ) { fprintf(fpack, "Requires: texlive-%s = %%{tl_version}\n", pkg[i].dep[n]); continue; } #ifdef PACKAGE_DOCS if ( pkg[i].req[n]->docfs ) { fprintf(fpack, "Requires: texlive-%s-doc = %%{tl_version}\n", pkg[i].dep[n]); continue; } #endif #ifdef PACKAGE_SOURCE if ( pkg[i].req[n]->srcfs ) { fprintf(fpack, "Requires: texlive-%s-source = %%{tl_version}\n", pkg[i].dep[n]); continue; } #endif if ( pkg[i].req[n]->binfs ) { size_t spost = strlen(pkg[i].dep[n])-5; if (strcmp(&pkg[i].dep[n][spost], ".ARCH")) { printf("Doesn't have .ARCH suffix!\n"); exit(1); } pkg[i].dep[n][spost] = '\0'; fprintf(fpack, "Requires: texlive-%s-bin = %%{tl_version}\n", pkg[i].dep[n]); pkg[i].dep[n][spost] = '.'; continue; } } } /* Lua dependencies */ for (n=0; n=m; s--) { if (*s == '\n') break; } while (*s == ' ' || *s == '\t' || *s == '\n' || *s == '\r') s++; if ( *s == '%' ) goto nextprov; s = os; skipspace(&s); if ( *s == '[' ) { s++; while (*s != ']') if (*s == '%') skipspace(&s); else s++; s++; skipspace(&s); } if ( *s != '{' ) goto nextprov; s++; for ( d=dep, os=s; ; s++ ) { if ( *s == ' ' || *s == '\t' || *s == '\n' || *s == '\r' ) continue; if ( (*s >= 'a' && *s <= 'z') || (*s >= 'A' && *s <= 'Z') || (*s >= '0' && *s <= '9') || *s == '-' ) { *d = *s; d++; continue; } if ( *s == '%') { skipspace(&s); s--; continue; } if ( *s == ',' || *s == '}' ) { *d = '\0'; for (k=0; k=m; s--) { if (*s == '\n') break; } while (*s == ' ' || *s == '\t' || *s == '\n' || *s == '\r') s++; if ( *s == '%' ) goto nextreq; s = os; if (!strncmp(s, "WithOptions", 11)) s+=11; skipspace(&s); if ( *s == '[' ) { s++; while (*s != ']') if (*s == '%') skipspace(&s); else s++; s++; skipspace(&s); } if ( *s != '{' ) goto nextreq; s++; for ( d=dep, os=s; ; s++ ) { if ( *s == ' ' || *s == '\t' || *s == '\n' || *s == '\r' ) continue; if ( (*s >= 'a' && *s <= 'z') || (*s >= 'A' && *s <= 'Z') || (*s >= '0' && *s <= '9') || *s == '-' ) { *d = *s; d++; continue; } if ( *s == '%') { skipspace(&s); s--; continue; } if ( *s == ',' || *s == '}') { *d = '\0'; for (k=0; k=m; s--) { if (*s == '\n') break; if (*s != ' ' || *s != '\t') goto nextinput; } s++; while (*s == ' ' || *s == '\t') s++; if ( *s == '%' ) goto nextinput; s = os; // printf("^^^ %30s\n", s); if (*s == ' ' || *s == '\t') { has_space = 1; while (*s == ' ' || *s == '\t') s++; } if (*s == '{') { has_space = 1; s++; while (*s == ' ' || *s == '\t') s++; } if ( !has_space ) goto nextinput; for (d=dep; (*s >= 'a' && *s <= 'z') || (*s >= 'A' && *s <= 'Z') || (*s >= '0' && *s <= '9') || *s == '-' || *s == '.'; s++) { *d = *s; d++; } if ( d == dep ) goto nextinput; while (*s == ' ' || *s == '\t') s++; if ( *s == '}' || *s == '%' || *s == '\n' || *s == '\r') { int x; size_t sz; *d = '\0'; if (!strchr(dep, '.')) strcat(dep, ".tex"); sz = strlen(dep); for ( x=0; x 4) { if (!strcmp(&pkg[i].runf[n][s-4], ".ttf") || !strcmp(&pkg[i].runf[n][s-4], ".ttc") || !strcmp(&pkg[i].runf[n][s-4], ".pfa") || !strcmp(&pkg[i].runf[n][s-4], ".pfb") || !strcmp(&pkg[i].runf[n][s-4], ".pcf") || !strcmp(&pkg[i].runf[n][s-4], ".otf") ) { fprintf(fpack, "Requires: texlive-%s-fedora-fonts = %%{tl_version}\n", name); break; } } } /* write virtual provides */ if ( !strcmp(name, "dvips") ) { // fprintf(fpack, "Provides: tex(dvips) = %%{tl_version}, tetex-dvips = 3.1-99, texlive-dvips = %%{tl_version}, texlive-texmf-dvips = %%{tl_version}\n"); // fprintf(fpack, "Obsoletes: tetex-dvips < 3.1-99, texlive-dvips < %%{tl_version}, texlive-texmf-dvips < %%{tl_version}\n"); fprintf(fpack, "Provides: tex(dvips) = %%{tl_version}, tetex-dvips = 3.1-99, texlive-texmf-dvips = %%{tl_version}\n"); fprintf(fpack, "Obsoletes: tetex-dvips < 3.1-99, texlive-texmf-dvips < %%{tl_version}\n"); } if ( !strcmp(name, "tex4ht") ) { fprintf(fpack, "Provides: tetex-tex4ht = %%{tl_version}\n"); fprintf(fpack, "Obsoletes: tetex-tex4ht < %%{tl_version}\n"); } if ( !strcmp(name, "latex") ) { fprintf(fpack, "Provides: tetex-latex = 3.1-99, texlive-latex = %%{tl_version}, texlive-texmf-latex = %%{tl_version}\n"); fprintf(fpack, "Obsoletes: tetex-latex < 3.1-99, texlive-latex < %%{tl_version}, texlive-texmf-latex < %%{tl_version}\n"); } if ( !strcmp(name, "IEEEtran") ) { fprintf(fpack, "Provides: tetex-IEEEtran = %%{tl_version}\n"); fprintf(fpack, "Obsoletes: tetex-IEEEtran < %%{tl_version}\n"); } if ( !strcmp(name, "bytefield") ) { fprintf(fpack, "Provides: tetex-bytefield = %%{tl_version}\n"); fprintf(fpack, "Obsoletes: tetex-bytefield < %%{tl_version}\n"); } if ( !strcmp(name, "elsevier") ) { fprintf(fpack, "Provides: tetex-elsevier = %%{tl_version}\n"); fprintf(fpack, "Obsoletes: tetex-elsevier < %%{tl_version}\n"); } if ( !strcmp(name, "perltex") ) { fprintf(fpack, "Provides: tetex-perltex = %%{tl_version}\n"); fprintf(fpack, "Obsoletes: tetex-perltex < %%{tl_version}\n"); } if ( !strcmp(name, "prosper") ) { fprintf(fpack, "Provides: tetex-prosper = %%{tl_version}\n"); fprintf(fpack, "Obsoletes: tetex-prosper < %%{tl_version}\n"); } if ( !strcmp(name, "texdoc") ) { fprintf(fpack, "Provides: texlive-doc = %%{tl_version}\n"); fprintf(fpack, "Obsoletes: texlive-doc < %%{tl_version}\n"); } /* description */ #ifndef SRPMS fprintf(fpack, "\n%%description %s\n", name); #else fprintf(fpack, "\n%%description\n"); #endif for (n=0; n/dev/null || :\n", &pkg[i].runf[k][15]); } } fprintf(fpack, "fi\n\n"); } if ( pkg[i].exes ) { int run_updmap, run_fmtutil; #ifndef SRPMS fprintf(fpack, "%%post %s\n", name); #else fprintf(fpack, "%%post\n"); #endif // fprintf(fpack, "echo 'post'\nmkdir -p /var/run/texlive\ntouch /var/run/texlive/run-texhash\n"); fprintf(fpack, "mkdir -p /var/run/texlive\ntouch /var/run/texlive/run-texhash\n"); if ( pkg[i].has_info ) { int k; for (k=0; k/dev/null\n", &pkg[i].runf[k][15]); } } } fprintf(fpack, "if [ $1 == 1 ] ; then\n"); for (run_updmap=run_fmtutil=n=0; n> %%{_texdir}/texmf/web2c/updmap.cfg\n", &pkg[i].exe[n][7]); // fprintf(fpack, "%%{_bindir}/updmap-sys --nomkmap --quiet --enable Map %s\n", &pkg[i].exe[n][7]); run_updmap = 1; continue; } if ( !strncmp(pkg[i].exe[n], "addMixedMap ", 12) ) { fprintf(fpack, "echo \"MixedMap %s\" >> %%{_texdir}/texmf/web2c/updmap.cfg\n", &pkg[i].exe[n][12]); // fprintf(fpack, "%%{_bindir}/updmap-sys --nomkmap --quiet --enable MixedMap %s\n", &pkg[i].exe[n][12]); run_updmap = 1; continue; } if ( !strncmp(pkg[i].exe[n], "BuildFormat ", 12) ) { fprintf(fpack, "sed -i 's/^\\#\\!\\ %s/%s/' %%{_texdir}/texmf/web2c/fmtutil.cnf\n", &pkg[i].exe[n][12], &pkg[i].exe[n][12]); run_fmtutil = 1; continue; } if ( !strncmp(pkg[i].exe[n], "AddFormat ", 10) ) { char *name = strstr(pkg[i].exe[n], "name="), *engine = strstr(pkg[i].exe[n], "engine="), *patterns = strstr(pkg[i].exe[n], "patterns="), *options = strstr(pkg[i].exe[n], "options="); char *opt, opt_char; if ( !name || !engine || !options ) { fprintf(stderr, "Invalid AddFormat entry in package %s: '%s' '%s' '%s' '%s'.\n", pkg[i].name, name, engine, patterns, options); exit(1); } name += 5; engine += 7; if ( patterns ) patterns += 9; options += 8; *strchr(name, ' ') = '\0'; *strchr(engine, ' ') = '\0'; if ( patterns && strchr(patterns, ' ') ) *strchr(patterns, ' ') = '\0'; if ( *options == '"' ) { options++; opt = strchr(options, '"'); } else { for (opt=options; *opt != ' ' && *opt != '\n'; opt++); } opt_char = *opt; *opt = '\0'; fprintf(fpack, "sed -i 's/^\\#\\!\\ %s.*$/%s %s %s %s/' %%{_texdir}/texmf/web2c/fmtutil.cnf\n", name, name, engine, patterns?patterns:"-", options); name[strlen(name)] = ' '; engine[strlen(engine)] = ' '; if ( patterns ) patterns[strlen(patterns)] = ' '; *opt = opt_char; run_fmtutil = 1; continue; } if ( !strncmp(pkg[i].exe[n], "AddHyphen ", 10) ) { char *name = strstr(pkg[i].exe[n], "name="), *synonyms = strstr(pkg[i].exe[n], "synonyms="), *lefthyphenmin = strstr(pkg[i].exe[n], "lefthyphenmin="), *righthyphenmin = strstr(pkg[i].exe[n], "righthyphenmin="), *file = strstr(pkg[i].exe[n], "file="); int k; if ( !name || !lefthyphenmin || !righthyphenmin || !file ) { fprintf(stderr, "Invalid AddHyphen entry in package %s.\n", pkg[i].name); exit(1); } name += 5; if ( synonyms ) synonyms += 9; lefthyphenmin += 14; righthyphenmin += 15; file += 5; for (k=10; pkg[i].exe[n][k]; k++) if ( pkg[i].exe[n][k] == ' ' ) pkg[i].exe[n][k] = '\0'; fprintf(fpack, "echo \"%s %s\" >> %%{_texdir}/texmf/tex/generic/config/language.dat\n", name, file); if ( synonyms ) { char *syn = synonyms, *s; while ( (s=strchr(syn, ',')) ) { *s = '\0'; fprintf(fpack, "echo \"=%s\" >> %%{_texdir}/texmf/tex/generic/config/language.dat\n", syn); *s = ','; syn = s+1; } fprintf(fpack, "echo \"=%s\" >> %%{_texdir}/texmf/tex/generic/config/language.dat\n", syn); } fprintf(fpack, "echo \"\\addlanguage{%s}{%s}{}{%s}{%s}\" >> %%{_texdir}/texmf/tex/generic/config/language.def\n", name, file, lefthyphenmin, righthyphenmin); if ( synonyms ) { char *syn = synonyms, *s; while ( (s=strchr(syn, ',')) ) { *s = '\0'; fprintf(fpack, "echo \"\\addlanguage{%s}{%s}{}{%s}{%s}\" >> %%{_texdir}/texmf/tex/generic/config/language.def\n", syn, file, lefthyphenmin, righthyphenmin); *s = ','; syn = s+1; } fprintf(fpack, "echo \"\\addlanguage{%s}{%s}{}{%s}{%s}\" >> %%{_texdir}/texmf/tex/generic/config/language.def\n", syn, file, lefthyphenmin, righthyphenmin); } for (--k; k>=10; k--) if ( pkg[i].exe[n][k] == '\0' ) pkg[i].exe[n][k] = ' '; run_fmtutil = 1; continue; } fprintf(stderr, "Unknown exec format: %s\n", pkg[i].exe[n]); exit(1); } if ( run_updmap ) fprintf(fpack, "touch /var/run/texlive/run-updmap\n"); if ( run_fmtutil ) fprintf(fpack, "touch /var/run/texlive/run-fmtutil\n"); fprintf(fpack, "fi\n:\n"); #ifndef SRPMS fprintf(fpack, "\n%%postun %s\n", name); #else fprintf(fpack, "\n%%postun\n"); #endif // fprintf(fpack, "echo 'postun'\nif [ $1 == 0 ] ; then\n"); fprintf(fpack, "if [ $1 == 0 ] ; then\n"); for (run_updmap=n=0; n=10; k--) if ( pkg[i].exe[n][k] == '\0' ) pkg[i].exe[n][k] = ' '; run_fmtutil = 1; continue; } } fprintf(fpack, "mkdir -p /var/run/texlive\ntouch /var/run/texlive/run-texhash\n"); if ( run_updmap ) fprintf(fpack, "touch /var/run/texlive/run-updmap\n"); if ( run_fmtutil ) fprintf(fpack, "touch /var/run/texlive/run-fmtutil\n"); fprintf(fpack, "fi\n:\n\n"); #ifndef SRPMS fprintf(fpack, "%%posttrans %s\n", name); #else fprintf(fpack, "%%posttrans\n"); #endif // fprintf(fpack, "echo 'posttrans'\n[ -e /var/run/texlive/run-texhash ] && %%{_bindir}/texhash 2> /dev/null; rm -f /var/run/texlive/run-texhash\n"); fprintf(fpack, "[ -e /var/run/texlive/run-texhash ] && %%{_bindir}/texhash 2> /dev/null; rm -f /var/run/texlive/run-texhash\n"); if ( run_updmap ) fprintf(fpack, "[ -e /var/run/texlive/run-updmap ] && %%{_bindir}/updmap-sys --nohash --quiet &> /dev/null; rm -f /var/run/texlive/run-updmap\n"); if ( run_fmtutil ) fprintf(fpack, "[ -e /var/run/texlive/run-fmtutil ] && %%{_bindir}/fmtutil-sys --all &> /dev/null; rm -f /var/run/texlive/run-fmtutil\n"); // fprintf(fpack, "[ -e /var/run/texlive ] && rm -rf /var/run/texlive\n:\n\n"); fprintf(fpack, ":\n\n"); } else if ( pkg[i].runfs ) { #ifndef SRPMS fprintf(fpack, "%%post %s\n", name); #else fprintf(fpack, "%%post\n"); #endif // fprintf(fpack, "echo 'post'\nmkdir -p /var/run/texlive\ntouch /var/run/texlive/run-texhash\n"); fprintf(fpack, "mkdir -p /var/run/texlive\ntouch /var/run/texlive/run-texhash\n"); if ( pkg[i].has_info ) { int k; for (k=0; k/dev/null\n", &pkg[i].runf[k][15]); } } } fprintf(fpack, ":\n"); #ifndef SRPMS fprintf(fpack, "\n%%postun %s\n", name); #else fprintf(fpack, "\n%%postun\n"); #endif // fprintf(fpack, "echo 'postun'\nif [ $1 == 1 ]; then\n mkdir -p /var/run/texlive\n touch /var/run/run-texhash\nelse\n %%{_bindir}/texhash 2> /dev/null\nfi\n"); fprintf(fpack, "if [ $1 == 1 ]; then\n mkdir -p /var/run/texlive\n touch /var/run/run-texhash\nelse\n %%{_bindir}/texhash 2> /dev/null\nfi\n"); fprintf(fpack, ":\n\n"); #ifndef SRPMS fprintf(fpack, "%%posttrans %s\n", name); #else fprintf(fpack, "%%posttrans\n"); #endif // fprintf(fpack, "[ -e /var/run/texlive/run-texhash ] && rm -f /var/run/texlive/run-texhash && [ -e %%{_bindir}/texhash ] && %%{_bindir}/texhash 2> /dev/null\n[ -e /var/run/texlive ] && rm -rf /var/run/texlive\n:\n\n"); // fprintf(fpack, "echo 'posttrans'\n[ -e /var/run/texlive/run-texhash ] && [ -e %%{_bindir}/texhash ] && %%{_bindir}/texhash 2> /dev/null; rm -f /var/run/texlive/run-texhash\n:\n\n"); fprintf(fpack, "[ -e /var/run/texlive/run-texhash ] && [ -e %%{_bindir}/texhash ] && %%{_bindir}/texhash 2> /dev/null; rm -f /var/run/texlive/run-texhash\n:\n\n"); } /* ... and main files */ #ifdef SRPMS mainpkg = 1; #endif append_filelist(pkg[i].name, "", pkg[i].runfs, pkg[i].runf, put_token(pkg[i].catalogue_license, license)); #ifdef SRPMS mainpkg = 0; #endif } #ifdef PACKAGE_DOCS /* write doc package if exists */ if ( pkg[i].docfs ) { main_written = pkg[i].runfs || pkg[i].reqs || pkg[i].exes; fprintf(funpack, UNPACK" -dc %%{SOURCE%d} | tar x -C %%{buildroot}%%{_texdir}%s\n", srcno, pkg[i].reloc?"/texmf-dist":""); fprintf(fsrc, "Source%d: "CTAN_URL"%s.doc.tar."UNPACK"\n", srcno++, name); #ifdef SRPMS if ( !main_written ) { fprintf(fpack, "Name: texlive-%s-doc\n", name); fprintf(fpack, "License: %s\n", put_token(pkg[i].catalogue_license, spec_license)?put_token(pkg[i].catalogue_license, spec_license):"LPPL"); } else { fprintf(fpack, "%%package doc\n"); } #else fprintf(fpack, "%%package %s-doc\n", name); #endif fprintf(fpack, "Summary: Documentation for %s\n", name); fprintf(fpack, "Version: %%{tl_version}\n"); fprintf(fpack, "Release: "); if ( pkg[i].catalogue_version ) fprintf(fpack, "%%{tl_noarch_release}.%s.svn%s%%{?dist}\n", pkg[i].catalogue_version, pkg[i].revision ); else fprintf(fpack, "%%{tl_noarch_release}.svn%s%%{?dist}\n", pkg[i].revision); // if ( pkg[i].catalogue_version ) fprintf(fpack, "%%{tl_release}.%s.svn%s%%{?dist}\n", pkg[i].catalogue_version, pkg[i].revision ); else fprintf(fpack, "%%{tl_release}.svn%s%%{?dist}\n", pkg[i].revision); if ( strncmp(name, "kpathsea", 8) ) { fprintf(fpack, "Requires: texlive-base = %%{tl_version}\n"); } else { fprintf(fpack, "Obsoletes: kpathsea < %%{tl_version}\n"); } // if ( pkg[i].docfs ) fprintf(fpack, "Requires(post,postun): texlive-kpathsea-bin = %%{tl_version}\n"); fprintf(fpack, "BuildArch: noarch\nAutoReqProv: No\n"); for (n=0; ncatalogue_license & LIC_NOTALLOWED ) continue; if ( pkg[i].req[n]->docfs ) fprintf(fpack, "Requires: texlive-%s-doc\n", pkg[i].dep[n]); } if ( main_written ) { #ifndef SRPMS fprintf(fpack, "\n%%description %s-doc\n", name); #else fprintf(fpack, "\n%%description doc\n"); #endif } else { #ifdef SRPMS fprintf(fpack, "\n%%description\n"); #else fprintf(fpack, "\n%%description %s-doc\n", name); #endif } fprintf(fpack, "Documentation for %s\n\n", name); /* if ( main_written ) { fprintf(fpack, "%%post doc\n%%{_bindir}/texhash 2> /dev/null\n:\n\n%%postun doc\n%%{_bindir}/texhash 2> /dev/null\n:\n\n"); } else { fprintf(fpack, "%%post\n%%{_bindir}/texhash 2> /dev/null\n:\n\n%%postun\n%%{_bindir}/texhash 2> /dev/null\n:\n\n"); } */ /* ... and doc files */ #ifdef SRPMS mainpkg = 1; #endif append_filelist(pkg[i].name, "doc", pkg[i].docfs, pkg[i].docf, put_token(pkg[i].catalogue_license, license)); #ifdef SRPMS mainpkg = 0; #endif } #endif #ifdef PACKAGE_SOURCE /* write source package if exists */ if ( pkg[i].srcfs ) { fprintf(funpack, UNPACK" -dc %%{SOURCE%d} | tar x -C %%{buildroot}%%{_texdir}%s\n", srcno, pkg[i].reloc?"/texmf-dist":""); fprintf(fsrc, "Source%d: "CTAN_URL"%s.source.tar."UNPACK"\n", srcno++, name); #ifndef SRPMS fprintf(fpack, "%%package %s-source\n", name); #else fprintf(fpack, "%%package source\n"); #endif fprintf(fpack, "Summary: Sources for %s\n", name); fprintf(fpack, "Version: %%{tl_version}\n"); fprintf(fpack, "Release: "); if ( pkg[i].catalogue_version ) fprintf(fpack, "%%{tl_noarch_release}.%s.svn%s%%{?dist}\n", pkg[i].catalogue_version, pkg[i].revision ); else fprintf(fpack, "%%{tl_noarch_release}.svn%s%%{?dist}\n", pkg[i].revision); // if ( pkg[i].catalogue_version ) fprintf(fpack, "%%{tl_release}.%s.svn%s%%{?dist}\n", pkg[i].catalogue_version, pkg[i].revision ); else fprintf(fpack, "%%{tl_release}.svn%s%%{?dist}\n", pkg[i].revision); if ( strncmp(name, "kpathsea", 8) ) fprintf(fpack, "Requires: texlive-base = %%{tl_version}\n"); // if ( pkg[i].srcfs ) fprintf(fpack, "Requires(post,postun): texlive-kpathsea-bin = %%{tl_version}\n"); fprintf(fpack, "BuildArch: noarch\nAutoReqProv: No\n"); for (n=0; ncatalogue_license & LIC_NOTALLOWED ) continue; if ( pkg[i].req[n]->srcfs ) fprintf(fpack, "Requires: texlive-%s-source = %%{tl_version}\n", pkg[i].dep[n]); } #ifndef SRPMS fprintf(fpack, "\n%%description %s-source\n", name); #else fprintf(fpack, "\n%%description source\n"); #endif fprintf(fpack, "Sources for %s\n\n", name); /* if ( pkg[i].docfs ) { fprintf(fpack, "%%post source\n"); fprintf(fpack, "%%{_bindir}/texhash 2> /dev/null\n"); fprintf(fpack, ":\n"); fprintf(fpack, "\n%%postun source\n"); fprintf(fpack, "%%{_bindir}/texhash 2> /dev/null\n"); fprintf(fpack, ":\n\n"); } */ /* ... and src files */ #ifdef SRPMS mainpkg = 1; #endif append_filelist(pkg[i].name, "source", pkg[i].srcfs, pkg[i].srcf, put_token(pkg[i].catalogue_license, license)); #ifdef SRPMS mainpkg = 0; #endif } #else /* write just link to source */ if ( pkg[i].srcfs ) { fprintf(fsrc, "Source%d: "CTAN_URL"%s.source.tar."UNPACK"\n", srcno++, name); } #endif /* fonts */ { int n, has_fonts = 0, k; for (n=0; n 4) { if (!strcmp(&pkg[i].runf[n][s-4], ".ttf") || !strcmp(&pkg[i].runf[n][s-4], ".ttc") || !strcmp(&pkg[i].runf[n][s-4], ".pfa") || !strcmp(&pkg[i].runf[n][s-4], ".pfb") || !strcmp(&pkg[i].runf[n][s-4], ".pcf") || !strcmp(&pkg[i].runf[n][s-4], ".otf") ) { if ( !has_fonts ) { #ifdef SRPMS fprintf(fpack, "%%package fedora-fonts\n"); #else fprintf(fpack, "%%package %s-fedora-fonts\n", name); #endif fprintf(fpack, "Summary: Fonts for %s\n", name); fprintf(fpack, "Version: %%{tl_version}\n"); fprintf(fpack, "Release: "); if ( pkg[i].catalogue_version ) fprintf(fpack, "%%{tl_noarch_release}.%s.svn%s%%{?dist}\n", pkg[i].catalogue_version, pkg[i].revision ); else fprintf(fpack, "%%{tl_noarch_release}.svn%s%%{?dist}\n", pkg[i].revision); // if ( pkg[i].catalogue_version ) fprintf(fpack, "%%{tl_release}.%s.svn%s%%{?dist}\n", pkg[i].catalogue_version, pkg[i].revision ); else fprintf(fpack, "%%{tl_release}.svn%s%%{?dist}\n", pkg[i].revision); fprintf(fpack, "Requires: fontpackages-filesystem\n"); fprintf(fpack, "BuildRequires: fontpackages-devel\n"); fprintf(fpack, "Requires: texlive-%s = %%{tl_version}\n", name); fprintf(fpack, "BuildArch: noarch\n"); #ifdef SRPMS fprintf(fpack, "\n%%description fedora-fonts\n"); #else fprintf(fpack, "\n%%description %s-fedora-fonts\n", name); #endif for (k=0; kname) ) { pkg[x].req[y] = pk; } } } } } } #ifdef SRPMS system("rm -rf ./specs; mkdir specs"); #endif for (i=0; i