Hello community, here is the log from the commit of package etc-update for openSUSE:Factory checked in at 2015-11-16 18:51:37 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/etc-update (Old) and /work/SRC/openSUSE:Factory/.etc-update.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "etc-update" Changes: -------- --- /work/SRC/openSUSE:Factory/etc-update/etc-update.changes 2013-02-12 16:38:40.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.etc-update.new/etc-update.changes 2015-11-16 18:51:37.000000000 +0100 @@ -1,0 +2,13 @@ +Fri Nov 13 14:54:16 UTC 2015 - [email protected] + +- Version bump 2.2.24: + * Test portageq and etc-update for Gentoo bug #462412. + * CONFIG_PROTECT: handle non-existent files + * etc-update: symlink support for Gentoo bug #485598 + * Add support for SUSE based distros in etc-update, Gentoo bug #456128 + * FEATURES=case-insensitive-fs for Gentoo bug #524236 + * Various minor updates in the makefile +- New URL due to redesign of all the Gentoo webpages +- Remove rpm-distribution.patch as it is merged upstream + +------------------------------------------------------------------- Old: ---- rpm-distribution.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ etc-update.spec ++++++ --- /var/tmp/diff_new_pack.WfP8LF/_old 2015-11-16 18:51:38.000000000 +0100 +++ /var/tmp/diff_new_pack.WfP8LF/_new 2015-11-16 18:51:38.000000000 +0100 @@ -1,7 +1,7 @@ # # spec file for package etc-update # -# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,14 +18,13 @@ Name: etc-update Requires: bash -Version: 2.1.11.50 +Version: 2.2.24 Release: 0 -Url: http://www.gentoo.org/proj/en/portage/index.xml +Url: https://wiki.gentoo.org/wiki/Handbook:X86/Portage/Tools#etc-update Source0: %name Source1: %name.1 Source2: %name.conf Source3: GPL-2 -Patch0: rpm-distribution.patch Summary: Configuration file update handler License: GPL-2.0 Group: System/Base @@ -44,7 +43,6 @@ %prep cp %_sourcedir/* . -%patch0 %build echo "Nothing to do..." @@ -52,6 +50,7 @@ %install install -D -m 0755 %name "%{buildroot}"/%{_sbindir}/%name install -D -m 0644 %name.conf "%{buildroot}"%{_sysconfdir}/%name.conf +sed -i -e "s/VERSION/%{version}/" %name.1 install -D -m 0644 %name.1 "%{buildroot}"/%{_mandir}/man1/%name.1 %clean ++++++ etc-update ++++++ --- /var/tmp/diff_new_pack.WfP8LF/_old 2015-11-16 18:51:38.000000000 +0100 +++ /var/tmp/diff_new_pack.WfP8LF/_new 2015-11-16 18:51:38.000000000 +0100 @@ -32,6 +32,35 @@ "${PORTAGE_CONFIGROOT}"etc/etc-update.conf) } +OS_RELEASE_ID=$(cat /etc/os-release 2>/dev/null | grep '^ID=' | cut -d'=' -f2) + +case $OS_RELEASE_ID in + suse|opensuse) OS_FAMILY='suse' ;; + *) OS_FAMILY='gentoo' ;; +esac + +if [[ $OS_FAMILY == 'gentoo' ]]; then + get_basename_find_opt() { + echo "._cfg????_${1}" + } + get_scan_regexp() { + echo "s:\(^.*/\)\(\._cfg[0-9]*_\)\(.*$\):\1\2\3$b\1$b\2$b\3:" + } + get_live_file() { + echo "${rpath}/${rfile:10}" + } +elif [[ $OS_FAMILY == 'suse' ]]; then + get_basename_find_opt() { + echo "${1}.rpmnew" + } + get_scan_regexp() { + echo "s:\(^.*/\)\(.*\)\(\.rpmnew\):\1\2\3$b\1$b\3$b\2:" + } + get_live_file() { + echo "${cfg_file%.rpmnew}" + } +fi + cmd_var_is_valid() { # return true if the first whitespace-separated token contained # in "${1}" is an executable file, false otherwise @@ -51,11 +80,15 @@ local src=${@:$(( $# - 1 )):1} local dst=${@:$(( $# - 0 )):1} - if [[ -L ${dst} ]] ; then #330221 + if [[ ! -L ${src} && -L ${dst} ]] ; then #330221 local lfile=$(readlink "${dst}") [[ ${lfile} == /* ]] || lfile="${dst%/*}/${lfile}" echo " Target is a symlink; replacing ${lfile}" dst=${lfile} + elif [[ -d ${dst} && ! -L ${dst} ]] ; then + # If ${dst} is a directory, do not move the file + # inside of it if this fails. + rmdir "${dst}" || return fi mv "${opts[@]}" "${src}" "${dst}" @@ -74,14 +107,21 @@ path="${EROOT%/}${path}" if [[ ! -d ${path} ]] ; then - [[ ! -f ${path} ]] && continue - local my_basename="${path##*/}" + # Protect files that don't exist (bug #523684). If the + # parent directory doesn't exist, we can safely skip it. + path=${path%/} + [[ -d ${path%/*} ]] || continue + local name_opt=$(get_basename_find_opt "${path##*/}") path="${path%/*}" - find_opts=( -maxdepth 1 -name "._cfg????_${my_basename}" ) + find_opts=( -maxdepth 1 ) else # Do not traverse hidden directories such as .svn or .git. - find_opts=( -name '.*' -type d -prune -o -name '._cfg????_*' ) + local name_opt=$(get_basename_find_opt '*') + find_opts=( -name '.*' -type d -prune -o ) fi + ${case_insensitive} && \ + find_opts+=( -iname ) || find_opts+=( -name ) + find_opts+=( "$name_opt" ) find_opts+=( ! -name '.*~' ! -iname '.*.bak' -print ) if [ ! -w "${path}" ] ; then @@ -90,10 +130,11 @@ fi local file ofile b=$'\001' + local scan_regexp=$(get_scan_regexp) for file in $(find "${path}"/ "${find_opts[@]}" | sed \ -e 's://*:/:g' \ - -e "s:\(^.*/\)\(\._cfg[0-9]*_\)\(.*$\):\1\2\3$b\1$b\2$b\3:" | + -e "${scan_regexp}" | sort -t"$b" -k2,2 -k4,4 -k3,3 | LC_ALL=C cut -f1 -d"$b") do @@ -101,7 +142,7 @@ rpath=${file%/*} rfile=${file##*/} cfg_file="${rpath}/${rfile}" - live_file="${rpath}/${rfile:10}" + live_file=$(get_live_file) local mpath for mpath in ${CONFIG_PROTECT_MASK}; do @@ -112,6 +153,24 @@ continue 2 fi done + if [[ -L ${file} ]] ; then + if [[ -L ${live_file} && \ + $(readlink "${live_file}") == $(readlink "${file}") ]] + then + rm -f "${file}" + continue + fi + if [[ "${ofile:10}" != "${rfile:10}" ]] || + [[ ${opath} != ${rpath} ]] + then + : $(( ++count )) + echo "${live_file}" > "${TMP}"/files/${count} + fi + echo "${cfg_file}" >> "${TMP}"/files/${count} + ofile="${rfile}" + opath="${rpath}" + continue + fi if [[ ! -f ${file} ]] ; then ${QUIET} || echo "Skipping non-file ${file} ..." continue @@ -121,7 +180,9 @@ [[ ${opath} != ${rpath} ]] then MATCHES=0 - if [[ ${eu_automerge} == "yes" ]] ; then + if ! [[ -f ${cfg_file} && -f ${live_file} ]] ; then + MATCHES=0 + elif [[ ${eu_automerge} == "yes" ]] ; then if [[ ! -e ${cfg_file} || ! -e ${live_file} ]] ; then MATCHES=0 else @@ -374,17 +435,50 @@ show_diff() { clear - local file1=$1 file2=$2 + local file1=$1 file2=$2 files=("$1" "$2") \ + diff_files=() file i tmpdir + + if [[ -L ${file1} && ! -L ${file2} && + -f ${file1} && -f ${file2} ]] ; then + # If a regular file replaces a symlink to a regular file, then + # show the diff between the regular files (bug #330221). + diff_files=("${file1}" "${file2}") + else + for i in 0 1 ; do + if [[ ! -L ${files[$i]} && -f ${files[$i]} ]] ; then + diff_files[$i]=${files[$i]} + continue + fi + [[ -n ${tmpdir} ]] || \ + tmpdir=$(mktemp -d "${TMP}/symdiff-XXX") + diff_files[$i]=${tmpdir}/${i} + if [[ ! -L ${files[$i]} && ! -e ${files[$i]} ]] ; then + echo "/dev/null" > "${diff_files[$i]}" + elif [[ -L ${files[$i]} ]] ; then + echo "SYM: ${file1} -> $(readlink "${files[$i]}")" > \ + "${diff_files[$i]}" + elif [[ -d ${files[$i]} ]] ; then + echo "DIR: ${file1}" > "${diff_files[$i]}" + elif [[ -p ${files[$i]} ]] ; then + echo "FIF: ${file1}" > "${diff_files[$i]}" + else + echo "DEV: ${file1}" > "${diff_files[$i]}" + fi + done + fi + if [[ ${using_editor} == 0 ]] ; then ( echo "Showing differences between ${file1} and ${file2}" - diff_command "${file1}" "${file2}" + diff_command "${diff_files[0]}" "${diff_files[1]}" ) | ${pager} else echo "Beginning of differences between ${file1} and ${file2}" - diff_command "${file1}" "${file2}" + diff_command "${diff_files[0]}" "${diff_files[1]}" echo "End of differences between ${file1} and ${file2}" fi + + [[ -n ${tmpdir} ]] && rm -rf "${tmpdir}" } do_cfg() { @@ -392,14 +486,14 @@ local ofile=$2 local -i my_input=0 - until (( my_input == -1 )) || [ ! -f "${file}" ] ; do + until (( my_input == -1 )) || [[ ! -f ${file} && ! -L ${file} ]] ; do if [[ "${OVERWRITE_ALL}" == "yes" ]] && ! user_special "${ofile}"; then my_input=1 elif [[ "${DELETE_ALL}" == "yes" ]] && ! user_special "${ofile}"; then my_input=2 else show_diff "${ofile}" "${file}" - if [[ -L ${file} ]] ; then + if [[ -L ${file} && ! -L ${ofile} ]] ; then cat <<-EOF ------------------------------------------------------------- @@ -458,6 +552,19 @@ local ofile="${2}" local mfile="${TMP}/${2}.merged" local -i my_input=0 + + if [[ -L ${file} && -L ${ofile} ]] ; then + echo "Both files are symlinks, so they will not be merged." + return 0 + elif [[ ! -f ${file} ]] ; then + echo "Non-regular file cannot be merged: ${file}" + return 0 + elif [[ ! -f ${ofile} ]] ; then + echo "Non-regular file cannot be merged: ${ofile}" + return 0 + fi + + echo "${file} ${ofile} ${mfile}" if [[ -e ${mfile} ]] ; then @@ -530,9 +637,18 @@ for (( count = 0; count <= 9999; ++count )) ; do suffix=$(printf ".dist_%04i" ${count}) efile="${ofile}${suffix}" - if [[ ! -f ${efile} ]] ; then + if [[ ! -f ${efile} && ! -L ${efile} ]] ; then mv ${mv_opts} "${file}" "${efile}" break + elif [[ -L ${efile} && -L ${file} ]] ; then + if [[ $(readlink "${efile}") == $(readlink "${file}") ]] ; then + # replace identical copy + mv "${file}" "${efile}" + break + fi + elif [[ -L ${efile} || -L ${file} ]] ; then + # not the same file types + continue elif diff_command "${file}" "${efile}" &> /dev/null; then # replace identical copy mv "${file}" "${efile}" @@ -620,9 +736,17 @@ done ${SET_X} && set -x -type portageq >/dev/null || die "missing portageq" +if [[ $OS_FAMILY == 'suse' ]]; then + PORTAGE_CONFIGROOT='/' + PORTAGE_TMPDIR='/tmp' + CONFIG_PROTECT='/etc' + CONFIG_PROTECT_MASK='' + [[ -f /etc/sysconfig/etc-update ]] && . /etc/sysconfig/etc-update +fi + portage_vars=( CONFIG_PROTECT{,_MASK} + FEATURES PORTAGE_CONFIGROOT PORTAGE_INST_{G,U}ID PORTAGE_TMPDIR @@ -630,9 +754,17 @@ USERLAND NOCOLOR ) -eval $(portageq envvar -v ${portage_vars[@]}) + +if type -P portageq > /dev/null; then + eval $(${PORTAGE_PYTHON:+"${PORTAGE_PYTHON}"} "$(type -P portageq)" envvar -v ${portage_vars[@]}) +else + [[ $OS_FAMILY == 'gentoo' ]] && die "missing portageq" +fi + export PORTAGE_TMPDIR SCAN_PATHS=${*:-${CONFIG_PROTECT}} +[[ " ${FEATURES} " == *" case-insensitive-fs "* ]] && \ + case_insensitive=true || case_insensitive=false TMP="${PORTAGE_TMPDIR}/etc-update-$$" trap "die terminated" SIGTERM ++++++ etc-update.1 ++++++ --- /var/tmp/diff_new_pack.WfP8LF/_old 2015-11-16 18:51:38.000000000 +0100 +++ /var/tmp/diff_new_pack.WfP8LF/_new 2015-11-16 18:51:38.000000000 +0100 @@ -1,28 +1,24 @@ -.TH "ETC-UPDATE" "1" "Mar 2012" "Portage 2.1.11.50" "Portage" -.SH NAME -etc-update \- handle configuration file updates -.SH SYNOPSIS -.BR etc-update +.TH "ETC-UPDATE" "1" "Mar 2012" "Portage VERSION" "Portage" +.SH "NAME" +etc\-update \- handle configuration file updates +.SH "SYNOPSIS" +.BR etc\-update [\fIoptions\fR] [\fI--automode <mode>\fR] [\fIpaths to scan\fR] -.SH DESCRIPTION -.I etc-update -is supposed to be run after merging a new package to see if +.SH "DESCRIPTION" +\fIetc\-update\fR is supposed to be run after merging a new package to see if there are updates to the configuration files. If a new -configuration file will override an old one, -.I etc-update -will prompt the user for a decision. +configuration file will override an old one, +\fIetc\-update\fR will prompt the user for a decision. .PP -.I etc-update -will check all directories specified on the command line. If no paths -are given, then the \fICONFIG_PROTECT\fR variable will be used. All -config files found in \fICONFIG_PROTECT_MASK\fR will automatically be -updated for you by \fIetc-update\fR. See \fBmake.conf\fR(5) for more -information. +\fIetc\-update\fR will check all directories specified on the command +line. If no paths are given, then the \fICONFIG_PROTECT\fR variable +will be used. All config files found in \fICONFIG_PROTECT_MASK\fR will +automatically be updated for you by \fIetc\-update\fR. +See \fBmake.conf\fR(5) for more information. .PP -.I etc-update -respects the normal \fIPORTAGE_CONFIGROOT\fR and \fIEROOT\fR variables -for finding the aforementioned config protect variables. -.SH OPTIONS +\fIetc\-update\fR respects the normal \fIPORTAGE_CONFIGROOT\fR and +\fIEROOT\fR variables for finding the aforementioned config protect variables. +.SH "OPTIONS" .TP .BR \-d ", " \-\-debug Run with shell tracing enabled. @@ -37,11 +33,11 @@ Show settings and important decision info while running. .TP .BR "\-\-automode <mode>" -Select one of the automatic merge modes. Valid modes are: -3 -5 -7 -9. +Select one of the automatic merge modes. Valid modes are: \-3 \-5 \-7 \-9. See the \fI\-\-help\fR text for more details. .SH "REPORTING BUGS" Please report bugs via http://bugs.gentoo.org/ -.SH AUTHORS +.SH "AUTHORS" .nf Jochem Kossen and Leo Lipelis Karl Trygve Kalleberg <[email protected]> @@ -49,8 +45,8 @@ .fi .SH "FILES" .TP -.B /etc/etc-update.conf -Configuration settings for \fIetc-update\fR are stored here. +.B /etc/etc\-update.conf +Configuration settings for \fIetc\-update\fR are stored here. .SH "SEE ALSO" -.BR dispatch-conf (1), +.BR dispatch\-conf (1), .BR make.conf (5)
