@@ -552,6 +552,7 @@ scratch_install() {
552
552
break
553
553
}
554
554
done_pkg=" $done_pkg $ii "
555
+ world_add $ii
555
556
cd - > /dev/null
556
557
fi
557
558
done
@@ -599,6 +600,9 @@ scratch_install() {
599
600
count=$(( count - 1 ))
600
601
break
601
602
}
603
+ if [ $( echo $IPKG | tr ' ' ' \n' | grep -x $int ) ]; then
604
+ world_add $int
605
+ fi
602
606
run_postinstallsh
603
607
done_pkg=" $done_pkg $int "
604
608
cd - > /dev/null
@@ -654,10 +658,12 @@ scratch_remove() {
654
658
count=$(( count + 1 ))
655
659
pre_triggers $pkg
656
660
settermtitle " [ $count /$pkgcount ] Removing $pkg ..."
661
+ echo " remove: $pkg -$( get_iver $pkg ) -$( get_irelease $pkg ) ..."
657
662
pkgdel $pkg $OPTS || {
658
663
error=1
659
664
break
660
665
}
666
+ world_del $pkg
661
667
done
662
668
settermtitle " Triggering remove hook..."
663
669
post_triggers
@@ -1286,15 +1292,15 @@ scratch_missingdep() {
1286
1292
}
1287
1293
1288
1294
scratch_orphan () {
1289
- tmpallpkg=" /tmp/.pkgquery_allpkg.$$ "
1290
- tmpalldep=" /tmp/.pkgquery_alldep.$$ "
1291
- for pkg in $( allinstalled) ; do
1292
- echo $pkg >> $tmpallpkg
1293
- dep=" $dep $( get_depends $pkg ) "
1295
+ tmpdeplistworld=" /tmp/.deplistworld.$$ "
1296
+ tmpallinstalled=" /tmp/.allinstalled.$$ "
1297
+ for i in $( cat $WORLD_FILE ) ; do
1298
+ deplist $i
1294
1299
done
1295
- echo $dep | tr ' ' ' \n' | sort | uniq > " $tmpalldep "
1296
- grep -xvF -f " $tmpalldep " " $tmpallpkg "
1297
- rm " $tmpalldep " " $tmpallpkg "
1300
+ echo $DEP | tr ' ' ' \n' > $tmpdeplistworld
1301
+ allinstalled > $tmpallinstalled
1302
+ grep -xvF -f $tmpdeplistworld $tmpallinstalled
1303
+ rm $tmpallinstalled $tmpdeplistworld
1298
1304
}
1299
1305
1300
1306
scratch_path () {
@@ -1361,6 +1367,46 @@ scratch_files() {
1361
1367
fi
1362
1368
}
1363
1369
1370
+ world_add () {
1371
+ grep -qx $1 " $WORLD_FILE " && return
1372
+ scratch_isinstalled $1 || {
1373
+ echo " '$1 ' not installed"
1374
+ return 1
1375
+ }
1376
+ echo " $1 " >> " $WORLD_FILE "
1377
+ echo " world: '$1 ' added to world"
1378
+ sort " $WORLD_FILE " -o " $WORLD_FILE " # sort world
1379
+ sed ' /^$/d' -i " $WORLD_FILE " # delete empty lines
1380
+ }
1381
+
1382
+ world_del () {
1383
+ grep -qx $1 " $WORLD_FILE " || return
1384
+ sed " /^$1 $/d" -i " $WORLD_FILE "
1385
+ echo " world: '$1 ' deleted from world"
1386
+ sed ' /^$/d' -i " $WORLD_FILE " # delete empty lines
1387
+ }
1388
+
1389
+ scratch_world () {
1390
+ if [ " $1 " ]; then
1391
+ needroot
1392
+ touch " $WORLD_FILE "
1393
+ while [ " $1 " ]; do
1394
+ if [ ! $( grep -x $1 " $WORLD_FILE " ) ] ; then
1395
+ world_add $1
1396
+ else
1397
+ world_del $1
1398
+ fi
1399
+ shift
1400
+ done
1401
+ else
1402
+ [ -s " $WORLD_FILE " ] && {
1403
+ cat " $WORLD_FILE "
1404
+ } || {
1405
+ echo " world is empty"
1406
+ }
1407
+ fi
1408
+ }
1409
+
1364
1410
scratch_help () {
1365
1411
cat << EOF
1366
1412
Usage:
@@ -1417,6 +1463,7 @@ Options:
1417
1463
missingdep print missing dependencies
1418
1464
orphan print orphan installed ports
1419
1465
foreign print foreign ports
1466
+ world [ports] print/add/remove world list
1420
1467
printconfig <opts> print scratchpkg configs
1421
1468
help print this help msg
1422
1469
@@ -1481,6 +1528,7 @@ REPO_FILE="${REPO_FILE:-/etc/scratchpkg.repo}"
1481
1528
ALIAS_FILE=" ${ALIAS_FILE:-/ etc/ scratchpkg.alias} "
1482
1529
MASK_FILE=" ${MASK_FILE:-/ etc/ scratchpkg.mask} "
1483
1530
CONFIG_FILE=" ${CONFIG_FILE:-/ etc/ scratchpkg.conf} "
1531
+ WORLD_FILE=" $( dirname $PKGDB_DIR ) /world"
1484
1532
1485
1533
# default value from pkgbuild
1486
1534
SOURCE_DIR=" /var/cache/scratchpkg/sources"
0 commit comments