Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic broken link detection and rebuild #5

Open
petronny opened this issue Apr 16, 2023 · 0 comments
Open

Automatic broken link detection and rebuild #5

petronny opened this issue Apr 16, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@petronny
Copy link
Member

petronny commented Apr 16, 2023

Here is the script that I currently use to detect broken links.

#!/bin/bash
dbdir=/var/lib/pacman/sync
repo=$1

tmp=$(mktemp -d --tmpdir check-links.XXXXXXXXXX)

for i in core extra community arch4edu
do
        tar zxf $dbdir/$i.files --wildcards '*/files' -O 2>/dev/null
done | grep -a '\.so' | sed 's|.*/||g' | sort | uniq > $tmp/files

mkdir -p $tmp/links
tar -C $tmp/links -zxf $repo --wildcards '*/links'
sed 's|.*/||g' -i $(find $tmp/links -type f -name 'links')
sort $(find $tmp/links -name links -type f) | uniq > $tmp/sodepends

diff $tmp/files $tmp/sodepends | grep -P '^\>' | cut -c 3- > $tmp/broken-links
sed '/^%LINKS%$/d' -i $tmp/broken-links
sed '/^libc\.musl-x86_64\.so.*$/d' -i $tmp/broken-links
sed '/^ld-linux\.so.*$/d' -i $tmp/broken-links
sed '/^ld\.so.*$/d' -i $tmp/broken-links

cd $tmp/links

for link in $(cat $tmp/broken-links)
do
        grep -Fx "$link" -r .
done | sort | cut -c 3-

To use it, first update your local pacman database

pacman -Sy
pacman -Fy

Then

./check-links.sh /path/to/arch4edu.links.tar.gz

It will still has false alarmed packages. We need add a new setting in cactus.yaml like check-links:

  • when check-links: true, we find out their pkgbase path in arch4edu and trigger the rebuild.
  • when check-links: false, we ignore their outputs in check-links.sh.
  • when unset, we add a warning somehow to let everybody know it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant