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