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
90c9c6be
Commit
90c9c6be
authored
May 13, 2023
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improve mktemp result checking and add remote_on_exit
parent
81641e8b
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
77 additions
and
28 deletions
+77
-28
epm-checksystem
bin/epm-checksystem
+3
-1
epm-download
bin/epm-download
+4
-3
epm-pack
bin/epm-pack
+3
-2
epm-play
bin/epm-play
+7
-4
epm-repack-deb
bin/epm-repack-deb
+2
-1
epm-repack-rpm
bin/epm-repack-rpm
+2
-4
epm-repo-addkey
bin/epm-repo-addkey
+4
-3
epm-restore
bin/epm-restore
+16
-8
epm-sh-functions
bin/epm-sh-functions
+2
-1
epm-status
bin/epm-status
+2
-1
test_mktemp.sh
tests/test_mktemp.sh
+32
-0
No files found.
bin/epm-checksystem
View file @
90c9c6be
...
...
@@ -21,7 +21,9 @@
__alt_fix_triggers
()
{
local
TDIR
=
"
$(
mktemp
-d
)
"
local
TDIR
TDIR
=
"
$(
mktemp
-d
)
"
||
fatal
remote_on_exit
$TDIR
assure_exists
time
touch
$TDIR
/added
for
ft
in
$(
ls
/usr/lib/rpm/
*
.filetrigger |
sort
)
;
do
...
...
bin/epm-download
View file @
90c9c6be
...
...
@@ -67,8 +67,8 @@ __download_pkg_urls()
local
url
[
-z
"
$pkg_urls
"
]
&&
return
for
url
in
$pkg_urls
;
do
local
tmppkg
=
"
$(
mktemp
-d
)
"
||
fatal
"failed mktemp -d"
remove_on_exit
"
$tmppkg
"
local
tmppkg
tmppkg
=
"
$(
mktemp
-d
)
"
||
fatal
docmd
chmod
$verbose
a+rX
$tmppkg
showcmd
cd
$tmppkg
cd
$tmppkg
||
fatal
...
...
@@ -147,7 +147,8 @@ __epm_print_url_alt_check()
{
local
pkg
=
$1
shift
local
tm
=
"
$(
mktemp
)
"
local
tm
tm
=
"
$(
mktemp
)
"
||
fatal
assure_exists curl
load_helper epm-site
quiet
=
1
...
...
bin/epm-pack
View file @
90c9c6be
...
...
@@ -112,8 +112,9 @@ epm_pack()
exit
fi
local
tmpdir
=
"
$(
mktemp
-d
--tmpdir
=
$BIGTMPDIR
)
"
remove_on_exit
$tmpdir
local
tmpdir
tmpdir
=
"
$(
mktemp
-d
--tmpdir
=
$BIGTMPDIR
)
"
||
fatal
remove_on_exit
"
$tmpdir
"
local
packname
=
"
$1
"
local
tarname
=
"
$2
"
...
...
bin/epm-play
View file @
90c9c6be
...
...
@@ -99,7 +99,8 @@ __list_app_packages_table()
__list_installed_app
()
{
local
i
local
tapt
=
"
$(
mktemp
)
"
||
fatal
local
tapt
tapt
=
"
$(
mktemp
)
"
||
fatal
remove_on_exit
$tapt
__list_app_packages_table
>
$tapt
# get all installed packages and convert it to a apps list
...
...
@@ -115,7 +116,8 @@ __list_installed_app()
__list_installed_packages
()
{
local
i
local
tapt
=
"
$(
mktemp
)
"
||
fatal
local
tapt
tapt
=
"
$(
mktemp
)
"
||
fatal
remove_on_exit
$tapt
__list_app_packages_table
>
$tapt
# get all installed packages
...
...
@@ -370,8 +372,9 @@ __epm_play_initialize_ipfs()
fi
# download and merge with local db
local
t
=
$(
mktemp
)
||
fatal
remove_on_exit
"
$t
"
local
t
t
=
$(
mktemp
)
||
fatal
remove_on_exit
$t
__epm_play_download_epm_file
"
$t
"
"eget-ipfs-db.txt"
||
warning
"Can't update IPFS DB"
if
[
-s
"
$t
"
]
;
then
echo
>>
$t
...
...
bin/epm-repack-deb
View file @
90c9c6be
...
...
@@ -30,7 +30,8 @@ __epm_repack_to_deb()
repacked_pkgs
=
''
local
TDIR
=
"
$(
mktemp
-d
--tmpdir
=
$BIGTMPDIR
)
"
local
TDIR
TDIR
=
"
$(
mktemp
-d
--tmpdir
=
$BIGTMPDIR
)
"
||
fatal
remove_on_exit
$TDIR
for
pkg
in
$pkgs
;
do
...
...
bin/epm-repack-rpm
View file @
90c9c6be
...
...
@@ -90,9 +90,6 @@ __apply_fix_code()
__create_rpmmacros
()
{
# FIXME:
[
-n
"
$TMPDIR
"
]
||
TMPDIR
=
/tmp
cat
<<
EOF
>
$HOME
/.rpmmacros
%_topdir
$HOME
/RPM
%_tmppath
$TMPDIR
...
...
@@ -140,8 +137,9 @@ __epm_repack_to_rpm()
fi
local
pkg
export
HOME
=
"
$(
mktemp
-d
--tmpdir
=
$BIGTMPDIR
)
"
HOME
=
"
$(
mktemp
-d
--tmpdir
=
$BIGTMPDIR
)
"
||
fatal
remove_on_exit
$HOME
export
HOME
__create_rpmmacros
local
alpkg
...
...
bin/epm-repo-addkey
View file @
90c9c6be
...
...
@@ -24,8 +24,8 @@ load_helper epm-sh-altlinux
__epm_get_file_from_url
()
{
local
url
=
"
$1
"
local
tmpfile
=
$(
mktemp
)
remove_on_exit
"
$tmpfile
"
local
tmpfile
tmpfile
=
$(
mktemp
)
||
fatal
eget
-O
"
$tmpfile
"
"
$url
"
>
/dev/null
echo
"
$tmpfile
"
}
...
...
@@ -116,7 +116,8 @@ __epm_addkey_dnf()
local
target
=
"/etc/yum.repos.d/
$name
.repo"
[
-s
$target
]
&&
return
local
tmpfile
=
$(
mktemp
)
local
tmpfile
tmpfile
=
$(
mktemp
)
||
fatal
remove_on_exit
$tmpfile
cat
>
$tmpfile
<<
EOF
[
$name
]
...
...
bin/epm-restore
View file @
90c9c6be
...
...
@@ -397,7 +397,8 @@ __epm_restore_meson()
# gtk_wayland_dep = dependency('gtk4-wayland', required: false)
# packagekit_dep = dependency('packagekit-glib2', version: '>= 1.2', required: get_option('packagekit'))
if
[
-n
"
$dryrun
"
]
;
then
local
lt
=
$(
mktemp
)
local
lt
lt
=
$(
mktemp
)
||
fatal
echo
__epm_restore_print_comment
"
$req_file
"
" dependency"
grep
"dependency("
$req_file
|
sed
-e
's|.*dependency(||'
-e
's|).*||'
-e
's|, required.*||'
-e
's|, version:||'
-e
"s|'||g"
>
$lt
...
...
@@ -407,7 +408,8 @@ __epm_restore_meson()
fi
info
"Install requirements from
$req_file
..."
local
lt
=
$(
mktemp
)
local
lt
lt
=
$(
mktemp
)
||
fatal
grep
"dependency("
$req_file
|
sed
-e
's|.*dependency(||'
-e
's|).*||'
-e
's|, required.*||'
-e
's|, version:||'
-e
"s|'||g"
>
$lt
ilist
=
"
$ilist
$(
__epm_print_meson_list
""
$lt
)
"
...
...
@@ -424,7 +426,8 @@ __epm_restore_npm()
assure_exists jq
||
fatal
if
[
-n
"
$dryrun
"
]
;
then
local
lt
=
$(
mktemp
)
local
lt
lt
=
$(
mktemp
)
||
fatal
a
=
jq .dependencies <
$req_file
>
$lt
echo
__epm_restore_print_comment
"
$req_file
"
...
...
@@ -439,7 +442,8 @@ __epm_restore_npm()
fi
info
"Install requirements from
$req_file
..."
local
lt
=
$(
mktemp
)
local
lt
lt
=
$(
mktemp
)
||
fatal
a
=
jq .dependencies <
$req_file
>
$lt
ilist
=
"
$(
__epm_print_npm_list
""
$lt
)
"
a
=
jq .devDependencies <
$req_file
>
$lt
...
...
@@ -454,7 +458,8 @@ __epm_restore_perl()
local
req_file
=
"
$1
"
if
[
-n
"
$dryrun
"
]
;
then
local
lt
=
$(
mktemp
)
local
lt
lt
=
$(
mktemp
)
||
fatal
a
=
/usr/bin/perl
$req_file
PRINT_PREREQ
=
1
>
$lt
# all requirements will autodetected during packing, put it to the buildreq
echo
...
...
@@ -465,7 +470,8 @@ __epm_restore_perl()
fi
info
"Install requirements from
$req_file
..."
local
lt
=
$(
mktemp
)
local
lt
lt
=
$(
mktemp
)
||
exit
a
=
/usr/bin/perl
$req_file
PRINT_PREREQ
=
1
>
$lt
ilist
=
"
$(
__epm_print_perl_list
""
$lt
)
"
rm
-f
$lt
...
...
@@ -480,7 +486,8 @@ __epm_restore_perl_shyaml()
assure_exists shyaml
||
fatal
if
[
-n
"
$dryrun
"
]
;
then
local
lt
=
$(
mktemp
)
local
lt
lt
=
$(
mktemp
)
||
fatal
a
=
shyaml get-value requires <
$req_file
>
$lt
# all requirements will autodetected during packing, put it to the buildreq
echo
...
...
@@ -496,7 +503,8 @@ __epm_restore_perl_shyaml()
fi
info
"Install requirements from
$req_file
..."
local
lt
=
$(
mktemp
)
local
lt
lt
=
$(
mktemp
)
||
fatal
a
=
shyaml get-value requires <
$req_file
>
$lt
ilist
=
"
$(
__epm_print_perl_list
""
$lt
)
"
a
=
shyaml get-value build_requires <
$req_file
>
$lt
...
...
bin/epm-sh-functions
View file @
90c9c6be
...
...
@@ -254,7 +254,7 @@ subst_option()
store_output
()
{
# use make_temp_file from etersoft-build-utils
RC_STDOUT
=
"
$(
mktemp
)
"
RC_STDOUT
=
"
$(
mktemp
)
"
||
fatal
local
CMDSTATUS
=
$RC_STDOUT
.pipestatus
echo
1
>
$CMDSTATUS
#RC_STDERR=$(mktemp)
...
...
@@ -909,6 +909,7 @@ subst()
fi
check_core_commands
()
{
#which which >/dev/null || fatal "Can't find which command (which or debianutils package is missed?)"
...
...
bin/epm-status
View file @
90c9c6be
...
...
@@ -22,7 +22,8 @@ load_helper epm-query
__convert_pkgallowscripts_to_regexp
()
{
local
tmpalf
=
"
$(
mktemp
)
"
||
fatal
local
tmpalf
tmpalf
=
"
$(
mktemp
)
"
||
fatal
# copied from eget's filter_glob
# check man glob
# remove commentы and translate glob to regexp
...
...
tests/test_mktemp.sh
0 → 100755
View file @
90c9c6be
remove_on_exit
()
{
list_on_exit
=
"
$1
"
}
fatal
()
{
echo
"
$*
"
>
&2
exit
1
}
# guarantied temp file/dir removed on exit
epm_mktemp
()
{
local
tmp
tmp
=
"
$(
2mktemp
"
$@
"
)
"
||
fatal
"Can't create temp file"
remove_on_exit
"
$tmp
"
echo
"
$tmp
"
}
test_func
()
{
local
tm
tm
=
$(
epm_mktemp
)
||
fatal
"ETEST"
echo
"tm:
$tm
"
}
file
=
$(
epm_mktemp
)
test_func
echo
"file:
$file
"
echo
"list_on_exit:
$list_on_exit
"
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