Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[extsys] Initial check-in
  • Loading branch information
mcb30 committed May 9, 2010
0 parents commit d8b5d10
Show file tree
Hide file tree
Showing 8 changed files with 370 additions and 0 deletions.
22 changes: 22 additions & 0 deletions README
@@ -0,0 +1,22 @@
Mandriva package repository access
==================================

If you do not have a Mandriva ssh account, you can still obtain easy
access to the Mandriva package repository by editing /etc/repsys.conf
and configuring the following settings:

[global]
mirror = http://svn.mandriva.com/svn/packages/cooker
[log]
oldurl = http://svn.mandriva.com/svn/packages/misc

It is then possible to check out and build packages (without the
changelog) using e.g.

mdvsys co perl-IO-Null
cd perl-IO-Null
bm -l

or to directly extract an SRPM (with changelog) using

mdvsys extract perl-IO-Null
7 changes: 7 additions & 0 deletions ext-create-srpm
@@ -0,0 +1,7 @@
#!/usr/bin/perl -w

use strict;
use warnings;

$ENV{REPSYS_CONF} = "/etc/extsys.conf";
exec ( "/usr/share/repsys/create-srpm", @ARGV );
30 changes: 30 additions & 0 deletions ext-upload-srpm
@@ -0,0 +1,30 @@
#!/usr/bin/perl -w

use File::Temp qw ( tempdir );
use strict;
use warnings;

die "Syntax: $0 [options] target srpm" unless @ARGV >= 2;

my $srpm = pop @ARGV;
my $target = pop @ARGV;
my @options = @ARGV;

my $pkgdir = tempdir ( CLEANUP => 1 );

my @bm = ( "/usr/bin/bm", "-l", "--move-srpm", $pkgdir, "--move-rpm", $pkgdir,
"--clean", $srpm );
system ( @bm ) == 0
or die ( "Could not build package using \"".join ( " ", @bm )."\": $?\n" );

my @rpms = glob ( $pkgdir."/*.rpm" );
print "Build RPMs: ".join ( " ", @rpms )."\n";

my @youri_submit = ( "/usr/bin/perl", "-I/usr/share/mdv-youri-core/lib",
"-I/usr/share/mdv-youri-submit/lib",
"/usr/share/mdv-youri-submit/bin/youri-submit",
"--config", "/etc/youri/extsubmit.conf", @options,
$target, @rpms );
system ( @youri_submit ) == 0
or die ( "Could not copy packages to distribution tree using \"".
join ( " ", @youri_submit )."\": $?\n" );
68 changes: 68 additions & 0 deletions extsubmit.conf
@@ -0,0 +1,68 @@
# repository definition
repository:
class: Youri::Repository::Mandriva_upload
options:
install_root: /var/lib/extsys/dist
upload_state: 2010.0
2010.0:
arch: x86_64 i586

# targets definitions
targets:
2010.0:
checks:
- tag
- recency
- history
actions:
# - sign
- install
- link
# - archive
- clean
posts:
- hdlist

# checks definitions
checks:
tag:
class: Youri::Submit::Check::Tag
options:
tags:
release: '\dfs[\d\.]*$'
packager: '<\w+@fensystems\.co\.uk>$'
distribution: '^Mandriva Linux$'
vendor: '^Fen Systems$'

recency:
class: Youri::Submit::Check::Recency

history:
class: Youri::Submit::Check::History

# actions definitions
actions:
sign:
class: Youri::Submit::Action::Sign
options:
name: packages@fensystems.co.uk
path: /var/lib/extsys/.gnupg
passphrase: undefined

install:
class: Youri::Submit::Action::Install

link:
class: Youri::Submit::Action::Link

archive:
class: Youri::Submit::Action::Archive

clean:
class: Youri::Submit::Action::Clean

posts:
hdlist:
class: Youri::Submit::Post::Genhdlist2
options:
command: /usr/bin/genhdlist2
12 changes: 12 additions & 0 deletions extsys
@@ -0,0 +1,12 @@
#!/usr/bin/perl -w

use strict;
use warnings;

my @args = @ARGV;
if ( @args >= 1 ) {
( my $action, my @remainder ) = @args;
@args = ( $action, "--config", "/etc/extsys.conf", @remainder );
}

exec ( "/usr/bin/mdvsys", @args );
24 changes: 24 additions & 0 deletions extsys.conf
@@ -0,0 +1,24 @@
[global]
default_parent = svn+ssh://extsys.fensystems.co.uk/var/lib/extsys/svn/cooker
repository = svn+ssh://extsys.fensystems.co.uk/var/lib/extsys/svn

[log]
oldurl = svn+ssh://extsys.fensystems.co.uk/var/lib/extsys/svn/misc

[helper]
create-srpm = /usr/bin/ext-create-srpm
upload-srpm = /usr/bin/ext-upload-srpm

[submit]
host = extsys.fensystems.co.uk
default = 2010.0


# Server-side configuration

[submit 2010.0]
target = /var/lib/extsys/tmp
allowed = svn+ssh://extsys.fensystems.co.uk/var/lib/extsys/svn/

[users]
mcb30 = Michael Brown <mbrown@fensystems.co.uk>
85 changes: 85 additions & 0 deletions extsys.spec
@@ -0,0 +1,85 @@
%define name extsys
%define version 0.1
%define release 1fs

%define extsysdir %{_var}/lib/extsys
%define mdvversion 2010.0

Summary: External Mandriva build system
Name: %{name}
Version: %{version}
Release: %{release}
Source0: http://git.fensystems.co.uk/release/%{name}/%{name}-%{version}.tar.bz2
License: GPL
Group: Development/Other
BuildArchitectures: noarch
Requires: subversion-tools subversion-server bm mdvsys mdv-youri-submit
Requires: mandriva-release-common = %{mdvversion}

%description
extsys provides a mechanism for maintaining a Mandriva external
package repository using the mdvsys family of tools.

%prep
%setup

%build

%install
rm -rf %{buildroot}
mkdir -p %{buildroot}%{_bindir}
install -m 0755 extsys %{buildroot}%{_bindir}/
install -m 0755 mkextrepo %{buildroot}%{_bindir}/
install -m 0755 ext-create-srpm %{buildroot}%{_bindir}/
install -m 0755 ext-upload-srpm %{buildroot}%{_bindir}/
mkdir -p %{buildroot}%{_sysconfdir}
install -m 0644 extsys.conf %{buildroot}%{_sysconfdir}/
mkdir -p %{buildroot}%{_sysconfdir}/youri
install -m 0644 extsubmit.conf %{buildroot}%{_sysconfdir}/youri/
mkdir -p %{buildroot}%{extsysdir}/{svn,dist,tmp}

%clean
rm -rf %{buildroot}

%pre
%_pre_groupadd extsys

%post
umask 002
if [ ! -f %{extsysdir}/svn/format ]; then
# Create empty subversion repository
svnadmin create %{extsysdir}/svn
find /var/lib/extsys/svn -type f -and -perm -u+w -exec chmod g+w \{\} \;
# Populate subversion repository with minimal directory structure
rm -rf %{extsysdir}/tmp/svn
cd %{extsysdir}/tmp
svn co -q file://%{extsysdir}/svn
cd %{extsysdir}/tmp/svn
mkdir cooker misc updates
svn add -q cooker misc updates
svn ci -q -m "Creating empty directory structure"
cd %{extsysdir}
rm -rf %{extsysdir}/tmp/svn
fi
if [ ! -d %{extsysdir}/dist/%{mdvversion} ]; then
# Create empty distribution tree
mkextrepo -q %{mdvversion}
fi

%files
%defattr(-,root,root)
%{_bindir}/extsys
%{_bindir}/mkextrepo
%{_bindir}/ext-create-srpm
%{_bindir}/ext-upload-srpm
%config(noreplace) %{_sysconfdir}/extsys.conf
%config(noreplace) %{_sysconfdir}/youri/extsubmit.conf
%dir %{extsysdir}
%attr (02775,root,extsys) %dir %{extsysdir}/svn
%attr (02775,root,extsys) %dir %{extsysdir}/dist
%attr (02775,root,extsys) %dir %{extsysdir}/tmp
%doc README

%changelog
* Sun May 9 2010 Michael Brown <mbrown@fensystems.co.uk> 0.1-1fs
- First packaged version
122 changes: 122 additions & 0 deletions mkextrepo
@@ -0,0 +1,122 @@
#!/usr/bin/perl -w

=head1 NAME
mkextrepo
=head1 SYNOPSIS
mkextrepo [options] dist_version
Options:
-h,--help Display brief help message
-v,--verbose Increase verbosity
-q,--quiet Decrease verbosity
-r,--root=DIR Specify external distribution root directory
-n,--name=NAME Specify external distribution name
-f,--force Force overwriting of existing media.cfg files
=cut

use Getopt::Long;
use Pod::Usage;
use File::Spec::Functions;
use File::Path qw ( make_path );
use Fcntl qw ( O_WRONLY O_CREAT O_TRUNC O_EXCL );
use strict;
use warnings;

# Parse command-line options
my $verbosity = 1;
my $distroot = "/var/lib/extsys/dist";
my $distname = "External Packages";
my $force = 0;
Getopt::Long::Configure ( 'bundling', 'auto_abbrev' );
GetOptions (
'verbose|v+' => sub { $verbosity++; },
'quiet|q+' => sub { $verbosity--; },
'root|r=s' => sub { shift; $distroot = shift; },
'name|n=s' => sub { shift; $distname = shift; },
'force|f' => sub { $force = 1; },
'help|h|?' => sub { pod2usage(1); },
) or pod2usage ( "Could not parse command-line options" );
die "No distribution version specified\n" unless @ARGV == 1;
my $distversion = shift;
my $distdir = catdir ( $distroot, $distversion );

print "Creating distribution tree \"".$distname."\" in ".$distdir."\n"
if $verbosity >= 1;

make_path ( catdir ( $distdir, "SRPMS", "contrib", "release" ),
catdir ( $distdir, "i586", "media", "media_info" ),
catdir ( $distdir, "i586", "media", "contrib", "release" ),
catdir ( $distdir, "x86_64", "media", "media_info" ),
catdir ( $distdir, "x86_64", "media", "contrib", "release" ) );

my $media_cfg = {};
$media_cfg->{x86_64} = <<__END_MEDIA_CFG__;
[media_info]
version=$distversion
mediacfg_version=2
arch=x86_64
product=$distname packages for Mandriva
xml-info=1
[contrib/release]
name=$distname
srpms=../../SRPMS/contrib/release
[debug_contrib/release]
name=$distname debug
srpms=../../SRPMS/contrib/release
noauto=1
debug_for=contrib/release
[../../i586/media/contrib/release]
name=$distname (32-bit)
arch=i586
[../../SRPMS/contrib/release]
name=$distname sources
rpms=contrib/release debug_contrib/release
noauto=1
__END_MEDIA_CFG__


$media_cfg->{i586} = <<__END_MEDIA_CFG__;
[media_info]
version=$distversion
mediacfg_version=2
arch=i586
product=$distname packages for Mandriva
xml-info=1
[contrib/release]
name=$distname
srpms=../../SRPMS/contrib/release
[debug_contrib/release]
name=$distname debug
srpms=../../SRPMS/contrib/release
noauto=1
debug_for=contrib/release
[../../SRPMS/contrib/release]
name=$distname sources
rpms=contrib/release debug_contrib/release
noauto=1
__END_MEDIA_CFG__


my $open_mode = ( $force ?
( O_WRONLY | O_CREAT | O_TRUNC ) :
( O_WRONLY | O_CREAT | O_EXCL ) );
foreach my $arch ( keys %$media_cfg ) {
my $filename =
catfile ( $distdir, $arch, "media", "media_info", "media.cfg" );
sysopen my $fh, $filename, $open_mode
or die "Could not open ".$filename.": $!\n";
syswrite $fh, $media_cfg->{$arch};
close $fh;
}

0 comments on commit d8b5d10

Please sign in to comment.