mithraen-build-utils-0.1.20/000075500000000000000000000000001230753762600156455ustar00rootroot00000000000000mithraen-build-utils-0.1.20/bin/000075500000000000000000000000001230753762600164155ustar00rootroot00000000000000mithraen-build-utils-0.1.20/bin/Co000075500000000000000000000016561230753762600167140ustar00rootroot00000000000000#!/bin/sh #=============================================================================# # simple menu for git checkout (select branch) # #=============================================================================# # (c) Denis Smirnov > $T_M # Get default DEFAULT="`git branch | grep '^\*' | sed 's/^..//' | tr -d "\n"`" if [ "x$DEFAULT" != "x" ]; then echo "\"$DEFAULT\" \"\"" >> $T_M fi # Get list git branch | grep '^ ' | sed 's/^..\(.*\)/"\1" ""/' | sort >> $T_M T1=`mktemp` dialog --file $T_M 2> $T1 RC=$? stty sane clear if [ $RC -eq 0 ]; then git checkout `cat $T1` fi rm -f $T_M $T1 mithraen-build-utils-0.1.20/bin/Gpush000075500000000000000000000013571230753762600174370ustar00rootroot00000000000000#!/bin/sh ssh-alt FORCE=0 if [ "$1" = "-f" ]; then FORCE=1 shift fi NAME=$1 if [ -z "$NAME" ]; then # Try to autodetect if [ -f .git/remotes/origin ]; then NAME=`grep 'URL: git.alt:packages/' .git/remotes/origin | sed 's!.*/!!'` echo "Using name: '$NAME'" fi fi if [ -z "$NAME" ]; then echo "Using: $0 packagename" exit -1 fi rm -f .git/remotes/origin 2> /dev/null rmdir .git/remotes 2> /dev/null if [ "$FORCE" = "0" ]; then T=`git config --get remote.origin.url` fi if [ -z "$T" ]; then git config 'remote.origin.url' "git.alt:packages/$NAME" git config 'remote.origin.push' "refs/heads/*:refs/heads/*" git config 'remote.origin.fetch' "refs/heads/*:refs/remotes/origin/heads/*" else echo "Already exists!" exit -1 fi mithraen-build-utils-0.1.20/bin/Pull000075500000000000000000000016701230753762600172630ustar00rootroot00000000000000#!/bin/sh #=============================================================================# # simple menu for git pull from local branch # #=============================================================================# # (c) Denis Smirnov > $T_M # Get default DEFAULT="`git branch | grep '^\*' | sed 's/^..//' | tr -d "\n"`" # Get list git branch | grep '^ ' | sed 's/^..\(.*\)/"\1" ""/' | grep -v "^$DEFAULT$" | sort >> $T_M T1=`mktemp` dialog --file $T_M 2> $T1 RC=$? stty sane clear if [ $RC -eq 0 ]; then git pull . `cat $T1` fi rm -f $T_M $T1 mithraen-build-utils-0.1.20/bin/Status000075500000000000000000000011611230753762600176250ustar00rootroot00000000000000#!/bin/sh GIT_DIR="$1" if [ -z "$GIT_DIR" ]; then GIT_DIR=`git rev-parse --git-dir` fi GIT_DIR=`realpath "$GIT_DIR"` if [ -d "$GIT_DIR/.git" ]; then GIT_DIR="$GIT_DIR/.git" fi B=`git --git-dir="$GIT_DIR" rev-parse --is-bare-repository ` if [ "$B" = "true" ]; then exit 0 fi cd "$GIT_DIR/.." COUNT=`git --git-dir="$GIT_DIR" status \ | grep -v 'nothing to commit' \ | grep -v '^On branch ' \ | grep -v '^#' \ | wc -l` if ! [ "$COUNT" = "0" ]; then echo "You need to commit" exit 1 fi COUNT2=`git --git-dir="$GIT_DIR" diff HEAD | wc -l` if [ "$COUNT2" = "0" ]; then exit fi echo "You need to commit" exit 1 mithraen-build-utils-0.1.20/bin/altlinux-fetch-gear000075500000000000000000000013211230753762600222030ustar00rootroot00000000000000#!/bin/bash for s in ~/git/altlinux/packages/*; do [ -d "$s/.git" ] || continue pushd "$s" 2>&1 > /dev/null NAME=`rpmbuild -bE $(ls -1 *.spec 2> /dev/null | head -1) 2> /dev/null | grep ^Name | head -1 | sed 's/Name:[[:space:]]*//' | tr -d '\r' | tr -d '\n'` if [ -z "$NAME" ]; then NAME=`cat *.spec 2> /dev/null | grep ^Name | head -1 | sed 's/Name:[[:space:]]*//' | tr -d '\r' | tr -d '\n'` fi [ -z "$NAME" ] && continue f=${NAME##?} n=${NAME%%$f} echo "$s > $NAME" git config remote.gears.url "git://git.altlinux.org/gears/$n/$NAME.git" git config remote.gears.fetch "+refs/heads/*:refs/heads/gears/*" git fetch gears git push origin popd 2>&1 > /dev/null done mithraen-build-utils-0.1.20/bin/amend000075500000000000000000000011531230753762600174270ustar00rootroot00000000000000#!/bin/bash #============================================================================# # Simple utility for git-amend with update commit comment from specfile # #============================================================================# . /usr/bin/gear-sh-functions . shell-getopt if [ "x$1" != "x" ]; then vr="$(sed -ne '/^[[:space:]]*%changelog[[:space:]]*$/{n; s/\* .* \([^[:space:]]\+\)$/\1/p}' "$1")" ch="$(sed -ne '0,/^[[:space:]]*%changelog[[:space:]]*$/d;2,/^* /{/^* /!p}' "$1")" T=`mktemp` echo $vr > $T echo "$ch" >> $T git commit -a --amend -F $T rm -f $T else git commit -a --amend fi mithraen-build-utils-0.1.20/bin/asterisk1.8-update000075500000000000000000000011631230753762600217000ustar00rootroot00000000000000#!/bin/sh -e #============================================================================# # Обновление asterisk1.8 из tarball # #============================================================================# # (C) Denis Smirnov http://mithraen.ru/ # #============================================================================# . /usr/share/mithraen-build-utils/asterisk-update-common ast_modules="app_konference chan_dongle chan_ss7 devel-doc" base_ver=1.8 ast_gear_clone ast_update TASK=`ssh git.alt task new` ast_send_to_git_alt mithraen-build-utils-0.1.20/bin/asterisk11-update000075500000000000000000000011321230753762600216070ustar00rootroot00000000000000#!/bin/sh -e #============================================================================# # Обновление asterisk11 из tarball # #============================================================================# # (C) Denis Smirnov http://mithraen.ru/ # #============================================================================# . /usr/share/mithraen-build-utils/asterisk-update-common ast_modules="devel-doc chan_dongle" base_ver=11 ast_gear_clone ast_update TASK=`ssh git.alt task new` ast_send_to_git_alt mithraen-build-utils-0.1.20/bin/build-daemon000075500000000000000000000044471230753762600207140ustar00rootroot00000000000000#!/usr/bin/perl -w use strict; use LockFile::Simple; my $HOME = $ENV{HOME}; my $SRC_DIR = $HOME . "/RPM/SRPMS"; my $LOG_DIR = $HOME . "/RPM/SRPMS/logs"; my $ERROR_DIR = $HOME . "/RPM/SRPMS/error"; my $lockmgr = LockFile::Simple->make( -autoclean => 1, -stale => 1 ); $lockmgr->trylock( $HOME . "/tmp/.build-daemon" ) || die "build-daemon already running"; mkdir $LOG_DIR; mkdir $ERROR_DIR; chdir $SRC_DIR; sub build_pkg($$); sub build_all_packages() { my @srpms = glob("$SRC_DIR/*.src.rpm"); foreach my $pkg (@srpms) { my $rc1 = build_pkg( $pkg, 'i586' ); my $rc2 = build_pkg( $pkg, 'x86_64' ); if ( $rc1 and $rc2 ) { unlink $pkg; } else { my $fn = $pkg; $fn =~ s/^.*\///; unlink "$ERROR_DIR/$fn"; rename( $pkg, "$ERROR_DIR/$fn" ) || die "$@$!"; } } } build_all_packages(); #while (1) { # sleep 1; #} sub get_logname($$) { my $pkg = shift; my $arch = shift; my $fn = $pkg; $fn =~ s/^.*\///; my $name = $fn; $name =~ s/.src.rpm$//; my $date = `date -I`; chomp $date; return "$name.$arch.$date.log"; } sub build_pkg($$) { local $| = 1; my $pkg = shift; my $arch = shift; my $fn = $pkg; $fn =~ s/^.*\///; my $name = $fn; $name =~ s/.src.rpm$//; my $date = `date -I`; chomp $date; my $logfile = get_logname( $pkg, $arch ); my $rc = 1; my $license = `rpm -qp --qf '%{LICENSE}' "$pkg"`; chomp $license; my $pocket = 'sisyphus'; if ( $license =~ /internal/i ) { $pocket = 'internal'; } my $repo = $ENV{HOME} . "/repo/" . $pocket; print "$name ($arch) into $pocket pocket..."; if ( $arch eq 'x86_64' ) { `hsh --repo="$repo" -v "$pkg" 2>> $LOG_DIR/$logfile >> $LOG_DIR/$logfile`; $rc = $?; } else { `i586 hsh --repo="$repo" -v "$pkg" 2>> $LOG_DIR/$logfile >> $LOG_DIR/$logfile`; $rc = $?; } if ( $rc == 0 ) { print "Ok\n"; print `h-cleanup-dups -f ~/repo/$pocket > /dev/null`; print `h-cleanup-pocket ~/repo/$pocket`; print `h-gen ~/repo/$pocket`; return 1; } unlink "$ERROR_DIR/$logfile"; rename "$LOG_DIR/$logfile", "$ERROR_DIR/$logfile"; print "Error\n"; return ''; } mithraen-build-utils-0.1.20/bin/build-sisyphus000075500000000000000000000001001230753762600213160ustar00rootroot00000000000000#!/bin/sh git.alt task new task-add "$2" "$3" git.alt task run mithraen-build-utils-0.1.20/bin/cl-add000075500000000000000000000006371230753762600174750ustar00rootroot00000000000000#!/bin/sh #=============================================================================# # Add and edit changelog to RPM spec # #=============================================================================# # (C) Denis Smirnov 2 Nov 2004 # #=============================================================================# exec cl-edit --add "$@" mithraen-build-utils-0.1.20/bin/cl-edit000075500000000000000000000044021230753762600176640ustar00rootroot00000000000000#!/bin/sh #=============================================================================# # Edit changelog to RPM spec # #=============================================================================# # (C) Denis Smirnov 2 Nov 2004 # #=============================================================================# PROG=${0##*/} USAGE() { cat <&2; exit 1 ;; esac done SPEC=$1 # Если не указано имя файла со spec'ом, пытаемся его определить автоматически if [ "$SPEC" = "" ] && [ -d .git ]; then SPEC=$(gear --command sh -- -c 'printf %s"$gear_specfile"') # Поддержка specgen if [ "$SPEC" != "" ] && [ -f "specs/$SPEC" ]; then SPEC="specs/$SPEC" fi fi if [ -z "$SPEC" ]; then echo "Use: $0 []" exit -1 fi run_edit() { N=`grep -n '^%changelog' $SPEC | head -n 1 | sed s!:.*!!g` N=$(($N + 2)) ${EDITOR:-vim} +$N "$1" } if [ "$ADD_ONLY" = "1" ]; then if add_changelog "$SPEC"; then if [ "$ADD_CHANGELOG_PARAM" = "" ]; then run_edit "$SPEC" fi fi else add_changelog "$SPEC" ||: if [ "$ADD_CHANGELOG_PARAM" = "" ]; then run_edit "$SPEC" fi fi mithraen-build-utils-0.1.20/bin/cleanup-repo000075500000000000000000000012611230753762600207350ustar00rootroot00000000000000#!/bin/bash if [ ! -d .git ]; then echo "It's not git repo" fi if [ ! -d .gear ] && [ ! -f .gear-rules ]; then echo "It's not gear repo" fi if [ ! -f .gitignore ]; then echo "*~" > .gitignore git add .gitignore git commit -m 'Add .gitignore' .gitignore fi if [ -f .gear-rules ]; then mkdir -p .gear mv .gear-rules .gear/rules git add .gear/rules git commit -m '.gear-rules -> .gear/rules' .gear-rules .gear/rules fi cleanup_spec() { sed -i '/\/sbin\/ldconfig/d' "$1" sed -i '/^%post_ldconfig/d' "$1" sed -i '/^%postun_ldconfig/d' "$1" sed -i '/^%update_menus/d' "$1" sed -i '/^%clean_menus/d' "$1" rpmcs "$1" } cleanup_spec *.spec git diff master *.spec mithraen-build-utils-0.1.20/bin/find-big-gits000075500000000000000000000005741230753762600207740ustar00rootroot00000000000000#!/bin/sh -e DIR=$1 DIR=`realpath "$DIR"` find "$DIR" -type f -path '*.git/objects/*' ! -path '*/objects/info/*' \ | sed "s%^$DIR/%%" \ | sed 's!/.*!!' \ | sort -u \ | tr '\n' '\0' \ | xargs -0i du -s "$DIR/{}" \ | sort -n \ | sed '/^[0-9][0-9][[:space:]]/d' \ | tail -n3 \ | sed 's/^[0-9]*[[:space:]]//' \ | tr '\n' '\0' \ | xargs -0i du -hs "{}" \ | sed "s%$DIR/%%" mithraen-build-utils-0.1.20/bin/gear-clone000075500000000000000000000015351230753762600203630ustar00rootroot00000000000000#!/bin/bash -e #============================================================================# # Find and clone repo from git.alt # #============================================================================# # (C) Denis Smirnov http://mithraen.ru/ # #============================================================================# if [ "$1" = "" ]; then echo "Use: $0 " > /dev/stderr exit 1 fi name=$1 girar-clone-build-commit -o girar "$name" "$name" "$name" pushd "$name" || exit -1 git --git-dir=".git" config 'remote.origin.url' "git.alt:packages/$name" git --git-dir=".git" config 'remote.origin.push' "refs/heads/*:refs/heads/*" git --git-dir=".git" config 'remote.origin.fetch' "refs/heads/*:refs/remotes/origin/heads/*" gear-rules-restore-branches mithraen-build-utils-0.1.20/bin/gear-rel000075500000000000000000000021251230753762600200410ustar00rootroot00000000000000#!/bin/bash -e #=============================================================================# # Release package # #=============================================================================# # (c) Denis Smirnov 06 Feb 2007 # #=============================================================================# ssh-alt if [ "$1" = "-f" ]; then force=-f fi # TODO: add support for branch repos if [ ! -d .git ]; then echo "You must run this script from root of git repo" exit -1 fi # Add changelog to spec-file if not added before cl-edit --add # Commit this version gear-commit -a --no-edit ||: # Get version VERSION=`rpmbuild -bE *.spec | grep Version: | sed 's/Version:[[:space:]]*//' | head -n1` RELEASE=`rpmbuild -bE *.spec | grep Release: | sed 's/Release:[[:space:]]*//' | head -n1` PACKAGE=`rpmbuild -bE *.spec | grep Name: | sed 's/Name:[[:space:]]*//' | head -n1` git tag -s -m "$PACKAGE/$VERSION-$RELEASE" "$PACKAGE/$VERSION-$RELEASE" $force git push ||: git push --tags $force mithraen-build-utils-0.1.20/bin/gear-svnupdate000075500000000000000000000014231230753762600212700ustar00rootroot00000000000000#!/bin/sh #=============================================================================# # Import branches from svn to git # #=============================================================================# # Denis Smirnov # #=============================================================================# svn_fetch() { export GIT_SVN_NO_LIB=1 if [ ! -d .git/refs/remotes/$2 ]; then git svn init -i $1 $2 fi git svn fetch -i $1 } # Updating while read name repo; do if [ -z "$name" ]; then exit 0 fi if [ -z "$repo" ]; then echo "Repo not defined for $name" exit -1 fi echo "Updating $name..." svn_fetch "$name" "$repo" done < .gear-svn mithraen-build-utils-0.1.20/bin/git-autobranches000075500000000000000000000005001230753762600215750ustar00rootroot00000000000000#!/usr/bin/perl -w use strict; open( IN, "git log --merges --format=\"%P %s\" |" ) || die; my %branches; while () { /^([0-9a-f]+)\s([0-9a-f]+)\sMerge branch '(.+?)'/ || next; $branches{$3} = $2 unless defined $branches{$3}; } close(IN); print $_. " " . $branches{$_} . "\n" foreach sort keys %branches; mithraen-build-utils-0.1.20/bin/git-clone-bare-hardlink000075500000000000000000000021311230753762600227220ustar00rootroot00000000000000#!/bin/sh FROM="$1" TO="$2" [ -z "$FROM" ] && exit -1 [ -z "$TO" ] && exit -1 [ -d "$TO" ] && exit -2 mkdir -p "$TO" cp -al "$FROM/objects" "$TO/objects" rm -f "$TO/objects/info"/* rmdir "$TO/objects/info" 2> /dev/null > /dev/null cp -a "$FROM/objects/info" "$TO/objects/" ||: [ -d "$FROM/svn" ] && cp -a $FROM/svn $TO/ ||: [ -d "$FROM/remotes" ] && cp -a $FROM/remotes $TO/ ||: cp -a $FROM/refs $TO/ ||: cp -a $FROM/info $TO/ ||: cp -a $FROM/hooks $TO/ ||: cp -a $FROM/branches $TO/ ||: cp -a $FROM/packed-refs $TO/ ||: [ -d "$FROM/gear" ] && cp -a $FROM/gear $TO/ ||: cp -a $FROM/config $TO/ ||: cp -a $FROM/description $TO/ ||: cp -a $FROM/HEAD $TO/ ||: find "$TO" -type f -path '*.git/hooks/*.sample' -delete mkdir -p "$TO/logs" [ -d "$TO/refs" ] && find "$TO/refs" -type d -empty -delete [ -d "$TO/branches" ] && find "$TO/branches" -type d -empty -delete # I don't want backup all versions of every branch after --amend mkdir -p "$TO/refs" "$TO/branches" "$TO/logs" exit 0 mithraen-build-utils-0.1.20/bin/git-diffstat000075500000000000000000000001301230753762600207220ustar00rootroot00000000000000#!/bin/sh branch=`git branch | grep '^\* ' | colrm 1 2` git diff "$branch" | diffstat mithraen-build-utils-0.1.20/bin/git-repos-cleanup000075500000000000000000000014741230753762600217070ustar00rootroot00000000000000#!/bin/bash #=======================================================================# # Simple script for repacking all not packed git repos # #=======================================================================# # (c) Denis Smirnov # #=======================================================================# WLEN=150 DEPTH=150 repack_here() { git repack -a -d -f --window=$WLEN --depth=$DEPTH } find -type f \ | grep git/objects \ | grep -v /pack/pack- \ | grep -v /packs$ \ | sed 's!/objects/.*!!' \ | sed 's/.git$//' \ | uniq | while read a; do pushd "$a" > /dev/null echo $a git prune repack_here popd done find -type f \ | grep git/objects \ | grep -v /pack/pack- \ | grep -v /packs$ \ | sed 's!/objects/.*!!' \ | uniq mithraen-build-utils-0.1.20/bin/git-show-branchname000075500000000000000000000000641230753762600222000ustar00rootroot00000000000000#!/bin/sh git branch \ | grep '^\*' \ | colrm 1 2 mithraen-build-utils-0.1.20/bin/git-show-roots000075500000000000000000000002071230753762600212470ustar00rootroot00000000000000#!/bin/sh git --git-dir "$1" \ log --pretty=tformat:'%H:%P' --all \ | sed -ne 's/:$//p' \ | add-postfix " $1" \ | sort -u exit 0 mithraen-build-utils-0.1.20/bin/git.alt000075500000000000000000000014671230753762600177150ustar00rootroot00000000000000#!/bin/sh -e #============================================================================# # Выполнить команду на git.alt # #============================================================================# # (C) Denis Smirnov http://mithraen.ru/ # #============================================================================# # Если есть ssh-ключ с именем для git.alt, проверить загружен ли он в ssh-add if [ -f ~/.ssh/id_dsa-alt ]; then if ! ssh-add -l | grep -q id_dsa-alt; then # Если ключ есть, но он не загружен в ssh-agent -- пытаемся загрузить ssh-add ~/.ssh/id_dsa-alt || exit -1 fi fi exec ssh git.alt "$@" mithraen-build-utils-0.1.20/bin/h000075500000000000000000000000611230753762600165670ustar00rootroot00000000000000#!/bin/sh exec try_build_targets "sisyphus" "$1" mithraen-build-utils-0.1.20/bin/h-cleanup000075500000000000000000000002171230753762600202170ustar00rootroot00000000000000#!/bin/sh h-cleanup-buffers for s in ~/repo/*; do [ -d "$s" ] || continue s=`realpath $s` h-cleanup-dups "$s" h-cleanup-pocket "$s" done mithraen-build-utils-0.1.20/bin/h-cleanup-buffers000075500000000000000000000015131230753762600216510ustar00rootroot00000000000000#!/bin/sh #===========================================================================# # Cleanup pockets and buffers -- remove packets that already in ALT repos # #===========================================================================# getname() { echo ${1##*/} } in_sisyphus() { if [ -f /var/lib/altlinux/sisyphus/files/SRPMS/"$1" ]; then return 0 fi return 1 } #in_branch() #{ # if [ -f /var/lib/altlinux/4.0/branch/files/SRPMS/"$1" ]; then # return 0 # fi # return 1 #} for s in ~/development/repo/sisyphus/SRPMS.hasher/*.rpm; do N=`getname "$s"` E="" in_sisyphus $N && E="$E Sisyphus" [ -z "$E" ] || rm -f $s done #for s in ~/development/pockets/backport/SRPMS.hasher/*.rpm; do # N=`getname "$s"` # E="" # in_branch $N && E="$E branch4.0" # [ -z "$E" ] || rm -f $s #done mithraen-build-utils-0.1.20/bin/h-cleanup-dups000075500000000000000000000037371230753762600212020ustar00rootroot00000000000000#!/bin/bash -e IS_FORCE=0 if [ "$1" = "-f" ]; then shift; IS_FORCE=1 fi if [ "$1" = "" ]; then echo "Use: $0 " > /dev/stderr exit -1 fi WORKDIR="`mktemp -dt dups.XXXXXXXXXX`" exit_handler() { local rc=$? trap - EXIT rm -rf -- "$WORKDIR" exit $rc } trap exit_handler EXIT HUP INT PIPE TERM QUIT echo "Making dups in repositories..." DISTRIBUTION="$1" if [ -z "$DISTRIBUTION" ]; then DISTRIBUTION=`dirname $(realpath $0)` fi DISTRIBUTION=`realpath "$DISTRIBUTION"` cd "$DISTRIBUTION" #ls -1 $DISTRIBUTION/{i?86,x86_64}/RPMS.*/*.noarch.rpm 2> /dev/null | while read f; do # T=`echo "$f" \ # | sed 's/\/[^\/]*$//' \ # | sed 's/^.*\/RPMS\.//'` # mv -f $f $DISTRIBUTION/noarch/RPMS.$T/ #done reps="$DISTRIBUTION/i?86/RPMS.*" reps="$reps $DISTRIBUTION/noarch/RPMS.*" reps="$reps $DISTRIBUTION/x86_64/RPMS.*" reps="$reps $DISTRIBUTION/SRPMS.*" for rep in $reps; do [ -d "$rep" ] || continue echo "rep: $rep" mkdir -p -m700 -- "$WORKDIR/$rep" pushd "$rep" >/dev/null ( echo "entering $rep." >"$WORKDIR/$rep/dups" || { echo "failed $rep."; exit 1; } for n in `ls -1 |grep '.rpm$' |cut -c1 |LC_COLLATE=C sort -u`; do rpmrdups "$n"*.rpm >>"$WORKDIR/$rep/dups" && echo "done $rep/$n." || { echo "failed $rep/$n."; exit 1; } done echo "leaving $rep." ) & popd >/dev/null done echo "Waiting for rpmrdups..." wait echo "Done." for rep in $reps; do if [ -s "$WORKDIR/$rep/dups" ]; then echo "Duplicated files found in \"$rep\" repository:" cat -- "$WORKDIR/$rep/dups" echo pushd "$rep" >/dev/null cut -d\ -f2- -- "$WORKDIR/$rep/dups" |xargs -r ls -Llt -- while :; do [ "$IS_FORCE" = "1" ] && break echo "Really purge files listed above? (yes/no)" read if [ "$REPLY" = no ]; then echo Cancelled! continue 2; fi if [ "$REPLY" = yes ]; then break; fi done cut -d\ -f2- -- "$WORKDIR/$rep/dups" |xargs -r realpath |xargs -r rm -v -- popd >/dev/null fi done h-gen "$DISTRIBUTION" mithraen-build-utils-0.1.20/bin/h-cleanup-pocket000075500000000000000000000046101230753762600215030ustar00rootroot00000000000000#!/usr/bin/perl -w use DB_File; use RPM::Header; use Fcntl; sub rpm_get_header($$); die "Use: h-cleanup-pocket " unless defined $ARGV[0]; die "Pocket not found: $ARGV[0]" unless -d $ARGV[0]; my $pocket = $ARGV[0]; chdir($pocket) || die; # Этап 1 -- ищем src.rpm с аналогичными именами в Сизифе # !!! перед этим этапом рекомендуется удалить устаревшие пакеты # с помощью h-cleanup-dups { my $sisyphus = '/var/lib/altlinux/sisyphus/files/SRPMS/'; my @srpms = glob("SRPMS.*/*.src.rpm"); foreach (@srpms) { my $path = $_; my $name = $path; $name =~ s/^.*\///; if ( -e $sisyphus . $name ) { my $t_s = ( stat( $sisyphus . $name ) )[9]; my $t_r = ( stat($path) )[9]; # если в Сизифе более новая сборка -- значит # мы уже отправили свою на сборку next if $t_s < $t_r; my $p_s = rpm_get_header( $sisyphus . $name, 'PACKAGER' ); my $p_r = rpm_get_header( $path, 'PACKAGER' ); # если собирали разные мантейнеры, то это пропускаем next if $p_s ne $p_r; # все тесты пройдены успешно -- значит этот пакет можно # просто удалить unlink $path; print "$name\n"; } } } my %hash; my $filename = "cache.db"; my $db = tie( %hash, 'DB_File', $filename, O_RDWR | O_CREAT, 0666, $DB_HASH ) or die "Cannot open $filename: $!\n"; my @srpms = glob("SRPMS.*/*.src.rpm"); my %srpms; foreach (@srpms) { my $f = $_; $f =~ s/^.*\///; $srpms{$f}++; } my @rpms = glob("*/RPMS.*/*.rpm"); sub rpm_get_header($$) { my $fn = shift; my $header = shift; my $fh; open( $fh, "< $fn" ) || die; my $hdr = new RPM::Header( \$fh ) or die "$RPM::err"; my $rc = $hdr->{$header}; close($fh); return $rc; } # load RPMs to cache foreach (@rpms) { next if defined( $hash{$_} ); my $srcrpm; { open( IN, "< $_" ); my $hdr = new RPM::Header( \*IN ) or die "$RPM::err"; $srcrpm = $hdr->{SOURCERPM}; close(IN); } $hash{$_} = $srcrpm; } foreach (@rpms) { unlink $_ unless defined $srpms{ $hash{$_} }; } $db->sync(); undef $db; untie %hash; mithraen-build-utils-0.1.20/bin/h-gen000075500000000000000000000015601230753762600173430ustar00rootroot00000000000000#!/bin/sh -e #============================================================================# # Пересоздание индексов для репозитория # #============================================================================# # (C) Denis Smirnov http://mithraen.ru/ # #============================================================================# show_usage() { echo "Create indexes for repository" echo "use: "$(basename "$0")" " exit -1 } exit_error() { echo "$@" exit -1 } [ ! -z "$1" ] || show_usage [ -d "$1" ] || exit_error "Directory $1 not exists" cd "$1" || exit_error "Can't chdir to $1" gen() { [ -d "$1" ] && genbasedir --bloat --bz2only --progress --topdir=. --create "$1" return 0 } gen i686 gen i586 gen noarch gen x86_64 mithraen-build-utils-0.1.20/bin/hshsh000075500000000000000000000003151230753762600174570ustar00rootroot00000000000000#!/bin/sh if [ ! -z "$1" ]; then H=`realpath $1` hsh-install "$H" mc vim-enhanced mithraen-build-utils hsh-shell "$H" else hsh-install mc vim-enhanced mithraen-build-utils hsh-shell fi mithraen-build-utils-0.1.20/bin/mass-push000075500000000000000000000002241230753762600202610ustar00rootroot00000000000000for s in *; do [ -d "$s" ] || continue pushd "$s" Gpush -f "$s" git.alt init-db "$s" git push git push --tags popd done mithraen-build-utils-0.1.20/bin/mass-task-add000075500000000000000000000001371230753762600207750ustar00rootroot00000000000000for s in *; do [ -d "$s/.git" ] || continue pushd "$s" task-add "$1" popd done mithraen-build-utils-0.1.20/bin/mithraen-build-utils-functions000064400000000000000000000004271230753762600244130ustar00rootroot00000000000000#!/bin/bash dialog_maxsize_() { local T T=`mktemp` dialog --print-maxsize 2> $T > /dev/null cat $T | sed -e 's/MaxSize:[[:space:]]//' -e 's/[[:space:]]*//g' -e 's/,/ /' rm -f $T } dialog_maxsize() { local T T=`mktemp` dialog_maxsize_ > $T read WM HM < $T rm -f $T } mithraen-build-utils-0.1.20/bin/mithraen-hasher-utils000075500000000000000000000036561230753762600225720ustar00rootroot00000000000000#!/bin/bash WORKDIR=~/development/hasher export TARGET=`uname -m` export NPROCS=$((`grep -c ^processor /proc/cpuinfo` * 4)) export WORKDIR=`realpath "$WORKDIR"` if [ "$TARGET" != "x86_64" ]; then TARGET=i586 fi mount_workdir() { rm -f $WORKDIR/repo 2> /dev/null rmdir $WORKDIR/repo 2> /dev/null mount $WORKDIR ln -s $POCKET $WORKDIR/repo } umount_workdir() { # if 'chroot' dir exists, it meant that build was not succesful # and if so, we may need to see what happens if [ ! -d $WORKDIR/chroot ]; then umount $WORKDIR fi } umount_workdir_force() { umount $WORKDIR > /dev/null 2> /dev/null } try_build() { echo "Building for $TARGET" POCKET=$1 SPEC=$2 TYPE=$3 if [ -z "$TYPE" ]; then TYPE=SS fi if [ "$POCKET" != "" ]; then POCKET=~/development/pockets/"$POCKET" else POCKET=~/development/repo fi export POCKET mkdir -p "$POCKET" umount_workdir_force mount_workdir export NPROCS=`nprocs 4` cmd="" if [ "$TARGET" == "i586" ]; then cmd=i586 fi APTCONF=/etc/apt/apt.conf.$TYPE.$TARGET if [ ! -f "$APTCONF" ]; then echo $APTCONF not found > /dev/stderr exit -1 fi echo ">>> Building for target $TARGET" if [ -z "$SPEC" ]; then $cmd gear-hsh-build \ --target=$TARGET \ --prefix "$WORKDIR" \ --repo repo \ -- \ ./.git \ -- \ --excludedocs \ --install-langs=en,ru \ --repackage-source \ --nprocs="$NPROCS" \ --target=$TARGET \ --apt-conf $APTCONF \ --build-args='--with debug --enable debug' else $cmd hsh \ --target=$TARGET \ --excludedocs \ --install-langs=en,ru \ --repackage-source \ --nprocs="$NPROCS" \ --build-args='--with debug --enable debug' \ --apt-conf "$APTCONF" \ "$WORKDIR" \ "$SPEC" fi umount_workdir } try_build_targets() { try_build "$1" "$2" "$3" if [ "$TARGET" == "x86_64" ]; then export TARGET=i586 try_build "$1" "$2" "$3" fi } # ? not worked ? # --build='--define \"_unpackaged_files_terminate_build 1\"' \ mithraen-build-utils-0.1.20/bin/ptch000075500000000000000000000011101230753762600172720ustar00rootroot00000000000000#!/usr/bin/perl -w #=============================================================================# # Create patches from all %.orig/% files from this directory tree # #=============================================================================# # (c) Denis Smirnov # #=============================================================================# use strict; chdir $ARGV[0] if defined $ARGV[0]; foreach ( split /\x00/, `find -type f -name '*.orig' -print0` ) { /(.+)\.orig$/; print `diff -ud $_ $1`; } mithraen-build-utils-0.1.20/bin/sisyphus2branch000075500000000000000000000013561230753762600214770ustar00rootroot00000000000000#!/bin/sh -e #============================================================================# # Copy package from Sisyphus to specified branch # #============================================================================# # (C) Denis Smirnov http://mithraen.ru/ # #============================================================================# branch=$1; shift if [ -z "$1" ]; then echo $(basename $0) -- utlity for copying from sisyphus to branch echo Use: $(basename $0) " [...]" exit -1 fi task=`git.alt task new "$branch"` while ! [ -z "$1" ]; do git.alt task add copy "$1" sisyphus shift done git.alt task run "$task" mithraen-build-utils-0.1.20/bin/so-graph000075500000000000000000000012471230753762600200670ustar00rootroot00000000000000#!/bin/sh T=`mktemp` T1=`mktemp` T2=`mktemp` for s in "$@"; do FILENAME=`basename $s` nm -D "$s" > $T sed -e "s!^ . \(.*\)\$!req\t$FILENAME\t\1!" < $T | grep ^req >> $T1 sed -e "s!^[0-9a-f]....... . \(.*\)\$!provides\t$FILENAME\t\1!" < $T | grep ^provides >> $T2 done rm -f $T T3=`mktemp` T4=`mktemp` awk '{print $3, $2}' < $T1 | sort > $T3 awk '{print $3, $2}' < $T2 | sort > $T4 rm -f $T1 $T2 echo "digraph test {" echo "rankdir=BT;" echo "mclimit=10;" echo "ranksep=1.5;" echo "overlap=false;" echo "spline=true;" echo "node [fontsize=30];" join $T3 $T4 | awk '{ print $2, $3 }' | sort -u | sed 's/\(.*\) \(.*\)/"\1" -> "\2"/' rm -f $T3 $T4 echo "}" mithraen-build-utils-0.1.20/bin/specgen-update000075500000000000000000000022521230753762600212500ustar00rootroot00000000000000#!/usr/bin/perl -w #============================================================================# # Обновление changelog и версии в базовом spec из основного # #============================================================================# # (C) Denis Smirnov # #============================================================================# use strict; use v5.14; die "It's not specgen-based package\n" unless -d "specs"; my $spec = `gear --command sh -- -c 'printf %s"\$gear_specfile"'`; open( IN, "<", "$spec" ) || die; undef $/; $_ = "\n" . ; my $version = $1 if s/\nVersion:\s*([^\s]+)\s*/\n/s; my $release = $1 if s/\nRelease:\s*([^\s]+)\s*/\n/s; my $changelog = $1 if $_ =~ /\n%changelog\s*\n(.+)$/s; $changelog =~ s/\s+$/\n/s; close( IN ); open( IN, "<", "specs/$spec" ) || die; my $specdata = ; close( IN ); $specdata =~ s/(\nVersion:\s*)([^\s]+)\s*?\n/$1$version\n/s; $specdata =~ s/(\nRelease:\s*)([^\s]+)\s*?\n/$1$release\n/s; $specdata =~ s/(\n%changelog\n).*$/$1$changelog/s; open( OUT, ">", "specs/$spec" ) || die; print OUT $specdata; close( OUT ); mithraen-build-utils-0.1.20/bin/ssh-alt000075500000000000000000000014471230753762600177240ustar00rootroot00000000000000#!/bin/sh -e #============================================================================# # Загружаем ssh key при необходимости # #============================================================================# # (C) Denis Smirnov http://mithraen.ru/ # #============================================================================# # Если есть ssh-ключ с именем для git.alt, проверить загружен ли он в ssh-add if [ -f ~/.ssh/id_dsa-alt ]; then if ! ssh-add -l | grep -q id_dsa-alt; then # Если ключ есть, но он не загружен в ssh-agent -- пытаемся загрузить ssh-add ~/.ssh/id_dsa-alt || exit -1 fi fi mithraen-build-utils-0.1.20/bin/subtask-add000075500000000000000000000004501230753762600205440ustar00rootroot00000000000000#!/bin/bash task_id=$1 subtask_id=$2 tag=`git describe --abbrev=0 ` repo=`git config --get remote.origin.url | sed 's!^.*:packages/!!'` echo "tag: $tag" echo "repo: $repo" git.alt task add "$task_id" "$subtask_id" repo "$repo" "$tag" \ 2>&1 \ | csed '/not\ found/ p red,bold' exit $? mithraen-build-utils-0.1.20/bin/task-add000075500000000000000000000010141230753762600200270ustar00rootroot00000000000000#!/bin/bash task_id=$1 echo "$tag $repo" if [ -z "$2" ]; then tag=`git describe --abbrev=0 ` repo=`git config --get remote.origin.url | sed 's!^.*:packages/!!'` elif [ -z "$3" ]; then tag=$1 repo=${tag%%/*} else repo=$1 tag=$2 fi echo "tag: $tag" echo "repo: $repo" if [ -z "$task_id" ]; then git.alt task add repo "$repo" "$tag" \ 2>&1 \ | csed '/not\ found/ p red,bold' else git.alt task add "$task_id" repo "$repo" "$tag" \ 2>&1 \ | csed '/not\ found/ p red,bold' fi exit $? mithraen-build-utils-0.1.20/bin/task-rm000075500000000000000000000000651230753762600177220ustar00rootroot00000000000000#!/bin/sh for s in $@; do git.alt task rm "$s" done mithraen-build-utils-0.1.20/bin/task-run000075500000000000000000000011701230753762600201060ustar00rootroot00000000000000#!/bin/bash . /usr/bin/mithraen-build-utils-functions if [ "$1" != "" ]; then while [ "$1" != "" ]; do git.alt task run $1 shift done exit 0 fi dialog_maxsize W=$(($WM-8)) T1=`mktemp` # for task list T2=`mktemp` # for dialog config T3=`mktemp` # for dialog output git.alt task ls \ | grep -P '^#\d+ NEW' \ | colrm 1 1 \ | sed 's/^\([0-9]*\) NEW \(.*\)/\1 \"\2\"/' \ > $T1 H2=`wc -l < $T1` if [ "$HM" -gt "$H2" ]; then H=$H2 else H=$HM fi echo "--menu \"select task for run\"" -1 $W $H > $T2 cat $T1 >> $T2 if dialog --file $T2 2> $T3; then git.alt task run "`cat $T3`" fi rm -f "$T1" "$T2" "$T3" stty sane mithraen-build-utils-0.1.20/bin/tasks-rerun000075500000000000000000000001621230753762600206200ustar00rootroot00000000000000#!/bin/sh git.alt task ls \ | grep FAIL \ | sed 's/ FAIL.*//' \ | sed 's/#//' \ | xargs -n1 git.alt task run mithraen-build-utils-0.1.20/bin/try_build_targets000075500000000000000000000002671230753762600220760ustar00rootroot00000000000000#!/bin/sh # Build in M40 pocket . $(dirname `realpath $0`)/mithraen-hasher-utils if [ -z "$1" ]; then exit -1 fi if [ -z "$2" ]; then exit -1 fi try_build_targets "$1" "$2" "$3" mithraen-build-utils-0.1.20/bin/un__.sh000075500000000000000000000040431230753762600176750ustar00rootroot00000000000000#!/bin/sh # a script to clean up RPM %__macro abuse # (those are actually rpm's _internal_ macros, # not intended for direct usage in specs and # in fact cluttering them up without any bonus) # 2006 by Michael Shigorin # 2007 by evg@altlinux # use freely fatal() { echo "$0: $*" >&2 exit 1 } [ -s "$1" ] || fatal "gimme a spec!" grep -q '^[^#]*%__' "$1" || exit 2 TMPSPEC=`mktemp $1.XXXXXX` || fatal "unable to create temporary file" sed \ -e 's@%__awk@gawk@g' \ -e 's@%__bzip2@bzip2@g' \ -e 's@%__cat@cat@g' \ -e 's@%__chgrp@chgrp@g' \ -e 's@%__chmod@chmod@g' \ -e 's@%__chown@chown@g' \ -e 's@%__cp@cp@g' \ -e 's@%__cpio@cpio@g' \ -e 's@%__file@file@g' \ -e 's@%__gpg@gpg@g' \ -e 's@%__grep@grep@g' \ -e 's@%__gzip@gzip@g' \ -e 's@%__id@id@g' \ -e 's@%__install@install@g' \ -e 's@%__install_info@install-info@g' \ -e 's@%__ln_s@ln -s@g' \ -e 's@%__make@make@g' \ -e 's@%__mkdir_p@mkdir -p@g' \ -e 's@%__mkdir@mkdir@g' \ -e 's@%__mv@mv@g' \ -e 's@%__patch@patch@g' \ -e 's@%__perl@perl@g' \ -e 's@%__pgp@pgp@g' \ -e 's@%__python@python@g' \ -e 's@%__rm@rm@g' \ -e 's@%__rsh@rsh@g' \ -e 's@%__sed@sed@g' \ -e 's@%__ssh@ssh@g' \ -e 's@%__subst@sed -i@g' \ -e 's@%__tar@tar@g' \ -e 's@%__unzip@unzip@g' \ -e 's@%__ar@ar@g' \ -e 's@%__as@as@g' \ -e 's@%__cc@gcc@g' \ -e 's@%__cpp@gcc -E@g' \ -e 's@%__cxx@g++@g' \ -e 's@%__ld@ld@g' \ -e 's@%__nm@nm@g' \ -e 's@%__objcopy@objcopy@g' \ -e 's@%__objdump@objdump@g' \ -e 's@%__ranlib@ranlib@g' \ -e 's@%__strip@strip@g' \ -e 's@%__libtoolize@libtoolize@g' \ -e 's@%__aclocal@aclocal@g' \ -e 's@%__autoheader@autoheader@g' \ -e 's@%__automake@automake@g' \ -e 's@%__autoconf@autoconf@g' \ < "$1" > "$TMPSPEC" \ && add_changelog -e '- spec macro abuse cleanup' "$TMPSPEC" ||: mv "$1" "$1.bak" \ && mv "$TMPSPEC" "$1" #echo "please inspect $TMPSPEC for cleaned up version" # changelog # 2006-12-16: initial release # 2006-12-18: minor fixes: # + %__mkdir was replaced before %__mkdir_p # + %__subst is now replaced with sed -i (tnx wrar@) mithraen-build-utils-0.1.20/bin/update-asterisk-1.6.2000075500000000000000000000024101230753762600221070ustar00rootroot00000000000000#!/bin/bash -e if [ ! -f "$1" ]; then echo "Use: $0 " exit -1 fi PACKAGE=`realpath "$1"` N=${PACKAGE##*/} N=${N%%.tar.gz} PACKAGE_NAME=${N%-*} PACKAGE_VER=${N##*-} echo $PACKAGE_NAME $PACKAGE_VER if [ "$PACKAGE_NAME" != "asterisk" ]; then echo "This script update only Asterisk" exit -1 fi pushd ~/git/altlinux/packages/asterisk1.6.2 2>&1 > /dev/null || exit -1 # update sources update_sources() { git checkout upstream rm -rf asterisk git checkout -f gear-update "$PACKAGE" asterisk rm -f asterisk/sounds/*.tar.gz git commit -a -m "$PACKAGE_VER" ||: } # update spec and create tag update_spec() { git checkout master git pull . upstream sed -i "s/^Version:.*/Version: $PACKAGE_VER/" specs/asterisk1.6.2.spec sed -i "s/^Release:.*/Release: alt1/" specs/asterisk1.6.2.spec add_changelog -e "- $PACKAGE_VER" specs/asterisk1.6.2.spec ||: specgen gear-update-tag -ac gear-commit --no-edit -a ||: gear-create-tag ||: git push ||: git push --tags ||: } update_sources update_spec TASK=`git.alt task new` for s in ~/git/altlinux/packages/asterisk1.6.2*; do if pushd "$s" > /dev/null; then git checkout master if [ -f update.sh ]; then ./update.sh fi task-add $TASK fi done mithraen-build-utils-0.1.20/share/000075500000000000000000000000001230753762600167475ustar00rootroot00000000000000mithraen-build-utils-0.1.20/share/asterisk-update-common000064400000000000000000000023401230753762600232640ustar00rootroot00000000000000#!/bin/sh -e #============================================================================# # Общий код для автоматизированной сборки обновления для Asterisk # #============================================================================# # (C) Denis Smirnov http://mithraen.ru/ # #============================================================================# clone() { if [ ! -d "$1" ]; then gear-clone "$1" fi } ast_gear_clone() { clone asterisk$base_ver & for pkg in $ast_modules; do clone asterisk$base_ver-$pkg & done wait } ast_update() { pushd asterisk$base_ver mkdir -p .git/uupdate gear-cronbuild ||: COUNT=`git diff HEAD asterisk$base_ver.spec | wc -l` if [ "$COUNT" = "0" ]; then echo "No need to update" exit -1 fi specgen-update gear-commit --no-edit -a ||: gear-create-tag ||: git push ||: git push --tags ||: popd } ast_send_to_git_alt() { cd asterisk$base_ver task-add $TASK cd .. for pkg in $ast_modules; do pushd asterisk$base_ver-$pkg ./update.sh task-add $TASK popd done }