Create dpkg status file from ppm metadata

interpretive language scripts


Moderator: Forum moderators

Post Reply
s243a
Posts: 501
Joined: Mon Dec 09, 2019 7:29 pm
Has thanked: 90 times
Been thanked: 37 times

Create dpkg status file from ppm metadata

Post by s243a »

I wrote a script to create the dpkg status file from the ppm (puppy package manager) metatdata.

"mk_dpkg_metadata.sh (draft 2)"

dpkg won't work without this file (i.e. /var/lib/dpkg/status)

This file containes the metadata for each package (not including file list). For instance part of the status file might look like this:

Code: Select all

Package: mesa-utils
Version: 8.4.0-1+b1
Maintainer: unspecified
Depends: libc6 (>=2.4), libgl1, libglew2.1 (>=1.12.0), libglu1-mesa, libx11-6, libxext6
Priority: optional
Section: Network

or at least that is what my scipt outputs but it's still missing some non-esential fields, like the package description. Perhaps an interesting part of the code is an AWK function to covert the dependency list from puppy format to debian format:

Code: Select all

function dep_fix(str,     a,k1,p1,p2,out,seps){
      split(str,a,",")
      out = ""
      for (k1 in a){
          p1=a[k1]
          gsub(/^+/,"",p1)
          split(p1,p2,/\&../,seps) # +libqpdf21&gt8.4 > p2[1]="+libqpdf21" seps[1]="&gt" p2[2]="8.4", 
          switch (seps[1]) {  
          case "&gt":
            out = out ", " p2[1] " (>" p2[2] ")"
            break 
          case "&ge":
            out = out ", " p2[1] " (>=" p2[2] ")"
            break 
          case "&lt":
            out = out ", " p2[1] " (<" p2[2] ")"
            break 
          case "&le":
            out = out "," p2[1] " (<=" p2[2] ")"
            break 
          case "&eq":
            out = out ", " p2[1] " (=" p2[2] ")"
            break 
          default:
            out = out ", " p2[1]
            break 
         }
         gsub(/^, /,"",out)
     }
     return out
  }
  

**debugging comments removed

For apt/dpkg to work well on puppy there is still more to do. I have to added dummy package entries for any blacklisted packages, I also should hard link the puppy file lists to the dpkg folder under the proper file name...assuming the file list format is compatable otherwise I have to copy these files. I also should do some checks to make sure there are no duplicate entries in this file because duplicate entries break dpkg. There might be something else to do that I don't know about.

if you are wonding why there is an empty chroot path variable used to construct the path to the dpkg folder this is because I used the project woof-next for some example code on how to do this. See note:

https://www.pearltrees.com/s243a/methad ... id37105977

I'm not sure whether or not this code will be useful for the woof-next project.

Post Reply

Return to “Scripts”