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 21:20:35 +0300
Message-ID: <20140619182035.GA18999@dad.imath.kiev.ua> (raw)
In-Reply-To: <53A3178E.5000001@altlinux.com>

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

On Thu, Jun 19, 2014 at 09:02:06PM +0400, Anton Farygin wrote:
> Игорь, я же говорю - remotes надо описывать в watch файле.

На watch файлы в свое время было много нареканий, что сложный в
освоении и запутанный формат. Основная причина, почему я взялся -
это много тысяч готовых watch файлов, которые можно скопировать
не читая из дистрибутивов, основанных на debian.

git+gear -- alt специфический, там нет такой необходимости
быть с чем-то совместимым. плюс специфика кода, я много 
усилий вложил в минимизацию diff с debian в участках кода,
работающего с watch файлами, чтобы можно было бесконфликтно
мержится с debian. Не хочется опять все ломать.

Просто посмотрите на .gear/upstream/remotes, что это такой
хитрый watch файл для git tags, а git-config -- это
такой у него формат.

Прилагаю к письму proof-of-concept скрипт, 
"watch для gear tags", test-tag-watch.

пока поддерживает только стандартные теги v@version@ и @version@,
для работы нужно скопировать секцию remote из .git/config
в .gear/upstream/remotes.

Проверьте у себя, пожалуйста. При запуске в корне gear репозитория
должен выдать что-то вроде "Repository is up to date."
 
> >он выполнил свой долг, создав файл .gear/upstream/remotes.
> Зачем эта информация сообществу ?

Меня тоже надо услышать. Мне лично и прямо сейчас такая информация
уже нужна для пакетов perl-*. Я ведь не исключен из сообщества?
А по закону больших чисел такая информация понадобится не раз и не
два еще не одному десятку майнтайнеров. Да, у нас массовые обновления 
и исправления пакетов не очень распространены. Но не потому, что
не нужны, а потому что требуется слишком много усилий из-за
несовершенства инструментов.

-- 

I V

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

#!/usr/bin/perl

use strict;
use warnings;
use RPM::uscan;

my $pattern='v?([\d\.]*\d)';
my $pkg_dir='.';
my $debug=0;
print 'remotes=', join("\n",get_remotes($pkg_dir)),"\n" if $debug;
my @tags=get_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";
	    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 18:20 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 [this message]
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
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=20140619182035.GA18999@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