Whether or not the package name itself or the (category,name) tuple
uniquely identified a package within a system has been a source of
confusion for a long time. Back in
03d278e4ff I ended up playing playing it
"safe" by going for (category,name), but in practice this doesn't make a
whole lot of sense. While it's *possible* for the same package name to
refer to completely different packages in different "categories", in
reality distributions can't sanely support this anyway.
For distributions where the category referred to a repository, the only
cases where the same package name was used in different repos was when
the package has moved from one repo to another. Those should certainly
not be treated as different packages.
For distributions where the category really referred to a category,
there's the Debian approach where the category is purely a tag and
doesn't help identify the package in any way, and then there's FreeBSD
where the category technically ought to be part of the name. There were
a few cases where FreeBSD used categories to separate out different
versions of the same package (e.g. ipv6 vs non-ipv6), but none were
relevant for man pages so I ended up merging those as well.
Getting rid of the categories simplifies and shortens URLs, unclutters
the UI a little bit and merges the packages in listings that should've
been merged all along.
Migration script:
-- Merge packages that are in multiple categories.
-- All versions are moved to the package with the lowest ID.
-- If the same version already exists in a lower ID, the higher-ID version is deleted.
BEGIN;
WITH migrate(old, new, second) AS (
SELECT q.id, MIN(p.id), MAX(p.id)
FROM packages p
JOIN packages q ON q.id > p.id AND p.system = q.system AND p.name = q.name
GROUP BY q.id
), ded(n) AS (
UPDATE packages SET dead = false
FROM migrate m
JOIN packages q ON q.id = m.old
WHERE packages.id = m.new AND packages.dead AND NOT q.dead
RETURNING 1
), mov(n) AS (
UPDATE package_versions SET package = m.new
FROM migrate m
WHERE package_versions.package = m.old
AND NOT EXISTS(
SELECT 1
FROM package_versions v
WHERE v.package IN(m.new, m.second)
AND v.version = package_versions.version)
RETURNING 1
), del(n) AS (
DELETE FROM packages WHERE id IN(SELECT old FROM migrate)
RETURNING 1
) SELECT (SELECT count(*) FROM migrate) AS migrate,
(SELECT count(*) FROM ded) AS ded,
(SELECT count(*) FROM mov) AS mov,
(SELECT count(*) FROM del) AS del;
ALTER TABLE packages DROP CONSTRAINT packages_system_name_category_key;
CREATE UNIQUE INDEX packages_system_name_key ON packages (system, name);
ALTER TABLE packages DROP COLUMN category;
COMMIT;
315 lines
6.1 KiB
Bash
Executable file
315 lines
6.1 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
. ./common.sh
|
|
|
|
VMIRROR=http://vault.centos.org/
|
|
CMIRROR=http://centos.mirrors.ovh.net/ftp.centos.org/
|
|
SMIRROR=http://mirror.transip.net/centos-stream/
|
|
|
|
# Centos 3.1 - 3.6 (doesn't have useful repo metadata)
|
|
centa() {
|
|
local VER=$1
|
|
index rpmdir --sys centos-$VER --mirror "$VMIRROR$VER/os/i386/RedHat/RPMS/"
|
|
index rpmdir --sys centos-$VER --mirror "$VMIRROR$VER/updates/i386/RPMS/"
|
|
index rpmdir --sys centos-$VER --mirror "$VMIRROR$VER/extras/i386/RPMS/"
|
|
index rpmdir --sys centos-$VER --mirror "$VMIRROR$VER/addons/i386/RPMS/"
|
|
index rpmdir --sys centos-$VER --mirror "$VMIRROR$VER/contrib/i386/RPMS/"
|
|
}
|
|
|
|
# Centos 3.7+ (same structure, but has more repos and metadata we can use)
|
|
centb() {
|
|
local VER=$1
|
|
local MIR=${2:-$VMIRROR}
|
|
index rpm --sys centos-$VER --mirror "$MIR$VER/os/i386/"
|
|
index rpm --sys centos-$VER --mirror "$MIR$VER/updates/i386/"
|
|
index rpm --sys centos-$VER --mirror "$MIR$VER/extras/i386/"
|
|
index rpm --sys centos-$VER --mirror "$MIR$VER/addons/i386/" # not present in 6.0+
|
|
index rpm --sys centos-$VER --mirror "$MIR$VER/contrib/i386/" # not present in some 5.x releases
|
|
index rpm --sys centos-$VER --mirror "$MIR$VER/centosplus/i386/"
|
|
}
|
|
|
|
# CentOS 7.0+ (different versioning, using x86_64)
|
|
centc() {
|
|
local VER=$1
|
|
local DIR=$2
|
|
local MIR=${3:-$VMIRROR}
|
|
index rpm --sys centos-$VER --mirror "$MIR$DIR/os/x86_64/"
|
|
index rpm --sys centos-$VER --mirror "$MIR$DIR/updates/x86_64/"
|
|
index rpm --sys centos-$VER --mirror "$MIR$DIR/extras/x86_64/"
|
|
index rpm --sys centos-$VER --mirror "$MIR$DIR/centosplus/x86_64/"
|
|
}
|
|
|
|
# CentOS 8.0+
|
|
centd() {
|
|
local VER=$1
|
|
local DIR=$2
|
|
local MIR=${3:-$VMIRROR}
|
|
index rpm --sys centos-$VER --mirror "$MIR$DIR/BaseOS/x86_64/os/"
|
|
index rpm --sys centos-$VER --mirror "$MIR$DIR/AppStream/x86_64/os/"
|
|
index rpm --sys centos-$VER --mirror "$MIR$DIR/PowerTools/x86_64/os/"
|
|
index rpm --sys centos-$VER --mirror "$MIR$DIR/extras/x86_64/os/"
|
|
index rpm --sys centos-$VER --mirror "$MIR$DIR/centosplus/x86_64/os/"
|
|
}
|
|
|
|
# CentOS Stream 9+
|
|
cente() {
|
|
local VER=$1
|
|
local DIR=$2
|
|
local MIR=${3:-$VMIRROR}
|
|
index rpm --sys centos-$VER --mirror "$MIR$DIR/BaseOS/x86_64/os/"
|
|
index rpm --sys centos-$VER --mirror "$MIR$DIR/AppStream/x86_64/os/"
|
|
index rpm --sys centos-$VER --mirror "$MIR$DIR/CRB/x86_64/os/"
|
|
# There's also NFV and RT (with lots of overlap) and HighAvailability and ResilientStorage (with lots of overlap).
|
|
# Not sure which of those should be included.
|
|
}
|
|
|
|
case "$1" in
|
|
2.1)
|
|
index rpmdir --sys centos-2.1 --mirror "${VMIRROR}2.1/final/i386/CentOS/RPMS/"
|
|
;;
|
|
3.1)
|
|
centa 3.1
|
|
;;
|
|
3.3)
|
|
centa 3.3
|
|
;;
|
|
3.4)
|
|
centa 3.4
|
|
;;
|
|
3.5)
|
|
centa 3.5
|
|
;;
|
|
3.6)
|
|
centa 3.6
|
|
;;
|
|
3.7)
|
|
centb 3.7
|
|
;;
|
|
3.8)
|
|
centb 3.8
|
|
;;
|
|
3.9)
|
|
centb 3.9
|
|
;;
|
|
4.0)
|
|
centb 4.0
|
|
;;
|
|
4.1)
|
|
centb 4.1
|
|
;;
|
|
4.2)
|
|
centb 4.2
|
|
;;
|
|
4.3)
|
|
centb 4.3
|
|
;;
|
|
4.4)
|
|
centb 4.4
|
|
;;
|
|
4.5)
|
|
centb 4.5
|
|
;;
|
|
4.6)
|
|
centb 4.6
|
|
;;
|
|
4.7)
|
|
centb 4.7
|
|
;;
|
|
4.8)
|
|
centb 4.8
|
|
;;
|
|
4.9)
|
|
centb 4.9
|
|
;;
|
|
5.0)
|
|
centb 5.0
|
|
;;
|
|
5.1)
|
|
centb 5.1
|
|
;;
|
|
5.2)
|
|
centb 5.2
|
|
;;
|
|
5.3)
|
|
centb 5.3
|
|
;;
|
|
5.4)
|
|
centb 5.4
|
|
;;
|
|
5.5)
|
|
centb 5.5
|
|
;;
|
|
5.6)
|
|
centb 5.6
|
|
;;
|
|
5.7)
|
|
centb 5.7
|
|
;;
|
|
5.8)
|
|
centb 5.8
|
|
;;
|
|
5.9)
|
|
centb 5.9
|
|
;;
|
|
5.10)
|
|
centb 5.10
|
|
;;
|
|
5.11)
|
|
centb 5.11
|
|
;;
|
|
6.0)
|
|
centb 6.0
|
|
;;
|
|
6.1)
|
|
centb 6.1
|
|
;;
|
|
6.2)
|
|
centb 6.2
|
|
;;
|
|
6.3)
|
|
centb 6.3
|
|
;;
|
|
6.4)
|
|
centb 6.4
|
|
;;
|
|
6.5)
|
|
centb 6.5
|
|
;;
|
|
6.6)
|
|
centb 6.6
|
|
;;
|
|
6.7)
|
|
centb 6.7
|
|
;;
|
|
6.8)
|
|
centb 6.8
|
|
;;
|
|
6.9)
|
|
centb 6.9 $CMIRROR
|
|
;;
|
|
6.10)
|
|
centb 6.10 $CMIRROR
|
|
;;
|
|
7.0)
|
|
centc 7.0 7.0.1406
|
|
;;
|
|
7.1)
|
|
centc 7.1 7.1.1503
|
|
;;
|
|
7.2)
|
|
centc 7.2 7.2.1511
|
|
;;
|
|
7.3)
|
|
centc 7.3 7.3.1611
|
|
;;
|
|
7.4)
|
|
centc 7.4 7.4.1708
|
|
;;
|
|
7.5)
|
|
centc 7.5 7.5.1804 $CMIRROR
|
|
;;
|
|
7.6)
|
|
centc 7.6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 7.6
|
|
$0 7.7
|
|
$0 7.8
|
|
$0 8.0
|
|
$0 8.1
|
|
$0 8.2
|
|
$0 8.3
|
|
$0 8.4
|
|
$0 8.5
|
|
;;
|
|
current)
|
|
$0 7.9 # till 2024-06-30
|
|
$0 8-stream
|
|
$0 9-stream
|
|
;;
|
|
all)
|
|
$0 old
|
|
$0 current
|
|
;;
|
|
esac
|