~sourcemage/sorcery

881ee986688b73031aad8c47a90d30f00021786f — Thomas Orgis 7 months ago b4bd850 + 6e5f1e1
Merge branch 'master' into devel-sobukus-protection
M Makefile => Makefile +1 -1
@@ 5,7 5,7 @@ AWK ?= awk
help:
	@${AWK} 'sub(/^#HELP: ?/, "")' ${.MAKE.MAKEFILES}

BRANCH = stable
BRANCH = devel
release = sorcery-$(BRANCH).tar.bz2

ts-scm = .git/refs/heads/master

M etc/sorcery/version => etc/sorcery/version +1 -1
@@ 1,1 1,1 @@
20111014
20221117

M install => install +1 -1
@@ 27,7 27,7 @@ echo /etc/sorcery/install.log > $SORCERY_INSTALL_LOG

echo "Installing scripts and libraries"
# Install the executables
install__find_non_volatile etc usr/sbin var/lib |
install__find_non_volatile etc usr/sbin var/lib usr/lib |
while read src; do
  dst="$INSTALL_ROOT/$src" &&
  install -o 0 -g 0 -m 755 -p -D "$src" "$dst" &&

A usr/lib/sorcery/cmd/sightsee => usr/lib/sorcery/cmd/sightsee +134 -0
@@ 0,0 1,134 @@
#!/bin/sh
. /etc/sorcery/local/config
. /etc/sorcery/roots
unset debug verbose paths

upstream_rel_get() {
  [ -z "$debug" ] || >&2 echo "D: Visiting $1"
  case "$HTTP_DL_HANDLER" in
    (curl) curl -s "$1" ;;
    (*) wget -q -O- "$1" ;;
  esac | gawk -vdebug="$debug" -vfname="$2" '
	{
		while (match(tolower($0), fname, V)) {
			if (debug) {
				printf "D: matched `%s`\n", \
					substr($0, RSTART, RLENGTH) \
					>"/dev/stderr"
			}
			print V[1 in V]
			$0 = substr($0, RSTART + RLENGTH)
		}
	}
  ' | sort -urV
}

# Process options
while
  case "$1" in
    (--test)
      shift
      upstream_rel_get "$@"
      exit
      ;;
    (--codex)
      CODEX_ROOT="$2"
      shift 2
      ;;
    (--debug)
      debug=1
      shift
      ;;
    (-v|--verbose)
      verbose=1
      shift
      ;;
    (-h|--help)
      cat <<"!"

sightsee [spell...]	Find upstream software releases. Takes paths or spell
			names.
!
      exit 0
      ;;
    (*) false ;;
  esac
do :
done

if [ $# = 0 ]; then
  paths="$CODEX_ROOT"
else
  for i in "$@"; do
    case "$i" in
      (*/*) ;;
      (*)
        if ! [ -d "$i" ]; then
          j=$(find "$CODEX_ROOT" -maxdepth 3 -name "$i" -type d -print -quit)
          [ -d "$j" ] && i="$j"
        fi
        ;;
    esac
    paths+=("$i")
  done
fi

find "${paths[@]}" -name DETAILS -exec awk -vdebug="$debug" '
	END { print_spell() }
	FNR==1 {
		if (spell != "") print_spell()
	}
	/^ *SPELL=/ {
		spell = $0
		sub(/^[^=]+=["'\'']?/, "", spell)
		sub(/["'\'']$/, "", spell)
		next
	}
	/^ *VERSION=/ {
		version = $0
		sub(/[\t ]*[;#].*/, "", version)
		sub(/.*=["'\'']?/, "", version)
		sub(/["'\'']$/, "", version)
		if (watch_url != "") nextfile
	}
	/^# *Watch:/ {
		sub(/^[^:]+: */, "")
		watch_url = $1
		sub(/^[^ ]+ */, "")
		watch_regex = $0
		if (version != "") nextfile
	}
	function print_spell() {
		if (watch_url == "") {
			printf "W: %s: %s\n", spell, \
				"Upstream releases page not specified" \
				>"/dev/stderr"
		} else {
			if (!watch_regex)
				watch_regex = spell \
					"[-_](R?[-_.+~0-9]+(([a-z]|rc|alpha|beta)[0-9]*)?)" \
					"([-.]src|[-.]source)?" \
					"[.](tar|zip|t[bgx]z|7z|sha?r|cpio|rpm|deb|[ot]tf)"
			if (debug)
				printf "D: regex `%s`\n", watch_regex >"/dev/stderr"
			print spell, version, watch_url, watch_regex
		}
		version = watch_url = spell = ""
	}
  ' {} + |
while read spell cur_rel url regex; do
  if [ -n "$debug" ]; then
    >&2 echo "D: current_release for $spell: $cur_rel"
  fi
  latest_rel=$(upstream_rel_get "$url" "$regex" | sed q) || continue
  if [ -z "$latest_rel" ]; then
    >&2 echo "W: $spell has no published releases, review the URL"
  elif [ "x$latest_rel" != "x$cur_rel" ]; then
    if [ -n "$debug" ]; then
      >&2 echo "D: latest release for $spell: $latest_rel"
    fi
    echo "$spell $latest_rel"
  elif [ -n "$verbose" ] || [ -n "$debug" ]; then
    >&2 echo "I: $spell is up to date"
  fi
done

M usr/sbin/delve => usr/sbin/delve +17 -25
@@ 169,24 169,27 @@ delve_pre_install() {
     > >(tee -a $C_LOG > $VOYEUR_STDOUT)
}

delve_staged_install_setup() {
  case "$STAGED_INSTALL:$CHROOT_CHECK" in
    (off:*) invoke_installwatch ;;
    (*:)
      if [ "x$1" = x--prepare ]; then
        prepare_stage_root
      fi &&
      invoke_stage_root &&
      export CHROOT_CHECK=true &&
      CHROOT_CMD="chroot $STAGE_DIRECTORY/MOUNT"
      ;&
    (*:true) INSTALL_ROOT="" ;;
  esac
}

delve_install() {
  debug "delve" "Running $FUNCNAME"

  delve_is_valid_step INSTALL 2 || return 1
  delve_log_helper
  if [[ "$STAGED_INSTALL" != "off" ]]
  then
    if [[ -z "$CHROOT_CHECK" ]]
    then
      prepare_stage_root &&
      invoke_stage_root &&
      export CHROOT_CHECK="true"
      CHROOT_CMD="chroot ${STAGE_DIRECTORY}/MOUNT"
    fi
    INSTALL_ROOT=""
  else
    invoke_installwatch
  fi
  delve_staged_install_setup --prepare
  (
    if [[ -z "$CHROOT_CMD" ]]
    then


@@ 210,18 213,7 @@ delve_install_extras() {

  delve_is_valid_step INSTALL_EXTRAS 2 || return 1
  delve_log_helper
  if [[ "$STAGED_INSTALL" != "off" ]]
  then
    if [[ -z "$CHROOT_CHECK" ]]
    then
      invoke_stage_root &&
      export CHROOT_CHECK="true"
      CHROOT_CMD="chroot ${STAGE_DIRECTORY}/MOUNT"
    fi
    INSTALL_ROOT=""
  else
    invoke_installwatch
  fi
  delve_staged_install_setup
  (
    if [[ -z "$CHROOT_CMD" ]]
    then

M usr/sbin/sorcery => usr/sbin/sorcery +12 -5
@@ 32,6 32,8 @@ Usage:          sorcery [parameters]

Optional Parameters:

-v  | --version         Print the sorcery version

-h  |  --help  |  help  Display this help screen

-s  |  system-update    Perform a system update (updates sorcery, grimoire,


@@ 80,13 82,11 @@ default add spell PROVIDER on/off       "Spell" is the provider for

default remove [spell|""] [spell|PROVIDER|""] Remove entry from defaults
default search [spell|""] [spell|PROVIDER|""] [on|off] Search defaults

-v  | --version                 Print the sorcery version

EOF

  exit 1
#' <-- fix for syntax highlighting in nedit
  find /usr/lib/sorcery/cmd -mindepth 1 -maxdepth 1 -perm /333 -type f \
    -exec {} --help \;
  exit 1
}

mirror_list() {


@@ 1996,6 1996,13 @@ main() {

}

# Externally-implemented subcommands take priority
if [ -f /usr/lib/sorcery/cmd/"$1" ]; then
  cmd="$1"
  shift
  exec /usr/lib/sorcery/cmd/"$cmd" "$@"
fi

. /etc/sorcery/config
verify_parameters "$@"


M var/lib/sorcery/build/run_compiler => var/lib/sorcery/build/run_compiler +8 -9
@@ 19,20 19,19 @@

. /etc/sorcery/compile_config

DISTCC=
if [[ $USE_DISTCC != off ]] &&
   [[ "$DISTCC_HOSTS" ]] &&
   test -x /usr/bin/distcc ; then

  DISTCC=/usr/bin/distcc

   [[ "$DISTCC_HOSTS" ]]; then
  if [ -x /usr/bin/icecc ]; then
    DISTCC=/usr/bin/icecc
  elif [ -x /usr/bin/distcc ]; then
    DISTCC=/usr/bin/distcc
  fi
  export DISTCC_HOSTS
  export DISTCC_DIR
  export DISTCC_VERBOSE=0
  export DISTCC_LOG=/dev/null

  test -d "$DISTCC_DIR/" || mkdir -p "$DISTCC_DIR"
else
  DISTCC=""
  mkdir -p "$DISTCC_DIR"
fi

if [ "$CCACHE" = "on" ] && [ -x /usr/bin/ccache ] ; then

M var/lib/sorcery/modules/build_api/api2 => var/lib/sorcery/modules/build_api/api2 +3 -3
@@ 372,11 372,11 @@ real_default_sorcery_install_extras() {
  install_desktop_files
  gather_docs
  init_post_install
  [[ $STAGED_INSTALL == off ]] &&
  case "$HOST" in *-gnu) ldconfig;; esac
  case "$STAGED_INSTALL:$HOST" in
    (off:*-gnu) ldconfig ;;
  esac
  # release_saved_libraries
  cd  /

}

real_default_sorcery_transfer() {

M var/lib/sorcery/modules/libgrimoire => var/lib/sorcery/modules/libgrimoire +1 -8
@@ 39,22 39,15 @@ real_mk_source_dir() {
  local NEW_DIR=${NEW_DIR:=$SOURCE_DIRECTORY}

  local SIZE=$2
  # See bug 15946. Even simpler approach: Just specify no size, wich
  # also defaults to half of RAM in Linux.
  # TODO: Use given size to decide for TMPFS or not, early bail out
  # if not enough disk.
  local sizepar
  if [[ -n "$SIZE" ]]; then
    sizepar="size=$SIZE,"
  fi
  # Could also think about inode count being necessary.

  if  [  -n  "$NEW_DIR"  ];  then

    rm_source_dir  $NEW_DIR
    mkdir -p $NEW_DIR  &&
    if  [[  $TMPFS == on  ]]; then
      mount  -o "$sizepar"nr_inodes=1m  -t  tmpfs  tmpfs  $NEW_DIR
      mount -o "${SIZE:+size=$SIZE,}"nr_inodes=1m -t tmpfs tmpfs "$NEW_DIR"
    fi
  fi


M var/lib/sorcery/modules/libmisc => var/lib/sorcery/modules/libmisc +1 -0
@@ 1736,6 1736,7 @@ show_file() {
              fi ;;
      x-bzip2) bzcat "$file" | $PAGER ;;
      x-gzip) gzip -cd "$file" | $PAGER ;;
      x-lzip) lzip -cd "$file" | $PAGER ;;
      x-xz|x-lzma) xz -cd "$file" | $PAGER ;;
      x-7z-compressed) 7z -d "$file" | $PAGER ;;
      # This is needed as long as there is stable grimoire with

M var/lib/sorcery/modules/libsorcery => var/lib/sorcery/modules/libsorcery +17 -3
@@ 1107,8 1107,10 @@ invoke_build_dir() {

  USE_DISTCC=off
  if [[ $DISABLE_DISTCC != yes ]] ; then
    if test -n "$DISTCC_HOSTS" && spell_ok distcc ; then
      USE_DISTCC=on
    if test -n "$DISTCC_HOSTS"; then
      if spell_ok icecream || spell_ok distcc; then
        USE_DISTCC=on
      fi
    fi
  fi



@@ 1144,6 1146,7 @@ set_compression_type() {
  local B_HELP="bzip2 compression (slow, small files)"
  local P_HELP="parallel bzip2 compression (slow unless on SMP, small files)"
  local X_HELP="xz compression (slow compress, fast decompress, smallest files)"
  local L_HELP="lzip compresison (slow compress, fast decompress, smallest files)"
  local G_HELP="gzip compression (fast, larger files)"
  local T_HELP="no compression/tar (fastest, largest files)"



@@ 1159,6 1162,7 @@ set_compression_type() {
                             "B"  "bzip2 compression"        "$B_HELP"  \
                             "P"  "pbzip2 compression (parallel bzip2)" "$P_HELP"  \
                             "X"  "xz compression"           "$X_HELP"  \
                             "L"  "lzip compression"         "$L_HELP"  \
                             "G"  "gzip compression"         "$G_HELP"  \
                             "T"  "no compression/tar"       "$T_HELP"')



@@ 1191,6 1195,16 @@ set_compression_type() {
          modify_local_config "COMPRESSBIN" "xz"   &&
          COMPRESSBIN="xz"                         &&
          modify_local_config "EXTENSION" ".xz"    ;;
      L)
          if ! spell_ok lzip; then
            clear_line
            message "lzip is not installed on this system! Running cast ...\n"
            sleep 2
            cast lzip
          fi &&
          modify_local_config "COMPRESSBIN" "lzip" &&
          COMPRESSBIN="lzip"                       &&
          modify_local_config "EXTENSION" ".lz"    ;;
      G)
          modify_local_config "COMPRESSBIN" "gzip" &&
          COMPRESSBIN="gzip"                         &&


@@ 1214,7 1228,7 @@ set_compression_type() {
##
#---------------------------------------------------------------------
filename_indicates_compression()  {
  grep -qE "^.*\.(gz|tgz|bz2|zip|Z|rpm|xz|7z|lzma)$" <<< "$1"
  grep -qE "^.*\.(gz|tgz|bz2|zip|Z|rpm|lz|xz|7z|lzma)$" <<< "$1"
}

#---------------------------------------------------------------------

M var/lib/sorcery/modules/libtrack => var/lib/sorcery/modules/libtrack +6 -12
@@ 124,11 124,7 @@ real_devoke_stage_root()
{
  unset CASTFS_LOGFILE
  unset CASTFS_DBGLVL
  for dir in /dev/pts /dev /proc /sys
  do
    umount -l "${STAGE_DIRECTORY}/MOUNT$dir"
  done &&
  umount -l "${STAGE_DIRECTORY}/MOUNT"
  umount -l "${STAGE_DIRECTORY}/MOUNT"{/dev/pts,/dev,/proc,/sys,}
}

#---------------------------------------------------------------------


@@ 178,12 174,10 @@ real_devoke_installwatch()  {

is_castfs_installed()
{
  if type castfs >/dev/null 2>&1 &&
     (
       modprobe fuse > /dev/null 2>&1 ||
       grep -q '^nodev[\t\v\f\r ]*fuse$' /proc/filesystems
     ) &&
     [ -c /dev/fuse ]
  modprobe fuse >/dev/null 2>&1
  if [ -c /dev/fuse ] &&
     grep -q '^nodev	fuse$' /proc/filesystems &&
     type castfs >/dev/null 2>&1
  then
    message "${MESSAGE_COLOR}Staging enabled${DEFAULT_COLOR}"
    return 0


@@ 429,7 423,7 @@ create_cache_archive()  {
  rm $TMP_DATA $TMP_MDATA

  case "$COMPRESSBIN" in
    gzip|bzip2|pbzip2|xz)
    gzip|bzip2|pbzip2|xz|lzip)
      if "$COMPRESSBIN" -c </dev/null &>/dev/null; then
        "$COMPRESSBIN" -c "$CACHE" > "$CACHE_COMP" &&
        rm "$CACHE"

M var/lib/sorcery/modules/libunpack => var/lib/sorcery/modules/libunpack +2 -1
@@ 196,6 196,7 @@ uncompress_core() {
            tar)  cat           "$1"  ;;
          xz|XZ)  xz -cdf "$1" ;;
           LZMA)  xz -cdf "$1" ;;
           lzip)  lzip -cdf "$1" ;;
          7-zip)  cat "$1" ;; # 7z supports stdout, but it unpacks at the same time
              *)  cat           "$1"  ;;
  esac


@@ 234,7 235,7 @@ unpack_core() {
  debug "libgrimoire" "unpack_core - $*"

  case  "$2"  in
            bzip2|gzip|compress*|tar|XZ|xz|LZMA)
            bzip2|gzip|compress*|lzip|tar|XZ|xz|LZMA)
                    untar 2>/dev/null || cat > /dev/null ;;
              Zip)  cat /dev/stdin >/dev/null   #get rid of unused output
                    unzip  -q  "$1"                                    ;;