/* * tl2rpm 0.0.1, TeX Live to RPM converter. * * Copyright (C) 2009-2012 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 FEDORA_FONTS #define UNPACK "xz" #define REQ_POSTTRANS "Requires: " #define REQ_POST_POSTUN "Requires(post,postun): " #ifndef TL2010 //# define CTAN_URL "ftp://ftp.ctex.org/mirrors/CTAN/systems/texlive/tlnet/archive/" # define CTAN_URL "http://ctan.sharelatex.com/tex-archive/systems/texlive/tlnet/archive/" #else # define CTAN_URL "" #endif #ifdef DEBUG # define REDIR "\n" #else # define REDIR " > /dev/null 2>&1\n" #endif #include #include #include #include #include #include #include #include "tl-oldpkgs.h" 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 LIC_PROBLEMATIC 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}, {"LPPL 1.2", LIC_LPPL12}, {"LPPL 1.3", LIC_LPPL13}, {"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}, {"OFL", 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 *fedora_license; char *catalogue_date; char *catalogue_version; char **dep; struct pk **req; int reqs; char **file_req; int file_reqs; char **file_prov; int file_provs; char **exe; int exes; int reloc; int has_man; int has_info; int main_pkg_written; int any_pkg_written; } 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; /* Packages to be ignored and not included */ char *pkg_blacklist[] = { "getafm", "psutils", "t1utils", "texworks", "xindy", // dependency on clisp "asymptote", // special build procedure, packaged separately "asymptote.i386-linux", "asymptote-by-example-zh-cn", "asymptote-faq-zh-cn", "asymptote-manual-zh-cn", "latex-tds", // only source "biber", // packaged separately "euro-ce", // nonfree license "latexmk", // packaged separately "uwmslide", // artistic (non-free) "texdiff", // artistic (non-free) NULL, }; char *rem[] = { /* any file beginning with this will be removed */ "texmf-dist/doc/info/kpathsea.info", "texmf-dist/scripts/context/stubs/source", "readme-txt.dir", "tlpkg/installer", "install-tl", NULL, }; char *fedora_license[] = { #include "texlive-fedora-licenses.h" NULL, 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; int ret; ret = asprintf(&new_l, "texmf-dist%s", rel+5); if (ret == -1) { fprintf(stderr, "asprintf failed?"); } l = new_l; } if (!strncmp(l, "texmf-dist/doc/man/man", 22)) { /* 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-dist/doc/info/", 20)) { /* 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; } 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); { int n; for (n=0; fedora_license[n]; n+=2) { if (!strcmp(fedora_license[n], pkg[p-1].name)) { pkg[p-1].fedora_license = fedora_license[n+1]; break; } } } 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) || !strncmp(l,"postaction ", 11) ) { continue; } fprintf(stderr, "unknown token: '%s'\n", l); } } package **inst; int installed, srcno=100, mainsrcno = 7000, mainpkg; FILE *fpack, *ffile, *funpack, *fsrc, *fremove, *ffont; char *cnf_files[] = { "texmf-dist/web2c/fmtutil.cnf", "texmf-dist/web2c/updmap.cfg", "texmf-dist/web2c/texmf.cnf", "texmf-dist/web2c/context.cnf", "texmf-dist/web2c/mktex.cnf", "texmf-dist/dvips/config/config.ps", /* rhbz#441171 */ "texmf-dist/tex/generic/config/language.dat", /* rhbz#929367 */ 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) && !(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+19]); } goto next; } if (!strncmp(&filelist[n][bin_index], "texmf-dist/doc/info", 19)) { /* 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+20]); } goto next; } if (!strcmp(&filelist[n][bin_index], "texmf-dist/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-dist/web2c/updmap.cfg\n"); } else if (!strcmp(&filelist[n][bin_index], "texmf-dist/web2c/fmtutil.cnf")) { fprintf(fremove, "\n# disable all formats\n"); fprintf(fremove, "sed -i '/^[a-z].*$/s/^/\\#\\!\\ /' %%{buildroot}%%{_texdir}/texmf-dist/web2c/fmtutil.cnf\n"); } else if (!strcmp(&filelist[n][bin_index], "texmf-dist/tex/generic/config/language.us")) { fprintf(fremove, "\n# disable all hyphenations\n"); fprintf(fremove, "cp -f %%{buildroot}%%{_texdir}/texmf-dist/tex/generic/config/language.us %%{buildroot}%%{_texdir}/texmf-dist/tex/generic/config/language.dat\n"); } else if (!strcmp(&filelist[n][bin_index], "texmf-dist/tex/generic/config/language.us.def")) { fprintf(fremove, "\n# disable all hyphenations\n"); fprintf(fremove, "cp -f %%{buildroot}%%{_texdir}/texmf-dist/tex/generic/config/language.us.def %%{buildroot}%%{_texdir}/texmf-dist/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"); } #if 0 static 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) = %%{tl_version}\n", strrchr(p->runf[n], '/')+1); } } } static void fill_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) = %%{tl_version}\n", strrchr(p->runf[n], '/')+1); } } } #endif static void fill_file_reqprov() { int i, j, n, k; char ss[0x100]; char *se; char *sufs[] = { ".tfm", ".ttf", ".ttc", ".pfa", ".pfb", ".pcf", ".otf", ".tex", ".cnf", ".cfg", ".def", ".dat", ".ldf", ".fd", ".enc", ".map", ".vf", ".vpl", ".clo", ".bug", ".bg2", ".cbx", ".bbx", ".cls", ".sty", NULL }; for (i=0; i=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'; strcpy(ss, dep); strcat(ss, ".sty"); 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'; strcpy(ss, dep); strcat(ss, ".sty"); 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; 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; xcatalogue_version ) { snprintf(noarchver, sizeof(noarchver), "svn%s.%s", p->revision, p->catalogue_version ); } else { snprintf(noarchver, sizeof(noarchver), "svn%s.0", p->revision); } return noarchver; } static char *skipspaces( char *s ) { while ( isblank(*s) ) s++; return s; } int level; void solve(char *name) { unsigned long h; int i, found = 0, doc_expanded = 0; #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]); } } if ( pkg[i].binfs ) { char s[0x100], *pp; unsigned long hh; strcpy(s, name); pp = strstr(s, ".ARCH"); *pp = 0; hh = hash(s); for (n=0; ncatalogue_license & LIC_NOTALLOWED ) { continue; } if ( pkg[i].req[n]->reqs || pkg[i].req[n]->runfs || pkg[i].req[n]->exes ) { if (strncmp(pkg[i].dep[n], "collection-", 11)) { fprintf(fpack, "Requires: tex-%s\n", pkg[i].dep[n]); } else { fprintf(fpack, "Requires: texlive-%s\n", pkg[i].dep[n]); } continue; } #ifdef PACKAGE_DOCS if ( pkg[i].req[n]->docfs ) { fprintf(fpack, "Requires: texlive-%s-doc\n", pkg[i].dep[n]); continue; } #endif #ifdef PACKAGE_SOURCE if ( pkg[i].req[n]->srcfs ) { fprintf(fpack, "Requires: texlive-%s-source\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\n", pkg[i].dep[n]); pkg[i].dep[n][spost] = '.'; continue; } } } /* write virtual provides */ if ( !strncmp(name, "collection-", 11) ) { if (!strcmp(name+11, "latexrecommended")) { fprintf(fpack, "Provides: tex(latex) = %%{tl_version}, texlive-latex = %%{tl_version}\n"); fprintf(fpack, "Requires: texlive-collection-fontsrecommended\n"); } else if (!strcmp(name+11, "latex")) { fprintf(fpack, "Provides: tex(latex-base) = %%{tl_version}\n"); } else if (!strcmp(name+11, "basic")) { fprintf(fpack, "Provides: tex(tex) = %%{tl_version}, tex = %%{tl_version}\n"); fprintf(fpack, "Requires: 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\n"); } else if (!strcmp(name+11, "xetex")) { fprintf(fpack, "Provides: tex(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-texmf-context < %%{tl_version}\n"); } if ( !strcmp(name, "ps2pk") ) { fprintf(fpack, "Provides: texlive-ps2pkm = %%{tl_version}\n"); fprintf(fpack, "Obsoletes: texlive-ps2pkm < %%{tl_version}\n"); } if ( !strcmp(name, "ps2pk-bin") ) { fprintf(fpack, "Provides: texlive-ps2pkm-bin%%{_isa} = %%{tl_version}\n"); fprintf(fpack, "Provides: texlive-ps2pkm-bin = %%{tl_version}\n"); fprintf(fpack, "Obsoletes: texlive-ps2pkm-bin < %%{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: tex-%s\n", pkg[i].dep[n]); continue; } #ifdef PACKAGE_DOCS if ( pkg[i].req[n]->docfs ) { fprintf(fpack, "Requires: tex-%s-doc\n", pkg[i].dep[n]); continue; } #endif #ifdef PACKAGE_SOURCE if ( pkg[i].req[n]->srcfs ) { fprintf(fpack, "Requires: tex-%s-source\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\n", pkg[i].dep[n]); pkg[i].dep[n][spost] = '.'; continue; } } } /* Ruby dependencies */ 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") ) { fprintf(fpack, "Requires: tex-%s-fedora-fonts\n", name); break; } } } #endif /* write virtual provides */ if ( !strcmp(name, "dvips") ) { fprintf(fpack, "Provides: tex(dvips) = %%{tl_version}, tetex-dvips = 3.1-99, texlive-texmf-dvips = %%{tl_version}, texlive-dvips = %%{tl_version}\n"); fprintf(fpack, "Obsoletes: tetex-dvips < 3.1-99, texlive-texmf-dvips < %%{tl_version}\n"); fprintf(fpack, "Requires: texlive-latex-fonts\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-texmf-latex = %%{tl_version}\n"); fprintf(fpack, "Obsoletes: tetex-latex < 3.1-99, 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"); } if ( !strcmp(name, "pdfjam") ) { fprintf(fpack, "Provides: pdfjam = %%{tl_version}\n"); fprintf(fpack, "Obsoletes: pdfjam < %%{tl_version}\n"); } if ( !strcmp(name, "ptex") ) { fprintf(fpack, "Provides: mendexk = %%{tl_version}\n"); fprintf(fpack, "Obsoletes: mendexk < %%{tl_version}\n"); } if ( !strcmp(name, "japanese") ) { fprintf(fpack, "Provides: texlive-east-asian = %%{tl_version}\n"); fprintf(fpack, "Obsoletes: texlive-east-asian < %%{tl_version}\n"); } if ( !strcmp(name, "preview") ) { fprintf(fpack, "Provides: tex-preview = %%{tl_version}\n"); fprintf(fpack, "Obsoletes: tex-preview < %%{tl_version}\n"); } /* if ( !strcmp(name, "latexmk") ) { // rhbz#868996 fprintf(fpack, "Provides: latexmk = %%{tl_version}\n"); fprintf(fpack, "Obsoletes: latexmk < %%{tl_version}\n"); }*/ if ( !strcmp(name, "chktex") ) { /* rhbz#864211 */ fprintf(fpack, "Provides: chktex = %%{tl_version}\n"); fprintf(fpack, "Obsoletes: chktex < %%{tl_version}\n"); } if ( !strcmp(name, "metauml") ) { /* rhbz#573863 */ fprintf(fpack, "Provides: metapost-metauml = %%{tl_version}\n"); fprintf(fpack, "Obsoletes: metapost-metauml < %%{tl_version}\n"); } if ( !strcmp(name, "cm-lgc") ) { /* rhbz#907728 */ fprintf(fpack, "Obsoletes: tex-cm-lgc < %%{tl_version}\n"); } if ( !strcmp(name, "simplecv") ) { /* rhbz#907728 */ fprintf(fpack, "Obsoletes: tex-simplecv < %%{tl_version}\n"); } if ( !strcmp(name, "kerkis") ) { /* rhbz#907728 */ fprintf(fpack, "Obsoletes: tex-kerkis < %%{tl_version}\n"); } if ( !strcmp(name, "detex") ) { /* rhbz#913678 */ fprintf(fpack, "Obsoletes: detex < %%{tl_version}\n"); } if ( !strcmp(name, "latexdiff") ) { /* rhbz#913678 */ fprintf(fpack, "Obsoletes: latexdiff < %%{tl_version}\n"); } if ( !strcmp(name, "pdfjam") ) { /* rhbz#913678 */ fprintf(fpack, "Obsoletes: pdfbook < %%{tl_version}1212\n"); } if ( !strcmp(name, "musixtex-fnts") ) { fprintf(fpack, "Provides: ctan-musixtex-fonts = %%{tl_version}\n"); fprintf(fpack, "Obsoletes: ctan-musixtex-fonts < %%{tl_version}\n"); } if ( !strcmp(name, "musixtex-doc") ) { fprintf(fpack, "Provides: tex-musixtex-doc = %%{tl_version}\n"); fprintf(fpack, "Obsoletes: tex-musixtex-doc < %%{tl_version}\n"); } if ( !strcmp(name, "musixtex") ) { fprintf(fpack, "Provides: tex-musixtex = %%{tl_version}\n"); fprintf(fpack, "Obsoletes: tex-musixtex < %%{tl_version}\n"); } if ( !strcmp(name, "dvipdfmx") ) { /* rhbz#968358 */ fprintf(fpack, "Provides: texlive-dvipdfm = 3:%%{tl_version}\n"); fprintf(fpack, "Obsoletes: texlive-dvipdfm < 3:%%{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][20]); } } } fprintf(fpack, "if [ $1 -gt 0 ] ; then\n"); for (run_updmap=run_fmtutil=n=0; n> %%{_texdir}/texmf-dist/tex/generic/config/language.dat\n", name, file); if ( synonyms ) { char *syn = synonyms, *s; while ( (s=strchr(syn, ',')) ) { *s = '\0'; fprintf(fpack, "sed -i '/=%s/d' %%{_texdir}/texmf-dist/tex/generic/config/language.dat\n", syn); fprintf(fpack, "echo \"=%s\" >> %%{_texdir}/texmf-dist/tex/generic/config/language.dat\n", syn); *s = ','; syn = s+1; } fprintf(fpack, "sed -i '/=%s/d' %%{_texdir}/texmf-dist/tex/generic/config/language.dat\n", syn); fprintf(fpack, "echo \"=%s\" >> %%{_texdir}/texmf-dist/tex/generic/config/language.dat\n", syn); } fprintf(fpack, "sed -i '/\\\\addlanguage{%s}.*/d' %%{_texdir}/texmf-dist/tex/generic/config/language.def\n", name); fprintf(fpack, "echo \"\\addlanguage{%s}{%s}{}{%s}{%s}\" >> %%{_texdir}/texmf-dist/tex/generic/config/language.def\n", name, file, lefthyphenmin, righthyphenmin); if ( synonyms ) { char *syn = synonyms, *s; while ( (s=strchr(syn, ',')) ) { *s = '\0'; fprintf(fpack, "sed -i '/\\\\addlanguage{%s}.*/d' %%{_texdir}/texmf-dist/tex/generic/config/language.def\n", syn); fprintf(fpack, "echo \"\\addlanguage{%s}{%s}{}{%s}{%s}\" >> %%{_texdir}/texmf-dist/tex/generic/config/language.def\n", syn, file, lefthyphenmin, righthyphenmin); *s = ','; syn = s+1; } fprintf(fpack, "sed -i '/\\\\addlanguage{%s}.*/d' %%{_texdir}/texmf-dist/tex/generic/config/language.def\n", syn); fprintf(fpack, "echo \"\\addlanguage{%s}{%s}{}{%s}{%s}\" >> %%{_texdir}/texmf-dist/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); continue; } 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, "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\ntouch /var/run/texlive/run-mtxrun\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, "if [ -e /var/run/texlive/run-texhash ]; then %%{_bindir}/texhash 2> /dev/null; rm -f /var/run/texlive/run-texhash; fi\n"); if ( run_updmap ) fprintf(fpack, "if [ -e /var/run/texlive/run-updmap ]; then %%{_bindir}/updmap-sys --quiet --nomkmap &> /dev/null;rm -f /var/run/texlive/run-updmap; fi\n"); if ( run_fmtutil ) fprintf(fpack, "if [ -e /var/run/texlive/run-fmtutil ]; then %%{_bindir}/fmtutil-sys --all &> /dev/null; rm -f /var/run/texlive/run-fmtutil; fi\n"); fprintf(fpack, "if [ -e /var/run/texlive/run-mtxrun ]; then export TEXMF=/usr/share/texlive/texmf-dist; export TEXMFCNF=/usr/share/texlive/texmf-dist/web2c; export TEXMFCACHE=/var/lib/texmf; %%{_bindir}/mtxrun --generate &> /dev/null; rm -f /var/run/texlive/run-mtxrun; fi\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, "mkdir -p /var/run/texlive\ntouch /var/run/texlive/run-texhash\ntouch /var/run/texlive/run-mtxrun\n"); if ( pkg[i].has_info ) { int k; for (k=0; k/dev/null\n", &pkg[i].runf[k][20]); } } } fprintf(fpack, ":\n"); #ifndef SRPMS fprintf(fpack, "\n%%postun %s\n", name); #else fprintf(fpack, "\n%%postun\n"); #endif 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, "if [ -e /var/run/texlive/run-texhash ] && [ -e %%{_bindir}/texhash ]; then %%{_bindir}/texhash 2> /dev/null; rm -f /var/run/texlive/run-texhash; fi\n"); fprintf(fpack, "if [ -e /var/run/texlive/run-mtxrun ]; then export TEXMF=/usr/share/texlive/texmf-dist; export TEXMFCNF=/usr/share/texlive/texmf-dist/web2c; export TEXMFCACHE=/var/lib/texmf; %%{_bindir}/mtxrun --generate &> /dev/null; rm -f /var/run/texlive/run-mtxrun; fi\n"); fprintf(fpack, ":\n\n"); } /* ... and main files */ #ifdef SRPMS mainpkg = 1; #endif main_written = 0; append_filelist(pkg[i].name, "", pkg[i].runfs, pkg[i].runf, pkg[i].fedora_license?pkg[i].fedora_license:put_token(pkg[i].catalogue_license, license)); #ifdef SRPMS mainpkg = 0; #endif } main_written = pkg[i].runfs || pkg[i].reqs || pkg[i].exes; #ifdef PACKAGE_DOCS /* write doc package if exists */ if ( pkg[i].docfs ) { pkg[i].any_pkg_written = 1; if ( !doc_expanded ) { fprintf(funpack, UNPACK" -dc %%{SOURCE%d} | tar x -C %%{buildroot}%%{_texdir}%s\n", srcno, pkg[i].reloc?"/texmf-dist":""); fprintf(fsrc, "Source%04d: "CTAN_URL"%s.doc.tar."UNPACK"\n", srcno++, name); } doc_expanded = 0; #ifdef SRPMS if ( !main_written ) { fprintf(fpack, "Name: tex-%s-doc\n", name); fprintf(fpack, "Obsoletes: texlive-%s-doc\n", name); fprintf(fpack, "License: %s\n", pkg[i].fedora_license?pkg[i].fedora_license:(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: %s\n", print_noarch_version(&pkg[i])); fprintf(fpack, "Release: %%{tl_noarch_release}\n"); fprintf(fpack, "Provides: tex-%s-doc\n", name); fprintf(fpack, "BuildArch: noarch\nAutoReqProv: No\n"); for (n=0; ncatalogue_license & LIC_NOTALLOWED ) continue; if ( pkg[i].req[n]->docfs ) fprintf(fpack, "Requires: tex-%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); #ifndef SRPMS fprintf(fpack, "%%post %s-doc\n", name); #else fprintf(fpack, "%%post\n"); #endif fprintf(fpack, "mkdir -p /var/run/texlive\ntouch /var/run/texlive/run-texhash\n"); fprintf(fpack, ":\n"); #ifndef SRPMS fprintf(fpack, "\n%%postun %s-doc\n", name); #else fprintf(fpack, "\n%%postun\n"); #endif 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-doc\n", name); #else fprintf(fpack, "%%posttrans\n"); #endif fprintf(fpack, "if [ -e /var/run/texlive/run-texhash ] && [ -e %%{_bindir}/texhash ]; then %%{_bindir}/texhash 2> /dev/null; rm -f /var/run/texlive/run-texhash; fi\n"); fprintf(fpack, ":\n\n"); /* ... and doc files */ #ifdef SRPMS mainpkg = 1; #endif append_filelist(pkg[i].name, "doc", pkg[i].docfs, pkg[i].docf, pkg[i].fedora_license?pkg[i].fedora_license: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%04d: "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: %s\n", print_noarch_version(&pkg[i])); fprintf(fpack, "Release: %%{tl_noarch_release}\n"); if ( strncmp(name, "kpathsea", 8) ) fprintf(fpack, "Requires: texlive-base\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: tex-%s-source\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); /* ... and src files */ #ifdef SRPMS mainpkg = 1; #endif append_filelist(pkg[i].name, "source", pkg[i].srcfs, pkg[i].srcf, pkg[i].fedora_license?pkg[i].fedora_license: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%04d: "CTAN_URL"%s.source.tar."UNPACK"\n", srcno++, name); } #endif #ifdef FEDORA_FONTS /* 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: %s\n", print_noarch_version(&pkg[i])); fprintf(fpack, "Release: %%{tl_noarch_release}\n"); fprintf(fpack, "Requires: fontpackages-filesystem\n"); fprintf(fpack, "BuildRequires: fontpackages-devel\n"); fprintf(fpack, "Requires: tex-%s\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; k 1) ) { char *ar = strstr(name, ".ARCH"); pkg[i].any_pkg_written = 1; *ar = '\0'; fprintf(fpack, "%%package %s-bin\n", name); fprintf(fpack, "Summary: Binaries for %s\n", name); fprintf(fpack, "Version: %s\n", print_noarch_version(&pkg[i])); if ( strncmp(name, "kpathsea", 8) ) fprintf(fpack, "Requires: texlive-base\n"); if ( has_noarch_pkg ) fprintf(fpack, "Requires: texlive-%s\n", name); if ( !strcmp(name, "xetex") ) { fprintf(fpack, "Requires: teckit\n"); fprintf(fpack, "Provides: xdvipdfmx = %%{version}-%%{release}\n"); fprintf(fpack, "Obsoletes: xdvipdfmx < %%{version}-%%{release}\n"); } if ( !strcmp(name, "dvipdfmx") ) { fprintf(fpack, "Provides: dvipdfmx = %%{tl_version}, dvipdfm = %%{tl_version}, texlive-dvipdfm-bin = 3:%%{tl_version}\n"); fprintf(fpack, "Obsoletes: dvipdfmx < %%{tl_version}, dvipdfm < %%{tl_version}, texlive-dvipdfm-bin < 3:%%{tl_version}\n"); } if ( !strcmp(name, "xdvi") ) { fprintf(fpack, "Provides: xdvi = %%{tl_version}, xdvik = %%{tl_version}, tetex-xdvi = 3.1-99\n"); fprintf(fpack, "Obsoletes: xdvi < %%{tl_version}, xdvik < %%{tl_version}, tetex-xdvi < 3.1-99\n"); } if ( !strcmp(name, "dvipng") ) { fprintf(fpack, "Provides: dvipng = %%{tl_version}\n"); fprintf(fpack, "Obsoletes: dvipng < %%{tl_version}\n"); } if ( !strcmp(name, "pdfcrop") ) { fprintf(fpack, "Requires: ghostscript-devel\n"); } if ( !strcmp(name, "dvisvgm") ) { fprintf(fpack, "Provides: dvisvgm = %%{tl_version}\n"); fprintf(fpack, "Obsoletes: dvisvgm < %%{tl_version}\n"); } if ( !strcmp(name, "lcdftypetools") ) { fprintf(fpack, "Provides: lcdf-typetools = %%{tl_version}\n"); fprintf(fpack, "Obsoletes: lcdf-typetools < %%{tl_version}\n"); } if ( !strcmp(name, "xmltex") ) { fprintf(fpack, "Provides: xmltex = %%{tl_version}0101\n"); fprintf(fpack, "Obsoletes: xmltex < %%{tl_version}0101\n"); } if ( !strcmp(name, "pstools") ) { fprintf(fpack, "Provides: ps2eps = %%{tl_version}\n"); fprintf(fpack, "Obsoletes: ps2eps < %%{tl_version}\n"); } /* if ( !strcmp(name, "asymptote") ) { fprintf(fpack, "Provides: asymptote = %%{tl_version}\n"); fprintf(fpack, "Obsoletes: asymptote < %%{tl_version}\n"); }*/ printf("bin-package %s contains %d files\n", pkg[i].name, pkg[i].binfs); { int n, noarch = 1; char s[0x100]; for (n=0; nname) ) { pkg[x].req[y] = pk; } } } } } } #ifdef SRPMS system("rm -rf ./specs; mkdir specs"); #endif fill_file_reqprov(); for (i=0; i