Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37483885
en ru br
Репозитории ALT
S:1.46-alt1
5.1: 1.08-alt0.M51.1
www.altlinux.org/Changes

Группа :: Разработка/Прочее
Пакет: gear-cronbuild

 Главная   Изменения   Спек   Патчи   Исходники   Загрузить   Gear   Bugs and FR  Repocop 

pax_global_header00006660000000000000000000000064123175447060014523gustar00rootroot0000000000000052 comment=dcc06169ae994c54d4ca2346f8a35dd79324784f
gear-cronbuild-1.26/000075500000000000000000000000001231754470600143465ustar00rootroot00000000000000gear-cronbuild-1.26/.gear/000075500000000000000000000000001231754470600153425ustar00rootroot00000000000000gear-cronbuild-1.26/.gear/rules000064400000000000000000000000071231754470600164140ustar00rootroot00000000000000tar: .
gear-cronbuild-1.26/gear-cronbuild000075500000000000000000000013141231754470600171700ustar00rootroot00000000000000#!/bin/sh -e

. shell-quote

if [ x"$1" = x--help ]; then
cat <<EOF
usage: gear-cronbuild <gear invocation arguments>

gear-cronbuild is a shell wrapper for the sequence
gear-cronbuild-apply-hooks && gear <gear invocation arguments> && gear-commit
EOF
exit 0
fi

echo running gear-cronbuild-apply-hooks ...
gear-cronbuild-apply-hooks
echo running gear "$@" ...
gear "$@"

[ -n "\$(git status --porcelain -s -uno)" ] || {
echo unuse gear-commit
exit 0
}

commitmsg=
[ -x .gear/cronbuild-commitmsg ] && commitmsg=`.gear/cronbuild-commitmsg`
[ -n "$commitmsg" ] && commitmsg="\"$(quote_shell "$commitmsg")\""

echo running gear-commit ${commitmsg:+-m "$commitmsg"} ...
gear-commit ${commitmsg:+-m "$commitmsg"}
gear-cronbuild-1.26/gear-cronbuild-apply-hooks000075500000000000000000000107051231754470600214400ustar00rootroot00000000000000#!/bin/sh

##############################
## TODO: PIPESTATUS is bashism
##############################

logfile=cronbuild-apply-hooks.log
difffile=cronbuild-apply-hooks.diff
EXIT_MAGIC_CODE_NOTHING_TO_DO=77

error_hook()
{
local hook_name="$1"; shift;
echo "cronbuild: the hook $hook_name exited ubnormally. see $logfile for details."
exit 2
}

do_hook()
{
local hook="$1"; shift;
echo running "$hook" "$@"
"$hook" "$@" 2>&1 | tee -a "$logfile"
[ ${PIPESTATUS[0]} -gt 0 ] && error_hook "$hook"
return 0
}

add_changelog_builtin()
{
local gear_specfile="$1"; shift;
adate=$(date +"%Y%m%d")
add_changelog -e "- repocop cronbuild $adate. At your service." $gear_specfile
}

find_watchfile()
{
local pkgname=$1
watchfile=
for i in .gear/$pkgname*.watch $pkgname*.watch .gear/autobuild.watch .gear/*.watch *.watch ; do
if [ -f $i ]; then
watchfile=$i
return 0
fi
done
watchfile=`find . -path '*/debian/watch' -type f | head -1`
[ -f "$watchfile" ] && return 0
return 1
}

if ! [ -d .gear ]; then
echo ".gear directory not found. exiting."
exit 1
fi

[ -e "$logfile" ] && rm -f "$logfile"
[ -e "$difffile" ] && rm -f "$difffile"

gear_specfile="$(gear --command sh -- -c 'printf %s "$gear_specfile"')"
if [ -z "$gear_specfile" ] || ! [ -e "$gear_specfile" ]; then
echo "cronbuild: can't find spec file. exiting."
exit 1
fi

if [ -e ./.gear/cronbuild-git-config ]; then
cat ./.gear/cronbuild-git-config | xargs git config
fi

saved_specfile="$gear_specfile".sav.~
saved_changelog="$gear_specfile".changelog.sav.~
gear_changelog="$gear_specfile".changelog.new.~
cat "$gear_specfile" > "$saved_specfile"
sed -e '1,/^%changelog/d' "$gear_specfile" > "$saved_changelog"

exit_cleanup()
{
rm -f "$saved_specfile" "$saved_changelog" "$gear_changelog"
}

last_commit=`git show-ref --head HEAD | awk '{if ($2=="HEAD") print $1;}'`
last_commit=${last_commit:=HEAD}

gear_pkg_name="$(gear --command sh -- -c 'printf %s "$gear_pkg_name"')"
if [ -x ./.gear/cronbuild-update-source ]; then
do_hook ./.gear/cronbuild-update-source $gear_specfile
elif find_watchfile $gear_pkg_name; then
echo "INFO: using watchfile $watchfile"
rpm-uscan --any-archive --watchfile="$watchfile" --force-action=gear-uupdate
else
echo "cronbuild: the required hook ./.gear/cronbuild-update-source is missing or not executable."
exit_cleanup
exit 3
fi

git diff $last_commit > "$difffile"
if ! [ -s "$difffile" ]; then
echo "INFO: source files did not change after cronbuild-update. Nothing to do.";
rm -f "$difffile"
exit $EXIT_MAGIC_CODE_NOTHING_TO_DO;
fi
rm -f "$difffile"

if [ -x ./.gear/cronbuild-update-version ]; then
do_hook ./.gear/cronbuild-update-version $gear_specfile
elif cmp "$saved_specfile" "$gear_specfile"; then
echo "INFO: spec file did not change after cronbuild-update-source."
echo "INFO: running built-in cronbuild-update-version"
do_hook gear-cronbuild-update-spec-timestamp $gear_specfile
else
echo "INFO: spec file changed after cronbuild-update-source."
echo "INFO: skip built-in built-in cronbuild-update-version"
fi

sed -e '1,/^%changelog/d' "$gear_specfile" > "$gear_changelog"
if [ -x ./.gear/cronbuild-add-changelog ]; then
do_hook ./.gear/cronbuild-add-changelog $gear_specfile
elif cmp "$saved_changelog" "$gear_changelog"; then
echo "INFO: changelog did not change before cronbuild-add-changelog."
echo "INFO: running built-in cronbuild-add-changelog"
do_hook add_changelog_builtin $gear_specfile
else
echo "INFO: changelog changed before cronbuild-add-changelog."
echo "INFO: skip built-in built-in cronbuild-add-changelog"
fi

exit_cleanup

git add $gear_specfile

: <<'__EOF__'

=head1 NAME

gear-cronbuild-apply-hooks

=head1 SYNOPSIS

B<gear-cronbuild-apply-hooks>

=head1 DESCRIPTION

B<gear-cronbuild-apply-hooks>

=head1 OPTIONS


= head1 FILES

=over

=item B<.gear/cronbuild-update-source>

Required.

=item B<.gear/cronbuild-update-version>

Optional.

=item B<.gear/cronbuild-add-changelog>

Optional.

=back

=head1 SEE ALSO

http://www.altlinux.org/Gear/cronbuild

=head1 AUTHOR

Written by Igor Vlasenko <viy@altlinux.org>.

=head1 COPYING

Copyright (c) 2010,2011 Igor Vlasenko, ALT Linux Team.

This is free software; you can redistribute it and/or modify it under the terms
of the GNU General Public License as published by the Free Software Foundation;
either version 2 of the License, or (at your option) any later version.

=cut

__EOF__
gear-cronbuild-1.26/gear-cronbuild-apply-hooks-in-hsh-chroot000075500000000000000000000112571231754470600241230ustar00rootroot00000000000000#!/bin/sh -e

gitbranch=
verbose=
quiet=
while :; do
case "$1" in
"") break
;;
--) shift; break
;;
-d|--gitbranch) shift; gitbranch="$1"
;;
-h|--help) pod2usage --exit=0 "$0"; exit 0
;;
-q|--quiet) quiet=-q; verbose=
;;
-v|--verbose) verbose=-v; quiet=
;;
*) pod2usage --exit=2 "$0"; exit 2
;;
esac
shift
done

[ -n "$verbose" ] && set $verbose

if ! [ -d .git ]; then
echo `pwd`" is not a .git repository"
exit 2
fi

# getting workdir
eval `hsh --printenv "$@"`
hsh --initroot-only "$@"
cronbuild_requires=
[ -e ./.gear/cronbuild-options ] && . ./.gear/cronbuild-options ||:
# skip git-arch git-svn git-cvs mc
hsh-install wget curl git-core vim-console less rpm-utils unzip xz gear-cronbuild libshell $cronbuild_requires

if [ -e ~/.gitconfig ]; then
cp ~/.gitconfig "$workdir"/chroot/.in/
elif [ -e ~/.config/git/config ]; then
cp ~/.config/git/config "$workdir"/chroot/.in/.gitconfig
else
cat <<EOF
file ~/.gitconfig is not found. please, configure your git using
git config --global user.name "Your Name Comes Here"
git config --global user.email you@yourdomain.example.com
EOF
exit 1
fi

current_gitbranch="$(git branch | awk '/^\*/{print $2}')" ||:
[ -z "$gitbranch" ] && gitbranch="$current_gitbranch" ||:
[ -z "$gitbranch" ] && gitbranch=cronbuild ||:

if [ "$gitbranch" != "$current_gitbranch" ]; then
git branch -D $gitbranch ||:
git checkout -b $gitbranch
fi

gid2=`hsh-run egrep '^builder:x:' /etc/group | awk -F: '{print $3}'`
cp -a . "$workdir"/chroot/.in/cronbuild.git
chgrp -R $gid2 "$workdir"/chroot/.in/cronbuild.git
chmod -R g+w "$workdir"/chroot/.in/cronbuild.git
pushd "$workdir"/chroot/.in/cronbuild.git >/dev/null
git init --shared=664
popd >/dev/null

if [ -x .gear/cronbuild-prepare-chroot-as-rooter ]; then
install -m755 .gear/cronbuild-prepare-chroot-as-rooter "$workdir"/chroot/.in/
hsh-run "$@" --rooter /.in/cronbuild-prepare-chroot-as-rooter
fi

cat <<EOF > "$workdir"/chroot/.in/cronbuild.sh
#!/bin/bash -e
. shell-quote
set -v
mkdir -p ~/.config/git
cp /.in/.gitconfig ~/.config/git/config
cd /.in/cronbuild.git
gear-cronbuild-apply-hooks
[ -n "\$(git status --porcelain -s -uno)" ] || exit 0
commitmsg=
[ -x .gear/cronbuild-commitmsg ] && commitmsg="\$(.gear/cronbuild-commitmsg)"
[ -n "\$commitmsg" ] && commitmsg="\"\$(quote_shell "\$commitmsg")\""
gear-commit \${commitmsg:+-m "\$commitmsg"} --no-edit
EOF
chmod 755 "$workdir"/chroot/.in/cronbuild.sh
hsh-run "$@" /.in/cronbuild.sh
git pull "$workdir"/chroot/.in/cronbuild.git $gitbranch

: <<'__EOF__'

=head1 NAME

gear-cronbuild-apply-hooks-in-hsh-chroot

=head1 SYNOPSIS

B<gear-cronbuild-apply-hooks-in-hsh-chroot>
[B<-h>]
[B<-d> I<local branch>]
[B<-v>]
[B<-q>]
[-- <hsh-initroot arguments>]


=head1 DESCRIPTION

B<gear-cronbuild-apply-hooks-in-hsh-chroot>
The safe variant of the gear-cronbuild-apply-hooks. It use hasher chroot
to apply gear-cronbuild hooks. Separate this utility options
and hsh-initroot/hsh-run arguments and options with --.

Example:
gear-cronbuild-apply-hooks-in-hsh-chroot -v -- $TMP/hasher --mountpoints=/proc --number=1
or just
gear-cronbuild-apply-hooks-in-hsh-chroot
to run hasher with default settings.

=head1 OPTIONS

=over

=item B<-d> I<local branch name>

Name of the local branch to apply gear-cronbuild hooks. Default is current branch.

=item B<-h>

Display this help and exit.

=item B<-v>

verbose

=item B<-q>

quiet

=back

= head1 FILES

=over

=item B<.gear/cronbuild-options>

By default, gear-cronbuild-apply-hooks-in-hsh-chroot will install in hasher chroot
the following packages:
wget curl git-core vim-console less rpm-utils unzip xz gear-cronbuild.

Any other package to be installed in hasher chroot should be explicitly
listed in I<cronbuild_requires> variable.

Example:
cronbuild_requires="git-svn rpm-macros-mingw32"

=item B<.gear/cronbuild-prepare-chroot-as-rooter>

Optional script that will be run in the hasher chroot with hasher's
rooter user privileges before the main gear-cronbuild scripts.

Should be used for chroot setup, like editing configs in /etc and so on.

The script should be executable.

=item B<.gear/cronbuild-commitmsg>

Optional script to provide commit message. By default, the default message
of gear-commit is used.

The script should be executable.

=back

=head1 SEE ALSO

http://www.altlinux.org/Gear/cronbuild

=head1 AUTHOR

Written by Igor Vlasenko <viy@altlinux.org>.

=head1 COPYING

Copyright (c) 2010,2011 Igor Vlasenko, ALT Linux Team.

This is free software; you can redistribute it and/or modify it under the terms
of the GNU General Public License as published by the Free Software Foundation;
either version 2 of the License, or (at your option) any later version.

=cut

__EOF__
gear-cronbuild-1.26/gear-cronbuild-update-spec-timestamp000075500000000000000000000032071231754470600234040ustar00rootroot00000000000000#!/usr/bin/perl -w

#use strict;
use warnings;
use Carp;
use Getopt::Long;
use File::Basename;
use RPM qw/vercmp/;
use RPM::Source::Editor;

my ($spec);
my $verbose=1;
my $result = GetOptions (
"verbose+" => \$verbose);

$specfile=$ARGV[0];
if (!$specfile) {
print "usage:$0 specfile\n";
exit (1);
}
if (! -e $specfile) {
print "ERROR: $specfile does not found\n";
exit (64);
}

$spec=RPM::Source::Editor->new(
SPECFILE=> $specfile,
VERBOSE=> $verbose,
);

my $mainsec=$spec->get_section('package','');

my $timestamp=`date +"\%Y\%m\%d"`;
chomp $timestamp;



&update_tag('Release');
&update_tag('Version');
&update_tag('Serial');
&update_tag('Epoch');
sub update_tag{
my $tagname=shift;
my $val = $mainsec->get_tag($tagname, RAW=>1);
if ($val and $val=~/20[012]\d(?:0[1-9]|1[0-2])[0-3][0-9]/) {
$val=~s/20[012]\d(?:0[1-9]|1[0-2])[0-3][0-9]/$timestamp/;
print "changed timestamp in tag $tagname\n";
$mainsec->set_tag($tagname, $val);
&write_spec_and_exit();
}
}

if ($mainsec->match_body(qr'^\%define\s+[\w_]+\s+20[012]\d(?:0[1-9]|1[0-2])[0-3][0-9]\s*$')) {
print "changed timestamp in macro definition\n";
$mainsec->subst_body_if(qr'20[012]\d(?:0[1-9]|1[0-2])[0-3][0-9]',$timestamp,
qr'^\%define\s+[\w_]+\s+20[012]\d(?:0[1-9]|1[0-2])[0-3][0-9]\s*$');
&write_spec_and_exit();
};

print "timestamp not found in spec file. exiting.\n";
exit 3;

sub write_spec_and_exit {
system('mv',$specfile,$specfile.'~')==0 or die "can't backup specfile $specfile";
open SPEC, '>', $specfile or die "can't rewrite specfile $specfile: $!";
print SPEC $spec->get_spec();
close SPEC;
exit 0;
}
gear-cronbuild-1.26/gear-cronbuild.spec000064400000000000000000000071361231754470600201260ustar00rootroot00000000000000Name: gear-cronbuild
Version: 1.26
Release: alt1

Summary: gear repository automated build utility
License: GPL
Group: Development/Other
Packager: Igor Vlasenko <viy@altlinux.org>
Url: http://www.altlinux.org/Gear/cronbuild
BuildArch: noarch

Source: %name-%version.tar

BuildRequires: perl-RPM-Source-Editor perl-RPM perl-devel /usr/bin/pod2man
Requires: gear rpm-uscan > 0.4

%description
%summary

%prep
%setup

%build
#make_build
rm gear-cronbuild.spec

%install
#make_install install DESTDIR=%buildroot
install -D -m755 gear-cronbuild %buildroot%_bindir/gear-cronbuild
install -D -m755 gear-cronbuild-update-spec-timestamp %buildroot%_bindir/gear-cronbuild-update-spec-timestamp
install -D -m755 gear-cronbuild-apply-hooks %buildroot%_bindir/gear-cronbuild-apply-hooks
install -D -m755 gear-cronbuild-apply-hooks-in-hsh-chroot %buildroot%_bindir/gear-cronbuild-apply-hooks-in-hsh-chroot

for i in gear-cronbuild-apply-hooks gear-cronbuild-apply-hooks-in-hsh-chroot; do
pod2man --name $i --center 'gear-cronbuild' --section 1 --release %version $i > $i.1
done

mkdir -p %buildroot%_man1dir
install -m 644 *.1 %buildroot%_man1dir/


%files
%_bindir/*
%_mandir/man?/*

%changelog
* Fri Apr 04 2014 Igor Vlasenko <viy@altlinux.ru> 1.26-alt1
- new version

* Mon Jun 03 2013 Igor Vlasenko <viy@altlinux.ru> 1.25-alt1
- support for .gear/cronbuild-git-config

* Thu Dec 06 2012 Igor Vlasenko <viy@altlinux.ru> 1.24-alt1
- bugfix release

* Tue Dec 13 2011 Igor Vlasenko <viy@altlinux.ru> 1.23-alt1
- gear-commit is optional (thanks to solo@)

* Mon Nov 14 2011 Igor Vlasenko <viy@altlinux.ru> 1.22-alt1
- added help, cleanup

* Wed Oct 19 2011 Igor Vlasenko <viy@altlinux.ru> 1.21-alt1
- support for .watch files

* Wed Oct 12 2011 Igor Vlasenko <viy@altlinux.ru> 1.20-alt1
- bugfix release

* Wed Oct 12 2011 Igor Vlasenko <viy@altlinux.ru> 1.19-alt1
- bugfix release

* Wed Oct 12 2011 Igor Vlasenko <viy@altlinux.ru> 1.18-alt1
- bugfix release

* Sat Oct 08 2011 Igor Vlasenko <viy@altlinux.ru> 1.17-alt1
- bugfixes in commit msg, by solo@ (closes: 26428)

* Wed Oct 05 2011 Igor Vlasenko <viy@altlinux.ru> 1.16-alt1
- update-version, add-changelog hooks are now optional.

* Wed Oct 05 2011 Igor Vlasenko <viy@altlinux.ru> 1.15-alt1
- added msg shell quoting, by solo@ (closes: 26412)

* Sun Oct 02 2011 Igor Vlasenko <viy@altlinux.ru> 1.14-alt1
- bugfix release

* Sun Oct 02 2011 Igor Vlasenko <viy@altlinux.ru> 1.13-alt1
- new version
- Merged Alexey Avdeev'support for commit msg (closes: 26400)

* Tue Sep 20 2011 Igor Vlasenko <viy@altlinux.ru> 1.12-alt1
- bugfix release
- added manuals

* Wed Sep 07 2011 Igor Vlasenko <viy@altlinux.ru> 1.11-alt1
- bugfix release

* Sun Sep 04 2011 Igor Vlasenko <viy@altlinux.ru> 1.10-alt1
- added gear-cronbuild-apply-hooks-in-hsh-chroot

* Wed Mar 30 2011 Igor Vlasenko <viy@altlinux.ru> 1.09-alt1
- more verbose messages

* Sat Feb 19 2011 Igor Vlasenko <viy@altlinux.ru> 1.08-alt1
- bugfix release

* Wed Feb 16 2011 Igor Vlasenko <viy@altlinux.ru> 1.07-alt1
- bugfix release

* Sat Oct 16 2010 Igor Vlasenko <viy@altlinux.ru> 1.06-alt1
- no eval in sh script (thanks to raorn@)

* Sat Jul 03 2010 Igor Vlasenko <viy@altlinux.ru> 1.05-alt1
- added proper commit diff

* Thu Jul 01 2010 Igor Vlasenko <viy@altlinux.ru> 1.04-alt1
- added nothing-to-do check

* Wed Jun 30 2010 Igor Vlasenko <viy@altlinux.ru> 1.03-alt1
- bugfix release

* Tue Jun 29 2010 Igor Vlasenko <viy@altlinux.ru> 1.02-alt1
- renamed gear-cronbuild-apply to gear-cronbuild-apply-hooks

* Sat Jun 26 2010 Igor Vlasenko <viy@altlinux.ru> 1.01-alt1
- added gear-cronbuild-apply

* Thu Jun 24 2010 Igor Vlasenko <viy@altlinux.ru> 1.0-alt1
- first release

 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin