Commit a83e4cc4 authored by Alad Wenter's avatar Alad Wenter
Browse files

db-remove: add removal of symlinks / pool directory

parent c204a5a5
......@@ -26,25 +26,32 @@ files in repository directories. These files contain the metadata
available in pacman(8) packages, and may be generated directly from
them::
x86_64
core
pkgbase_a.json
core-debug
extra
pkgbase_b.json
extra-debug
staging
testing
community
community-debug
community-staging
community-testing
gnome-unstable
kde-unstable
multilib
multilib-debug
multilib-staging
multilib-testing
.
└── meta
└── x86_64
├── core
│ └── pkgbase_a.json
├── core-debug
└── extra
└── pkgbase_b.json
├── extra-debug
├── staging
├── testing
├── community
├── community-debug
├── community-staging
├── community-testing
├── gnome-unstable
├── kde-unstable
├── multilib
├── multilib-debug
├── multilib-staging
└── multilib-testing
.. note::
Unlike svn, there is no distinction between repositories, in
particular between `community` and packages in other repositories
such as `extra`.
Per-architecture repo with per-package metadata file in repo directories
=========================================================================
......@@ -155,19 +162,20 @@ If *package_a* in version *1:2-3* is in::
its binary package will be symlinked from the pool to the respective location::
core
os
x86_64
core.db
[..]
package_a-1:2-3-x86_64.pkg.tar.xz -> ../../../pool/package_a-1:2-3-x86_64.pkg.tar.xz
package_a-1:2-3-x86_64.pkg.tar.xz.sig -> ../../../pool/package_a-1:2-3-x86_64.pkg.tar.xz.sig
[..]
pool
[..]
package_a-1:2-3-x86_64.pkg.tar.xz
package_a-1:2-3-x86_64.pkg.tar.xz.sig
[..]
.
├── /srv/ftp/core
│ └── os
│ └── x86_64
│ ├── core.db
│ ├── [..]
│ ├── package_a-1:2-3-x86_64.pkg.tar.xz -> ../../../pool/package_a-1:2-3-x86_64.pkg.tar.xz
│ ├── package_a-1:2-3-x86_64.pkg.tar.xz.sig -> ../../../pool/package_a-1:2-3-x86_64.pkg.tar.xz.sig
│ └── [..]
└── /srv/ftp/pool
├── [..]
├── package_a-1:2-3-x86_64.pkg.tar.xz
├── package_a-1:2-3-x86_64.pkg.tar.xz.sig
└── [..]
Workflows
_________
......@@ -323,9 +331,11 @@ Remove existing pkgbases.
- **DONE** Delete JSON files
- **DONE** Write out DB files
- `git commit`
- Remove old symlinks
- **DONE** Remove old symlinks
- Move (move existing pkgbases from e.g. testing to extra)
Move
----
Move packages from one repository (e.g. testing) to another (e.g. extra).
- **DONE** For each repo to process:
......
......@@ -12,6 +12,9 @@ from lib.dbwrite import generate_dbs
async def main(repo, pkgbases) -> int:
metadir = (Path(argv[0]).parent / "meta").resolve(strict=True)
# XXX stating and meta need not have the same parent directory (/srv, /srv/ftp)
stagingdir = (Path(argv[0]).parent / "staging").resolve(strict=True)
pooldir = (Path(argv[0]).parent / "pool").resolve(strict=True)
# FIXME: Put this into metadir/.git/
lockfile = (metadir / "dbscripts.lock").open(mode="w")
......@@ -31,16 +34,29 @@ async def main(repo, pkgbases) -> int:
return {p.stem: json_load(repodir / p) for p in repodir.glob("*.json")}
meta = {repo: repo_load(repo)}
removals = ()
# remove packages from meta and corresponding json files
for pkgbase in pkgbases:
if pkgbase not in meta[repo]:
raise RuntimeError(f"pkgbase '{pkgbase}' is not present in '{repo}' repo")
# old package files
for package in meta[repo][pkgbase]["packages"]:
removals.append(package["filename"])
# remove database entry
del meta[repo][pkgbase]
(metadir / repo / f"{pkgbase}.json").unlink()
# rebuild DB file using `meta` object
generate_dbs(meta)
# XXX git commit
# remove old symlinks
for p in removals:
(stagingdir / p).unlink()
(stagingdir / p + ".sig").unlink()
(pooldir / p).unlink()
(pooldir / p + ".sig").unlink()
return 0
......
......@@ -2,3 +2,4 @@
mkdir -p staging/{community,community-staging}
mkdir -p meta
mkdir -p pool
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment