portage.xpak module

portage.xpak.addtolist(mylist, curdir)

(list, dir) — Takes an array(list) and appends all files from dir down the directory tree. Returns nothing. list is modified.

portage.xpak.decodeint(mystring)

Takes a 4 byte string and converts it into a 4 byte integer. Returns an integer.

portage.xpak.encodeint(myint)

Takes a 4 byte integer and converts it into a string of 4 characters. Returns the characters in a string.

portage.xpak.getboth(infile)

(infile) – grabs the index and data segments from the infile. Returns an array [indexSegment, dataSegment]

portage.xpak.getindex(infile)

(infile) – grabs the index segment from the infile and returns it.

portage.xpak.getindex_mem(myindex)

Returns the filenames listed in the indexglob passed in.

portage.xpak.getitem(myid, myitem)
portage.xpak.listindex(myindex)

Print to the terminal the filenames listed in the indexglob passed in.

portage.xpak.searchindex(myindex, myitem)

(index, item) – Finds the offset and length of the file ‘item’ in the datasegment via the index ‘index’ provided.

class portage.xpak.tbz2(myfile)

Bases: object

cleanup(datadir)
compose(datadir, cleanup=0)

Alias for recompose().

decompose(datadir, cleanup=1)

Alias for unpackinfo() — Complement to recompose() but optionally deletes the destination directory. Extracts the xpak from the tbz2 into the directory provided. Raises IOError if scan() fails. Returns result of upackinfo().

filelist()

Return an array of each file listed in the index.

get_data()

Returns all the files from the dataSegment as a map object.

getboth()

Returns an array [indexSegment, dataSegment]

getelements(myfile)

A split/array representation of tbz2.getfile()

getfile(myfile, mydefault=None)

Finds ‘myfile’ in the data segment and returns it.

recompose(datadir, cleanup=0, break_hardlinks=True)

Creates an xpak segment from the datadir provided, truncates the tbz2 to the end of regular data if an xpak segment already exists, and adds the new segment to the file with terminating info.

recompose_mem(xpdata, break_hardlinks=True)

Update the xpak segment. :param xpdata: A new xpak segment to be written, like that returned

from the xpak_mem() function.

Parameters

break_hardlinks – If hardlinks exist, create a copy in order to break them. This makes it safe to use hardlinks to create cheap snapshots of the repository, which is useful for solving race conditions on binhosts as described here: https://crbug.com/185031 Default is True.

scan()

Scans the tbz2 to locate the xpak segment and setup internal values. This function is called by relevant functions already.

unpackinfo(mydest)

Unpacks all the files from the dataSegment into ‘mydest’.

portage.xpak.xpak(rootdir, outfile=None)

(rootdir, outfile) – creates an xpak segment of the directory ‘rootdir’ and under the name ‘outfile’ if it is specified. Otherwise it returns the xpak segment.

portage.xpak.xpak_mem(mydata)

Create an xpack segment from a map object.

portage.xpak.xpand(myid, mydest)
portage.xpak.xsplit(infile)

(infile) – Splits the infile into two files. ‘infile.index’ contains the index segment. ‘infile.dat’ contails the data segment.

portage.xpak.xsplit_mem(mydat)