ALT Linux Team development discussions
 help / color / mirror / Atom feed
From: Igor Vlasenko <vlasenko@imath.kiev.ua>
To: ALT Linux Team development discussions <devel@lists.altlinux.org>
Cc: Anton Farygin <rider@altlinux.com>
Subject: Re: [devel] Gear и внешние   VCS.
Date: Thu, 19 Jun 2014 22:50:07 +0300
Message-ID: <20140619195007.GA19664@dad.imath.kiev.ua> (raw)
In-Reply-To: <20140619194626.GA19576@dad.imath.kiev.ua>

[-- Attachment #1: Type: text/plain, Size: 761 bytes --]

On Thu, Jun 19, 2014 at 10:46:26PM +0300, Igor Vlasenko wrote:
> On Thu, Jun 19, 2014 at 11:08:17PM +0400, Anton Farygin wrote:
> > >Достаточно ли
> > >>>пока поддерживает только стандартные теги v@version@ и @version@,
> > >?
> > нет, см. php5
> 
> Пока не определился с форматом .gear/upstream/tag-filter,
> прикрепляю новый test-tag-watch, для php5 запускать как
> 
> test-tag-watch --pattern 'php-([0-9\.]+)'
> 
> когда станет ясно содержимое .gear/upstream/tag-filter,
> php-([0-9\.]+) можно будет вписать туда.

забыл сам скрипт прикрепить - прикрепляю.

-- 

I V

[-- Attachment #2: test-tag-watch --]
[-- Type: text/plain, Size: 2353 bytes --]

#!/usr/bin/perl

use strict;
use warnings;
use RPM::uscan;
use Getopt::Long;

my $pattern='v?([\d\.]*\d)';
my $pkg_dir='.';
my $debug=0;
my ($verbose,$help);

my $result = GetOptions (
    'verbose+' => \$verbose,
    'q|quiet'  => sub {$verbose=0},
    'h|help'   => \$help,
    'pattern=s'   => \$pattern,
    );

$debug=1 if $verbose;
print "pattern=$pattern\n" if $debug;
print 'remotes=', join("\n",get_remotes($pkg_dir)),"\n" if $debug;
my @tags=get_tags();
die "no tags found that match pattern $pattern\n" unless @tags;
@tags = map {$_->[0]} Devscripts::Versort::upstream_versort(map {[$_,$_]}@tags);
print 'tags=', join(" ",@tags),"\n" if $debug;

my (undef, $upackage, $uversion) = RPM::uscan::altlinux_guess_package_and_version($pkg_dir);
my $version_cmp=Devscripts::Versort::myvercmp($uversion, $tags[0]);

if ($version_cmp>1) {
    print "Oops! local repository ($uversion) is ahead of remote repository ($tags[0]).\n";
} elsif ($version_cmp==0) {
    print "Repository is up to date.\n";
} else {
    print "New version $tags[0] is available.\n";
}

sub get_tags {
    my @tags;
    foreach my $remote (&get_remotes($pkg_dir)) {
	foreach my $tag (&exec2array('git ls-remote --tags '.$remote)) {
	    $tag=~s!^\S+\s+refs/tags/!!;
	    $tag=~s!\^\{\}$!!;
	    print "testing: $tag\n" if $debug;
	    push @tags, $1 if $tag=~/^$pattern$/;
	}
    }
    return @tags;
}

sub exec2array {
    my ($cmd)=@_;
    my @out;
    my $fn;
    open ($fn, "$cmd |") or die "$!: can't exec $cmd\n";
    local $_;
    while (<$fn>) {
	chomp;
	push @out, $_;
    }
    close ($fn);
    #print 'out=', join(";",@out),"\n";
    return @out;
}

sub get_remotes {
    my ($pkg_dir)=@_;
    my @remotes;
    die "can't find $pkg_dir/.gear/upstream/remotes\n" unless -r $pkg_dir.'/.gear/upstream/remotes';
    my $fn;
    open ($fn, 'git config --file '.$pkg_dir.'/.gear/upstream/remotes --list|') or die "$!: can't open .gear/upstream/remotes\n";
    local $_;
    while (<$fn>) {
	chomp;
	next unless /^remote\.([^\.]+)\.url=(\S+)/;
	my $remote=$1;
	#my $url=$2;
	push @remotes, $remote;
    }
    close ($fn);

    my %local_remotes=map{$_=>1} &exec2array('git remote');
    foreach my $remote (@remotes) {
	die "Oops: remote $remote is present in .gear/upstream/remotes, but not in .git/config!\n" unless $local_remotes{$remote};
    }
    return @remotes;
}

  reply	other threads:[~2014-06-19 19:50 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-17 19:42 [devel] Q: редкие примеры .gear/rules ? Igor Vlasenko
2014-06-18  4:45 ` Eugene Prokopiev
2014-06-18 17:53   ` Igor Vlasenko
2014-06-19  7:52   ` Igor Vlasenko
2014-06-19  8:00     ` Eugene Prokopiev
2014-06-19 11:08       ` [devel] Gear и внешние VCS Igor Vlasenko
2014-06-19 11:10         ` Anton Farygin
2014-06-19 11:55           ` Igor Vlasenko
2014-06-19 12:10             ` Anton Farygin
2014-06-19 12:17               ` Igor Vlasenko
2014-06-19 12:49                 ` Anton Farygin
2014-06-19 13:09                   ` Anton Farygin
2014-06-19 14:38                     ` Igor Vlasenko
2014-06-19 14:24                   ` Igor Vlasenko
2014-06-19 17:02                     ` Anton Farygin
2014-06-19 18:20                       ` Igor Vlasenko
2014-06-19 18:35                         ` Anton Farygin
2014-06-19 18:52                           ` Igor Vlasenko
2014-06-19 19:08                             ` Anton Farygin
2014-06-19 19:46                               ` Igor Vlasenko
2014-06-19 19:50                                 ` Igor Vlasenko [this message]
2014-06-20  5:51                                 ` Anton Farygin
2014-06-20 12:23                                   ` Igor Vlasenko
2014-06-20  5:01                         ` Eugene Prokopiev
2014-06-20 12:11                           ` Igor Vlasenko
2014-06-20 12:20                             ` Eugene Prokopiev
2014-06-18  6:14 ` [devel] Q: редкие примеры .gear/rules ? Anton Farygin
2014-06-18 10:30   ` Dmitry V. Levin
2014-06-18 17:54     ` Igor Vlasenko
2014-06-18 18:30   ` Igor Vlasenko
2014-06-18 18:40     ` Pavel Vainerman
2014-06-18 19:08       ` Anton Farygin
2014-06-18  9:50 ` Anton V. Boyarshinov
2014-06-18 10:53 ` Sergey V Turchin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140619195007.GA19664@dad.imath.kiev.ua \
    --to=vlasenko@imath.kiev.ua \
    --cc=devel@lists.altlinux.org \
    --cc=rider@altlinux.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ALT Linux Team development discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/devel/0 devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 devel devel/ http://lore.altlinux.org/devel \
		devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru
	public-inbox-index devel

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git