<commit_before>#!/bin/bash
# 2007 (c) Etersoft http://etersoft.ru
# Author: <NAME> <<EMAIL>>
# GNU Public License
#
#
# TODO: WINENUMVERSION is not used now

# , wine-etersoft
PACKAGE="$1"
# , network
# , EEEE-C0DE
ETERREGNUM="$2"
SOURCEURL=$3
BUILDSRPM=$4
SRPM=`basename $BUILDSRPM`
PATCH="/usr/bin/patch"
WGET="/usr/bin/wget"
TAR="/usr/bin/gnu/tar"
PATH="/opt/csw/bin:/usr/sbin:/usr/bin:/usr/bin/gnu/bin:"
TMPPATH="/tmp/wine"
MAKE="gmake -j2"
ARCH=`arch`
[ -x $PATCH ] || exit 1
[ -x $WGET ] || exit 1
[ -x $TAR ] || exit 1

BASEVER="1.0.9"

export PACKAGE
PRODUCT=`echo $PACKAGE | sed 's/wine-etersoft-\(.*\)/\1/g'`
echo "We get $PRODUCT to build"

package_info() {
#gen pkg filelist
	cd $DESTDIR
	pkgproto . >> $TMPPATH/prototype
#mv prototype to pkgdir.      ,    pkglist
	mv $TMPPATH/prototype $DESTDIR
#fix owner in pkg filelist
	subst 's| builder | root |g' $DESTDIR/prototype
	subst 's| other| root|g' $DESTDIR/prototype
#create pkginfo
	echo "PKG=$1" > $DESTDIR/pkginfo
	echo "NAME=Wine Is Not Emulator + many patches from Etersoft company." >> $DESTDIR/pkginfo
	echo "ARCH=$ARCH" >> $DESTDIR/pkginfo
	echo "VERSION=$WINENUMVERSION-$RELEASE" >> $DESTDIR/pkginfo
	echo "VENDOR=Etersoft" >> $DESTDIR/pkginfo
	echo "EMAIL=<EMAIL>" >> $DESTDIR/pkginfo
	echo "CATEGORY=system" >> $DESTDIR/pkginfo
	echo "BASEDIR=/" >> $DESTDIR/pkginfo
#include pkg info
	echo "i pkginfo=$DESTDIR/pkginfo" >> $DESTDIR/prototype
#make pkgmap
	cd $DESTDIR
	mkdir $TMPPATH/ready/
	pkgmk -o -r $DESTDIR -d $TMPPATH/ready/
}

pack_pkg() {
	if [ "$1" = "wine-etersoft-public" ] ; then
	    pkgtrans -so $TMPPATH/ready $1-"$VER"_"$RELEASE".$ARCH.pkg $1
	    gzip -9 $TMPPATH/ready/$1-"$VER"_"$RELEASE".$ARCH.pkg
	else
	    pkgtrans -so $TMPPATH/ready $1-"$WINENUMVERSION"_"$RELEASE".$ARCH.pkg $1
	    gzip -9 $TMPPATH/ready/$1-"$WINENUMVERSION"_"$RELEASE".$ARCH.pkg
	fi
}

upack_src() {
    $TAR xjf $1.tar.bz2
}

get_source() {
    $WGET $SOURCEURL/$SRPM
    rpm2cpio $SRPM > $PACKAGE.cpio
    cpio -d -i < $PACKAGE.cpio
}
#################################################################
#				BODY				#
#################################################################
##############################WINE-ETERSOFT######################

#   .
rm -rf $TMPPATH/*
mkdir $TMPPATH/
cd $TMPPATH/
DESTDIR="$TMPPATH/$PACKAGE"
##############################WINE-PUBLIC########################
if [ "$PACKAGE" = "wine-etersoft-public" ] ; then
    #   .
    echo "Building $PACKAGE from $SOURCEURL"
    get_source
    VER=`cat wine.spec | grep Version | sed 's/Version: //g'`
    RELEASE=`cat wine.spec | grep Release | sed 's/Release: alt//g'`
    upack_src wine-$WINENUMVERSION || exit 1
    # wine.
    cd wine-$WINENUMVERSION
    $PATCH -p0 < etersoft/wine-etersoft.patch || exit 1
   # wine.
    echo "$MAKE wine with patches"
    ./configure --prefix=/usr || exit 1
    $MAKE depend || exit 1
    $MAKE || exit 1
    mkdir -p $DESTDIR
    echo "$MAKE install to $DESTDIR"
    $MAKE install DESTDIR="$DESTDIR" || exit 1
    echo "$MAKE install ETERSOFT WINE utils to $DESTDIR"
    cd $TMPPATH/wine-$VER/etersoft
    $MAKE install prefix=$DESTDIR/usr initdir=$DESTDIR/etc/init.d sysconfdir=$DESTDIR/etc MKDIRPROG='mkdir -p' || exit 1
   #    (  )
    package_info $PACKAGE
    pack_pkg $PACKAGE
else
##############################WINE-PVT###########################
    echo "Building $PACKAGE from $SOURCEURL"
    get_source
    upack_src $PACKAGE-$WINENUMVERSION
    RELEASE=`cat $PACKAGE.spec | grep Release | sed 's/Release: alt//g'`
# .
    cd $PACKAGE-$WINENUMVERSION
    ./configure --prefix=/usr --sysconfdir=/etc --with-$PRODUCT --with-regnum=$ETERREGNUM || exit 1
    $MAKE || exit 1
    mkdir -p $DESTDIR
    echo "$MAKE install to $DESTDIR"
    $MAKE install DESTDIR="$DESTDIR" initdir="$DESTDIR/etc/init.d" || exit 1
#     (  )
    package_info $PACKAGE
    pack_pkg $PACKAGE
fi<commit_msg>changes due to the new RPM-scheme<commit_after>#!/bin/bash
# 2007 (c) Etersoft http://etersoft.ru
# Author: <NAME> <<EMAIL>>
# GNU Public License
#
#
# TODO: WINENUMVERSION is not used now

# , wine-etersoft
PACKAGE="$1"

SOURCEURL=$2

querypackage()
{
        rpmquery -p --queryformat "%{$2}" $1
}

package_info() {
#gen pkg filelist
	cd $WORKDIR
	pkgproto . >> $WORKDIR/prototype
#mv prototype to pkgdir.      ,    pkglist
	mv $WORKDIR/prototype $DESTDIR
#fix owner in pkg filelist
	subst 's| korinfer | root |g' $DESTDIR/prototype
	subst 's| builder | root |g' $DESTDIR/prototype
	subst 's| other| root|g' $DESTDIR/prototype
#create pkginfo
	echo "PKG=$1" > $DESTDIR/pkginfo
	echo "NAME=$SUMMARY" >> $DESTDIR/pkginfo
	echo "ARCH=$ARCH" >> $DESTDIR/pkginfo
	echo "VERSION=$VER" >> $DESTDIR/pkginfo
	echo "VENDOR=Etersoft" >> $DESTDIR/pkginfo
	echo "EMAIL=<EMAIL>" >> $DESTDIR/pkginfo
	#TODO: fix for various categories
	echo "CATEGORY=system" >> $DESTDIR/pkginfo
	echo "BASEDIR=/" >> $DESTDIR/pkginfo
#include pkg info
	echo "i pkginfo=$DESTDIR/pkginfo" >> $DESTDIR/prototype
#make pkgmap
	cd $DESTDIR
	mkdir $DESTDIR/ready/
	pkgmk -o -r $DESTDIR -d $DESTDIR/ready/
}

pack_pkg() {
	pkgtrans -so $DESTDIR/ready $1-"$VER"_"$RELEASE".$ARCH.pkg $1
	gzip -9 $DESTDIR/ready/$1-"$VER"_"$RELEASE".$ARCH.pkg
}

get_bin() {
        #get file hierarchy
    cp $BUILTRPM ${WORKDIR}/${PACKAGE}
    rpm2cpio $BUILTRPM | cpio -dimv || fatal "error with rpm2cpio"
    rm -f $BUILTRPM
}

#################################################################
#				BODY				#
#################################################################

#   .
#TMPPATH="/tmp/${PACKAGE}"
DESTDIR="/tmp/$PACKAGE"
WORKDIR="/tmp/$PACKAGE/work"
rm -rf $DESTDIR
mkdir $DESTDIR
cd $DESTDIR/
RPMSDIR=/home/korinfer/RPM/RPMS
##############################WINE-PUBLIC########################
#   .
echo "Building $PACKAGE from $SOURCEURL"
get_bin
#Set variables
BUILTRPM=$(ls -1 $RPMSDIR/*.rpm | grep $PACKAGE | tail -n1)
VER=`querypackage "$BUILTRPM" VERSION`
RELEASE=`querypackage "$BUILTRPM" RELEASE`
SUMMARY=`querypackage "$BUILTRPM" SUMMARY`
ARCH=`arch`

get_bin
#    (  )
package_info $PACKAGE
pack_pkg $PACKAGE
{'fraction_non_alphanumeric': 0.22695738354806738, 'fraction_numerical': 0.00958044268252395, 'mean_word_length': 4.0500417014178485, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 50, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '976593', 'n_tokens_mistral': 2397, 'n_tokens_neox': 2273, 'n_words': 517}