From 6fc6b0bda684007ae8a09101b517d96e4c2413e3 Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Fri, 23 May 2014 21:17:27 +0200 Subject: [PATCH] Added autodist-repository tool, further fixes to support a central sociallog and more fixes --- Makefile | 1 + autodist-repository | 1011 +++++++++++++++++++++++++++ automaint | 6 +- webbuild/html/scripts/socialbox.js | 1 - webbuild/webbuild-cgi | 103 +-- webbuild/webbuild-functions | 11 +- webbuild/webbuild-functions-private | 7 +- 7 files changed, 1084 insertions(+), 56 deletions(-) create mode 100755 autodist-repository diff --git a/Makefile b/Makefile index 42e69c2..ef21f46 100644 --- a/Makefile +++ b/Makefile @@ -71,6 +71,7 @@ install-programs: @$(INSTALL_SCRIPT) autoport $(DESTDIR)$(bindir)/autoport @$(INSTALL_SCRIPT) automaint $(DESTDIR)$(sbindir)/automaint @$(INSTALL_SCRIPT) autoport-chroot $(DESTDIR)$(sbindir)/autoport-chroot + @$(INSTALL_SCRIPT) autodist-repository $(DESTDIR)$(sbindir)/autodist-repository @$(INSTALL_SCRIPT) autodist-upstream-updates $(DESTDIR)$(sbindir)/autodist-upstream-updates @$(INSTALL_SCRIPT) autoport-fix-environment $(DESTDIR)$(bindir)/autoport-fix-environment @$(INSTALL_SCRIPT) etc/autodist/scripts/* $(DESTDIR)$(configdir)/scripts/ diff --git a/autodist-repository b/autodist-repository new file mode 100755 index 0000000..53a0b68 --- /dev/null +++ b/autodist-repository @@ -0,0 +1,1011 @@ +# +# autodist repositories maintainance script +# Copyright (c) 2007-2014 by Silvan Calarco +# +. /etc/autodist/config +#. /sysconfig/openmamba-central + +basearch=i586 + +me=${0##*/} + +function usage() { + + echo "autodist repositories maintainance script" + echo "Copyright (c) 2007-2014 by Silvan Calarco" + echo + echo "Usage:" + echo "$me list" + echo "$me import REPOSITORY [PKGS ...] [-d REPOSITORY] [-s] [-y]" + echo "$me release REPOSITORY [PKGS ...] [-d REPOSITORY] [-s] [-y]" + echo "$me archive REPOSITORY PKGS ..." + echo "$me restore REPOSITORY PKGS ..." + echo "$me query REPOSITORY PKGS ..." + echo "$me search [-i] [-r regexp] STRING" + echo "$me verify REPOSITORY [PKGS ...]" + echo "$me inspect REPOSITORY {PKGS ...} [-d REPOSITORY]" + echo "$me setwarning REPOSITORY {PKG ...} -t \"TEXT\"" + echo "$me diff REPOSITORY [PKGS ...] [-d REPOSITORY]" + echo "$me distromatic REPOSITORY" + echo + echo " -d use given repository as destination (default: devel)" + echo " -f force import to destination repository" + echo " -r match repositories with given regexp" + echo " -s simulate operations to see if it would work" + echo " -t warning text" + echo " -y assume yes to all questions (be careful!)" +} + +function get_packages_from_last_build() { + local rep=$1 + [ "$rep" ] || return + [ -r $SRCPKGLIST ] || { + echo "Error: srcpkglist file missing for $origrepository repository; aborting." + exit 1 + } + tmpfile=`mktemp` + packages=() + cat $SRCPKGLIST | sort -k3 -r > $tmpfile + while read line; do + set -- $line + [ "$4" = "$rep" ] && packages=(${packages[*]} $1) + done < $tmpfile + rm -f $tmpfile +} + +# get_pkg_srcinfo - search using srcpkginfo file to find source when no builds exist +# +# $1: repository name +# $2: pkg name +get_pkg_srcinfo() { + + local rep pkg line + + [ $1 ] && rep=$1 || exit 1 + [ $2 ] && pkg=$2 || exit 1 + + unset pkg_archs pkg_name pkg_version pkg_release + + line=`grep "^$pkg " $SRCPKGLIST` + + [ "$line" ] || return + + set -- $line + + [ "$4" = "$rep" ] || return + + pkg_name=$1 + pkg_arch= + pkg_archs= + pkg_version=$2 + pkg_release=$6 + pkg_repository=$4 + pkg_buildtime=$3 +} + +# get_pkg_buildinfo - uses distromatic generated build file for +# getting information on the repository +# +# $1: repository name +# $2: architecture +# $3: pkg name +function get_pkg_buildinfo() { + + local pkg i a + + [ $1 ] && rep=$1 || exit 1 + [ $2 ] && buildarch=$2 || exit 1 + [ $3 ] && pkg=$3 + + pkg_archs=(); + for a in ${AUTODIST_ARCHS[*]}; do + pkg_header=(); + DISTROMATIC_BUILD_FILE=${LOCAL_REPS_BASE_DIR}/distromatic/$rep/builds-$a.sh + [ -e $DISTROMATIC_BUILD_FILE ] && { + . $DISTROMATIC_BUILD_FILE + [ "$buildarch" = "any" -a "$pkg" = "" ] && buildarch=$a + [ ${pkg_header[0]} ] && { + pkg_archs=(${pkg_archs[*]} $a) + [ "$buildarch" = "any" ] && buildarch=$a + } + } + done + + pkg_header=(); + pkg_builds=(); + pkg_obsoletes=(); + pkg_list=(); + + unset pkg_name pkg_arch pkg_version pkg_release \ + pkg_group pkg_license pkg_size pkg_buildtime pkg_altrep pkg_repository + + if [ "$buildarch" = "any" ]; then +# echo "Error: package $pkg does not exist in $rep; aborting." + return; + fi + + DISTROMATIC_BUILD_FILE=${LOCAL_REPS_BASE_DIR}/distromatic/$rep/builds-${buildarch}.sh + if [ ! -e $DISTROMATIC_BUILD_FILE ]; then + return; + fi + . $DISTROMATIC_BUILD_FILE + + + for i in ${pkg_list[*]}; do + if [ "$i" == "${pkg_header[0]}" ]; then + pkg_name=${pkg_header[0]}; + # Note: pkg_arch reported in builds file is just last arch source was + # built for, so we use repository arch instead + pkg_arch=${pkg_header[1]}; + [ "$pkg_arch" = "noarch" ] || pkg_arch=$buildarch + pkg_version=${pkg_header[2]}; + pkg_release=${pkg_header[3]}; + pkg_group=${pkg_header[4]}; + pkg_license=${pkg_header[5]}; + pkg_size=${pkg_header[6]}; + pkg_buildtime=${pkg_header[7]}; + pkg_altrep=${pkg_header[8]}; + pkg_repository=${pkg_header[9]}; + return 0 + fi + done + return 0 +} + +function import_file() { + [ $1 ] || exit 1 + + local f import_mode + f=$1 + import_mode=$2 + if [ "$import_mode" = "backup" ]; then + curl_delete_add="-Q '-DELE $f'" + else + curl_delete_add="" + fi + + [ "$simulate" = "1" ] && return + + if [ "$ORIG_MODE" = "remote" ]; then + if [ $ORIG_URL_LOCAL_ARCH -a ! -f $ORIG_URL_LOCAL_ARCH/$f ]; then + echo "Warning: package missing in local mirror; setting copy from remote repository." + fi + + if [ "$DEST_MODE" = "local" ]; then + # remote -> local + if [ $ORIG_URL_LOCAL_ARCH -a -f $ORIG_URL_LOCAL_ARCH/$f ]; then + echo -n "(L) " + # if file exists in a local mirror use it by preference + cp $ORIG_URL_LOCAL_ARCH/$f $DEST_URL_ARCH/ || { + echo "Error: cannot move file $ORIG_URL_LOCAL_ARCH/$f to $DEST_URL_ARCH/$f; aborting." + exit 1 + } + #chown ftp$DEST_REPOSITORY:users $DEST_URL_ARCH/$f + eval curl -s -u${AUTODIST_REPOSITORIES_REMOTE_FTPUSER}:${AUTODIST_REPOSITORIES_REMOTE_FTPPASS} $ORIG_URL_ARCH $curl_delete_add >/dev/null && { + rm -f $ORIG_URL_LOCAL_ARCH/$f + touch $ORIG_URL_LOCAL_ARCH + } || { + echo + echo "Warning: cannot delete remote file $ORIG_URL_ARCH/$f; you'll have to delete it." + } + else + echo -n "(R) " + curl -s -u${AUTODIST_REPOSITORIES_REMOTE_FTPUSER}:${AUTODIST_REPOSITORIES_REMOTE_FTPPASS} \ + --get $ORIG_URL_ARCH/$f \ + -o $DEST_URL_ARCH/$f $curl_delete_add || { + echo + echo "Error: cannot get file $ORIG_URL_ARCH/$f; aborting." + exit 1 + } + fi + else + # remote -> remote + echo "Error: remote to remote file import is not implemented yet; aborting." + exit 1 + fi + else + if [ "$DEST_MODE" = "local" ]; then + # local -> local + cp $ORIG_URL_ARCH/$f $DEST_URL_ARCH/ || { + echo "Error: cannot copy file $ORIG_URL_ARCH/$f to $DEST_URL_ARCH/$f; aborting." + exit 1 + } + #chown ftp$DEST_REPOSITORY:users $DEST_URL_ARCH/$f + touch $DEST_URL_ARCH + if [ "$import_mode" = "backup" ]; then + rm -f $ORIG_URL_ARCH/$f || { + echo "Error: cannot remove file $ORIG_URL_ARCH/$f; aborting." + exit 1 + } + touch $ORIG_URL_ARCH + fi + else + # local -> remote + echo -n "(R) " + curl -s -u${AUTODIST_REPOSITORIES_REMOTE_FTPUSER}:${AUTODIST_REPOSITORIES_REMOTE_FTPPASS} \ + -T $ORIG_URL_ARCH/$f \ + $DEST_URL_ARCH/ || { + echo + echo "Error: cannot send file $ORIG_URL_ARCH/$f; aborting." + exit 1 + } + rm -f $ORIG_URL_ARCH/$f || { + echo + echo "Warning: cannot delete local file $ORIG_URL_ARCH/$f; you'll have to delete it." + } + touch $ORIG_URL_ARCH + fi + fi + +} + +function backup_local_file() { + [ $1 ] || return + + [ -e $LOCAL_BACKUP ] || mkdir -p $LOCAL_BACKUP + movefiles=$1 + + #`find $DEST_URL_ARCH -maxdepth 1 -regex ".*/${pkgname}-[^-]*-[^-]*"` + for m in $movefiles; do + echo "backing up $m" + if [ "$simulate" != "1" ]; then + mv $m $LOCAL_BACKUP/ || { + echo "Error: can't move $m to $LOCAL_BACKUP; aborting." + exit 1 + } + touch `dirname $m` + fi + done + +} + +function backup_package() { + local rep reg i + + [ "$1" ] || return + [ "$2" ] && rep=$2 || rep=$destrepository + [ "$3" ] && reg=$3 || reg=$DESTREGFILE + + archive_pkg=$1 + + get_pkg_buildinfo $rep any $archive_pkg + + if [ ! "$pkg_name" ]; then + get_pkg_srcinfo $rep $archive_pkg + if [ "$pkg_name" ]; then + echo "Warning: only source package has been found in repository" + fi + fi + + if [ "$pkg_name" ]; then + LOCAL_BACKUP=$DEST_URL_LOCAL/$rep/old/${pkg_name}_${BACKUP_DATE} + PKG_FILENAME="$pkg_name-$pkg_version-$pkg_release.src.rpm" + + if [ -f $DEST_URL_LOCAL/$rep/SRPMS.base/$PKG_FILENAME ]; then + backup_local_file $DEST_URL_LOCAL/$rep/SRPMS.base/$PKG_FILENAME + else + echo "Warning: package $PKG_FILENAME does not exist in local repository" + fi + + if [ "$simulate" != "1" -a "$DEST_MODE" = "remote" ]; then + curl -s -u${AUTODIST_REPOSITORIES_REMOTE_FTPUSER}:${AUTODIST_REPOSITORIES_REMOTE_FTPPASS} $DEST_URL/$rep/SRPMS.base/ -Q "-DELE $PKG_FILENAME" >/dev/null || { + echo "Warning: cannot delete remote file $DEST_URL/$rep/SRPMS.base/$PKG_FILENAME; you'll have to delete it." + } + fi + + for a in ${pkg_archs[*]}; do + get_pkg_buildinfo $rep $a $archive_pkg + + for i in ${pkg_builds[*]}; do + PKG_FILENAME="$i-$pkg_version-$pkg_release.$pkg_arch.rpm" + if [ -f $DEST_URL_LOCAL/$rep/RPMS.$a/$PKG_FILENAME ]; then + backup_local_file $DEST_URL_LOCAL/$rep/RPMS.$a/$PKG_FILENAME + else + echo "Warning: package $PKG_FILENAME does not exist in local repository" + fi + + if [ "$simulate" != "1" -a "$DEST_MODE" = "remote" ]; then + curl -s -u${AUTODIST_REPOSITORIES_REMOTE_FTPUSER}:${AUTODIST_REPOSITORIES_REMOTE_FTPPASS} $DEST_URL/$rep/RPMS.$a/ -Q "-DELE $PKG_FILENAME" >/dev/null || { + echo "Warning: cannot delete remote file $DEST_URL/$rep/RPMS.$pkg_arch/$PKG_FILENAME; you'll have to delete it." + } + fi + done + done + + # write register + [ "$simulate" != "1" ] && { + echo "`date +%Y%m%d%H%M` Package $pkg_name ($pkg_version-$pkg_release) archived" >> $reg +# | \ +# tee -a $ORIGREGFILE $DESTREGFILE >/dev/null +# echo "`date +%Y%m%d%H%M` \"\" \"package $pkg_name ($pkg_version-$pkg_release) archived from $rep\"" >> $reg + } + else + echo "Warning: package $archive_pkg does not exists in $rep; skipping." + fi +} + +function restore_local_file() { + [ $1 ] || return + [ $2 ] || return + [ $4 ] || return + + local restorefiles=$1 + local backupprefix=$2 + local ARCH=$3 + local restorerepository=$4 + + #`find $DEST_URL_ARCH -maxdepth 1 -regex ".*/${pkgname}-[^-]*-[^-]*"` + for r in $restorefiles; do + [ "$ARCH" ] && restoredest=$DEST_URL_LOCAL/$restorerepository/RPMS.$ARCH/ || restoredest=$DEST_URL_LOCAL/$restorerepository/SRPMS.base/ + echo "restoring $r to $restorerepository" + if [ "$simulate" != "1" ]; then + cp ${backupprefix}/$r $restoredest || { + echo "Error: can't copy $p to $restoredest; aborting." + exit 1 + } + touch $restoredest + fi + done + +} + +function restore_package() { + local rep reg i + + [ "$1" ] || return + [ "$2" ] && rep=$2 || rep=$destrepository + [ "$3" ] && reg=$3 || reg=$DESTREGFILE + + restore_pkg=$1 + + get_pkg_buildinfo $rep any $restore_pkg + + if [ ! "$pkg_name" ]; then + echo "Info: package $restore_pkg does not exists in $rep" + fi + + LOCAL_RESTORE_PREFIX=$DEST_URL_LOCAL/$rep/old/${restore_pkg}_ + + local cnt=0 + local RESTORE_NAMES=() + ls ${LOCAL_RESTORE_PREFIX}* &>/dev/null && \ + for f in ${LOCAL_RESTORE_PREFIX}*; do + [ "$cnt" = 0 ] && echo "Available backups: " + cnt=`expr $cnt + 1` + RESTORE_NAMES=(${RESTORE_NAMES[*]} `echo ${f/*_/}`) + echo "($cnt) ${RESTORE_NAMES[$cnt-1]}" + done + [ "$cnt" == "0" ] && { + echo "Sorry, no backups availables for ${restore_pkg} in $rep" + return + } + local ans=0 + while [ $ans -le 0 2>/dev/null -o $ans -gt $cnt 2>/dev/null ]; do + echo + echo -n "Please select the entry to restore or press ENTER to skip (1-$cnt): " + read ans + [ "$ans" ] || return + [ $ans -eq $ans 2>/dev/null ] || ans=0 + done + + echo "Restoring: " + for f in `ls ${LOCAL_RESTORE_PREFIX}${RESTORE_NAMES[$ans-1]}`; do + echo -n "${f/*\/} " + done + echo + echo -n "Ok to restore [y/N]? " + read ans1 + [ "$ans1" != "y" -a "$ans1" != "Y" ] && return + + for a in ${AUTODIST_ARCHS[*]}; do + for f in `ls ${LOCAL_RESTORE_PREFIX}${RESTORE_NAMES[$ans-1]}/*.${a}.rpm 2>/dev/null`; do + restore_local_file ${f/*\/} ${LOCAL_RESTORE_PREFIX}${RESTORE_NAMES[$ans-1]}/ $a $rep + done + done + + for f in `ls ${LOCAL_RESTORE_PREFIX}${RESTORE_NAMES[$ans-1]}/*.src.rpm 2>/dev/null`; do + restore_local_file ${f/*\/} ${LOCAL_RESTORE_PREFIX}${RESTORE_NAMES[$ans-1]}/ "" $rep + done + + # write register + [ "$simulate" != "1" ] && { + echo "`date +%Y%m%d%H%M` Package $restore_pkg restored" >> $reg + } +} + +function import_package() { + [ $1 ] || exit 1 + + local import_pkg import_mode + + import_pkg=$1 + import_mode=$2 + + # check for all architectures + for a in ${AUTODIST_ARCHS[*]}; do + # check release in dest repository + get_pkg_buildinfo $destrepository $a $import_pkg + [ "$pkg_name" ] && { +# IMPORT_ORIG_ARCHS=(${IMPORT_ORIG_ARCHS[*]} $a) + get_pkg_buildinfo $origrepository $a $import_pkg + [ "$pkg_name" ] || { + [ "$a" == "$basearch" ] && { + echo "Error: package $import_pkg does not exist in $origrepository($a); skipping." + return + } + if [ "$force" = "1" ]; then + echo "Warning: package $import_pkg is missing in $origrepository($a) but present in $destrepository($a)." + echo "Import forced. You will need to port package to the missing arch." + else + echo "Error: package $import_pkg is missing in $origrepository($a). This would break package in $destrepository($a) repository." + return 255 + fi + } + } + done + + # check release in dest repository + get_pkg_buildinfo $destrepository any $import_pkg + + [ "$pkg_version" ] && { + destpkgname="$pkg_name" + destpkgversion="$pkg_version-$pkg_release" +# destpkgarch="$pkg_arch" + } || destpkgversion="none" + + get_pkg_buildinfo $origrepository any $import_pkg + + [ "$pkg_version" ] && { + origpkgname="$pkg_name" + origpkgversion="$pkg_version-$pkg_release" +# origpkgarch="$pkg_arch" + } || origpkgversion="none" + + [ $origpkgname ] || { + echo "Error: package $import_pkg does not exist in $origrepository; aborting." + exit 1 + } + + DEST_URL_ARCH=$DEST_URL/$destrepository/SRPMS.base/ + ORIG_URL_ARCH=$ORIG_URL/$origrepository/SRPMS.base/ + ORIG_URL_LOCAL_ARCH=$ORIG_URL_LOCAL/$origrepository/SRPMS.base/ + + PKG_FILENAME="$origpkgname-$origpkgversion.src.rpm" + + [ "$ORIG_MODE" = "remote" ] && + ORIG_FILELIST=`curl -s -l -u${AUTODIST_REPOSITORIES_REMOTE_FTPUSER}:${AUTODIST_REPOSITORIES_REMOTE_FTPPASS} --url $ORIG_URL_ARCH/` || + ORIG_FILELIST=`ls $ORIG_URL_ARCH` + + check_existence=0; + + for i in $ORIG_FILELIST; do + [ "$i" = "$PKG_FILENAME" ] && check_existence=1; + done + + if [ $check_existence = 1 ]; then + + [ "$destpkgversion" = "$origpkgversion" ] && { + echo "Warning: same version of $origpkgname exists in destination" + } + + if [ "$assume_yes" != "1" ]; then + echo -n "Import $PKG_FILENAME $origpkgversion($origrepository) -> $destpkgversion($destrepository) [y/N]?" + read ans + fi + + [ "$assume_yes" = "1" -o "$ans" = "y" -o "$ans" = "Y" ] && { + + echo -n "Importing $PKG_FILENAME " + + import_file $PKG_FILENAME $import_mode + + get_pkg_buildinfo $origrepository any $import_pkg + + for a in ${pkg_archs[*]}; do + get_pkg_buildinfo $origrepository $a $import_pkg + for i in ${pkg_builds[*]}; do + PKG_FILENAME="$i-$origpkgversion.$pkg_arch.rpm" + DEST_URL_ARCH=$DEST_URL/$destrepository/RPMS.$a/ + ORIG_URL_ARCH=$ORIG_URL/$origrepository/RPMS.$a/ + ORIG_URL_LOCAL_ARCH=$ORIG_URL_LOCAL/$origrepository/RPMS.$a/ + echo -n "$PKG_FILENAME " + import_file $PKG_FILENAME $import_mode + done + done + echo + + # write register + [ "$simulate" != "1" ] && { + echo "`date +%Y%m%d%H%M` Package $import_pkg ($origpkgversion -> $destpkgversion) imported from $origrepository to $destrepository" | \ + tee -a $ORIGREGFILE $DESTREGFILE >/dev/null + } + +# if [ "$import_mode" = "backup" ]; then + # backup old stuff in destination repository + [ "$destpkgversion" != "none" -a \ + "$destpkgversion" != "$origpkgversion" ] && { + backup_package $import_pkg $destrepository $DESTREGFILE + } + # remove distromatic extra files associated with this package + [ -e ${LOCAL_REPS_BASE_DIR}/distromatic/$rep/warnings/$import_pkg.in ] && { + rm -f ${LOCAL_REPS_BASE_DIR}/distromatic/$rep/warnings/$import_pkg.in || + echo "Warning: cannot remove file ${LOCAL_REPS_BASE_DIR}/distromatic/$rep/warnings/$import_pkg.in" + } +# fi + + #for i in ${pkg_obsoletes}; do + # PKG_FILENAME="$i-$pkg_version-$pkg_release.$namearch.rpm" + # DEST_URL_ARCH=$DEST_URL/$destrepository/RPMS.$namearch/$PKG_FILENAME + # [ -e $DEST_URL_ARCH ] && echo "Warning: obsoleted package $i exists" + # backup_package $i $destrepository $DESTREGFILE + # #echo rm $DEST_URL_ARCH + #done + + } # ans = y + + else # check_existence != 1 + echo "Warning: $import_pkg reported by distromatic does no longer exist" + fi +} + +# FIXME: only works with basearch +function extract_diffinfo() { + PKG=$1 + REP=$2 + TMP=$3 + local i + + get_pkg_buildinfo $REP $basearch $PKG + if [ "$pkg_name" ]; then + PKG_FILENAME="${LOCAL_REPS_BASE_DIR}/$REP/SRPMS.base/$pkg_name-$pkg_version-$pkg_release.src.rpm" + [ -e "$PKG_FILENAME" ] || { + echo "Error: package $PKG_FILENAME missing in $origrepository; skipping" + return 1 + } + local filesize=`stat -c %s $PKG_FILENAME` + [ $filesize -gt 1073741824 ] && { + echo "Warning: $PKG_FILENAME size of $filesize is more than 1GB; skipping" + return 1 + } + rpm -qp $PKG_FILENAME --requires > $TMP/buildrequires + + autospec -q -x $PKG_FILENAME -F \*.spec --destdir $TMP >/dev/null || { + echo "Error: could not extract specfile from $PKG_FILENAME; skipping package" + return 1 + } + [ -e "$TMP_SPEC_DIR/$pkg_name.spec" ] || { + SPEC_FOUND="`ls $TMP_SPEC_DIR/*.spec`" + mv $SPEC_FOUND $TMP_SPEC_DIR/$pkg_name.spec + echo "Warning: specfile name should be $pkg_name.spec instead of ${SPEC_FOUND/*\//} in $REP repository" + } + > $TMP/requires + > $TMP/provides + for i in ${pkg_builds[*]}; do + PKG_FILENAME="${LOCAL_REPS_BASE_DIR}/$REP/RPMS.$basearch/$i-$pkg_version-$pkg_release.$pkg_arch.rpm" + [ -e "$PKG_FILENAME" ] || { + echo "Error: package $PKG_FILENAME missing in $origrepository; skipping" + return 1 + } + rpm -qp $PKG_FILENAME --requires >> $TMP/requires + rpm -qp $PKG_FILENAME --provides >> $TMP/provides + rpm -qlp $PKG_FILENAME >> $TMP/files + done + else + #echo "Warning: can't find package $PKG in $REP repository" + return 1 + fi + return 0 +} + +[ $1 ] || { usage; exit 1; } + +origrepository= +destrepository=devel +packages= +command= +simulate=0 + +while [ "$1" ]; do + case $1 in + -d) + destrepository=$2; shift ;; + -r) + searchrep=$2; shift ;; + -s) + simulate=1 ;; + -t) + shift + warningtext="$@" + break ;; + -f) + force=1 ;; + -i) + ignorecase=1 ;; + -y) + assume_yes=1 ;; + *) + if [ "$command" ]; then + case "$command" in + "import"|"release"|"query"|"verify"|"archive"|"restore"|"diff"|"inspect"|"setwarning"|"distromatic") + [ "$origrepository" ] && + packages="$packages $1" || + origrepository=$1 + ;; + "search") + [ "$searchstring" ] && { + echo "Error: invalid option $1; aborting." + exit 1 + } + searchstring="$1" + ;; + *) usage + echo "Error: invalid option $1; aborting." + exit 1 + ;; + esac + else + case "$1" in + "import"|"release"|"query"|"verify"|"archive"|"restore"|"list"|"diff"|"inspect"|"setwarning"|"distromatic"|"search") command=$1 ;; + *) + usage + echo "Errror: $1 is not a valid command; aborting." + exit 1 + ;; + esac + fi + ;; + esac + shift +done +[ "$command" = "" ] && { usage; exit 1; } + +#[ "$command" = "list" ] && echo "Local repositories:" +for a in ${AUTODIST_REPOSITORIES_LOCAL_REPS[*]}; do + [ "$a" = "$destrepository" ] && DEST_MODE=local; + [ "$a" = "$origrepository" ] && ORIG_MODE=local; + [ "$command" = "list" ] && echo "$a" +done +#[ "$command" = "list" ] && echo "Remote repositories:" +for a in ${AUTODIST_REPOSITORIES_REMOTE_REPS[*]}; do + [ "$a" = "$destrepository" ] && DEST_MODE=remote; + [ "$a" = "$origrepository" ] && ORIG_MODE=remote; + [ "$command" = "list" ] && echo "$a" +done +[ "$command" = "list" ] && exit 0; + +[ "$command" = "search" ] && { + [ "$ignorecase" ] && GREP_OPTS="-i" + for rep in ${AUTODIST_REPOSITORIES_LOCAL_REPS[*]} ${AUTODIST_REPOSITORIES_REMOTE_REPS[*]}; do + [[ "$rep" =~ "$searchrep" ]] || continue + [ -r ${LOCAL_REPS_BASE_DIR}/$rep/SRPMS.base ] || continue + ls ${LOCAL_REPS_BASE_DIR}/$rep/SRPMS.base | grep $GREP_OPTS "$searchstring" 2>/dev/null | \ + while read PKGLINE; do + [ "$PKGLINE" ] && { + echo "$rep(source): ${PKGLINE/ *}" + } + done + for a in ${AUTODIST_ARCHS[*]}; do + [ -r ${LOCAL_REPS_BASE_DIR}/$rep/RPMS.$a ] || continue + ls ${LOCAL_REPS_BASE_DIR}/$rep/RPMS.$a | grep $GREP_OPTS "$searchstring" 2>/dev/null | \ + while read PKGLINE; do + [ "$PKGLINE" ] && { + echo "$rep($a): ${PKGLINE/ *}" + } + done + done + done + exit 0 +} + +[ "$origrepository" ] || { usage; exit 1; } +SRCPKGLIST="${LOCAL_REPS_BASE_DIR}/$origrepository/srcpkglist" + +[ "$DEST_MODE" ] || { echo "Error: $destrepository is not a valid repository; aborting."; exit 1; } +[ "$ORIG_MODE" ] || { echo "Error: $origrepository is not a valid repository; aborting."; exit 1; } +[ "$DEST_MODE" = "remote" ] && { echo "Waring: destination is a remote repository; this is an EXPERIMENTAL feature."; } + +[ "$command" = "query" ] && { + [ "$packages" ] || { usage; exit 1; } + for i in $packages; do + get_pkg_buildinfo $origrepository any $i + if [ ! "$pkg_name" ]; then + echo "$i: package not found in $origrepository repository" + else + for a in ${pkg_archs[*]}; do + get_pkg_buildinfo $origrepository $a $i + if [ "$pkg_name" ]; then + echo "Repository:$origrepository($a)" + echo "Name: $pkg_name" + echo "BuildArch: $pkg_arch" + echo "Version: $pkg_version" + echo "Release: $pkg_release" + echo "Group: $pkg_group" + echo "License: $pkg_license" + echo "Size: $pkg_size" + echo "Builds: ${pkg_builds[*]}" + echo "Obsoletes: ${pkg_obsoletes[*]}" + echo + fi + done + fi + done + exit 0; +} + +[ "$command" = "verify" ] && { + [ "$packages" ] || { + get_pkg_buildinfo $origrepository any + packages=${pkg_list[*]} + } + for i in $packages; do + get_pkg_buildinfo $origrepository any $i + if [ ! "$pkg_name" ]; then + echo "$i: package not found in $origrepository repository" + else + PKG_FILENAME="$i-$pkg_version-$pkg_release.src.rpm" + rpm2cpio ${LOCAL_REPS_BASE_DIR}/${origrepository}/SRPMS.base/$PKG_FILENAME &>/dev/null || { + echo "Warning: source package $PKG_FILENAME is empty or corrupted." + } + + for a in ${AUTODIST_ARCHS[*]}; do + get_pkg_buildinfo $origrepository $a $i + if [ "$pkg_name" ]; then + for l in ${pkg_builds[*]}; do + PKG_FILENAME="$l-$pkg_version-$pkg_release.$pkg_arch.rpm" + rpm2cpio ${LOCAL_REPS_BASE_DIR}/${origrepository}/RPMS.$a/$PKG_FILENAME &>/dev/null || { + echo "Warning: package $PKG_FILENAME($a) is empty or corrupted." + } + done + fi + done + fi + done + exit 0; +} + +[ "$command" = "diff" ] && { + [ "$packages" ] || { + get_pkg_buildinfo $origrepository any + packages=${pkg_list[*]} + } + TMP_SPEC_DIR=`mktemp -d --tmpdir=/dev/shm` + for i in $packages; do + echo + echo "*******************************************************************" + echo "$i package check:" + echo "*******************************************************************" + + extract_diffinfo $i $origrepository $TMP_SPEC_DIR || continue + [ -e $TMP_SPEC_DIR/$i.spec ] || { + echo "Error: could not extract specfile for $i in $origrepository repository; skipping" + continue + } + mv $TMP_SPEC_DIR/$i.spec $TMP_SPEC_DIR/$i.spec.origrep + mv $TMP_SPEC_DIR/files $TMP_SPEC_DIR/files.origrep + sort -u $TMP_SPEC_DIR/buildrequires > $TMP_SPEC_DIR/buildrequires.origrep + sort -u $TMP_SPEC_DIR/requires > $TMP_SPEC_DIR/requires.origrep + sort -u $TMP_SPEC_DIR/provides > $TMP_SPEC_DIR/provides.origrep + + extract_diffinfo $i $destrepository $TMP_SPEC_DIR || { + echo "Looks like a new package; inspecting data:" + echo "" + echo "SPECFILE:" + echo "=========" + cat $TMP_SPEC_DIR/$i.spec.origrep + echo "" + echo "REQUIRES:" + echo "=========" + cat $TMP_SPEC_DIR/requires.origrep + echo "" + echo "PROVIDES:" + echo "=========" + cat $TMP_SPEC_DIR/provides.origrep + echo "" + echo "FILES:" + echo "======" + cat $TMP_SPEC_DIR/files.origrep + continue + } + [ -e $TMP_SPEC_DIR/$i.spec ] || { + echo "Error: could not extract specfile for $i in $destrepository repository; skipping" + } + mv $TMP_SPEC_DIR/$i.spec $TMP_SPEC_DIR/$i.spec.destrep + mv $TMP_SPEC_DIR/files $TMP_SPEC_DIR/files.destrep + sort -u $TMP_SPEC_DIR/buildrequires > $TMP_SPEC_DIR/buildrequires.destrep + sort -u $TMP_SPEC_DIR/requires > $TMP_SPEC_DIR/requires.destrep + sort -u $TMP_SPEC_DIR/provides > $TMP_SPEC_DIR/provides.destrep + + echo "Showing differences between package version in $origrepository and $destrepository:" + echo "" + echo "SPECFILE:" + echo "=========" + diff -u $TMP_SPEC_DIR/$i.spec.destrep $TMP_SPEC_DIR/$i.spec.origrep + echo "" + echo "BUILDREQUIRES:" + echo "==============" + diff -u $TMP_SPEC_DIR/buildrequires.destrep $TMP_SPEC_DIR/buildrequires.origrep + echo "" + echo "REQUIRES:" + echo "=========" + diff -u $TMP_SPEC_DIR/requires.destrep $TMP_SPEC_DIR/requires.origrep + echo "" + echo "PROVIDES:" + echo "=========" + diff -u $TMP_SPEC_DIR/provides.destrep $TMP_SPEC_DIR/provides.origrep + echo "" + echo "FILES:" + echo "======" + diff -u $TMP_SPEC_DIR/files.destrep $TMP_SPEC_DIR/files.origrep + echo + done + rm -rf $TMP_SPEC_DIR + exit 0; +} + +[ "$command" = "setwarning" ] && { + [ "$packages" ] || { usage; exit 1; } + TMP_SPEC_DIR=`mktemp -d` + for i in $packages; do + extract_diffinfo $i $origrepository $TMP_SPEC_DIR + [ -e $TMP_SPEC_DIR/$i.spec ] || { + echo "Error: could not extract specfile for $i in $origrepository repository; aborting." + exit 1 + } + echo "$warningtext" > ${LOCAL_REPS_BASE_DIR}/distromatic/$origrepository/warnings/$i.in + done + [ "$TMP_SPEC_DIR" != "/" ] && rm -rf $TMP_SPEC_DIR + exit 0 +} + +[ "$command" = "inspect" ] && { + [ "$packages" ] || { usage; exit 1; } + TMP_SPEC_DIR=`mktemp -d` + for i in $packages; do + extract_diffinfo $i $origrepository $TMP_SPEC_DIR + [ -e $TMP_SPEC_DIR/$i.spec ] || { + echo "Error: could not extract specfile for $i in $origrepository repository; aborting." + exit 1 + } + echo "$i: details of package in $origrepository repository" + echo "" + echo "SPECFILE:" + echo "=========" + cat $TMP_SPEC_DIR/$i.spec + echo "" + echo "REQUIRES:" + echo "=========" + cat $TMP_SPEC_DIR/requires + echo "" + echo "PROVIDES:" + echo "=========" + cat $TMP_SPEC_DIR/provides + done + [ "$TMP_SPEC_DIR" != "/" ] && rm -rf $TMP_SPEC_DIR + exit 0; +} + +[ "$command" = "distromatic" ] && { + [ -r $SRCPKGLIST ] || { + echo "Error: srcpkglist file missing for $origrepository repository; aborting." + exit 1 + } + [ -d ${LOCAL_REPS_BASE_DIR}/$origrepository/specs ] || mkdir ${LOCAL_REPS_BASE_DIR}/$origrepository/specs + [ -d ${LOCAL_REPS_BASE_DIR}/$origrepository/patches ] || mkdir ${LOCAL_REPS_BASE_DIR}/$origrepository/patches + + while read line; do + set -- $line + [ -e ${LOCAL_REPS_BASE_DIR}/$origrepository/SRPMS.base/$1-$2-$6.src.rpm ] && { + [ ${LOCAL_REPS_BASE_DIR}/$origrepository/SRPMS.base/$1-$2-$6.src.rpm -nt \ + ${LOCAL_REPS_BASE_DIR}/$origrepository/specs/$1.spec ] && { +# echo ${LOCAL_REPS_BASE_DIR}/$origrepository/SRPMS.base/$1-$2-$6.src.rpm + autospec -x ${LOCAL_REPS_BASE_DIR}/$origrepository/SRPMS.base/$1-$2-$6.src.rpm -F '*.spec' \ + --destdir ${LOCAL_REPS_BASE_DIR}/$origrepository/specs/ -q >/dev/null + touch ${LOCAL_REPS_BASE_DIR}/$origrepository/specs/$1.spec + grep -i "^Patch[0-9]*:" ${LOCAL_REPS_BASE_DIR}/$origrepository/specs/$1.spec &>/dev/null && { + autospec -x ${LOCAL_REPS_BASE_DIR}/$origrepository/SRPMS.base/$1-$2-$6.src.rpm -F '*.patch' \ + --destdir ${LOCAL_REPS_BASE_DIR}/$origrepository/patches/ -q >/dev/null + } + } + } + done < $SRCPKGLIST + exit 0 +} + +[ "$simulate" = "1" ] && echo "Simulation mode enabled." +# +# import and other active commands +# +if [ "$DEST_MODE" = "remote" ]; then + DEST_URL=${AUTODIST_REPOSITORIES_REMOTE_FTP}/pub/openmamba +else + DEST_URL=${LOCAL_REPS_BASE_DIR} +fi +DEST_URL_LOCAL=${LOCAL_REPS_BASE_DIR} + +# ORIG_URL_LOCAL is set if a local copy of the repository exists +# and will be preferred for file transfer optimizations +if [ "$ORIG_MODE" = "remote" ]; then + ORIG_URL=${AUTODIST_REPOSITORIES_REMOTE_FTP}/pub/openmamba +else + ORIG_URL=${LOCAL_REPS_BASE_DIR} +fi +ORIG_URL_LOCAL=${LOCAL_REPS_BASE_DIR} + +BACKUP_DATE=`date +%y%m%d.%H%M%S` +LOCAL_BACKUP=$DEST_URL/$destrepository/old + +# operation files are always in the local copy of the repository +ORIGREGFILE=${LOCAL_REPS_BASE_DIR}/$origrepository/operations.log.html +DESTREGFILE=${LOCAL_REPS_BASE_DIR}/$destrepository/operations.log.html + + +[ "$command" = "archive" ] && { + DEST_URL=$ORIG_URL + DEST_URL_LOCAL=$ORIG_URL_LOCAL + DEST_MODE=$ORIG_MODE + + [ "$packages" ] || { usage; exit 1; } + + for i in $packages; do + backup_package $i $origrepository $ORIGREGFILE + done + + exit 0 +} + +[ "$command" = "restore" ] && { + DEST_URL=$ORIG_URL + DEST_URL_LOCAL=$ORIG_URL_LOCAL + DEST_MODE=$ORIG_MODE + + [ "$ORIG_MODE" = "remote" ] && { + echo "Error: restore is only implemented in local repository; exiting." + exit 1 + } + [ "$packages" ] || { usage; exit 1; } + + for i in $packages; do + restore_package $i $origrepository $ORIGREGFILE + done + + exit 0 + +} + +[ "$command" = "import" -o "$command" = "release" ] && { + + [ "$origrepository" = "$destrepository" ] && { + echo "Error: source and destination repository cannot be the same; aborting."; exit 1; } + + if [ "$command" = "import" ]; then + echo "Importing $1: $origrepository ($ORIG_MODE) => $destrepository ($DEST_MODE)" + backup_mode=backup + else + echo "Releasing $1: $origrepository ($ORIG_MODE) => $destrepository ($DEST_MODE)" + backup_mode=release + fi + + if [ ! "$packages" ]; then + get_packages_from_last_build $origrepository + fi + + for i in ${packages[*]}; do + import_package $i $backup_mode + if [ $? -eq 255 -a "${AUTODIST_REPOSITORIES_TRANSITIONAL_REP}" -a \ + "${AUTODIST_REPOSITORIES_TRANSITIONAL_REP}" != "$destrepository" -a \ + "${AUTODIST_REPOSITORIES_TRANSITIONAL_REP}" != "$origrepository" -a \ + "${AUTODIST_REPOSITORIES_TRANSITIONAL_REP/-*}" = "${destrepository/-*}" ]; then + echo "Use -f to force import to $destrepository; now trying to import to ${AUTODIST_REPOSITORIES_TRANSITIONAL_REP} instead." + destrepositorysave=$destrepository + destrepository=${AUTODIST_REPOSITORIES_TRANSITIONAL_REP} + import_package $i $backup_mode + destrepository=$destrepositorysave + fi + done + + exit 0 +} + +usage +echo "Error: $command is not a valid command; aborting." +exit 1 diff --git a/automaint b/automaint index d0c57cf..ae4728a 100755 --- a/automaint +++ b/automaint @@ -1,6 +1,6 @@ #!/bin/bash # automaint -- batch automatic maintainance tool of the autodist suite -# Copyright (C) 2013 by Silvan Calarco +# Copyright (C) 2013-2014 by Silvan Calarco # # Released under the terms of the GNU GPL release 3 license # @@ -212,7 +212,7 @@ for p in ${pkglist[0]}; do if [ "$needsport" ]; then echo "$p: importing from $SOURCE_REPOSITORY to $PORT_REPOSITORY ($spkg_version-$spkg_release -> $pkg_version-$pkg_release)" if [ ! "$TESTMODE" ]; then - openmamba-repository import $SOURCE_REPOSITORY $p -d $PORT_REPOSITORY -y >/dev/null + autodist-repository import $SOURCE_REPOSITORY $p -d $PORT_REPOSITORY -y >/dev/null if [ $? -eq 0 -a "$WEBBUILD_URL" -a "$WEBBUILD_USER" ]; then curl -s "$WEBBUILD_URL?REQUEST=message&USER=$WEBBUILD_USER&SECRET=${WEBBUILD_SECRET}&USER_EMAIL=$WEBBUILD_EMAIL&\ MESSAGE=`cgi_encodevar \"imported $p from $SOURCE_REPOSITORY to $PORT_REPOSITORY for porting\"`" >/dev/null @@ -221,7 +221,7 @@ MESSAGE=`cgi_encodevar \"imported $p from $SOURCE_REPOSITORY to $pkg_version-$pkg_release; update type: $update_type)" if [ ! "$TESTMODE" ]; then - openmamba-repository import $SOURCE_REPOSITORY $p -d $DEST_REPOSITORY -y >/dev/null + autodist-repository import $SOURCE_REPOSITORY $p -d $DEST_REPOSITORY -y >/dev/null if [ $? -eq 0 -a "$WEBBUILD_URL" -a "$WEBBUILD_USER" ]; then curl -s "$WEBBUILD_URL?REQUEST=message&USER=$WEBBUILD_USER&SECRET=${WEBBUILD_SECRET}&USER_EMAIL=$WEBBUILD_EMAIL&\ MESSAGE=`cgi_encodevar \"imported $p from $SOURCE_REPOSITORY to $DEST_REPOSITORY\"`" >/dev/null diff --git a/webbuild/html/scripts/socialbox.js b/webbuild/html/scripts/socialbox.js index 558aa83..d28bbae 100644 --- a/webbuild/html/scripts/socialbox.js +++ b/webbuild/html/scripts/socialbox.js @@ -47,7 +47,6 @@ var socialbox_reloadtime = 15000; function ajax_getvalues_refresh(request,user,user_email,secret) { var fromid = 0; -//alert("refresh"); if (socialbox_interval != null) { clearInterval(socialbox_interval); } diff --git a/webbuild/webbuild-cgi b/webbuild/webbuild-cgi index 6912698..6334f8a 100755 --- a/webbuild/webbuild-cgi +++ b/webbuild/webbuild-cgi @@ -14,7 +14,7 @@ cgi_getvars BOTH ALL [ "$PACKAGE" ] && PACKAGEENCODED=`cgi_encodevar "$PACKAGE"` || PACKAGEENCODED= #cgi_getvars POST -if [ "$REQUEST" != "refresh" ]; then +if [ "${REQUEST:0:7}" != "refresh" ]; then echo "`date` - USER=$USER&REQUEST=$REQUEST&ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGE&MAINTAINERMODE=$MAINTAINERMODE" >> $LOG fi @@ -65,7 +65,7 @@ if [ "$USER" ]; then else USER_ENABLED= fi - elif [ "$REQUEST" != "refresh" ]; then + elif [ "${REQUEST:0:7}" != "refresh" ]; then # no "$USER_SECRET" set; require password echo -n " " echo -n " " echo -n " " @@ -210,48 +210,53 @@ fi # # Public requests # -if [ "$REQUEST" = "refresh" -o ! "$USER" ]; then - [ -e "$WEBBUILD_STATEDIR/social_log" ] || exit - # social box - echo -n "" - count=0 - if [ ! "$FROMID" -o "$FROMID" = "0" -o "$FROMID" = "NaN" ]; then - if [ "$USER" ]; then - line=`tail -n 500 $WEBBUILD_STATEDIR/social_log | grep -v " SUSER=$USER " 2>/dev/null | tail -n 25 | head -n 1` - else - line=`tail -n 500 $WEBBUILD_STATEDIR/social_log | grep -v " STARGET=developers " 2>/dev/null | tail -n 25 | head -n 1` +if [ "$REQUEST" = "refresh" -o "$REQUEST" = "refreshsocial" -o ! "$USER" ]; then + if [ "$WEBBUILD_URL" -a "$USER" ]; then + curl -s "$WEBBUILD_URL?REQUEST=refreshsocial&USER=$USER&SECRET=`cgi_encodevar \"$USER_SECRET\"`&USER_EMAIL=$USER_EMAIL&FROMID=$FROMID" + else + [ -e "$WEBBUILD_STATEDIR/social_log" ] || exit + # social box + echo -n "" + count=0 + SID=0 + if [ ! "$FROMID" -o "$FROMID" = "0" -o "$FROMID" = "NaN" ]; then + if [ "$USER" ]; then + line=`tail -n 500 $WEBBUILD_STATEDIR/social_log | grep -v " SUSER=$USER " 2>/dev/null | tail -n 25 | head -n 1` + else + line=`tail -n 500 $WEBBUILD_STATEDIR/social_log | grep -v " STARGET=developers " 2>/dev/null | tail -n 25 | head -n 1` + fi + eval $line + FROMID=$SID fi - eval $line - FROMID=$SID + tail -n 100 $WEBBUILD_STATEDIR/social_log | while read line; do + STYPE= + SPRIVACY= + SUSER= + STARGET= + SID= + eval $line + [ "$SID" ] || continue + [ $SID -ge $FROMID ] || continue + [ "$STARGET" = "developers" -a ! "$USER" ] && continue + [ "$SUSER" = "$USER" -a "$STARGET" == "developers" ] && continue + if [ "$SPRIVACY" -a ! "$USER" ]; then + USER_GRAVATAR= + else + USER_GRAVATAR=`echo -n $SEMAIL | md5sum | sed "s| .*||"` + fi + echo -n "
" + echo -n "
" + if [ "$SPRIVACY" -a ! "$USER" ]; then + SUSER="a developer" + elif [ "$USER" = "$SUSER" ]; then + SUSER="you" + fi + echo -n "
$SUSER $STEXT
" + echo -n "

]]>
" + count=$(($count + 1)) + done + echo -n "
" fi - tail -n 100 $WEBBUILD_STATEDIR/social_log | while read line; do - STYPE= - SPRIVACY= - SUSER= - STARGET= - SID= - eval $line - [ "$SID" ] || continue - [ $SID -ge $FROMID ] || continue - [ "$STARGET" = "developers" -a ! "$USER" ] && continue - [ "$SUSER" = "$USER" -a "$STARGET" == "developers" ] && continue - if [ "$SPRIVACY" -a ! "$USER" ]; then - USER_GRAVATAR= - else - USER_GRAVATAR=`echo -n $SEMAIL | md5sum | sed "s| .*||"` - fi - echo -n "
" - echo -n "
" - if [ "$SPRIVACY" -a ! "$USER" ]; then - SUSER="a developer" - elif [ "$USER" = "$SUSER" ]; then - SUSER="you" - fi - echo -n "
$SUSER $STEXT
" - echo -n "

]]>
" - count=$(($count + 1)) - done - echo -n "
" fi if [ "$USER_ENABLED" != "1" ]; then @@ -463,7 +468,7 @@ if [ "$REQUEST" = "repsearch" ]; then # echo -n "
"
    curl -s "${WEBBUILD_DISTROQUERY_URL}?query=$REPSEARCHTEXT&search_milestone2=true&search_devel=true\
 &search_i586=true&search_x86_64=true&search_arm=true&search_sources=true&query_compact=true&replyplain=true"
-#   $SUDO_WRAPPER 0 local "$USER" "" "openmamba-repository search -i ${REPSEARCHTEXT/-/\-}" | \
+#   $SUDO_WRAPPER 0 local "$USER" "" "autodist-repository search -i ${REPSEARCHTEXT/-/\-}" | \
 #      parse_search_output ${AUTOPORT_ARCH[$ENVIRONMENT]}
 #      sed "s|\(.*(source).*\)|\1|;
 #           s|\(.*(${AUTOPORT_ARCH[$ENVIRONMENT]}).*\)|\1|"
@@ -1873,7 +1878,7 @@ case $REQUEST in
                       for p in $PACKAGES; do
                          [ "$REPOSITORYSIMULATE" = "true" -o ! "$USER_CANMAINTAIN" ] && SIMULATEADD="-s" || SIMULATEADD=
                          [ "$REPOSITORYFORCE" = "true"  ] && FORCEADD="-f"
-                         $SUDO_WRAPPER 0 local "$USER" "$PACKAGE" "openmamba-repository import $SENDREPOSITORY $p -d $REPOSITORYIMPORTTO $SIMULATEADD $FORCEADD -y"
+                         $SUDO_WRAPPER 0 local "$USER" "$PACKAGE" "autodist-repository import $SENDREPOSITORY $p -d $REPOSITORYIMPORTTO $SIMULATEADD $FORCEADD -y"
                          RET=$?
                          if [ ! "$SIMULATEADD" -a $RET -eq 0 ]; then
                             social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"imported $p from $SENDREPOSITORY to $REPOSITORYIMPORTTO\" STIME=`date +%s`"
@@ -1890,7 +1895,7 @@ case $REQUEST in
                       for p in $PACKAGES; do
                          [ "$REPOSITORYSIMULATE" = "true" -o ! "$USER_CANMAINTAIN" ] && SIMULATEADD="-s" || SIMULATEADD=
                          [ "$REPOSITORYFORCE" = "true"  ] && SIMULATEADD="$SIMULATEADD -f"
-                         $SUDO_WRAPPER 0 local "$USER" "$PACKAGE" "openmamba-repository release $SENDREPOSITORY $p -d $REPOSITORYIMPORTTO $SIMULATEADD -y"
+                         $SUDO_WRAPPER 0 local "$USER" "$PACKAGE" "autodist-repository release $SENDREPOSITORY $p -d $REPOSITORYIMPORTTO $SIMULATEADD -y"
                          RET=$?
                          if [ ! "$SIMULATEADD" -a $RET -eq 0 ]; then
                             social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"released $p from $SENDREPOSITORY to $REPOSITORYIMPORTTO\" STIME=`date +%s`"
@@ -1905,7 +1910,7 @@ case $REQUEST in
                          break
                       }
                       for p in $PACKAGES; do
-                         $SUDO_WRAPPER 0 local "$USER" "" "openmamba-repository diff $SENDREPOSITORY $p -d $REPOSITORYIMPORTTO"
+                         $SUDO_WRAPPER 0 local "$USER" "" "autodist-repository diff $SENDREPOSITORY $p -d $REPOSITORYIMPORTTO"
                          RET=$?
                          [ $RET -eq 0 ] || break
                       done
@@ -1918,7 +1923,7 @@ case $REQUEST in
                       }
                       for p in $PACKAGES; do
                          [ "$REPOSITORYSIMULATE" = "true" -o ! "$USER_CANMAINTAIN" ] && SIMULATEADD="-s" || SIMULATEADD=
-                         $SUDO_WRAPPER 0 local "$USER" "$PACKAGE" "openmamba-repository archive $SENDREPOSITORY $p -y"
+                         $SUDO_WRAPPER 0 local "$USER" "$PACKAGE" "autodist-repository archive $SENDREPOSITORY $p -y"
                          RET=$?
                          if [ ! "$SIMULATEADD" -a $RET -eq 0 ]; then
                             social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"archived $p from $SENDREPOSITORY\" STIME=`date +%s`"
diff --git a/webbuild/webbuild-functions b/webbuild/webbuild-functions
index 8f4df3e..ce43e00 100644
--- a/webbuild/webbuild-functions
+++ b/webbuild/webbuild-functions
@@ -1,7 +1,7 @@
 #!/bin/bash
 #
 # webbuild functions
-# Copyright (c) 2012 by Silvan Calarco 
+# Copyright (c) 2012-2014 by Silvan Calarco 
 #
 . /etc/autodist/config
 
@@ -36,6 +36,13 @@ function social_log() {
       STATE_SOCIALLOG_ID=$(($STATE_SOCIALLOG_ID + 1))
       set_user_state_var STATE_SOCIALLOG_ID $STATE_SOCIALLOG_ID webbuild
       echo "SID=$STATE_SOCIALLOG_ID SPRIVACY=$STATE_PRIVACYMODE $line" >> $WEBBUILD_STATEDIR/social_log
+
+      if [ "$WEBBUILD_URL" ]; then
+         eval $line
+         USER_SECRET_FIXED=`echo $USER_SECRET | sed "s|\$|\\$|"`
+         curl -s "$WEBBUILD_URL?REQUEST=message&USER=$USER&SECRET=`cgi_encodevar \"$USER_SECRET\"`&USER_EMAIL=$USER_EMAIL&\
+MESSAGE=`cgi_encodevar \"$STEXT\"`" >/dev/null
+      fi
    fi
 }
 
@@ -205,7 +212,7 @@ function parse_search_output() {
       echo -n "$2
" echo -n "" # if [ "$ARCH" ] -# $SUDO_WRAPPER 0 local "$USER" "" "openmamba-repository search -i $REPSEARCHTEXT" | \ +# $SUDO_WRAPPER 0 local "$USER" "" "autodist-repository search -i $REPSEARCHTEXT" | \ # sed "s|\(.*(source).*\)|\1|; # s|\(.*(${AUTOPORT_ARCH[$ENVIRONMENT]}).*\)|\1|" done diff --git a/webbuild/webbuild-functions-private b/webbuild/webbuild-functions-private index 95f201c..facb19c 100644 --- a/webbuild/webbuild-functions-private +++ b/webbuild/webbuild-functions-private @@ -1,8 +1,13 @@ +# +# webbuild functions-private include file +# Copyright (c) 2012-2014 by Silvan Calarco +# + repository_list() { if [ "$WEBBUILD_REPOSITORIES" ]; then echo "${WEBBUILD_REPOSITORIES[*]}" else - $SUDO_WRAPPER 0 local "$USER" "" "/usr/sbin/openmamba-repository list" + $SUDO_WRAPPER 0 local "$USER" "" "/usr/sbin/autodist-repository list" fi }