add: unpack all libs correctly

* unpack all libs correctly
* move some apt logic to `generate_dream_lock`
* filter out debians own `glibc` -> might be a pain point in the future!
This commit is contained in:
a-kenji 2022-07-28 14:22:50 +02:00 committed by DavHau
parent 55239870c1
commit 989391af45
3 changed files with 79 additions and 25 deletions

View File

@ -40,7 +40,11 @@
l.flatten
(l.mapAttrsToList
(name: versions:
if l.elem name [defaultPackageName]
if
l.elem name [
defaultPackageName
"libc6"
]
then []
else l.map (ver: getSource name ver) versions)
packageVersions);
@ -74,10 +78,20 @@
tar xvf $TMP/unpack/data.tar.xz
mkdir -p $TMP/unpack/usr/bin
cp -r $TMP/unpack/usr/bin $out
mkdir -p $TMP/unpack/usr/sbin
cp -r $TMP/unpack/usr/sbin $out
if [ -d $TMP/unpack/usr/sbin ]; then
cp $TMP/unpack/usr/sbin/* $out/bin
fi
mkdir -p $TMP/unpack/usr/share
cp -r $TMP/unpack/usr/share $out
for variant in "/usr/lib" "/usr/lib64" "/lib" "/lib64"; do
for file in $(find $TMP/unpack/$variant -type f -or -type l);do
cp -r $file $out/lib
done
done
mkdir -p $TMP/unpack/etc
cp -r $TMP/unpack/etc $out
rm -rf $TMP/unpack
@ -86,7 +100,7 @@
runHook postBuild
'';
installPhase = ":";
autoPatchelfIgnoreMissingDeps = true;
# autoPatchelfIgnoreMissingDeps = true;
});
in {
packages.${defaultPackageName}.${defaultPackageVersion} = package;

View File

@ -80,29 +80,29 @@ in {
mkdir -p ./etc/apt
echo "deb http://deb.debian.org/debian bullseye main" >> ./etc/apt/sources.list
apt -o Acquire::AllowInsecureRepositories=1 \
-o Dir::State::status=./status \
-o Dir::Etc=./etc/apt \
-o Dir::State=./state \
update
# apt -o Acquire::AllowInsecureRepositories=1 \
# -o Dir::State::status=./status \
# -o Dir::Etc=./etc/apt \
# -o Dir::State=./state \
# update
apt -o Acquire::AllowInsecureRepositories=1 \
-o Dir::State::status=./status \
-o Dir::Etc=./etc/apt \
-o Dir::State=./state \
install $pkgsName --print-uris > ./deb-uris
apt -o Acquire::AllowInsecureRepositories=1 \
-o Dir::State::status=./status \
-o Dir::Etc=./etc/apt \
-o Dir::Cache=./download \
-o Dir::State=./state \
install $pkgsName --download-only -y --allow-unauthenticated
# apt -o Acquire::AllowInsecureRepositories=1 \
# -o Dir::State::status=./status \
# -o Dir::Etc=./etc/apt \
# -o Dir::State=./state \
# install $pkgsName --print-uris > ./deb-uris
#
# apt -o Acquire::AllowInsecureRepositories=1 \
# -o Dir::State::status=./status \
# -o Dir::Etc=./etc/apt \
# -o Dir::Cache=./download \
# -o Dir::State=./state \
# install $pkgsName --download-only -y --allow-unauthenticated
# cat ./deb-uris
# ls ./download/archives
ls ./download
ls ./download/archives
# ls ./download
# ls ./download/archives
# TODO:
# read input files/dirs and produce a json file at $outputFile

View File

@ -1,11 +1,51 @@
import base64
import hashlib
import json
import os
import pathlib
import base64
import hashlib
import subprocess
# for initialization
def update_apt():
subprocess.run(
["apt",
"-o", "Acquire::AllowInsecureRepositories=1",
"-o", "Dir::State::status=./status",
"-o", "Dir::Etc=./etc/apt",
"-o" ,"Dir::State=./state",
"update"
])
def get_package_info_apt(name):
result = subprocess.run(
["apt",
"-o Acquire::AllowInsecureRepositories=1",
"-o", "Dir::State::status=./status",
"-o", "Dir::Etc=./etc/apt",
"-o" "Dir::State=./state",
"install", f"{name}", "--print-uris",
],
stdout=subprocess.PIPE,
text=True,
)
print(f"result {result.stdout}")
with open('./deb-uris', 'w') as f:
f.write(result.stdout)
subprocess.run(
["apt",
"-o", "Acquire::AllowInsecureRepositories=1",
"-o", "Dir::State::status=./status",
"-o", "Dir::Etc=./etc/apt",
"-o", "Dir::Cache=./download",
"-o", "Dir::State=./state",
"install", f"{name}", "--download-only", "-y" ,"--allow-unauthenticated",
])
def main():
update_apt()
get_package_info_apt(os.environ.get("NAME"))
with open("./deb-uris") as f:
uris = f.readlines()