util

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 9, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChecksumBytes

func ChecksumBytes(content []byte, checkSumType constant.ChecksumType) (string, error)

func ChecksumFile

func ChecksumFile(filename string, checkSumType constant.ChecksumType) (string, error)

ChecksumFile return checksum of the filename according to the checkSumType

func CompressFileToZstd

func CompressFileToZstd(inputPath, outputPath string) error

func CompressXMLToZstd

func CompressXMLToZstd(xmlData []byte, outputPath string) error

func Contains

func Contains(slice []string, elem string) bool

func CopyDir

func CopyDir(src string, dst string) error

CopyDir iterate copy directory

func CopyFile

func CopyFile(src, dst string) error

CopyFile copies a file from src to dst and attempts to preserve metadata.

func CrCompareDependencyRegex

func CrCompareDependencyRegex(dep1, dep2 string) int

CrCompareDependencyRegex

Compares two dependency by name
* NOTE: The function assume first parts must be same!
* libc.so.6() < libc.so.6(GLIBC_2.3.4)(64 bit) < libc.so.6(GLIBC_2.4)
* Returns -1 if first < second, 1 if first > second, and 0 if first == second.

func CrFlagToStr

func CrFlagToStr(flags uint64) string

CrFlagToStr Convert flags from RPM header to a string representation.

func CrIsPrimary

func CrIsPrimary(filePath string) bool

CrIsPrimary Check if the filename match pattern for primary files (files listed in primary.xml).

func DependencyListContainsForbiddenControlChars

func DependencyListContainsForbiddenControlChars(dep []model.Dependency) bool

DependencyListContainsForbiddenControlChars check if the name, epoch, version, and release in the list of dependencies contain any forbidden control characters.

func DumpXML

func DumpXML(obj any) ([]byte, error)

func GetFilelistsPackage

func GetFilelistsPackage(pkg *model.Package, isFilelistsExt bool, taskID int64) *model.FilelistsPackage

func GetOtherPackage

func GetOtherPackage(pkg *model.Package, taskID int64) *model.OtherPackage

func GetPrimaryPackage

func GetPrimaryPackage(pkg *model.Package, taskID int64) *model.PrimaryPackage

func HasControlChars

func HasControlChars(str string) bool

HasControlChars checks if a string contains control characters other than tab (9), newline (10), and carriage return (13).

func InitXMLStructAll

func InitXMLStructAll() *model.XMLStructAll

func IsDir

func IsDir(path string) bool

func NormalizeDirPath

func NormalizeDirPath(path string) string

NormalizeDirPath Return path with exactly one trailing '/'

func PackageContainsForbiddenControlChars

func PackageContainsForbiddenControlChars(pkg *model.Package) bool

func PackageNEVRA

func PackageNEVRA(pkg *model.Package) string

func PathExists

func PathExists(path string) (bool, error)

PathExists if file or dir exists

func PrependProtocol

func PrependProtocol(url string) string

PrependProtocol checks if the given URL starts with a forward slash and, if so, prepends "file://" to it. Otherwise, it returns the URL as is.

func RecordCmp

func RecordCmp(a, b *model.RepomdRecord) int

RecordCmp compares two crRepomdRecord pointers and returns an integer for sorting purposes.

func RecordTypeValue

func RecordTypeValue(recordType constant.RepomdType) int

func ReverseArray

func ReverseArray[T any](slice []T)

func StatFile

func StatFile(fullPath string) (int64, int64, error)

func StrToEVR

func StrToEVR(input string) *model.EVR

func WriteXML

func WriteXML(obj any, filepath string) error

func XMLDumpFiles

func XMLDumpFiles(files []model.PackageFile, isPrimary bool, isFilelistsExt bool) []*model.File

func XMLDumpPrimaryDumpPCOR

func XMLDumpPrimaryDumpPCOR(dependencies []model.Dependency, depType constant.DepType) *model.DepEntryList

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL