SecBSD's official ports repository

This commit is contained in:
purplerain 2023-08-16 22:26:55 +00:00
commit 2c0afcbbf3
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
64331 changed files with 5339189 additions and 0 deletions

View file

@ -0,0 +1,37 @@
#! /usr/bin/perl
# a small script that takes a sqlite3 schema and creates
# a normalized version (zaps extraneous spaces, rewrites
# everything as lowercase, sorts by table/view name)
use v5.36;
my ($object, $comment);
my $stmt = '';
while(<STDIN>) {
chomp;
$stmt .= " ".lc($_);
if (m/\;/) {
$stmt =~ s/\s+/ /g;
$stmt =~ s/^\s//;
$stmt =~ s/\s?\(\s?/\(/g;
$stmt =~ s/\s?\)\s?/\)/g;
if ($stmt =~ m/^create table (\S+)/) {
$object->{$1} = $stmt;
} elsif ($stmt =~ m/^create view (\S+)/) {
$object->{$1} = $stmt;
} else {
say $stmt;
}
$stmt = '';
}
}
for my $k (sort keys %$object) {
if ($object->{$k} =~ m,\s/\*,) {
say "$`\n/*$'\n";
} else {
say $object->{$k}, "\n";
}
}

View file

@ -0,0 +1,64 @@
#! /bin/sh
# $OpenBSD: print-ports-index,v 1.12 2019/07/14 11:27:19 espie Exp $
#
# Copyright (c) 2018 Marc Espie <espie@openbsd.org>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
# recreate index file, identical to /usr/ports/INDEX
set -e
if [ $# -ge 1 ]
then
file=$1
else
file=${TRUEPREFIX}/share/sqlports
fi
cat <<'EOSQL' |sqlite3 $file
-- in order for group_concat to sort, you must do it in two steps
with
d1 (d, p, t) as
(select
distinct((case pkgspec when '' then '' else pkgspec||":" end)||_paths.fullpkgpath) as fd,
_depends.fullpkgpath, type
from _depends join _paths on _Paths.Id=_depends.dependspath order by fd),
-- and now the part that's going to be used 3 times in the main request
d2 as
(select group_concat(d, ' ') as dlist, p, t
from d1 group by p, t)
select fullpkgname, ports.fullpkgpath,
(case prefix when '/usr/local' THEN "" else prefix end),
comment,descr, maintainer,categories,
libd.dlist, buildd.dlist, rund.dlist,
case 1
when only_for_archs is null then
case 1
when not_for_archs is null
then 'any'
else '!'||not_for_archs
end
else only_for_archs
end,
'?',
(case lower(PERMIT_PACKAGE) when "yes" then "y" else "n" end),
(case lower(PERMIT_DISTFILES) when "yes" then "y" else "n" end)
from ports
left join d2 as libd on libd.p=ports.pathid and libd.t=0
left join d2 as buildd on buildd.p=ports.pathid and buildd.t=2
left join d2 as rund on rund.p=ports.pathid and rund.t=1
where ports.pathid in (select distinct canonical from _paths)
group by ports.fullpkgpath
order by ports.fullpkgpath;
EOSQL

View file

@ -0,0 +1,25 @@
#! /bin/sh
# $OpenBSD: rebuild-sqlports-cache,v 1.2 2019/06/04 16:05:52 espie Exp $
#
# Copyright (c) 2019 Marc Espie <espie@openbsd.org>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
set -e
if [ $# -ge 1 ]
then
file=$1
else
file=${TRUEPREFIX}/share/sqlports
fi
sqlite3 $file <${TRUEPREFIX}/share/sqlports_cache.sql

View file

@ -0,0 +1,106 @@
#! /bin/sh
# $OpenBSD: show-reverse-deps,v 1.10 2020/06/11 19:55:15 espie Exp $
#
# Copyright (c) 2018 Marc Espie <espie@openbsd.org>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
# compute reverse dependencies
# XXX this is not perfect yet! it *does* require collating lib-depends over
# multi-packages setup, which this is NOT doing yet, but it is close to
# actually doing it.
# we just require a few more views for that.
usage="Usage: show-reverse-deps [-ftv] [-d sqlite_db] pkgpath"
args=`getopt d:ftv $*`
if [ $? -ne 0 ]
then
echo 2>&1 $usage
fi
set -e
db=${TRUEPREFIX}/share/sqlports
type_root="root.type!=3"
type_child="child.type!=3"
fuzzy=false
verbose=false
set -- $args
while [ $# -ne 0 ]
do
case "$1" in
-d)
db="$2"
shift
shift
;;
-f)
fuzzy=true
shift
;;
-t)
type_root=true
type_child=true
shift
;;
-v)
verbose=true
shift
;;
--)
shift
break
;;
esac
done
if [ $# -ne 1 ]
then
echo 2>&1 $usage
exit 1
fi
if $fuzzy
then
query="p2.fullpkgpath like \"%$1%\""
else
query="p2.fullpkgpath=\"$1\""
fi
if $verbose
then
adj=", _paths2.fullpkgpath, case d.type when 0 then 'LIB_DEPENDS' when 1 then 'RUN_DEPENDS' when 2 then 'BUILD_DEPENDS' when 3 then 'TEST_DEPENDS' end"
join_adj="join _paths _paths2 on _paths2.id=d.dependspath"
else
adj=""
join_adj=""
fi
sqlite3 "$db" <<EOSQL
with recursive d (fullpkgpath, dependspath, type) as
(select root.fullpkgpath, root.dependspath, root.type
from _canonical_depends root
join _paths
on root.dependspath=_paths.canonical
join _paths p2
on $query and p2.id=_paths.pkgpath
where $type_root
union
select child.fullpkgpath, child.dependspath, child.type
from d parent, _canonical_depends child
where parent.fullpkgpath=child.dependspath and $type_child)
select distinct _paths.fullpkgpath $adj from d
join _paths
on _paths.id=d.fullpkgpath
$join_adj
order by _paths.fullpkgpath $adj;
EOSQL