Problem scripting with BarryK's mageia2ppm

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
scsijon
Posts: 1596
Joined: Thu 24 May 2007, 03:59
Location: the australian mallee
Contact:

Problem scripting with BarryK's mageia2ppm

#1 Post by scsijon »

Part 1: Could one of our coders tell me why this: (part of mageia2ppm file attached) (the mageia version is '2' in this case), and fix it for me if possible please. I'm not much of a coder nowadays!

Code: Select all

echo
mgaPTN0="\\[== [^@]*\\.mga${MAGEIA_VERSION}\\]"
mgaPTN1="s%\\.mga${MAGEIA_VERSION}.*%%"
echo -n "" > /tmp/mageia2ppm-ppm-temp1
cat $SYNTHHDLIST |
while read ONELINE
do
 echo -n '.'
 case $ONELINE in
  @provides@*)
   DB_version="`echo -n "$ONELINE" | grep -o "$mgaPTN0" | cut -f 2 -d ' ' | rev | cut -f 2-9 -d '.' | rev | head -n 1 | cut -f 2 -d ':'`"
   PROVIDES_SO=" `echo -n "$ONELINE" | tr '@' '\n' | tr -s '\n' | grep -E '\.so$|\.so\.[0-9]' | cut -f 1 -d '(' | sort -u | tr '\n' ' '`" #list of shared libs, space-delimited.
  ;;
  @conflicts@*)
   true
  ;;
  @requires@*)
   REQUIRES_SO=" `echo -n "$ONELINE" | tr '@' '\n' | tr -s '\n' | grep -E '\.so$|\.so\.[0-9]' | cut -f 1 -d '(' | sort -u | tr '\n' ' '`" #list of shared libs, space-delimited.
   REQUIRES_PKG=" `echo -n "$ONELINE" | tr '@' '\n' | tr -s '\n' | grep -v -E '\.so$|\.so\.[0-9]|/|requires|\(' | cut -f 1 -d '[' | sort -u | tr '\n' ' '`"
  ;;
  @summary@*)
   DB_description="`echo -n "$ONELINE" | cut -f 3 -d '@' | tr '[|<>]' ' '`"
  ;;
  @info@*)
   FULLNAME="`echo -n "$ONELINE" | cut -f 3 -d '@'`"
   DB_fullfilename="${FULLNAME}.rpm"
   DB_pkgname="`echo -n "$FULLNAME" | sed -e "$mgaPTN1"`"
   vPTN="s%\\-${DB_version}.*%%"
   DB_nameonly="`echo -n "$DB_pkgname" | sed -e "$vPTN"`"
   DB_compileddistro="mageia";DB_compiledrelease="$MAGEIA_VERSION"
   if [ "`echo -n "$FULLNAME" | grep '\.noarch$'`" != "" ];then
    DB_compileddistro=""
    DB_compiledrelease=""
   fi
   sizeBYTES=`echo -n "$ONELINE" | cut -f 5 -d '@'`
   DB_size=$(($sizeBYTES/1024))
   
   categoryORIG="`echo -n "$ONELINE" | cut -f 6 -d '@'`"
   #puppy categories are: Desktop, System, Setup, Utility, Filesystem, Graphic, Document, Business, Personal, Network, Internet, Multimedia, Fun, BuildingBlock, Help, Develop
   case $categoryORIG in
    Development*) DB_category="Development" ;;
    Archiving*|Sciences*|Monitoring*|Terminals*) DB_category="Utility" ;;
    System/Internationalization*|System/Font*) DB_category="System" ;;
    System/Configuration*) DB_category="Setup" ;;
    System*) DB_category="BuildingBlock" ;;
    Office*|Database*) DB_category="Business" ;;
    Networking/Other|Networking/Remote*|Communications*) DB_category="Network" ;;
    Networking*) DB_category="Internet" ;;
    *desktop*|Accessibility*) DB_category="Desktop" ;;
    Video*|Sound*) DB_category="Multimedia" ;;
    Graphics*) DB_category="Graphic" ;;
    Games*|Toys*) DB_category="Fun" ;;
    Text*|Publishing*|Education*|Editors*) DB_category="Document" ;;
    File*) DB_category="Filesystem" ;;
    Books*) DB_category="Help" ;;
    *) DB_category="BuildingBlock" ;;
   esac
   #3 fields on end are temporary...
   echo "$DB_pkgname|$DB_nameonly|$DB_version||$DB_category|${DB_size}K|$DB_path|$DB_fullfilename|$DB_dependencies|$DB_description|${DB_compileddistro}|${DB_compiledrelease}||${PROVIDES_SO}|${REQUIRES_SO}|${REQUIRES_PKG}|" >> /tmp/mageia2ppm-ppm-temp1
   PROVIDES_SO="";REQUIRES_SO="";REQUIRES_PKG="";FULLNAME="";DB_pkgname='';DB_nameonly='';DB_version='';DB_category='';DB_size='';DB_fullfilename='';DB_dependencies='';DB_description=''
  ;;
 esac
-------------------

on this: (part of the Packages-mageia-2-taintedpre db file attached)

Code: Select all

@provides@adplug.so@audacious-adplug[== 5:3.2.1-1.mga2.tainted]@audacious-adplug(x86-32)[== 5:3.2.1-1.mga2.tainted]
@requires@audacious[>= 5:3.2.1]@libaudcore.so.1@libbinio.so.1@libc.so.6@libc.so.6(GLIBC_2.0)@libc.so.6(GLIBC_2.1.3)@libc.so.6(GLIBC_2.3.4)@libc.so.6(GLIBC_2.4)@libgcc_s.so.1@libgcc_s.so.1(GCC_3.0)@libglib-2.0.so.0@libgobject-2.0.so.0@libgtk-3.so.0@libm.so.6@libm.so.6(GLIBC_2.0)@libstdc++.so.6@libstdc++.so.6(GLIBCXX_3.4)@libstdc++.so.6(GLIBCXX_3.4.11)@libstdc++.so.6(GLIBCXX_3.4.15)@libstdc++.so.6(GLIBCXX_3.4.9)@rtld(GNU_HASH)
@summary@AdLib player plugin for audacious
@filesize@164259
@info@audacious-adplug-3.2.1-1.mga2.tainted.i586@5@427376@Sound
-------------------

is outputing this: (second and third fields are wrong).

Code: Select all

audacious-adplug-3.2.1-1|audacious|||Multimedia|417K|tainted/release|audacious-adplug-3.2.1-1.mga2.tainted.i586.rpm||AdLib player plugin for audacious|mageia|2||

--------------------

Instead of this:

Code: Select all

audacious-adplug-3.2.1-1|audacious-adplug|3.2.1-1||Multimedia|417K|tainted/release|audacious-adplug-3.2.1-1.mga2.tainted.i586.rpm||AdLib player plugin for audacious|mageia|2||
-------------------

For the second field, it seems to be cutting at the first '-' instead of the end of the field;
And for the third field it's putting nothing in it!

BUT IT's not always so, just mostly! And most annoying is that if I try it on Mageia's mga1 databases, when it was built by BarryK, it seems that it works every time. But there doesn't seem to be any visable differances between them!

-------------------------------------------------

Part 2:

I also need to have where the .mga2 is, also allow .mga1 or the letter c (for cauldron) to appear.
--------------------------------------------
The attached files need their fake .gz removed before opening, if you need them.

Apologies for the wide fields, but I didn't want to stuff anything up!

Any ideas?

thanks in advance

scsijon
Attachments
Packages-mageia-2-taintedpre.gz
(165.41 KiB) Downloaded 206 times
mageia2ppm.gz
(6.33 KiB) Downloaded 197 times
Packages-mageia-2-tainted.gz
(39.59 KiB) Downloaded 358 times

Post Reply