diff options
author | Norbert Preining <preining@logic.at> | 2007-11-15 21:17:37 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2007-11-15 21:17:37 +0000 |
commit | e7c687567cdd868dbe343f1bf09bd32abd97e731 (patch) | |
tree | 097f68b43aeb7f19480fcd843eaad9b0d9e85f2c /Master/tlpkg/bin | |
parent | aeb985d233fd72659294d6c217b205f641a7f3b4 (diff) |
add tlpkg/bin/ctan-check which should play the role of tpm-ctan-check ..
not completely implemented yet
git-svn-id: svn://tug.org/texlive/trunk@5427 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/bin')
-rwxr-xr-x | Master/tlpkg/bin/ctan-check | 340 |
1 files changed, 340 insertions, 0 deletions
diff --git a/Master/tlpkg/bin/ctan-check b/Master/tlpkg/bin/ctan-check new file mode 100755 index 00000000000..d52853ed6c9 --- /dev/null +++ b/Master/tlpkg/bin/ctan-check @@ -0,0 +1,340 @@ +#!/usr/bin/env perl +# $Id: ctan-check 5382 2007-11-06 19:44:39Z karl $ +# Public domain. Originally written 2005, Karl Berry. +# Rewritten for new infrastructure 2007, Norbert Preining. +# Check if a package in TL has any changes on CTAN. Just the beginnings. + +BEGIN { + chomp ($mydir = `dirname $0`); # we are in Master/tlpkg/bin + unshift (@INC, "$mydir/.."); +} + +use TeXLive::TLConfig; +use TeXLive::TLPOBJ; +use TeXLive::TLPDB; + +use File::Basename; + +my $tlpdb; +my $TL; + +# euenc +my @WorkingTLP = qw( + 12many + a0poster aastex abbr abc abstract abstyles accfonts achemso + acmtrans acronym + active-conf addlines adrconv ae aguplus algorithm2e + algorithmicx algorithms + alnumsec altfont ametsoc ams amsaddr amsldoc-it amsrefs + amsthdoc-it animate ANUfinalexam anyfontsize apacite appendix apl + arabi arabtex arabxetex archaic arcs arev + armenian arrayjob arydshln Asana-Math ascii assignment astro + attachfile aurical authorindex auto-pst-pdf automata + babelbib barcodes bbold + beamer beamer-contrib beamer-tut-pt begriff bera betababel + bezos bghyphen bibhtml bibleref bibtopic bibunits bigfoot + binomexp bitfield blacklettert1 blindtext blockdraw_mp boldtensors + bookest booklet bophook + boxhandler breakurl bullcntr bussproofs bytefield + captcont caption carlisle carolmin-ps + cbcoptic ccaption cclicenses cdpbundl cellspace + changebar changes chappg chem-journal chemcompounds chemscheme + chemstyle cherokee circ + citeref cjhebrew classicthesis + clefval cleveref + clock clrscode cmap cmastro cmdstring cmdtrack cmll colorinfo + colortbl colorwav commath compactbib complexity comprehensive + computational-complexity confproc + cooking cool coollist coolstr cooltooltips + coordsys courier-scaled courseoutline coursepaper coverpage + crop crossreference csquotes csvtools ctable + cursolatex cursor cuisine + currvita curve curve2e curves + custom-bib cweb-latex cyrillic + dancers dashbox datatool + dateiliste datetime dcpic decimal delimtxt digiconfigs + dinat dingbat directory disser dk-bib dlfltxb doi doipubmed dottex + doublestroke dpfloat + draftwatermark dramatist dtxgallery + dtxtut dvdcoll dvipsconfig dyntree + easy ebong ebsthesis eCards ecc economic + ecv edmac ednotes eemeir egameps + egplot eijkhout elatex + ellipsis elpres elsevier elsevier-bib emulateapj endfloat endheads + engrec enumitem envbig environ epigrafica epiolmec eplain epsdice + epsf epslatex-fr epspdfconversion eqlist eqparbox errata es-tex-faq + ESIEEcv esint esint-type1 eskd eskdx eso-pic etaremune + ethiop ethiop-t1 etoolbox + eulervm euproposal euro europecv eurosans everypage exam + examdesign examplep exercise expl3 expressg extarrows exteps + extpfeil extract extsizes + faktor fancybox fancyhdr fancynum fancyref fancytooltips fax featpost + fge filecontents fink fixme + flagderiv flippdf float floatflt floatrow flowfram fltpoint + fmtcount fnbreak + fncychap foekfont fontch fontspec footbib forloop formular + fourier fouriernc + fp fpl frankenstein free-math-font-survey + frenchle fribrief frletter fullpict functan + galois gastex gatech-thesis gcard gcite + genmisc genmpage germbib ginpenc + glossaries gmdoc gmeometric + gmiflink gmutils gmverb gnuplottex gost graphics + graphicx-psmin greenpoint + grnumalt gu GuIT + HA-prosper hands harmony hepthesis hepunits hhtensor histogr hitec + hrlatex hvfloat + hyperref hyperxmp hyphen-base hyphen-basque + hyphen-french hyphen-german + hyphen-greek hyphen-italian hyphen-latin hyphen-mongolian + hyphen-norwegian hyphen-ukenglish + hyphen-usorbian hyplain + ibygrk icsv IEEEconf IEEEtran ifxetex ijmart ijqc image-gallery + inlinebib interactiveworkbook inversepath invoice + iopart-num isodoc isorot isotope itnumpar iwona + japanese jeopardy jknapltx jneurosci jpsj jurabib juramisc + kalender kerkis kerntest keystroke koma-script kpfonts + l2picfaq l2tabu-english labelcas labels latex latex-tds latexmp + layouts lcd lcg leading leaflet ledmac leftidx lewis lfb lgreek lh + libertine limap linearA lineno lipsum listings listliketab lkproof lm + logpap lps lsc lshort-bulgarian lshort-dutch lshort-english + lshort-finnish lshort-french lshort-german lshort-italian + lshort-japanese lshort-korean lshort-mongolian + lshort-polish lshort-portuguese lshort-slovak + lshort-spanish lshort-thai lshort-turkish lshort-ukr + lshort-vietnamese ltablex ltabptch ltxindex ltxmisc + mafr magyar mailing makebox makecell makecirc makeglos + makeplot maple marginnote marvosym mathdots mathexam + mathmode maybemath + mcaption mceinleger mdwtools memoir MemoirChapStyles mentis + menu metaobj metaplot metatex metauml mff mfpic mftinc mhchem + mhs microtype minipage-marginpar minitoc minutes mkpattern + mla-paper mlist mnsymbol + moderncv mongolian-babel moreverb movie15 ms msg multicap + munich muthesis mwcls mwrite + nag namespc natbib nath nature ncclatex ncctools newlfm nih noitcrul + nomencl nomentbl notes2bib + ntgclass ntheorem-vn numline numname numprint + oberdiek ocr-latex octavo ofs ogham oldstyle onlyamsmath opcit + ordinalpt osa + papercdcase papertex parallel paresse parrun pauldoc + pdf-forms-tutorial-de pdf-forms-tutorial-en pdf-trans pdfcprot + pdfpages pdfscreen pdfsync pdftex-def perception perltex permute + pgf phaistos philosophersimprint + pict2e pictex pictex2 pittetd placeins plari plates play + poemscol polynom polynomial polytable powerdot ppr-prv + pracjourn preprint + prettyref preview probsoln procIAGssymp program protocol pseudocode + psfrag psfrag-italian psnfss pspicture + pst-2dplot pst-3d pst-3dplot pst-bar + pst-barcode pst-blur pst-circ pst-dbicons pst-diffraction + pst-eps pst-eucl pst-fill + pst-fr3d pst-fractal pst-func + pst-geo pst-grad pst-infixplot pst-labo + pst-lens pst-math pst-ob3d pst-optexp pst-optic + pst-osci pst-pdf pst-pdgr pst-qtree pst-soroban pst-spectra + pst-slpe pst-uml pst-vue3d + pstricks pstricks-add + qcm qstest qtree + randbild rccol rcs rcsinfo + refstyle regcount register resume robustcommand + robustindex rsc rtkinenc rtklage + sae sauerj sauterfonts savefnmark savesym savetrees scale + scalebar schedule scientificpaper sciposter screenplay script + sdrt sectionbox sectsty semantic semaphor seminar semioneside + seqsplit setspace sf298 sffms sfg sfmath sgame shadbox shapepar + shorttoc showdim showexpl showlabels sidecap sides siggraph + simplecv + SIstyle SIunits skaknew slideshow smalltableof smartref + snapshot songbook sort-by-letters soul sparklines spie + splines splitbib splitindex spotcolor sprite srcltx sseq + ssqquote stack stage stdclsdv stdpage stellenbosch struktex + sttools subdepth subeqn subeqnarray + subfig subfigure subfloat substr sudoku + sudokubundle sugconf supertabular svgcolor svn svn-multi svninfo + swebib syntax synproof syntrace synttree + t-angles Tabbing tableaux tabulary tabvar talk tamethebeast + templates-fenn templates-sommer tengwarscript + tensor teubner tex-gyre texilikecover texmate + texpower texshade + textcase textfit textopo textpath textpos thesis-titlepage-fhac + thumb thumbpdf ticket titlefoot titlesec titling tocbibind + tocloft todo tokenizer toolbox tools toptesi totpages tracking + trajan trfsigns trivfloat + trsym tugboat tugboat-plain turnstile twoup Type1fonts + typedref typogrid + ucthesis uhrzeit uiucthesis ulsy umich-thesis uml umlaute + umthesis underlin undertilde units unitsdef unroman + upmethodology upquote ushort + vancouver variations varindex vector velthuis verse versions + vhistory visualfaq vmargin vntex volumes vpe + wallpaper warning warpcol williams wordcount wordlike wrapfig + xargs xbase xcolor xdoc xetexref xfor xfrac xgreek xifthen + xkeyval xltxtra xnewcommand xoptarg + xq xtab xtcapts xunicode xyling xypic-tut-pt xytree + york-thesis + ); +#abstyles not updated but too old to matter +#amscls amsltx2 amsmath - AMS packages come from tds zips, all very weird +#beebe needs more work +#euenc - xetex people don't keep ctan up to date +#logic/gn-logic14 conflicts with logic font +#lshort-russian # only zip files on CTAN +#malayalam # missing C sources on CTAN wrote author 5jun05. +#mathspic # inside pictex later +#mpattern # not up-to-date on CTAN wrote author 28may05. +#plnfss # only a zip file on CTAN +#slidenotes # non-free: ALl rights reserved, nothing else! +#shortlst # works, but license: no profit! needs catalogue update +#sae # works, no profit license! +#xltxtra - xetex people don't keep ctan up to date + + + +exit (&main ()); + +sub main +{ + # get the Master dir + chomp (my $Master = `cd $mydir/../.. && pwd`); + $TL = $Master; + my $tlpdbloc = "$Master/" . $TeXLive::TLConfig::InfraLocation . "/texlive.tlpdb"; + # First we load the current texlive.tlpdb + $tlpdb = TeXLive::TLPDB->new ("location" => $tlpdbloc); + die("Cannot load tlpdb at $tlpdbloc!\n") unless defined($tlpdb); + + $OPT{"verbose"} = 1; + + if ($ARGV[0] eq "--list-not-treated-tlp") { + @AllTLP = $tlpdb->list_packages; + my @nottreatedtlp=(); + foreach my $b (@AllTLP) { + my @foo = grep(/^$b$/, @WorkingTPM); + if ($#foo < 0) { push @nottreatedtlp, $b ; } + } + print "List of tlps which are not in ctan-check:\n"; + foreach (@nottreatedtlp) { + print "$_\n"; + } + exit 0; + } + # xx read FILES.last7days, determine CTAN changes, map to TL packages + # xx alternatively, check all tpm's + if ($ARGV[0] eq "--check") { + $OPT{"verbose"} = 0; + + # xx but for now, just check the few packages we have worked with. + # xx don't check babel, heiko patched it. + @ARGV = @WorkingTLP; + } + + my $errcount = 0; + for my $tlp (@ARGV) { + print "checking $tlp..." if $OPT{"verbose"}; + $errcount += &do_tlp ($tlp); + } + return $errcount; +} + + + +# Return 1 if TPM needs updating, 0 if ok. +# +sub do_tlp +{ + my ($tlpn) = @_; + my $needed = 0; + + my $tlp = $tlpdb->get_package($tlpn); + die("Cannot get package $tlpn, strange!\n") unless (defined($tlp)); + + chomp (my $ctan_dir = `$mydir/tlpkginfo --ctan-dir '$tlpn'`); + if (! $ctan_dir) { + warn "$0: oops, no CTAN directory for $tlpn, fix fix\n"; + return (); + } + my @tpm_files = (); + push @tpm_files, $tlp->runfiles; + push @tpm_files, $tlp->docfiles; + push @tpm_files, $tlp->srcfiles; + # we don't push bin files, should we? + + my @compared = (); + for my $file (@tpm_files) { +#warn "checking file $file\n"; + my $tl_file = "$TL/$file"; + if (! -e $tl_file) { + warn "$tl_file: TL file missing\n"; + next; + } + + (my $basefile = $file) =~ s,^.*/,,; + chomp (my @ctan_files = `find $tpm{CTANdir}/ -name $basefile`); +#warn "ctan find $basefile: @ctan_files\n"; + # the trailing / is so if we happen to hit a symlink on CTAN, it'll + # go through. + next if @ctan_files > 1; # if more than one file by same name, skip + + my $ctan_file = $ctan_files[0]; +#warn "ctan file is $ctan_file\n"; + if (! -e $ctan_file) { + # maybe it'll be there with a case change in the name + chomp (@ctan_files = `find $tpm{CTANdir}/ -iname $basefile`); + next if @ctan_files > 1; # if more than one file by same name, skip + $ctan_file = $ctan_files[0]; + + if (! -e $ctan_file) { + # we generate lots of files, eg perlmacros.sty, so might skip. + warn "$ctan_file: CTAN file missing\n" + if $ctan_file && $ctan_file !~ /(cfg|dvi|sty|tex)$/; + next; + } + } + + push (@compared, $basefile); + if (&files_differ ($tl_file, $ctan_file)) { + # we sometimes regenerate pdf's for TL, so we don't complain if + # they are different. On the other hand, we don't always + # regenerate them, so might as well check first. + next if $tl_file =~ /\.pdf$/; + + print "# $tpm\ndiff $ctan_file $tl_file\n"; + $needed = 1; + last; + } + } + + # xx check ctan dir for new files + + if (@compared == 0) { + warn "\n$tpm: no files to compare in $tpm{CTANdir}, fixme!\n"; + warn "(tpm_files = @tpm_files)\n"; + } elsif ($needed == 0) { + print "ok, " . (@compared + 0) . " compared (@compared)\n" + if $OPT{"verbose"}; + } + + return $needed; +} + + + +# 0 if files are the same, 1 if they are different. +# +sub files_differ +{ + my ($tl_file,$ctan_file) = @_; +#warn "comparing $tl_file $ctan_file\n"; + + my $different = 0; + if (-s $tl_file != -s $ctan_file) { + # sometimes what's checked into CTAN vs. TL differs in the eol + # conventions. Don't worry about that. + if (system ("diff -q --strip-trailing-cr $tl_file $ctan_file >/dev/null") + != 0) { + $different = 1; + } + } + + return $different; +} |