Compare commits
10 Commits
v1.0
...
7a5df1a97b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7a5df1a97b | ||
|
|
4f8c85707c | ||
|
|
27863a1dd4 | ||
|
|
bc612a6d2e | ||
|
|
01304b1cda | ||
|
|
f35076a8f5 | ||
|
|
41c39b2da0 | ||
|
|
e1a0eac8df | ||
|
|
7f29ad2191 | ||
|
|
e9cbb187bb |
2
.hgtags
Normal file
2
.hgtags
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
7220aac9615b3ef8f1b26df11d8c5a0c5310dcc0 v1.0
|
||||||
|
f30a03756874abf5a09aebcd3d9ab2e236608b60 v1.1
|
||||||
15
README.md
15
README.md
@@ -1,6 +1,6 @@
|
|||||||
# RPM Repositories Cloning tool
|
# RPM Repositories Cloning tool
|
||||||
|
|
||||||
1 to 1 rpm cloning tool
|
1 to 1 rpm repository cloning tool
|
||||||
|
|
||||||
## Getting Started
|
## Getting Started
|
||||||
|
|
||||||
@@ -21,10 +21,19 @@ in case of Slackware Linux everything is already shipped with single Perl
|
|||||||
package.
|
package.
|
||||||
|
|
||||||
```
|
```
|
||||||
apt install libjson-pp-perl, libfile-spec-perl, libxml-parser-perl,
|
# apt install libjson-pp-perl libfile-spec-perl libxml-parser-perl \
|
||||||
libio-compress-perl, liburi-perl
|
libio-compress-perl liburi-perl
|
||||||
```
|
```
|
||||||
|
|
||||||
|
A correct path to repository. You need a string after "baseurl=" in repo-file
|
||||||
|
(one that located in /etc/yum.repos.d, for example), it must end with trailng
|
||||||
|
slash. If it does not, just add it.
|
||||||
|
|
||||||
|
To check that url is correct you can try to download part of repository xml
|
||||||
|
metadata. Put your string into browser address bar and add
|
||||||
|
"repodata/repomd.xml" (no quotes) and if you see xml text then - vua-la! -
|
||||||
|
your string is correct.
|
||||||
|
|
||||||
### Installing
|
### Installing
|
||||||
|
|
||||||
There are no additional effort required for one-shot sync.
|
There are no additional effort required for one-shot sync.
|
||||||
|
|||||||
4
TODO
4
TODO
@@ -1,15 +1,11 @@
|
|||||||
Технический долг и планируемые доработки.
|
Технический долг и планируемые доработки.
|
||||||
|
|
||||||
* внедрить GetOpt, чтобы корректно парсить аргументы ком.строки стандартными средствами. Для этого нужно будет использовать внешние по отношению к Perl модули, GetOpt и GetOpt::Long
|
|
||||||
* XML::Simple умеет работать не только с деревом, но и с потоком xml, в случае с потоком должно потребляться меньше памяти, но работать с ним сложнее
|
* XML::Simple умеет работать не только с деревом, но и с потоком xml, в случае с потоком должно потребляться меньше памяти, но работать с ним сложнее
|
||||||
* добавить возможность работы с sqlite-метаданными и перейти на этот метод по-умолчанию
|
* добавить возможность работы с sqlite-метаданными и перейти на этот метод по-умолчанию
|
||||||
* добавить пример spec-файла
|
* добавить пример spec-файла
|
||||||
* добавить пример debian package
|
* добавить пример debian package
|
||||||
* добавить slackbuild
|
* добавить slackbuild
|
||||||
* добавить ebuild
|
* добавить ebuild
|
||||||
* добавить примеры crontab
|
|
||||||
* добавить man page
|
|
||||||
* добавить методики работы с https://packagecloud.io/ и сервисами подобными им (без автоиндекса)
|
|
||||||
|
|
||||||
Факультативное задание :)
|
Факультативное задание :)
|
||||||
* добавить возможность клонирования deb-репозиториев
|
* добавить возможность клонирования deb-репозиториев
|
||||||
|
|||||||
41
docs/rrclone.1
Normal file
41
docs/rrclone.1
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
.TH "RRCLONE" "1" "5 December 2019"
|
||||||
|
.SH "NAME"
|
||||||
|
rrclone \- RPM Repository Cloning tool
|
||||||
|
.SH "SYNOPSIS"
|
||||||
|
.B rrclone
|
||||||
|
[\fI\,OPTION\/\fR]...
|
||||||
|
SOURCE
|
||||||
|
DESTINATION
|
||||||
|
.SH "DESCRIPTION"
|
||||||
|
.PP
|
||||||
|
Copies all packages and metadata from remote repository to local folder.
|
||||||
|
To guess package list it parses metadata. For now only XML metadata is supported.
|
||||||
|
.SH "OPTIONS"
|
||||||
|
.TP
|
||||||
|
\fB\-\-help\fR
|
||||||
|
show brief help message
|
||||||
|
.TP
|
||||||
|
\fB\-\-version\fR
|
||||||
|
show version
|
||||||
|
.TP
|
||||||
|
\fB\-\-verbose\fR
|
||||||
|
more verbose output
|
||||||
|
.TP
|
||||||
|
\fB\-\-noclean\fR
|
||||||
|
do not clean packages that are missing in metadata
|
||||||
|
.TP
|
||||||
|
\fBSOURCE\fR
|
||||||
|
is http(s) url that does not include repodata part.
|
||||||
|
For example if full (index) metadata path is http://server/repo/Packages/repodata/repomd.xml
|
||||||
|
then SOURCE will be http://server/repo/Packages/ with trailing slash.
|
||||||
|
.TP
|
||||||
|
\fBDESTINATION\fR
|
||||||
|
full path to local directory, for example /var/www/repository/ with triling slash.
|
||||||
|
.SH "AUTHOR"
|
||||||
|
.TP
|
||||||
|
Sergei Fedosoff <eleksir@gmail.com> aka eleksir <eleksir@exs-elm.ru>
|
||||||
|
.SH "COPYRIGHT"
|
||||||
|
Copyright © 2018 Sergei Fedosoff. License 2 clause BSD:
|
||||||
|
https://directory.fsf.org/wiki?title=License:FreeBSD
|
||||||
|
.SH "SEE ALSO"
|
||||||
|
.B rpm (1).
|
||||||
2
docs/rrclone.crontab
Normal file
2
docs/rrclone.crontab
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
# run every sunday at 4.30 in the night
|
||||||
|
30 4 * * 0 http://server/repo/packages/ /var/www/repo 1>/dev/null
|
||||||
46
rrclone
46
rrclone
@@ -15,6 +15,7 @@ use URI::URL;
|
|||||||
use Data::Dumper;
|
use Data::Dumper;
|
||||||
use HTTP::Tiny;
|
use HTTP::Tiny;
|
||||||
use IO::Socket::SSL; # implicit requirement in order to HTTP::Tiny work with https
|
use IO::Socket::SSL; # implicit requirement in order to HTTP::Tiny work with https
|
||||||
|
use Getopt::Long;
|
||||||
|
|
||||||
sub mythread();
|
sub mythread();
|
||||||
sub dlfunc(@);
|
sub dlfunc(@);
|
||||||
@@ -25,29 +26,31 @@ sub path_normalize_by_string_manipulation($);
|
|||||||
sub getfilenames($);
|
sub getfilenames($);
|
||||||
sub noslash($);
|
sub noslash($);
|
||||||
sub dbg($);
|
sub dbg($);
|
||||||
|
sub version();
|
||||||
|
|
||||||
help(0) unless (defined $ARGV[0]);
|
my ($help, $verbose, $noclean, $version);
|
||||||
help(1) unless (defined $ARGV[1]);
|
|
||||||
|
|
||||||
help(0) if ($ARGV[0] eq '--help');
|
GetOptions(
|
||||||
help(0) if ($ARGV[0] eq '-h');
|
"help" => \$help,
|
||||||
|
"verbose" => \$verbose,
|
||||||
|
"noclean" => \$noclean,
|
||||||
|
"version" => \$version
|
||||||
|
);
|
||||||
|
|
||||||
|
version() if ($version);
|
||||||
|
help(0) if ($help);
|
||||||
|
|
||||||
my $noclean = 0;
|
|
||||||
my $DEBUG = 0;
|
my $DEBUG = 0;
|
||||||
|
$DEBUG = 1 if ($verbose);
|
||||||
|
$noclean = 1 if ($noclean);
|
||||||
|
|
||||||
if (defined($ARGV[0]) and $ARGV[0] eq '--noclean') {
|
my $BASEURL = $ARGV[0] // '';
|
||||||
$noclean = 1;
|
my $BASEDIR = $ARGV[1] // '';
|
||||||
}
|
|
||||||
|
|
||||||
my $BASEURL = $ARGV[0];
|
help(0) unless ($BASEURL);
|
||||||
my $BASEDIR = $ARGV[1];
|
help(1) unless ($BASEDIR);
|
||||||
|
|
||||||
if ($noclean == 1) {
|
|
||||||
help(1) unless (defined $ARGV[2]);
|
|
||||||
$BASEURL = $ARGV[1];
|
|
||||||
$BASEDIR = $ARGV[2];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
# check if there is trailing slash at the end of url and path
|
||||||
noslash($BASEURL);
|
noslash($BASEURL);
|
||||||
noslash($BASEDIR);
|
noslash($BASEDIR);
|
||||||
|
|
||||||
@@ -173,7 +176,7 @@ exit 0;
|
|||||||
sub help($) {
|
sub help($) {
|
||||||
my $rc = shift;
|
my $rc = shift;
|
||||||
my $help = <<'HELP';
|
my $help = <<'HELP';
|
||||||
Usage: cr.pl [--noclean] http://source/url/ /destination/dir/
|
Usage: rrclone.pl [--noclean] http://source/url/ /destination/dir/
|
||||||
|
|
||||||
Where
|
Where
|
||||||
--noclean is optional argument, if it specified, no cleanup operation will
|
--noclean is optional argument, if it specified, no cleanup operation will
|
||||||
@@ -188,6 +191,11 @@ Destination is the folder where all files and metadata will be downloaded, if
|
|||||||
folder does not exist it will be created. Must contain trailng slash char.
|
folder does not exist it will be created. Must contain trailng slash char.
|
||||||
For example:
|
For example:
|
||||||
/var/www/htdocs/repo/
|
/var/www/htdocs/repo/
|
||||||
|
|
||||||
|
Other options:
|
||||||
|
--help - show this message
|
||||||
|
--verbose - increases output verbosity
|
||||||
|
--version - show version number and quit
|
||||||
HELP
|
HELP
|
||||||
|
|
||||||
syswrite STDOUT, $help;
|
syswrite STDOUT, $help;
|
||||||
@@ -390,4 +398,8 @@ sub dbg($) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub version() {
|
||||||
|
syswrite STDOUT, "rrclone 1.1\n";
|
||||||
|
exit 0;
|
||||||
|
}
|
||||||
__END__
|
__END__
|
||||||
|
|||||||
Reference in New Issue
Block a user