spec: drop hacks for Fedora 32

There are not needed anymore, yay!

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
This commit is contained in:
Ondřej Budai 2021-06-30 14:44:04 +02:00 committed by Ondřej Budai
parent 5ae6203d65
commit 385648223d
7 changed files with 14 additions and 182 deletions

View file

@ -14,8 +14,9 @@ import (
"os"
"github.com/kolo/xmlrpc"
"github.com/osbuild/osbuild-composer/internal/rpmmd"
"github.com/ubccr/kerby/khttp"
"github.com/osbuild/osbuild-composer/internal/rpmmd"
)
type Koji struct {
@ -314,9 +315,15 @@ func (k *Koji) uploadChunk(chunk []byte, filepath, filename string, offset uint6
HexDigest string `xmlrpc:"hexdigest"`
}
err = processXMLRPCResponse(body, &reply)
resp := xmlrpc.Response(body)
if resp.Err() != nil {
return fmt.Errorf("xmlrpc server returned an error: %v", resp.Err())
}
err = resp.Unmarshal(&reply)
if err != nil {
return err
return fmt.Errorf("cannot unmarshal the xmlrpc response: %v", err)
}
if reply.Size != len(chunk) {

View file

@ -1,33 +0,0 @@
// +build kolo_xmlrpc_oldapi
//
// This file provides a wrapper around kolo/xmlrpc response handling.
//
// Commit e3ad6d89 of the xmlrpc library changed the API of response handling.
// This means that different APIs are available in Fedora 32 and 33 (it does
// not matter for RHEL as uses vendored libraries).
// This wrapper allows us to use both xmlrpc's APIs using buildflags.
//
// This file is a wrapper for xmlrpc older than e3ad6d89.
package koji
import (
"fmt"
"github.com/kolo/xmlrpc"
)
// processXMLRPCResponse is a wrapper around kolo/xmlrpc
func processXMLRPCResponse(body []byte, reply interface{}) error {
resp := xmlrpc.NewResponse(body)
if resp.Failed() {
return fmt.Errorf("xmlrpc server returned an error: %v", resp.Err())
}
err := resp.Unmarshal(reply)
if err != nil {
return fmt.Errorf("cannot unmarshal the xmlrpc response: %v", err)
}
return nil
}

View file

@ -1,34 +0,0 @@
// +build !kolo_xmlrpc_oldapi
//
// This file provides a wrapper around kolo/xmlrpc response handling.
//
// Commit e3ad6d89 of the xmlrpc library changed the API of response handling.
// This means that different APIs are available in Fedora 32 and 33 (it does
// not matter for RHEL as uses vendored libraries).
// This wrapper allows us to use both xmlrpc's APIs using buildflags.
//
// This file is a wrapper for xmlrpc equal or newer than e3ad6d89.
package koji
import (
"fmt"
"github.com/kolo/xmlrpc"
)
// processXMLRPCResponse is a wrapper around kolo/xmlrpc
func processXMLRPCResponse(body []byte, reply interface{}) error {
resp := xmlrpc.Response(body)
if resp.Err() != nil {
return fmt.Errorf("xmlrpc server returned an error: %v", resp.Err())
}
err := resp.Unmarshal(reply)
if err != nil {
return fmt.Errorf("cannot unmarshal the xmlrpc response: %v", err)
}
return nil
}