Skip to content

Commit

Permalink
CDN Preparation
Browse files Browse the repository at this point in the history
  • Loading branch information
vavroch2010 committed Jan 8, 2024
1 parent bb1013d commit 7c6fbca
Show file tree
Hide file tree
Showing 18 changed files with 600 additions and 120 deletions.
77 changes: 77 additions & 0 deletions .ttreerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#------------------------------------------------------------------------
# sample .ttreerc file created automatically by ttree version 2.9
#
# This file originally written to /home/vavrat/.ttreerc
#
# For more information on the contents of this configuration file, see
#
# perldoc ttree
# ttree -h
#
#------------------------------------------------------------------------

# The most flexible way to use ttree is to create a separate directory
# for configuration files and simply use the .ttreerc to tell ttree where
# it is.
#
# cfg = /path/to/ttree/config/directory

# print summary of what's going on
verbose

# recurse into any sub-directories and process files
recurse

# regexen of things that aren't templates and should be ignored
ignore = \b(CVS|RCS)\b
ignore = ^#
ignore = ^\.(inc|cross)

# ditto for things that should be copied rather than processed.
copy = \.png$
copy = \.gif$

# ditto for things that should be linked rather than copied / processed.
# link = \.flv$

# by default, everything not ignored or copied is accepted; add 'accept'
# lines if you want to filter further. e.g.
#
# accept = \.html$
# accept = \.tt2$
accept = \.md\.tt$

# options to rewrite files suffixes (htm => html, tt2 => html)
#
# suffix htm=html
# suffix tt2=html
suffix md.tt=html

# options to define dependencies between templates
#
# depend *=header,footer,menu
# depend index.html=mainpage,sidebar
# depend menu=menuitem,menubar
#

#------------------------------------------------------------------------
# The following options usually relate to a particular project so
# you'll probably want to put them in a separate configuration file
# in the directory specified by the 'cfg' option and then invoke tree
# using '-f' to tell it which configuration you want to use.
# However, there's nothing to stop you from adding default 'src',
# 'dest' or 'lib' options in the .ttreerc. The 'src' and 'dest' options
# can be re-defined in another configuration file, but be aware that 'lib'
# options accumulate so any 'lib' options defined in the .ttreerc will
# be applied every time you run ttree.
#------------------------------------------------------------------------
# # directory containing source page templates
# src = /path/to/your/source/page/templates
#
# # directory where output files should be written
# dest = /path/to/your/html/output/directory
#
# # additional directories of library templates
# lib = /first/path/to/your/library/templates
# lib = /second/path/to/your/library/templates

23 changes: 12 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ docs: subdocs manpagetts mancross manhtml
subdocs: $(SIMPLEDOCS)

clean:
rm -f $(SIMPLE) $(SIMPLEDOCS) $(SRCLISTS)
rm -rf $(SIMPLE) $(SIMPLEDOCS) $(SRCLISTS)

akamai-purge:

Expand Down Expand Up @@ -315,16 +315,17 @@ mancross:
# patterns for a for loop.
MANHTML_TTPATTERNS=$(foreach D,$(MANMASTER_DIRS) $(MANPAGE_DIRS), $(D)/*.md.tt)
manhtml:
@set -e; for t in $(MANHTML_TTPATTERNS); do \
if ! [ -f "$$t" ]; then continue; fi; \
d="$$(dirname $$t)"; \
h="$$(basename "$$t" .md.tt)"; \
i=; \
if [ "$$h" = "index" ]; then i=" -i"; fi; \
echo "$$t -> $$h.html"; \
./bin/from-tt -d "$$d" < "$$d/$$h.md.tt" \
| ./bin/md-to-html5$$i -o "$$d/$$h.html"; \
done
./bin/mk-manhtml '$(MANHTML_TTPATTERNS)'
# @set -e; for t in $(MANHTML_TTPATTERNS); do \
# if ! [ -f "$$t" ]; then continue; fi; \
# d="$$(dirname $$t)"; \
# h="$$(basename "$$t" .md.tt)"; \
# i=; \
# if [ "$$h" = "index" ]; then i=" -i"; fi; \
# echo "$$t -> $$h.html"; \
# ./bin/from-tt -d "$$d" < "$$d/$$h.md.tt" \
# | ./bin/md-to-html5$$i -o "$$d/$$h.html"; \
# done

docs/manpages.md: docs/manpages.md.tt Makefile bin/from-tt
@rm -f $@
Expand Down
18 changes: 16 additions & 2 deletions bin/cvejsontohtml.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from optparse import OptionParser
import datetime
import sys

parser = OptionParser()

parser.add_option("-b","--base",help="major version to filter on",dest="base")
Expand Down Expand Up @@ -105,6 +106,8 @@ def getbasefor(fixedin):
if "tags" in ref:
if "vendor-advisory" in ref["tags"]:
url = ref["url"]
if url.startswith("https://www.openssl.org/news/"):
url = url.replace("https://www.openssl.org/news/","")
refs = "<a href=\""+url+"\">"+title+"</a>"
allissues += " "+refs

Expand All @@ -113,14 +116,18 @@ def getbasefor(fixedin):
if "other" in metric["format"]:
impact = metric["other"]["content"]["text"]
if not "unknown" in impact:
allissues += " <a href=\""+metric["other"]["type"]+"\">["+impact+" severity]</a>"
metric_url = metric["other"]["type"]
if metric["other"]["type"].startswith("https://www.openssl.org/policies/"):
metric_url = metric_url.replace("https://www.openssl.org/","../")

allissues += f" <a href=\"{metric_url}\">[{impact} severity]</a>"

# Date
datepublic =cna["datePublic"]
t = datetime.datetime(int(datepublic[:4]), int(datepublic[5:7]), int(datepublic[8:10]), 0, 0)
allissues += t.strftime(" %d %B %Y: ")

allissues += "<a href=\"#toc\"><img src=\"/img/up.gif\"/></a></dt>\n<dd>"
allissues += "<a href=\"#toc\"><img src=\"../img/up.gif\"/></a></dt>\n<dd>"

# Description
for desc in cna["descriptions"]:
Expand Down Expand Up @@ -158,6 +165,10 @@ def getbasefor(fixedin):
continue
allissues += "<li>Affects %s up to and including OpenSSL %s " %(earliest, lastaffected)
if (git != ""):
issue = git.split('/')[-1]
if git.startswith("https://git.openssl.org/"):
commitId=git.split(";")[-1].split("=")[-1]
git = f"https://github.com/openssl/openssl/commit/{commitId}"
allissues += "<a href=\"%s\">(fix in git commit)</a> " %(git)
allissues += "</li>"
if "lessThan" in ver:
Expand All @@ -174,6 +185,9 @@ def getbasefor(fixedin):
continue
allissues += "<li>Fixed in OpenSSL %s " %(fixedin)
if (git != ""):
if git.startswith("https://git.openssl.org/"):
commitId=git.split(";")[-1].split("=")[-1]
git = f"https://github.com/openssl/openssl/commit/{commitId}"
if (fixedin.startswith("1.0.2") and fixedin[5]>='w'): # 1.0.2w and above hack
allissues += "<a href=\"/support/contracts.html?giturl=%s\">(premium support)</a> " %(git)
else:
Expand Down
46 changes: 25 additions & 21 deletions bin/from-tt
Original file line number Diff line number Diff line change
Expand Up @@ -106,37 +106,41 @@ else
errfiles=
nofiles=
for f in "$@"; do
base=$(basename "$f" .tt)
base_with_ext="${f##*/}"
base=${base_with_ext%.tt}
# base=$(basename "$f" .tt)

if [ "$base" = "$f" ]; then
errfiles="$errfiles '$f'"
elif [ ! -f "$f" ]; then
nofiles="$nofiles '$f'"
fi
if [ "$base" = "$f" ]; then
errfiles="$errfiles '$f'"
elif [ ! -f "$f" ]; then
nofiles="$nofiles '$f'"
fi
done
if [ -n "$errfiles" ]; then
echo >&2 "Files not ending with .tt:$errfiles"
echo >&2 "Files not ending with .tt:$errfiles"
fi
if [ -n "$nofiles" ]; then
echo >&2 "Files no present:$nofiles"
echo >&2 "Files no present:$nofiles"
fi
if [ -n "$errfiles" -o -n "$nofiles" ]; then
exit 1
exit 1
fi

for f in "$@"; do
base=$(basename "$f" .tt)
filedir=$(dirname "$f")
base_with_ext="${f##*/}"
base=${base_with_ext%.tt}
# base=$(basename "$f" .tt)
filedir=$(dirname "$f")

if [ "$f" != "$base" ]; then
if ! (
cd $filedir
( cat $HERE/../inc/common.tt; cat $base.tt ) | \
eval "$tpagecmd --define 'dir=${dir:-$filedir}'" \
> $base
); then
exit $?
fi
fi
if [ "$f" != "$base" ]; then
if ! (
cd $filedir
( cat $HERE/../inc/common.tt; cat $base.tt ) | \
eval "$tpagecmd --define 'dir=${dir:-$filedir}'" \
> $base
); then
exit $?
fi
fi
done
fi

0 comments on commit 7c6fbca

Please sign in to comment.