Skip to content

Commit

Permalink
Remove packages marked to not build anymore on given architecture
Browse files Browse the repository at this point in the history
When package is updated and marked not to build on some architectures
with archs/nocross/broken/restricted, it needs to be removed form
repository.
  • Loading branch information
Chocimier committed Feb 17, 2022
1 parent b8a67b5 commit 8ec5b49
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ pkgs.txt
pkgs-removed.txt
repo-checkvers.txt
repo-checkvers-remove.txt
repo-checkvers-pkgver.txt
disabled.txt
17 changes: 13 additions & 4 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ XSC=
_append=""
RCV=`command -v xbps-checkvers 2>/dev/null`
RCV_F="repo-checkvers.txt"
RCV_FPV="repo-checkvers-pkgver.txt"
RCV_FR="repo-checkvers-remove.txt"
TOBUILD=
_TOBUILD=
Expand Down Expand Up @@ -125,7 +126,9 @@ case "$?" in
0) # version < 0.54
grep pkgname "$RCV_F" | awk '{ print $2 }' >pkgs.txt ;;
1) # version >= 0.54
cut -d' ' -f1 "$RCV_F" >pkgs.txt ;;
cut -d' ' -f1 "$RCV_F" >pkgs.txt
cut -d' ' -f1-2 "$RCV_F" > "$RCV_FPV"
;;
*)
echo "ERROR: couldn't determine xbps-checkvers version"
exit 1
Expand Down Expand Up @@ -217,13 +220,19 @@ printf "BUILT = \$(patsubst tobuild/%%,built/%%,\$(TOBUILD))\n\n" >> Makefile
printf "PKGS_REMOVED = $TOREMOVE\n" >> Makefile
printf "TOREMOVE = \$(patsubst %%,toremove/%%,\$(PKGS_REMOVED))\n" >> Makefile
printf "REMOVED = \$(patsubst toremove/%%,removed/%%,\$(TOREMOVE))\n\n" >> Makefile
printf "all: \$(BUILT) \$(REMOVED)\n" >> Makefile
printf "all: allbuilt allremoved\n" >> Makefile
printf "\t@echo \"[Done]\"\n\n" >> Makefile
printf "allbuilt: \$(BUILT)\n\n" >> Makefile
printf "allremoved: \$(REMOVED) remove_disabled\n\n" >> Makefile
printf "remove_disabled: allbuilt\n" >> Makefile
printf "\t@touch disabled.txt\n" >> Makefile
printf "\t@./remove-disabled.sh \"$HOSTDIR/binpkgs\" $PKG_ARCH ${CROSS_ARCH:+XBPS_TARGET_ARCH=$CROSS_ARCH} \n" >> Makefile
printf "\t@rm disabled.txt\n\n" >> Makefile
printf "print_pkgs:\n" >> Makefile
printf "\t@echo \$(PKGS)\n\n" >> Makefile
printf "built/%%: tobuild/%%\n" >> Makefile
printf "\t@echo \"[xbps-src]\t\${@F}\"\n" >> Makefile
printf "\t@( $XSC pkg \${@F}; rval=\$\$?; [ \$\$rval -eq 2 ] && exit 0 || exit \$\$rval )\n" >> Makefile
printf "\t@( $XSC pkg \${@F}; rval=\$\$?; [ \$\$rval -eq 2 ] && { echo \${@F} >> disabled.txt; exit 0; } || exit \$\$rval )\n" >> Makefile
printf "\t@touch \$@\n" >> Makefile
printf "\t@rm tobuild/\${@F}\n\n" >> Makefile
printf "removed/%%: toremove/%%\n" >> Makefile
Expand Down Expand Up @@ -267,7 +276,7 @@ printf "clean:\n" >> Makefile
printf "\t@rm -f built/*\n" >> Makefile
printf "\t@rm -f removed/*\n" >> Makefile
printf "\t@echo \"[Clean]\"\n\n" >> Makefile
printf ".PHONY: all print_pkgs clean\n" >> Makefile
printf ".PHONY: all print_pkgs clean allbuilt allremoved remove_disabled\n" >> Makefile

printf "INFO: 'Makefile' generated.\n"
printf "INFO: Type 'make'\n"
Expand Down
16 changes: 16 additions & 0 deletions remove-disabled.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/sh

repository="$1"
arch="$2"
xbps_target_arch="$3"
RCV_FPV="repo-checkvers-pkgver.txt"

[ -d "$repository" ] || exit 0
[ -e disabled.txt ] || exit 0
[ -e "$RCV_FPV" ] || exit 0

while read -r pkgname; do
pkgver="$(grep "^$pkgname " < $RCV_FPV | tr ' ' -)"
[ "$pkgver" ] || continue
find "$repository" -name "${pkgver}.${arch}.xbps" -exec env $xbps_target_arch xbps-rindex -R '{}' ';'
done < disabled.txt

0 comments on commit 8ec5b49

Please sign in to comment.