@@ -5,6 +5,7 @@ CFG_CMDLINE=
55CFG_CROSS=
66CFG_REPO=
77CROSS_ARCH=
8+ PKG_ARCH=
89DISTDIR=
910MASTERDIR=
1011HOSTDIR=
@@ -44,7 +45,7 @@ while getopts a:Cc:d:Nm:th:vR: OPT; do
4445 exit 0
4546 ;;
4647 C)
47- rm -rf tobuild built
48+ rm -rf tobuild built toremove removed
4849 rm -f * .txt Makefile
4950 exit 0
5051 ;;
@@ -90,6 +91,7 @@ shift $(($OPTIND - 1))
9091: ${MASTERDIR:= $DISTDIR / masterdir}
9192: ${HOSTDIR:= $DISTDIR / hostdir}
9293
94+ PKG_ARCH=${CROSS_ARCH:- $(xbps-uhelper -r " $MASTERDIR " arch)}
9395SRCPKGS=$DISTDIR /srcpkgs
9496XBPS_SRCPKGDIR=$SRCPKGS
9597
@@ -99,7 +101,13 @@ if [ -n "$CFG_CROSS" ]; then
99101 export XBPS_TARGET_ARCH=$CROSS_ARCH
100102fi
101103
102- RCV_CMD_LINE=" $RCV $CFG_REPO --distdir=${DISTDIR} ${* } "
104+ if $RCV -h 2>&1 | grep -q -e --removed; then
105+ RCV_REMOVED=-e
106+ else
107+ RCV_REMOVED=
108+ fi
109+
110+ RCV_CMD_LINE=" $RCV $RCV_REMOVED $CFG_REPO --distdir=${DISTDIR} ${* } "
103111printf " INFO: Getting list of updates, please wait...\n"
104112printf " INFO: Running '$RCV_CMD_LINE ' (${CROSS_ARCH:- native} ) ...\n"
105113
114122xbps-uhelper pkgmatch " xbps-$( $RCV -V | cut -d' ' -f2) _1" ' xbps>=0.54_1'
115123case " $? " in
1161240) # version < 0.54
117- grep pkgname " $RCV_F " | awk ' { print $2 }' > pkgs.txt ;;
125+ grep pkgname " $RCV_F " | awk ' { print $2 0 0 }' > pkgs.txt ;;
1181261) # version >= 0.54
119- cut -d' ' -f1 " $RCV_F " > pkgs.txt ;;
127+ cut -d' ' -f1-3 " $RCV_F " > pkgs.txt ;;
120128* )
121129 echo " ERROR: couldn't determine xbps-checkvers version"
122130 exit 1
123131 ;;
124132esac
125133
126134printf " INFO: Creating source targets...\n"
127- rm -rf tobuild built
128- mkdir -p tobuild built
129- for p in ` cat pkgs.txt` ; do
135+ rm -rf tobuild built toremove removed
136+ mkdir -p tobuild built toremove removed
137+ cat pkgs.txt | while read p old new ; do
130138 if [ -f " $SRCPKGS /$p /template" ]; then
131139 $XSC show-avail $p 2> /dev/null
132140 if [ $? -eq 0 ]; then
133141 touch tobuild/$p
134142 fi
143+ elif [ " $new " = - ]; then
144+ touch toremove/$p -$old
135145 fi
136146done
137147
138148_TOBUILD=" ` find tobuild -type f` "
149+ TOREMOVE=" ` find toremove -type f -printf ' %f ' ` "
139150
140151concat () {
141152 local found=0
@@ -192,7 +203,10 @@ printf "# Generated by configure, do not modify.\n\n" >> Makefile
192203printf " PKGS = $TOBUILD \n" >> Makefile
193204printf " TOBUILD = \$ (patsubst %%,tobuild/%%,\$ (PKGS))\n" >> Makefile
194205printf " BUILT = \$ (patsubst tobuild/%%,built/%%,\$ (TOBUILD))\n\n" >> Makefile
195- printf " all: \$ (BUILT)\n" >> Makefile
206+ printf " PKGS_REMOVED = $TOREMOVE \n" >> Makefile
207+ printf " TOREMOVE = \$ (patsubst %%,toremove/%%,\$ (PKGS_REMOVED))\n" >> Makefile
208+ printf " REMOVED = \$ (patsubst toremove/%%,removed/%%,\$ (TOREMOVE))\n\n" >> Makefile
209+ printf " all: \$ (BUILT) \$ (REMOVED)\n" >> Makefile
196210printf " \t@echo \" [Done]\" \n\n" >> Makefile
197211printf " print_pkgs:\n" >> Makefile
198212printf " \t@echo \$ (PKGS)\n\n" >> Makefile
@@ -201,6 +215,11 @@ printf "\t@echo \"[xbps-src]\t\${@F}\"\n" >> Makefile
201215printf " \t@( $XSC pkg \$ {@F}; rval=\$\$ ?; [ \$\$ rval -eq 2 ] && exit 0 || exit \$\$ rval )\n" >> Makefile
202216printf " \t@touch \$ @\n" >> Makefile
203217printf " \t@rm tobuild/\$ {@F}\n\n" >> Makefile
218+ printf " removed/%%: toremove/%%\n" >> Makefile
219+ printf " \t@echo \" [xbps-rindex -R]\t\$ {@F}\" \n" >> Makefile
220+ printf " \t@find \" $HOSTDIR /binpkgs\" '(' -name \$ {@F}.$PKG_ARCH .xbps -o -name \$ {@F}.noarch.xbps ')' -exec env ${CROSS_ARCH: +XBPS_TARGET_ARCH=$CROSS_ARCH } xbps-rindex -R '{}' ';' -delete '(' -name \$ {@F}.noarch.xbps -a -exec touch '{}' ';' ')' \n" >> Makefile
221+ printf " \t@touch \$ @\n" >> Makefile
222+ printf " \t@rm toremove/\$ {@F}\n\n" >> Makefile
204223
205224
206225printf " INFO: Finding and adding dependencies...\n"
@@ -228,9 +247,14 @@ for p in $TOBUILD; do
228247 printf " built/$p : $deps \n" >> Makefile
229248done
230249
250+ for p in $TOREMOVE ; do
251+ printf " removed/$p :\n" >> Makefile
252+ done
253+
231254printf " \n" >> Makefile
232255printf " clean:\n" >> Makefile
233256printf " \t@rm -f built/*\n" >> Makefile
257+ printf " \t@rm -f removed/*\n" >> Makefile
234258printf " \t@echo \" [Clean]\" \n\n" >> Makefile
235259printf " .PHONY: all print_pkgs clean\n" >> Makefile
236260
0 commit comments