Skip to content

Commit

Permalink
Generate abi reports inside of the chroot using abi-wizard
Browse files Browse the repository at this point in the history
Generating abi reports inside chroot solves the problem of unclean
abi reports when packagers do not have all dependencies installed.

This requires that `abi-wizard` be packaged as part of the `system.devel`
component to ensure it is always available inside of the chroot.
  • Loading branch information
joebonrichie authored and JoshStrobl committed Dec 29, 2021
1 parent 4a679d5 commit 1e5885d
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions builder/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,16 @@ func (p *Package) BuildYpkg(notif PidNotifier, usr *UserInfo, pman *EopkgManager
}).Error("Failed to build package")
return err
}

// Generate ABI Report
log.Debug("Attempting to generate ABI report")
if err := p.GenerateABIReport(notif, overlay); err != nil {
log.WithFields(log.Fields{
"error": err,
}).Error("Failed to generate ABI report within solbuild")
return err
}

notif.SetActivePID(0)
return nil
}
Expand Down Expand Up @@ -450,6 +460,21 @@ func (p *Package) BuildXML(notif PidNotifier, pman *EopkgManager, overlay *Overl
return nil
}

// GenerateABIReport will take care of generating the abireport using abi-wizard
func (p *Package) GenerateABIReport(notif PidNotifier, overlay *Overlay) error {
wdir := p.GetWorkDirInternal()
log.Printf("Generating ABI Report...")
cmd := fmt.Sprintf("cd %s; abi-wizard %s/YPKG/root/%s/install", wdir, BuildUserHome, p.Name)
if err := ChrootExec(notif, overlay.MountPoint, cmd); err != nil {
log.WithFields(log.Fields{
"error": err,
}).Error("Failed to generate abireport with abi-wizard")
return err
}
notif.SetActivePID(0)
return nil
}

// CollectAssets will search for the build files and copy them back to the
// users current directory. If solbuild was invoked via sudo, solbuild will
// then attempt to set the owner as the original user.
Expand Down Expand Up @@ -488,6 +513,10 @@ func (p *Package) CollectAssets(overlay *Overlay, usr *UserInfo, manifestTarget
collections = append(collections, tramPath)
}

// Collect files from abireport
abireportfiles, _ := filepath.Glob(filepath.Join(collectionDir, "abi_*"))
collections = append(collections, abireportfiles...)

if p.Type == PackageTypeYpkg {
pspecs, _ := filepath.Glob(filepath.Join(collectionDir, "pspec_*.xml"))
collections = append(collections, pspecs...)
Expand Down

0 comments on commit 1e5885d

Please sign in to comment.