progress towards mirroring
This commit is contained in:
parent
40965d9775
commit
b57676d972
|
@ -152,7 +152,7 @@ class Repoline:
|
|||
if line[0].startswith("["):
|
||||
line.pop(0)
|
||||
|
||||
# assume amd64 for now
|
||||
#TODO assume amd64 for now
|
||||
arch = "amd64"
|
||||
|
||||
# now we have the base url
|
||||
|
@ -310,10 +310,62 @@ def cmd_mirror(args, parser):
|
|||
- containing a subset of packages based on some query
|
||||
- containing a subset of packages matching an existing repo
|
||||
"""
|
||||
repo = Repo(args.database)
|
||||
|
||||
# filter the packages
|
||||
#TODO
|
||||
package_query = """SELECT * FROM repo_package;"""
|
||||
package_query_params = ()
|
||||
|
||||
from collections import defaultdict
|
||||
# (dist,component) -> list((name,arch,version))
|
||||
packages = defaultdict(list)
|
||||
|
||||
with closing(repo.db.cursor()) as c:
|
||||
c.execute(package_query, package_query_params)
|
||||
for row in c:
|
||||
packages[(row["dist"], row["component"], )].append(
|
||||
(row["arch"], row["name"], row["version"], ))
|
||||
|
||||
packages = dict(packages)
|
||||
|
||||
# build the metadata files
|
||||
"""
|
||||
we need to build a structure like:
|
||||
|
||||
/pool/<component>/<letter>/<source>/whatever.deb
|
||||
* source is a field in the package's metadata
|
||||
TODO add it to the db
|
||||
|
||||
and
|
||||
|
||||
/dists/<dist>/
|
||||
Release (hashes of everything in ./<component/)
|
||||
InRelease (the above, but as a gpg signed message)
|
||||
Release.gpg (pgp signature for Release file)
|
||||
Contents-<arch>.gz
|
||||
(optional? Some kind of index of package contents)
|
||||
we'll need to skip it for now anyways as we aren't importing it
|
||||
|
||||
/dists/<dist>/<component>/<arch>/
|
||||
Release (very small identifier file)
|
||||
Packages (the metadata of all the packages we'll include)
|
||||
|
||||
procedure:
|
||||
|
||||
for each component:
|
||||
for each package:
|
||||
link the package file into place, if needed
|
||||
|
||||
for each dist:
|
||||
for each component:
|
||||
for each arch:
|
||||
generate Packages file
|
||||
generate the Release / InRelease metadata file
|
||||
"""
|
||||
|
||||
import pdb
|
||||
pdb.set_trace()
|
||||
|
||||
# sign the files
|
||||
|
||||
|
@ -340,11 +392,25 @@ def cmd_import(args, parser):
|
|||
r.import_source_packages(line)
|
||||
|
||||
|
||||
def cmd_shell(args, parser):
|
||||
repo = Repo(args.database)
|
||||
import pdb
|
||||
pdb.set_trace()
|
||||
pass
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description="apt repo mirroring tool")
|
||||
parser.add_argument("--database", required=True, help="package database path")
|
||||
|
||||
sp_action = parser.add_subparsers(dest="action", help="action to take")
|
||||
|
||||
p_shell = sp_action.add_parser("shell", help="interactive shell")
|
||||
p_shell.set_defaults(func=cmd_shell)
|
||||
|
||||
p_mirror = sp_action.add_parser("mirror", help="deploy a repo")
|
||||
p_mirror.set_defaults(func=cmd_mirror)
|
||||
|
||||
p_ingest = sp_action.add_parser("ingest", help="import packages from existing repos")
|
||||
p_ingest.set_defaults(func=cmd_import)
|
||||
|
||||
|
|
Loading…
Reference in New Issue