@@ -5,6 +5,7 @@ CFG_CMDLINE=
5
5
CFG_CROSS=
6
6
CFG_REPO=
7
7
CROSS_ARCH=
8
+ PKG_ARCH=
8
9
DISTDIR=
9
10
MASTERDIR=
10
11
HOSTDIR=
@@ -44,7 +45,7 @@ while getopts a:Cc:d:Nm:th:vR: OPT; do
44
45
exit 0
45
46
;;
46
47
C)
47
- rm -rf tobuild built
48
+ rm -rf tobuild built toremove removed
48
49
rm -f * .txt Makefile
49
50
exit 0
50
51
;;
@@ -90,6 +91,7 @@ shift $(($OPTIND - 1))
90
91
: ${MASTERDIR:= $DISTDIR / masterdir}
91
92
: ${HOSTDIR:= $DISTDIR / hostdir}
92
93
94
+ PKG_ARCH=${CROSS_ARCH:- $(xbps-uhelper -r " $MASTERDIR " arch)}
93
95
SRCPKGS=$DISTDIR /srcpkgs
94
96
XBPS_SRCPKGDIR=$SRCPKGS
95
97
@@ -99,7 +101,13 @@ if [ -n "$CFG_CROSS" ]; then
99
101
export XBPS_TARGET_ARCH=$CROSS_ARCH
100
102
fi
101
103
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} ${* } "
103
111
printf " INFO: Getting list of updates, please wait...\n"
104
112
printf " INFO: Running '$RCV_CMD_LINE ' (${CROSS_ARCH:- native} ) ...\n"
105
113
114
122
xbps-uhelper pkgmatch " xbps-$( $RCV -V | cut -d' ' -f2) _1" ' xbps>=0.54_1'
115
123
case " $? " in
116
124
0) # 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 ;;
118
126
1) # version >= 0.54
119
- cut -d' ' -f1 " $RCV_F " > pkgs.txt ;;
127
+ cut -d' ' -f1-3 " $RCV_F " > pkgs.txt ;;
120
128
* )
121
129
echo " ERROR: couldn't determine xbps-checkvers version"
122
130
exit 1
123
131
;;
124
132
esac
125
133
126
134
printf " 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
130
138
if [ -f " $SRCPKGS /$p /template" ]; then
131
139
$XSC show-avail $p 2> /dev/null
132
140
if [ $? -eq 0 ]; then
133
141
touch tobuild/$p
134
142
fi
143
+ elif [ " $new " = - ]; then
144
+ touch toremove/$p -$old
135
145
fi
136
146
done
137
147
138
148
_TOBUILD=" ` find tobuild -type f` "
149
+ TOREMOVE=" ` find toremove -type f -printf ' %f ' ` "
139
150
140
151
concat () {
141
152
local found=0
@@ -192,7 +203,10 @@ printf "# Generated by configure, do not modify.\n\n" >> Makefile
192
203
printf " PKGS = $TOBUILD \n" >> Makefile
193
204
printf " TOBUILD = \$ (patsubst %%,tobuild/%%,\$ (PKGS))\n" >> Makefile
194
205
printf " 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
196
210
printf " \t@echo \" [Done]\" \n\n" >> Makefile
197
211
printf " print_pkgs:\n" >> Makefile
198
212
printf " \t@echo \$ (PKGS)\n\n" >> Makefile
@@ -201,6 +215,11 @@ printf "\t@echo \"[xbps-src]\t\${@F}\"\n" >> Makefile
201
215
printf " \t@( $XSC pkg \$ {@F}; rval=\$\$ ?; [ \$\$ rval -eq 2 ] && exit 0 || exit \$\$ rval )\n" >> Makefile
202
216
printf " \t@touch \$ @\n" >> Makefile
203
217
printf " \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
204
223
205
224
206
225
printf " INFO: Finding and adding dependencies...\n"
@@ -228,9 +247,14 @@ for p in $TOBUILD; do
228
247
printf " built/$p : $deps \n" >> Makefile
229
248
done
230
249
250
+ for p in $TOREMOVE ; do
251
+ printf " removed/$p :\n" >> Makefile
252
+ done
253
+
231
254
printf " \n" >> Makefile
232
255
printf " clean:\n" >> Makefile
233
256
printf " \t@rm -f built/*\n" >> Makefile
257
+ printf " \t@rm -f removed/*\n" >> Makefile
234
258
printf " \t@echo \" [Clean]\" \n\n" >> Makefile
235
259
printf " .PHONY: all print_pkgs clean\n" >> Makefile
236
260
0 commit comments