Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
eepm
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
eepm
Commits
c1fcf500
Commit
c1fcf500
authored
Mar 09, 2017
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implement local cache for contents index for ALT repos
parent
3ba96cdc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
85 additions
and
12 deletions
+85
-12
epm-search_file
bin/epm-search_file
+27
-6
epm-sh-altlinux
bin/epm-sh-altlinux
+58
-6
No files found.
bin/epm-search_file
View file @
c1fcf500
...
...
@@ -17,22 +17,43 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
__local_ercat
()
{
local
i
for
i
in
$*
;
do
case
"
$i
"
in
*
.xz
)
xzcat
$i
;;
*
.lz4
)
lz4cat
$i
;;
*
)
cat
$i
;;
esac
done
}
__alt_local_content_search
()
{
load_helper epm-sh-altlinux
info
"Locate contents index file(s) ..."
local
CI
=
"
$(
get_local_alt_contents_index
)
"
# TODO use something like
[
-n
"
$CI
"
]
||
fatal
"Have no local contents index"
#local OUTCMD="less"
info
"Searching in"
echo
"
$CI
"
echo
"for
$1
... "
#[ -n "$USETTY" ] || OUTCMD="cat"
OUTCMD
=
"cat"
#
OUTCMD="cat"
{
[
-n
"
$USETTY
"
]
&&
info
"Search in
$CI
for
$1
..."
# {
# note! tabulation below!
grep
-h
--
".*
$1
.* "
$CI
|
sed
-e
"s|
\(
.*
\)\t\(
.*
\)
|
\2
:
\1
|g"
}
|
$OUTCMD
__local_ercat
$CI
|
grep
-h
--
".*
$1
.* "
|
sed
-e
"s|
\(
.*
\)\t\(
.*
\)
|
\2
:
\1
|g"
#
} | $OUTCMD
}
epm_search_file
()
...
...
bin/epm-sh-altlinux
View file @
c1fcf500
#!/bin/sh
#
# Copyright (C) 2014 Etersoft
# Copyright (C) 2014 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2014
, 2017
Etersoft
# Copyright (C) 2014
, 2017
Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
...
...
@@ -17,19 +17,71 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#
TODO: port or rewrite apt-file
#
apt-file like. See also
# https://bugzilla.altlinux.org/show_bug.cgi?id=14449
# convert "http://download.etersoft.ru/pub/ALTLinux/p8/branch x86_64" to /tmp/epm/ALTLinux/p8/branch/x86_64
get_local_alt_mirror_path
()
{
local
DN1
=
$(
dirname
"
$1
"
)
local
DN2
=
$(
dirname
$DN1
)
local
BN0
=
$(
basename
"
$1
"
)
# arch
local
BN1
=
$(
basename
$DN1
)
# branch/Sisyphus
local
BN2
=
$(
basename
$DN2
)
[
"
$BN1
"
=
"branch"
]
&&
echo
"/tmp/eepm/
$BN2
/
$BN1
/
$BN0
"
||
echo
"/tmp/eepm/
$BN1
/
$BN0
"
}
# args: url target_file
# result: will set FILE
download_alt_contents_index
()
{
local
TD
=
"
$2
"
local
OFILE
=
"
$TD
/
$(
basename
"
$1
"
)
"
local
DONE
=
"
$TD
/done.
$(
basename
"
$1
"
)
"
# TODO: check if too old
if
[
-r
"
$DONE
"
]
;
then
return
fi
mkdir
-p
"
$TD
"
docmd eget
-O
"
$OFILE
"
"
$1
"
||
return
# plain file by default
echo
""
>
$DONE
# try compress
if
epm assure lz4
;
then
docmd lz4
--rm
"
$OFILE
"
"
$OFILE
.lz4"
||
return
echo
"lz4"
>
$DONE
else
epm assure xz
||
return
docmd xz
"
$ofile
"
||
return
echo
"xz"
>
$DONE
fi
}
get_local_alt_contents_index
()
{
load_helper epm-repolist
epm_repolist |
grep
"rpm.*file:/"
|
sed
-e
"s|^rpm.*file:||g"
|
while
read
URL ARCH other
;
do
test
-d
"
$URL
/
$ARCH
"
||
continue
# fatal "Local mirror is not accessible via $URL/$ARCH"
FILE
=
"
$URL
/
$ARCH
/base/contents_index"
# print out from local mirror
epm_repolist |
grep
"rpm.*file:/"
|
sed
-e
"s|^rpm.*file:||g"
|
while
read
LOCALPATH ARCH other
;
do
test
-d
"
$LOCALPATH
/
$ARCH
"
||
continue
FILE
=
"
$LOCALPATH
/
$ARCH
/base/contents_index"
if
[
-r
"
$FILE
"
]
;
then
echo
"
$FILE
"
else
info
"TODO for girar server: There is no
$(
basename
$FILE
)
file in
$(
dirname
$FILE
)
"
fi
done
# print out from mirrored contents_index
epm_repolist |
grep
-E
"rpm[[:space:]]*(ftp|http|https)://"
|
sed
-e
"s@^rpm.*
\(
ftp
\|
http
\|
https://
\)
@
\1
@g"
|
while
read
URL ARCH other
;
do
LOCALPATH
=
$(
get_local_alt_mirror_path
"
$URL
/
$ARCH
"
)
download_alt_contents_index
$URL
/
$ARCH
/base/contents_index
$LOCALPATH
echo
"
$LOCALPATH
/contents_index*"
done
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment