Skip to content

Commit 6e6f992

Browse files
committed
Do not require existence of binpkg on disk to remove indexed package
1 parent b0714e7 commit 6e6f992

File tree

1 file changed

+17
-27
lines changed

1 file changed

+17
-27
lines changed

configure

Lines changed: 17 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ while getopts a:Cc:d:Nm:th:vR: OPT; do
4747
exit 0
4848
;;
4949
C)
50-
rm -rf tobuild built toremove removed toremove32bit removed32bit
50+
rm -rf tobuild built
5151
rm -f *.txt Makefile
5252
exit 0
5353
;;
@@ -147,8 +147,8 @@ fi
147147
printf "INFO: Creating source targets...\n"
148148
TOREMOVE=
149149
TOREMOVE32BIT=
150-
rm -rf tobuild built toremove removed toremove32bit removed32bit
151-
mkdir -p tobuild built toremove removed toremove32bit removed32bit
150+
rm -rf tobuild built
151+
mkdir -p tobuild built
152152
for p in `cat pkgs.txt`; do
153153
if [ -f "$SRCPKGS/$p/template" ]; then
154154
$XSC show-avail $p 2>/dev/null
@@ -180,14 +180,6 @@ fi
180180

181181
_TOBUILD="`find tobuild -type f`"
182182

183-
for i in $TOREMOVE; do
184-
touch toremove/$i
185-
done
186-
187-
for i in $TOREMOVE32BIT; do
188-
touch toremove32bit/$i
189-
done
190-
191183
concat() {
192184
local found=0
193185
for tb in $TOBUILD; do
@@ -244,12 +236,23 @@ printf "PKGS = $TOBUILD\n" >> Makefile
244236
printf "TOBUILD = \$(patsubst %%,tobuild/%%,\$(PKGS))\n" >> Makefile
245237
printf "BUILT = \$(patsubst tobuild/%%,built/%%,\$(TOBUILD))\n\n" >> Makefile
246238
printf "PKGS_REMOVED = $TOREMOVE\n" >> Makefile
247-
printf "TOREMOVE = \$(patsubst %%,toremove/%%,\$(PKGS_REMOVED))\n" >> Makefile
248-
printf "REMOVED = \$(patsubst toremove/%%,removed/%%,\$(TOREMOVE))\n\n" >> Makefile
239+
printf "PKGS_REMOVED_32BIT = $TOREMOVE32BIT\n" >> Makefile
249240
printf "all: allbuilt allremoved\n" >> Makefile
250241
printf "\t@echo \"[Done]\"\n\n" >> Makefile
251242
printf "allbuilt: \$(BUILT)\n\n" >> Makefile
252-
printf "allremoved: \$(REMOVED)\n\n" >> Makefile
243+
printf "allremoved:\n" >> Makefile
244+
printf "\t@echo \"[xbps-rindex --remove --stage]\t\"\n" >> Makefile
245+
# TODO: xbps-query --stage -s
246+
for subrepo in "" /debug /nonfree; do
247+
printf "\t@( in_repo=\$\$(env XBPS_TARGET_ARCH=$PKG_ARCH xbps-query -i -R --repository=\"$HOSTDIR/binpkgs$subrepo\" -s '' | cut -d' ' -f2 | while read -r indexed; do for removed in \$(PKGS_REMOVED); do [ \"\$\$indexed\" = \"\$\$removed\" ] && echo \"$HOSTDIR/binpkgs$subrepo\"/\$\$removed.$PKG_ARCH.xbps; done; done ); [ \"\$\$in_repo\" ] && env XBPS_TARGET_ARCH=$PKG_ARCH xbps-rindex --remove --stage \$\$in_repo )\n" >> Makefile
248+
done
249+
if [ "$XBPS_ARCH" = i686 ]; then
250+
printf "\t@echo \"[xbps-rindex --remove --stage # multilib]\t\"\n" >> Makefile
251+
for subrepo in /multilib /multilib/nonfree; do
252+
printf "\t@( in_repo=\$\$(env XBPS_TARGET_ARCH=x86_64 xbps-query -i -R --repository=\"$HOSTDIR/binpkgs$subrepo\" -s '' | cut -d' ' -f2 | while read -r indexed; do for removed in \$(PKGS_REMOVED_32BIT); do [ \"\$\$indexed\" = \"\$\$removed\" ] && echo \"$HOSTDIR/binpkgs$subrepo\"/\$\$removed.x86_64.xbps; done; done ); [ \"\$\$in_repo\" ] && env XBPS_TARGET_ARCH=x86_64 xbps-rindex --remove --stage \$\$in_repo )\n" >> Makefile
253+
done
254+
fi
255+
printf "\n" >> Makefile
253256
printf "print_pkgs:\n" >> Makefile
254257
printf "\t@echo \$(PKGS)\n\n" >> Makefile
255258
printf "print_pkgs_removed:\n" >> Makefile
@@ -261,19 +264,6 @@ printf "\t@( $XSC pkg \${@F}; rval=\$\$?; [ \$\$rval -eq 2 ] && exit 0 || exit \
261264
printf "\t@touch \$@\n" >> Makefile
262265
printf "\t@rm tobuild/\${@F}\n\n" >> Makefile
263266

264-
printf "removed/%%: toremove/%%\n" >> Makefile
265-
printf "\t@echo \"[xbps-rindex --remove --stage]\t\${@F}\"\n" >> Makefile
266-
printf "\t@find \"$HOSTDIR/binpkgs\" -name \${@F}.$PKG_ARCH.xbps -exec env XBPS_ARCH=$PKG_ARCH ${CROSS_ARCH:+XBPS_TARGET_ARCH=$CROSS_ARCH} xbps-rindex --remove --stage '{}' ';'\n" >> Makefile
267-
printf "\t@touch \$@\n" >> Makefile
268-
printf "\t@rm toremove/\${@F}\n\n" >> Makefile
269-
270-
printf "removed32bit/%%: toremove32bit/%%\n" >> Makefile
271-
printf "\t@echo \"[xbps-rindex --remove --stage # multilib]\t\${@F}\"\n" >> Makefile
272-
printf "\t@find \"$HOSTDIR/binpkgs\" -name \${@F}.x86_64.xbps -exec env XBPS_TARGET_ARCH=x86_64 ${CROSS_ARCH:+XBPS_TARGET_ARCH=$CROSS_ARCH} xbps-rindex --remove --stage '{}' ';'\n" >> Makefile
273-
printf "\t@touch \$@\n" >> Makefile
274-
printf "\t@rm toremove/\${@F}\n\n" >> Makefile
275-
276-
277267
printf "INFO: Finding and adding dependencies...\n"
278268
printf "# Dependencies\n" >> Makefile
279269
for p in $TOBUILD; do

0 commit comments

Comments
 (0)