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
Nurlan
eepm
Commits
8c2dd278
Commit
8c2dd278
authored
Aug 24, 2020
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
epm-repack: improve cleanup tmp dir
parent
5814780c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
4 deletions
+28
-4
epm-repack
bin/epm-repack
+28
-4
No files found.
bin/epm-repack
View file @
8c2dd278
...
@@ -60,6 +60,14 @@ __epm_repack_rpm_to_deb()
...
@@ -60,6 +60,14 @@ __epm_repack_rpm_to_deb()
clean_store_output
clean_store_output
done
done
# TODO: move it to exit handler
if
[
-z
"
$DEBUG
"
]
;
then
# TODO: reinvent
[
-n
"
$to_remove_pkg_files
"
]
&&
rm
-f
$to_remove_pkg_files
[
-n
"
$to_remove_pkg_files
"
]
&&
rmdir
$(
dirname
$to_remove_pkg_files
|
head
-n1
)
2>/dev/null
[
-n
"
$to_remove_pkg_dirs
"
]
&&
rmdir
$to_remove_pkg_dirs
fi
cd
-
>
/dev/null
cd
-
>
/dev/null
return
0
return
0
}
}
...
@@ -125,6 +133,7 @@ __create_rpmmacros()
...
@@ -125,6 +133,7 @@ __create_rpmmacros()
%packager EPM <support@etersoft.ru>
%packager EPM <support@etersoft.ru>
%_gpg_name support@etersoft.ru
%_gpg_name support@etersoft.ru
EOF
EOF
to_remove_pkg_files
=
"
$to_remove_pkg_files
$HOME
/.rpmmacros"
}
}
# will fill repacked_rpms var
# will fill repacked_rpms var
...
@@ -145,14 +154,15 @@ __epm_repack_rpm()
...
@@ -145,14 +154,15 @@ __epm_repack_rpm()
local
pkg
local
pkg
export
HOME
=
$(
mktemp
-d
)
export
HOME
=
$(
mktemp
-d
)
local
tmpbuilddir
=
$HOME
/repack
mkdir
$tmpbuilddir
__create_rpmmacros
__create_rpmmacros
local
abspkg
local
abspkg
repacked_rpms
=
''
repacked_rpms
=
''
for
pkg
in
$*
;
do
for
pkg
in
$*
;
do
local
tmpbuilddir
=
$HOME
/repack-
$(
basename
$pkg
)
mkdir
$tmpbuilddir
abspkg
=
$(
realpath
$pkg
)
abspkg
=
$(
realpath
$pkg
)
info
""
info
"Repacking
$abspkg
to local rpm format ..."
info
"Repacking
$abspkg
to local rpm format ..."
cd
$tmpbuilddir
||
fatal
cd
$tmpbuilddir
||
fatal
docmd fakeroot alien
--generate
--to-rpm
$verbose
$scripts
$abspkg
||
fatal
docmd fakeroot alien
--generate
--to-rpm
$verbose
$scripts
$abspkg
||
fatal
...
@@ -168,13 +178,16 @@ __epm_repack_rpm()
...
@@ -168,13 +178,16 @@ __epm_repack_rpm()
__fix_spec
$tmpbuilddir
/
$subdir
$spec
__fix_spec
$tmpbuilddir
/
$subdir
$spec
local
pkgname
=
"
$(
grep
"^Name: "
$spec
|
sed
-e
"s|Name: ||g"
|
head
-n1
)
"
local
pkgname
=
"
$(
grep
"^Name: "
$spec
|
sed
-e
"s|Name: ||g"
|
head
-n1
)
"
__apply_fix_code
$pkgname
$tmpbuilddir
/
$subdir
$spec
__apply_fix_code
$pkgname
$tmpbuilddir
/
$subdir
$spec
# TODO: we need these dirs to be created
to_remove_pkg_dirs
=
"
$to_remove_pkg_dirs
$HOME
/RPM/BUILD
$HOME
/RPM"
showcmd fakeroot rpmbuild
--buildroot
$tmpbuilddir
/
$subdir
--define
=
'_allow_root_build 1'
-bb
$spec
showcmd fakeroot rpmbuild
--buildroot
$tmpbuilddir
/
$subdir
--define
=
'_allow_root_build 1'
-bb
$spec
if
[
-n
"
$verbose
"
]
;
then
if
[
-n
"
$verbose
"
]
;
then
a
=
''
fakeroot rpmbuild
--buildroot
$tmpbuilddir
/
$subdir
--define
=
'_allow_root_build 1'
-bb
$spec
||
fatal
a
=
''
fakeroot rpmbuild
--buildroot
$tmpbuilddir
/
$subdir
--define
=
'_allow_root_build 1'
-bb
$spec
||
fatal
else
else
a
=
''
fakeroot rpmbuild
--buildroot
$tmpbuilddir
/
$subdir
--define
=
'_allow_root_build 1'
-bb
$spec
>
/dev/null
||
fatal
a
=
''
fakeroot rpmbuild
--buildroot
$tmpbuilddir
/
$subdir
--define
=
'_allow_root_build 1'
-bb
$spec
>
/dev/null
||
fatal
fi
fi
local
repacked_rpm
=
"
$(
realpath
$tmpbuilddir
/../
*
.rpm
)
"
mv
$tmpbuilddir
/../
*
.rpm
$tmpbuilddir
/
local
repacked_rpm
=
"
$(
realpath
$tmpbuilddir
/
*
.rpm
)
"
if
[
-s
"
$repacked_rpm
"
]
;
then
if
[
-s
"
$repacked_rpm
"
]
;
then
repacked_rpms
=
"
$repacked_rpms
$repacked_rpm
"
repacked_rpms
=
"
$repacked_rpms
$repacked_rpm
"
to_remove_pkg_files
=
"
$to_remove_pkg_files
$repacked_rpm
"
to_remove_pkg_files
=
"
$to_remove_pkg_files
$repacked_rpm
"
...
@@ -186,6 +199,8 @@ __epm_repack_rpm()
...
@@ -186,6 +199,8 @@ __epm_repack_rpm()
#rm -rf $tmpbuilddir/../*.rpm
#rm -rf $tmpbuilddir/../*.rpm
rm
-rf
$spec
rm
-rf
$spec
done
done
to_remove_pkg_dirs
=
"
$to_remove_pkg_dirs
$HOME
"
rmdir
$tmpbuilddir
rmdir
$tmpbuilddir
#rmdir $tmpbuilddir/..
#rmdir $tmpbuilddir/..
true
true
...
@@ -199,6 +214,14 @@ __epm_check_if_try_install_deb()
...
@@ -199,6 +214,14 @@ __epm_check_if_try_install_deb()
# TODO: move to install
# TODO: move to install
docmd epm
install
$force
$nodeps
$repacked_rpms
docmd epm
install
$force
$nodeps
$repacked_rpms
# TODO: move it to exit handler
if
[
-z
"
$DEBUG
"
]
;
then
# TODO: reinvent
[
-n
"
$to_remove_pkg_files
"
]
&&
rm
-f
$to_remove_pkg_files
[
-n
"
$to_remove_pkg_files
"
]
&&
rmdir
$(
dirname
$to_remove_pkg_files
|
head
-n1
)
2>/dev/null
[
-n
"
$to_remove_pkg_dirs
"
]
&&
rmdir
$to_remove_pkg_dirs
2>/dev/null
fi
return
0
return
0
}
}
...
@@ -238,12 +261,13 @@ epm_repack()
...
@@ -238,12 +261,13 @@ epm_repack()
;;
;;
esac
esac
# TODO: move it to exit handler
# TODO: move it to exit handler
if
[
-z
"
$DEBUG
"
]
;
then
if
[
-z
"
$DEBUG
"
]
;
then
# TODO: reinvent
# TODO: reinvent
[
-n
"
$to_remove_pkg_files
"
]
&&
rm
-f
$to_remove_pkg_files
[
-n
"
$to_remove_pkg_files
"
]
&&
rm
-f
$to_remove_pkg_files
# hack??
[
-n
"
$to_remove_pkg_files
"
]
&&
rmdir
$(
dirname
$to_remove_pkg_files
|
head
-n1
)
2>/dev/null
[
-n
"
$to_remove_pkg_files
"
]
&&
rmdir
$(
dirname
$to_remove_pkg_files
|
head
-n1
)
2>/dev/null
[
-n
"
$to_remove_pkg_dirs
"
]
&&
rmdir
$to_remove_pkg_dirs
2>/dev/null
fi
fi
}
}
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