Commit e354aac9 authored by Vitaly Lipatov's avatar Vitaly Lipatov

TODO: move packing code to pack.d generic

parent e3cd1d04
......@@ -23,15 +23,16 @@ load_helper epm-repack
[ -n "$EPM_PACK_SCRIPTS_DIR" ] || EPM_PACK_SCRIPTS_DIR="$CONFIGDIR/pack.d"
__epm_pack()
# <packname> <abstarname>
# fills returntarname with returned tar name or empty
__epm_pack_run_handler()
{
local packname="$1"
local tarname="$2"
returntarname=''
local repackcode="$EPM_PACK_SCRIPTS_DIR/$packname.sh"
[ -x "$repackcode" ] || fatal "Can't find script $repackcode for packname $packname"
[ -x "$repackcode" ] || return
[ -f "$repackcode.rpmnew" ] && warning "There is .rpmnew file(s) in $EPM_PACK_SCRIPTS_DIR dir. The pack script can be outdated."
tmpdir=$(mktemp -d)
......@@ -51,15 +52,18 @@ __epm_pack()
returntarname="$(cat "$filefortarname")" || fatal "pack script $repackcode didn't set tarname"
rm -rf $tmpdir
[ -s "$returntarname" ] || fatal "pack script $repackcode didn't return tarname"
return 0
}
#local newname="$(basename "$returntarname")"
__epm_pack()
{
local packname="$1"
local tarname="$2"
# now it is by default in the current dir
#if [ "$returntarname" != "$(realpath $newname)" ; then
# # repack put its result to the current dir
# mv -v $returntarname . || fatal
#fi
# will run pack script and check the result
__epm_pack_run_handler $packname $tarname || fatal "Can't find script $repackcode for packname $packname"
[ -s "$returntarname" ] || fatal "pack script $repackcode didn't return tarname"
if [ -n "$download_only" ] ; then
return
......
......@@ -92,13 +92,17 @@ __set_version_pkgname()
}
# AppImage version
# hack for ktalk2.4.2 -> ktalk 2.4.2
__set_version_apppkgname()
# TODO: pack
# args: pkgname buildroot spec
__try_generic_handler()
{
local alpkg="$1"
VERSION="$(echo "$alpkg" | grep -o -P "[-_.a-zA-Z]([0-9])([0-9])*([.]*[0-9])*" | head -n1 | sed -e 's|^[-_.a-zA-Z]||' -e 's|--|-|g' )" #"
[ -n "$VERSION" ] && PKGNAME="$(echo "$alpkg" | sed -e "s|[-_.]$VERSION.*||")"
local repackcode="$EPM_REPACK_SCRIPTS_DIR/$1.sh"
[ -s "$repackcode" ] || return
shift
export PATH=$PROGDIR:$PATH
local bashopt=''
[ -n "$verbose" ] && bashopt='-x'
( unset EPMCURDIR ; docmd $CMDSHELL $bashopt $repackcode "$1" "$2" "$3" ) || fatal "There is an error from $repackcode script"
}
......@@ -123,6 +127,8 @@ __prepare_source_package()
VERSION=''
SUBGENERIC=''
# convert tarballs to tar (for alien)
if rhas "$alpkg" "\.(rpm|deb)$" ; then
return
......
#!/bin/sh
TAR="$1"
#VERSION="$2"
RETURNTARNAME="$2"
. $(dirname $0)/common.sh
# ignore archive not for us
rhas "$TAR" "\.AppImage$" || exit 1
CURDIR="$(pwd)"
PKGDIR="$(mktemp -d)"
trap "rm -fr $PKGDIR" EXIT
cd $PKGDIR || fatal
# AppImage version
__set_version_apppkgname()
{
local alpkg="$1"
VERSION="$(echo "$alpkg" | grep -o -P "[-_.a-zA-Z]([0-9])([0-9])*([.]*[0-9])*" | head -n1 | sed -e 's|^[-_.a-zA-Z]||' -e 's|--|-|g' )" #"
[ -n "$VERSION" ] && PKGNAME="$(echo "$alpkg" | sed -e "s|[-_.]$VERSION.*||")"
}
alpkg=$(basename $TAR)
__set_version_apppkgname $alpkg
[ -n "$VERSION" ] || fatal "Can't get version from $alpkg."
# TODO: move repack archive to erc?
[ -x "$alpkg" ] || docmd chmod u+x $verbose "$alpkg"
./$alpkg --appimage-extract || fatal
alpkg=$CURDIR/$PKGNAME-$VERSION.tar
# make a tar for alien
erc a $alpkg squashfs-root || fatal
return_tar "$alpkg"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment