mirror of
https://github.com/wcbing/wcbing-apt-repo.git
synced 2025-12-29 02:28:30 +08:00
Compare commits
5 Commits
d2f19aaede
...
c420ab12b9
| Author | SHA1 | Date | |
|---|---|---|---|
| c420ab12b9 | |||
| 015dfbd099 | |||
| 60588bd38e | |||
| de9fae4414 | |||
| 91f098d89f |
17
Dockerfile
Normal file
17
Dockerfile
Normal file
@ -0,0 +1,17 @@
|
||||
FROM debian:12-slim
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
apt-utils \
|
||||
python3-apt \
|
||||
python3-requests \
|
||||
curl \
|
||||
jq \
|
||||
gpg \
|
||||
gpg-agent && \
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /mnt
|
||||
|
||||
CMD ["/bin/bash"]
|
||||
@ -12,6 +12,9 @@ import requests
|
||||
import sys
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
from threading import Lock
|
||||
import apt_pkg
|
||||
|
||||
apt_pkg.init() # 初始化 apt_pkg
|
||||
|
||||
package_version = {arch: {} for arch in ["all", "amd64", "i386", "arm64"]}
|
||||
package_info = {arch: {} for arch in ["all", "amd64", "i386", "arm64"]}
|
||||
@ -92,13 +95,8 @@ def get_latest(deb_packages: bytes):
|
||||
arch = find_arch.search(v).group(1).decode()
|
||||
tmp_version = find_version.search(v).group(1).decode()
|
||||
with lock[arch]:
|
||||
if (
|
||||
name not in package_version[arch]
|
||||
or os.system(
|
||||
f"dpkg --compare-versions {tmp_version} gt {package_version[arch][name]}"
|
||||
)
|
||||
== 0
|
||||
):
|
||||
# 使用 apt_pkg 进行版本比较
|
||||
if name not in package_version[arch] or apt_pkg.version_compare(tmp_version, package_version[arch][name]) > 0:
|
||||
package_version[arch][name] = tmp_version
|
||||
package_info[arch][name] = v
|
||||
except Exception as e:
|
||||
@ -111,7 +109,7 @@ def process_repo(r: dict):
|
||||
获取仓库中不同架构子仓库的内容,最后调用 get_latest 去重并保存。
|
||||
"""
|
||||
try:
|
||||
for arch, path in r["path"].items():
|
||||
for path in r["path"].values():
|
||||
get_latest(get_remote_packages(r["repo"], path))
|
||||
except Exception as e:
|
||||
logging.error(f"Error processing repo {r.get('name', 'unknown')}: {e}")
|
||||
|
||||
17
run.sh
17
run.sh
@ -7,25 +7,28 @@ find get -type f -name "*.sh" -exec sh {} \;
|
||||
# generate the html
|
||||
./gen-list-html.py
|
||||
|
||||
# generate the Packages file
|
||||
## generate the local Packages file
|
||||
cd deb
|
||||
# generate the local Packages
|
||||
apt-ftparchive packages . > tmpPackages
|
||||
sed -i "s|\./\(https\?\):/|\1://|g" tmpPackages
|
||||
|
||||
cd ..
|
||||
|
||||
## merge the Packages file from local package
|
||||
cat $(find packages -name "*.package") >> deb/tmpPackages
|
||||
# merge the Packages files from third-party repositories
|
||||
|
||||
## merge the Packages files from third-party repositories
|
||||
./merge-apt-repo.py --local deb/tmpPackages
|
||||
|
||||
# generate the Release file
|
||||
cd deb/dists/wcbing
|
||||
cd deb/dists/wcbing && \
|
||||
echo 'Origin: wcbing APT Repo
|
||||
Label: wcbing
|
||||
Suite: wcbing
|
||||
Codename: wcbing
|
||||
Architectures: amd64 arm64
|
||||
Components: main
|
||||
Description: wcbing APT Repo || wcbing 的 APT 仓库' > Release
|
||||
apt-ftparchive release . >> Release
|
||||
gpg --yes --detach-sign -a -o Release.gpg Release
|
||||
Description: wcbing APT Repo || wcbing 的 APT 仓库' > Release && \
|
||||
apt-ftparchive release . >> Release && \
|
||||
gpg --yes --detach-sign -a -o Release.gpg Release && \
|
||||
gpg --yes --clearsign -o InRelease Release
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user