summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODOS1
-rwxr-xr-xcompute_dependencies.sh54
2 files changed, 54 insertions, 1 deletions
diff --git a/TODOS b/TODOS
index 271d9ee..56aa715 100644
--- a/TODOS
+++ b/TODOS
@@ -49,4 +49,3 @@
- using the cross compiler for syslinux is most likely overkill
- some packages still build more than really needed:
- syslinux: builds docu with asciidoc and build EFI stuff from gnu-efi
-- net-tools, redo the patch
diff --git a/compute_dependencies.sh b/compute_dependencies.sh
new file mode 100755
index 0000000..b9a5fd6
--- /dev/null
+++ b/compute_dependencies.sh
@@ -0,0 +1,54 @@
+#!/bin/bash
+
+. "./default.conf"
+
+# Compute dependencies and make-dependencies to build packages in stage1,
+# stage2 or stage3
+
+tmp_dir=$(mktemp -d 'tmp.compute-dependencies.0.XXXXXXXXXX' --tmpdir)
+trap 'rm -rf --one-file-system "${tmp_dir}"' EXIT
+
+# all top-level packages in base and base-devel
+TOP_PACKAGES=$(pacman -Qg base base-devel | cut -f 2 -d ' ')
+
+# get dependencies
+for package in $TOP_PACKAGES; do
+ pactree -l $package >>${tmp_dir}/dependencies
+done
+
+# all packages needed
+ALL_PACKAGES=$(cat ${tmp_dir}/dependencies | sort | uniq)
+
+export CARCH='x86_64'
+
+for package in $ALL_PACKAGES; do
+ asp show $package >${tmp_dir}/$package.PKGBUILD
+ # temporary hotfix for FS#57524
+ if test "$(head -n1 ${tmp_dir}/$package.PKGBUILD | grep -c '^\$Id\$$' )" == 1; then
+ sed -i 's/^\(\$Id\$\)$/#\1/' ${tmp_dir}/$package.PKGBUILD
+ fi
+ # asp makes redirects like '==>' ignore those and use the pointee
+ if test "$(head -n1 ${tmp_dir}/$package.PKGBUILD | grep -c '==>' )" == 1; then
+ _tmp=$(head -n1 ${tmp_dir}/$package.PKGBUILD | sed 's/==> \(.*\)/\1/')
+ SUB_PACKAGE=$(echo $_tmp | cut -f 1 -d ' ')
+ ADD_PACKAGE=$(echo $_tmp | rev | cut -f 1 -d ' ' | rev)
+ # TODO: we should map sub packages to packages everywhere
+ echo "WARN: seen a redirect from $SUB_PACKAGE to $ADD_PACKAGE" >&2
+ continue
+ fi
+ depends=$(. ${tmp_dir}/$package.PKGBUILD; echo "${depends[@]}")
+ makedepends=$(. ${tmp_dir}/$package.PKGBUILD; echo "${makedepends[@]}")
+ # TODO handle version constraints
+ #checkdepends=$(. ${tmp_dir}/$package.PKGBUILD; echo "${checkdepends[@]}")
+ #echo $package
+ #printf "\tdepends: $depends\n"
+ #printf "\tmakedepends: $makedepends\n"
+ #printf "\tcheckdepends: $checkdepends\n"
+# echo "${depends[@]}"
+ echo "${makedepends[@]}"
+done
+
+# ./compute_dependencies.sh | tr -s ' ' '\n' | sort | uniq > depends
+# ./compute_dependencies.sh | tr -s ' ' '\n' | sort | uniq > makedepends
+# grep -xf depends makedepends > makedepends_already_depends
+# grep -vxf depends makedepends > new_makedepends