pax_global_header00006660000000000000000000000064116373435700014523gustar00rootroot0000000000000052 comment=8d1580101e0bc884c26a29487da1aa0a4401f6e9 ALTLinux-Girar-UploadMethod-0.01/000075500000000000000000000000001163734357000165265ustar00rootroot00000000000000ALTLinux-Girar-UploadMethod-0.01/.gear/000075500000000000000000000000001163734357000175225ustar00rootroot00000000000000ALTLinux-Girar-UploadMethod-0.01/.gear/rules000064400000000000000000000001351163734357000205760ustar00rootroot00000000000000tar: . name=ALTLinux-Girar-UploadMethod-@version@ base=ALTLinux-Girar-UploadMethod-@version@ ALTLinux-Girar-UploadMethod-0.01/Makefile.PL000064400000000000000000000013671163734357000205070ustar00rootroot00000000000000use ExtUtils::MakeMaker; # See lib/ExtUtils/MakeMaker.pm for details of how to influence # the contents of the Makefile that is written. WriteMakefile( 'NAME' => 'ALTLinux::Girar::UploadMethod', 'VERSION_FROM' => 'UploadMethod.pm', # finds $VERSION 'PREREQ_PM' => { 'File::Path' => 0, 'File::Basename' => 0, 'KyotoCabinet' => 0, 'IPC::Run3' => 0, }, # 'EXE_FILES' => [ 'cpanflute2', 'cpanflute2-old' ], # 'PL_FILES' => { 'cpanflute2.PL' => 'cpanflute2' }, ($] >= 5.005 ? ## Add these new keywords supported since 5.005 ( # ABSTRACT_FROM => 'ACL.pm', # retrieve abstract from module AUTHOR => 'Igor Vlasenko ') : ()), 'EXE_FILES' => [ ], ); ALTLinux-Girar-UploadMethod-0.01/UploadMethod.pm000064400000000000000000000063361163734357000214610ustar00rootroot00000000000000#!/usr/bin/perl -w package ALTLinux::Girar::UploadMethod; use strict; use warnings; use File::Path qw(make_path); use File::Basename; use KyotoCabinet; use IPC::Run3; use constant UNKNOWN => 0; use constant SRPM => 1; use constant GIT => 2; our $VERSION = 0.01; #our $default_expire = 5/24; # -M; 5/24=5 hours our $default_branch = 'sisyphus'; our $default_verbose = 0; our $girar_url="git://git.altlinux.org"; my @cachedirs=grep {$_} ($ENV{HOME}.'/.cache/altlinux-girar','.'); my $dbfile=$cachedirs[0].'/upload_method.kch'; my $db = new KyotoCabinet::DB; make_path($cachedirs[0]); # open the database if (!$db->open($dbfile, $db->OWRITER | $db->OCREATE)) { printf STDERR ("ALTLinux::Girar::UploadMethod: $dbfile: open error: %s\n", $db->error); unlink $dbfile; $db=undef unless $db->open($dbfile, $db->OWRITER | $db->OCREATE); } END { if ($db and !$db->close) { printf STDERR ("ALTLinux::Girar::UploadMethod: $dbfile: close error: %s\n", $db->error); } } sub new { my $proto=shift; my $class=ref($proto) || $proto; my $self = { # -expire=> $default_expire, -branch=> $default_branch, -verbose=> $default_verbose, @_, }; bless($self,$class); return $self; } sub get { my ($self,$name,$version,$release,$branch)=@_; $branch=$self->{-branch} unless $branch; my $key=join("\0",$name,$version,$release,$branch); my $value; $value = $db->get($key) if $db; return $value if defined $value; $value=&method($name,$branch); if ($db and not $db->set($key, $value)) { printf STDERR ("ALTLinux::Girar::UploadMethod: $dbfile: internal set error: %s\n", $db->error); } return $value; } sub method { my ($name,$repobranch)=@_; $repobranch||=$default_branch; my $gitrepo=substr($name,0,1).'/'.$name.'.git'; my $gitpath="refs/heads/$repobranch"; my ($gitcommit, $srpmcommit); my $retval=UNKNOWN; run3 [qw/git ls-remote -h/, "$girar_url/gears/$gitrepo", $gitpath], \undef, \$gitcommit, \undef; my $GITRETVAL=$?; if ($GITRETVAL == 0 and $gitcommit) { $retval=GIT; return $retval unless wantarray; } run3 [qw/git ls-remote -h/, "$girar_url/srpms/$gitrepo", $gitpath], \undef, \$srpmcommit, \undef; my $SRPMRETVAL=$?; $retval=SRPM if ($retval==UNKNOWN and $SRPMRETVAL==0 and $srpmcommit); unless (wantarray) { return $retval; } else { my $has_git_history= $GITRETVAL==0; my $has_srpm_history= $SRPMRETVAL==0; $gitcommit=~s/\s.*$//s; $srpmcommit=~s/\s.*$//s; return $retval, $has_git_history, $has_srpm_history, $gitcommit, $srpmcommit; } } 1; =head1 NAME ALTLinux:: - ALTLinux Girar upload method query library. =head1 DESCRIPTION ALTLinux Girar upload method query library provides an interface to query and cache package's ALTLinux Girar upload method (using srpm or git repository). Upload methods are cached by the name/version/release/branch signature. =head1 AUTHOR Written by Igor Vlasenko . =head1 COPYING Copyright (c) 2010 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 ALTLinux-Girar-UploadMethod-0.01/perl-ALTLinux-Girar-UploadMethod.spec000064400000000000000000000014251163734357000254310ustar00rootroot00000000000000%define module ALTLinux-Girar-UploadMethod Name: perl-%module Version: 0.01 Release: alt1 BuildArch: noarch Packager: Igor Yu. Vlasenko Summary: %module - Perl extension for quering ALTLinux ACL files Group: Development/Perl License: GPL or Artistic Source: http://www.cpan.org/modules/by-module/RPM/%module-%version.tar Url: http://search.cpan.org/dist/%module # Automatically added by buildreq on Wed Nov 06 2002 BuildRequires: perl-devel perl(Pod/Usage.pm) perl-KyotoCabinet perl-IPC-Run3 %description %summary %prep %setup -q -n %module-%version %build %perl_vendor_build %install %perl_vendor_install %files #doc Changes #doc README %perl_vendor_privlib/ALT* #%_bindir/* %changelog * Fri Sep 23 2011 Igor Vlasenko 0.01-alt1 - new version