From f3018114ddd74ad2bd162fac647550a591c06fd2 Mon Sep 17 00:00:00 2001 From: emmett1 Date: Wed, 29 Jul 2020 22:09:27 +0800 Subject: [PATCH] add mask function --- scratch | 31 +++++++++++++++++++------------ scratchpkg.alias | 2 +- scratchpkg.conf | 6 +++--- scratchpkg.mask | 6 ++++++ 4 files changed, 29 insertions(+), 16 deletions(-) create mode 100644 scratchpkg.mask diff --git a/scratch b/scratch index ab0b804..40bf182 100755 --- a/scratch +++ b/scratch @@ -697,18 +697,21 @@ scratch_remove() { outdatepkg() { for pkg in $(allinstalled); do - if [ ! -e "$PKGDB_DIR/$pkg/.lock" ] && getportpath $pkg >/dev/null; then - . $(getportpath $pkg)/$BUILD_SCRIPT - if [ -z "$name" ] || [ -z "$version" ]; then - continue - fi - iversion=$(installed_pkg_info version $pkg) - irelease=$(installed_pkg_info release $pkg) - if [ "$release" != "$irelease" ] || [ "$version" != "$iversion" ]; then - echo $name - fi - unset iversion irelease version release + if [ -f "$MASK_FILE" ] && [ $(grep -Ev '^(#|$| )' $MASK_FILE | grep $pkg) ]; then + continue + fi + [ -e "$PKGDB_DIR/$pkg/.lock" ] && continue + getportpath $pkg >/dev/null || continue + . $(getportpath $pkg)/$BUILD_SCRIPT + if [ -z "$name" ] || [ -z "$version" ]; then + continue + fi + iversion=$(installed_pkg_info version $pkg) + irelease=$(installed_pkg_info release $pkg) + if [ "$release" != "$irelease" ] || [ "$version" != "$iversion" ]; then + echo $name fi + unset iversion irelease version release done } @@ -903,7 +906,10 @@ scratch_outdate() { fi iversion=$(installed_pkg_info version $pkg) irelease=$(installed_pkg_info release $pkg) - [ -f "$PKGDB_DIR/$pkg/.lock" ] && ITSLOCK="[locked]" + [ -f "$PKGDB_DIR/$pkg/.lock" ] && ITSLOCK="[masked]" + if [ -f "$MASK_FILE" ] && [ $(grep -Ev '^(#|$| )' $MASK_FILE | grep $pkg) ]; then + ITSLOCK="[masked]" + fi outdatemsg="$name $iversion-$irelease => $version-$release $ITSLOCK" newerinstmsg="$name $iversion-$irelease => $version-$release [newer installed] $ITSLOCK" if [ "$version" != "$iversion" ]; then @@ -1438,6 +1444,7 @@ BUILD_SCRIPT="spkgbuild" PKGDB_DIR="$(pkgadd --print-dbdir)" REPO_FILE="${REPO_FILE:-/etc/scratchpkg.repo}" ALIAS_FILE="${ALIAS_FILE:-/etc/scratchpkg.alias}" +MASK_FILE="${MASK_FILE:-/etc/scratchpkg.mask}" # default value from pkgbuild SOURCE_DIR="/var/cache/scratchpkg/sources" diff --git a/scratchpkg.alias b/scratchpkg.alias index a3b0eab..1ef2a49 100644 --- a/scratchpkg.alias +++ b/scratchpkg.alias @@ -6,4 +6,4 @@ # # example: # openssl libressl -# \ No newline at end of file +# diff --git a/scratchpkg.conf b/scratchpkg.conf index ee52c66..37207b0 100644 --- a/scratchpkg.conf +++ b/scratchpkg.conf @@ -2,9 +2,9 @@ # Configuration file for scratchpkg # -CFLAGS="-O2 -march=x86-64 -pipe" -CXXFLAGS="${CFLAGS}" -MAKEFLAGS="-j$(nproc)" +# CFLAGS="-O2 -march=x86-64 -pipe" +# CXXFLAGS="${CFLAGS}" +# MAKEFLAGS="-j$(nproc)" # SOURCE_DIR="/var/cache/scratchpkg/sources" # PACKAGE_DIR="/var/cache/scratchpkg/packages" diff --git a/scratchpkg.mask b/scratchpkg.mask new file mode 100644 index 0000000..4beda9c --- /dev/null +++ b/scratchpkg.mask @@ -0,0 +1,6 @@ +# exclude packages from sysup + +glibc +gcc +linux-api-headers +binutils