Skip to content

Commit 34599c6

Browse files
Marc Espiecnst
Marc Espie
authored andcommittedFeb 21, 2013
ports-readmes: initial revision, from OpenBSD 5.2 ports.tar.gz
0 parents  commit 34599c6

12 files changed

+383
-0
lines changed
 

‎CVS/Entries

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/Makefile/1.5/Mon Jun 18 12:18:45 2012//
2+
D/files////
3+
D/pkg////

‎CVS/Repository

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ports/databases/ports-readmes

‎Makefile

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# $OpenBSD: Makefile,v 1.5 2012/06/18 12:18:45 espie Exp $
2+
3+
COMMENT = readmes.html
4+
5+
PKG_ARCH = *
6+
DISTNAME = ports-readmes-1
7+
DISTFILES =
8+
9+
CATEGORIES = databases
10+
11+
PERMIT_PACKAGE_CDROM = Yes
12+
PERMIT_PACKAGE_FTP = Yes
13+
PERMIT_DISTFILES_CDROM =Yes
14+
PERMIT_DISTFILES_FTP = Yes
15+
16+
BUILD_DEPENDS = databases/sqlports,-compact>=2.2 \
17+
databases/p5-DBD-SQLite \
18+
textproc/p5-Template
19+
20+
PLIST = ${WRKINST}/plist
21+
# XXX this plist *will change*
22+
STATIC_PLIST = No
23+
24+
do-build:
25+
TEMPLATESDIR=${FILESDIR} \
26+
OUTPUTDIR=${WRKBUILD} \
27+
DATABASE=${LOCALBASE}/share/sqlports-compact \
28+
perl ${FILESDIR}/make-readmes
29+
30+
READMES_DIR = ${PREFIX}/share/ports-readme
31+
32+
do-install:
33+
${INSTALL_DATA_DIR} ${READMES_DIR}
34+
cp -r ${WRKBUILD}/* ${READMES_DIR}
35+
chown -R ${SHAREOWN}.${SHAREGRP} ${READMES_DIR}
36+
cd ${PREFIX} && find share/ports-readme -type f >${WRKINST}/list1
37+
cd ${PREFIX} && find share/ports-readme -type d|sed -e 's,$$,/,' >${WRKINST}/list2
38+
{ \
39+
echo "@comment This file has been automatically generated"; \
40+
echo "@option always-update"; \
41+
sort ${WRKINST}/list[12]; \
42+
} >${PLIST}
43+
44+
.include <bsd.port.mk>

‎files/CVS/Entries

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/category.tt2/1.1.1.1/Sat May 26 12:22:44 2012//
2+
/main.tt2/1.1.1.1/Sat May 26 12:22:44 2012//
3+
/make-readmes/1.4/Fri Jun 1 13:21:26 2012//
4+
/port.tt2/1.2/Sat May 26 12:57:57 2012//
5+
D

‎files/CVS/Repository

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ports/databases/ports-readmes/files

‎files/category.tt2

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
2+
<html><head><title>Ports in [% category %]</title></head>
3+
<body>
4+
<h1>Port in [% category %] category</h1>
5+
<ul>
6+
[% FOREACH p IN ports %]
7+
<li><a href="[% p.url | url %]">[% p.name %]</a>
8+
[% END %]
9+
</ul>
10+
</body></html>

‎files/main.tt2

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
2+
<html><head><title>Ports index</title></head>
3+
<body>
4+
<h1>Category index</h1>
5+
<ul>
6+
[% FOREACH c IN categories %]
7+
<li><a href="[% c.url | url %]">[% c.name %]</a>
8+
[% END %]
9+
</ul>
10+
</body></html>

‎files/make-readmes

+222
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,222 @@
1+
#! /usr/bin/perl
2+
# ex:ts=8 sw=4:
3+
# $OpenBSD: make-readmes,v 1.4 2012/06/01 13:21:26 espie Exp $
4+
#
5+
# Copyright (c) 2012 Marc Espie <espie@openbsd.org>
6+
#
7+
# Permission to use, copy, modify, and distribute this software for any
8+
# purpose with or without fee is hereby granted, provided that the above
9+
# copyright notice and this permission notice appear in all copies.
10+
#
11+
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12+
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13+
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14+
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15+
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16+
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17+
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18+
19+
use strict;
20+
use warnings;
21+
use DBI;
22+
use Template;
23+
use File::Path qw(make_path);
24+
use File::Basename;
25+
use File::Spec;
26+
use Data::Dumper;
27+
28+
sub relative_url
29+
{
30+
my ($a, $b) = @_;
31+
$a .= ".html";
32+
$b .= ".html";
33+
return File::Spec->abs2rel($a, dirname($b));
34+
}
35+
36+
my $db = DBI->connect("dbi:SQLite:dbname=$ENV{DATABASE}", '', '', {});
37+
38+
my $outputdir = $ENV{OUTPUTDIR};
39+
my $template = Template->new(
40+
{
41+
INCLUDE_PATH => $ENV{TEMPLATESDIR},
42+
OUTPUT_PATH => $outputdir,
43+
});
44+
45+
46+
my $info_req = $db->prepare(
47+
qq{select
48+
paths.id,
49+
paths.fullpkgpath,
50+
ports.comment,
51+
ports.homepage,
52+
descr.value,
53+
fullpkgname,
54+
permit_cd.value,
55+
permit_ftp.value
56+
from paths
57+
join Ports on paths.id=Ports.fullpkgpath
58+
left join Descr on paths.id=Descr.fullpkgpath
59+
join keywords2 permit_cd
60+
on ports.permit_package_cdrom=permit_cd.keyref
61+
join keywords2 permit_ftp
62+
on ports.permit_package_ftp=permit_ftp.keyref
63+
order by paths.fullpkgpath});
64+
my ($id, $path, $comment, $homepage, $descr, $fullpkgname, $permit_cd, $permit_ftp);
65+
$info_req->bind_columns(\($id, $path, $comment, $homepage, $descr, $fullpkgname, $permit_cd, $permit_ftp));
66+
67+
my $dep_req = $db->prepare(
68+
q{select
69+
depends.type,
70+
depends.fulldepends,
71+
t2.fullpkgpath
72+
from depends
73+
join paths on depends.dependspath=paths.id
74+
join paths t2 on paths.canonical=t2.id
75+
where depends.fullpkgpath=?
76+
order by depends.fulldepends
77+
});
78+
my ($type, $fulldepends, $dependspath);
79+
$dep_req->bind_columns(\($type, $fulldepends, $dependspath));
80+
my $multi_req = $db->prepare(
81+
q{select
82+
ports.fullpkgname,
83+
t2.fullpkgpath
84+
from multi
85+
join paths on multi.subpkgpath=paths.id
86+
join paths t2 on paths.canonical=t2.id
87+
join ports on paths.canonical=ports.fullpkgpath
88+
where multi.fullpkgpath=?
89+
});
90+
my ($multi, $subpath);
91+
$multi_req->bind_columns(\($multi, $subpath));
92+
my $only_for = $db->prepare(
93+
q{select
94+
Arch.value
95+
from OnlyForArch
96+
join Arch on arch.keyref=OnlyForArch.value
97+
where OnlyForArch.fullpkgpath=?
98+
order by Arch.value
99+
});
100+
my $arch;
101+
$only_for->bind_columns(\($arch));
102+
my $not_for = $db->prepare(
103+
q{select
104+
Arch.value
105+
from NotforArch
106+
join Arch on arch.keyref=NotForArch.value
107+
where NotForArch.fullpkgpath=?
108+
order by Arch.value
109+
});
110+
$not_for->bind_columns(\($arch));
111+
112+
my $category;
113+
my $cat_req = $db->prepare(
114+
q{select
115+
categorykeys.value
116+
from categories
117+
join categorykeys on categorykeys.keyref=categories.value
118+
where categories.fullpkgpath=?
119+
order by categorykeys.value
120+
});
121+
$cat_req->bind_columns(\($category));
122+
123+
my $broken_req = $db->prepare(
124+
q{select
125+
arch.value,
126+
broken.value
127+
from broken
128+
left join arch on arch.keyref=broken.arch
129+
where fullpkgpath=?
130+
order by arch.value});
131+
132+
my $broken;
133+
$broken_req->bind_columns(\($arch, $broken));
134+
135+
my $cat = {};
136+
137+
my @depends = (qw(libdepends rundepends builddepends regressdepends));
138+
139+
$info_req->execute;
140+
while ($info_req->fetch) {
141+
print "+++$path\n";
142+
my $e = { path => $path,
143+
comment => $comment,
144+
homepage => $homepage,
145+
descr => $descr,
146+
fullpkgname => $fullpkgname };
147+
unless ($permit_cd =~ /yes/i) {
148+
$e->{permit_cd} = $permit_cd;
149+
}
150+
unless ($permit_ftp =~ /yes/i) {
151+
$e->{permit_ftp} = $permit_ftp;
152+
}
153+
$dep_req->execute($id);
154+
while ($dep_req->fetch) {
155+
push(@{$e->{$depends[$type]}},
156+
{
157+
depends => $fulldepends,
158+
url => relative_url($dependspath, $e->{path})
159+
});
160+
}
161+
162+
$broken_req->execute($id);
163+
while ($broken_req->fetch) {
164+
push (@{$e->{broken}},
165+
{
166+
arch => $arch,
167+
text => $broken
168+
});
169+
}
170+
$only_for->execute($id);
171+
while ($only_for->fetch) {
172+
push (@{$e->{only_for}}, $arch);
173+
}
174+
$not_for->execute($id);
175+
while ($not_for->fetch) {
176+
push (@{$e->{not_for}}, $arch);
177+
}
178+
$multi_req->execute($id);
179+
while ($multi_req->fetch) {
180+
push @{$e->{multi}},
181+
{
182+
name => $multi,
183+
url => relative_url($subpath, $e->{path})
184+
};
185+
}
186+
187+
$cat_req->execute($id);
188+
while ($cat_req->fetch) {
189+
push @{$e->{category}},
190+
{
191+
name => $category,
192+
url => relative_url($category, $e->{path})
193+
};
194+
$cat->{$category}{$e->{fullpkgname}} = $e->{path};
195+
}
196+
$template->process('port.tt2', $e, "$e->{path}.html") or die;
197+
}
198+
199+
print "Generating category indexes\n";
200+
while (my ($c, $h) = each %$cat) {
201+
my $e = { category => $c};
202+
for my $pkgname (sort keys %$h) {
203+
my $p = $h->{$pkgname};
204+
push @{$e->{ports}},
205+
{
206+
name => $pkgname,
207+
url => relative_url($p, $c)
208+
};
209+
}
210+
$template->process('category.tt2', $e, "$c.html") or die;
211+
}
212+
213+
print "Generating main index\n";
214+
my $e = {};
215+
for my $c (sort keys %$cat) {
216+
push @{$e->{categories}},
217+
{
218+
name => $c,
219+
url => "$c.html"
220+
};
221+
}
222+
$template->process('main.tt2', $e, "index.html") or die;

‎files/port.tt2

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
2+
<html><head><title>The [% path | html %] port</title></head>
3+
<body>
4+
5+
<h1>The [% path | html %] port</h1>
6+
7+
<H2>[% fullpkgname | html %] &ndash; [% comment | html %]</H2>
8+
9+
<H2>Description</H2>
10+
11+
<pre>
12+
[% descr %]
13+
</pre>
14+
[% IF homepage %]
15+
WWW: <a href="[% homepage | url %]">[% homepage | html %]</a>
16+
[% ELSE %]
17+
No homepage
18+
[% END %]
19+
20+
<dl>
21+
[% IF permit_cd %]
22+
<dt>Distribution forbidden on cdroms<dd>
23+
[% permit_cd | html %]
24+
[% END %]
25+
[% IF permit_ftp %]
26+
<dt>Distribution forbidden on ftp<dd>
27+
[% permit_ftp | html %]
28+
[% END %]
29+
[% IF multi %]
30+
<dt>Multi-packages<dd>
31+
[% FOREACH m IN multi %]
32+
<a href="[% m.url | url %]">[% m.name | html %]</a>
33+
[% END %]
34+
[% END %]
35+
[% IF only_for %]
36+
<dt>Only for arches<dd>
37+
[% FOREACH a IN only_for %]
38+
[% a | html %]
39+
[% END %]
40+
[% END %]
41+
[% IF not_for %]
42+
<dt>Not for arches<dd>
43+
[% FOREACH a IN not_for %]
44+
[% a | html %]
45+
[% END %]
46+
[% END %]
47+
[% IF broken %]
48+
<dt>Broken<dd>
49+
[% FOREACH b IN broken %]
50+
[% IF b.arch %]
51+
on [% b.arch | html %]:
52+
[% END %]
53+
[% b.text | html %]
54+
[% END %]
55+
[% END %]
56+
57+
<dt>Categories:<dd>
58+
[% FOREACH c IN category %]
59+
<a href="[% c.url | url %]">[% c.name | html %]</a>
60+
[% END %]
61+
</dl>
62+
63+
<H2>Library dependencies</H2>
64+
<ul>
65+
[% FOREACH d IN libdepends %]
66+
<li><a href="[% d.url | url %]">[% d.depends %]</a>
67+
[% END %]
68+
</ul>
69+
<H2>Build dependencies</H2>
70+
<ul>
71+
[% FOREACH d IN builddepends %]
72+
<li><a href="[% d.url | url %]">[% d.depends %]</a>
73+
[% END %]
74+
</ul>
75+
76+
<H2>Run dependencies</H2>
77+
<ul>
78+
[% FOREACH d IN rundepends %]
79+
<li><a href="[% d.url | url %]">[% d.depends %]</a>
80+
[% END %]
81+
</ul>
82+
83+
</body></html>

‎pkg/CVS/Entries

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/DESCR/1.2/Sat May 26 12:36:35 2012//
2+
D

‎pkg/CVS/Repository

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ports/databases/ports-readmes/pkg

‎pkg/DESCR

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
readmes for the ports tree.

0 commit comments

Comments
 (0)
Please sign in to comment.