github.com/google/osv-scalibr@v0.4.1/extractor/filesystem/os/rpm/rpm_dummy.go (about)

     1  // Copyright 2025 Google LLC
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //      http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  //go:build windows
    16  
    17  // Package rpm extracts packages from rpm database.
    18  package rpm
    19  
    20  import (
    21  	"context"
    22  	"errors"
    23  	"time"
    24  
    25  	"github.com/google/osv-scalibr/extractor/filesystem"
    26  	"github.com/google/osv-scalibr/inventory"
    27  	"github.com/google/osv-scalibr/plugin"
    28  	"github.com/google/osv-scalibr/stats"
    29  )
    30  
    31  // Name is the name for the RPM extractor
    32  const Name = "os/rpm"
    33  
    34  // Extractor extracts rpm packages from rpm database.
    35  type Extractor struct{}
    36  
    37  // Config contains RPM specific configuration values
    38  type Config struct {
    39  	Stats            stats.Collector
    40  	MaxFileSizeBytes int64
    41  	Timeout          time.Duration
    42  }
    43  
    44  // DefaultConfig returns the default configuration values for the RPM extractor.
    45  func DefaultConfig() Config { return Config{} }
    46  
    47  // New returns an RPM extractor.
    48  //
    49  // For most use cases, initialize with:
    50  // ```
    51  // e := New(DefaultConfig())
    52  // ```
    53  func New(cfg Config) *Extractor {
    54  	return &Extractor{}
    55  }
    56  
    57  // NewDefault returns an extractor with the default config settings.
    58  func NewDefault() filesystem.Extractor { return New(DefaultConfig()) }
    59  
    60  // Name of the extractor.
    61  func (e Extractor) Name() string { return Name }
    62  
    63  // Version of the extractor.
    64  func (e Extractor) Version() int { return 0 }
    65  
    66  // Requirements of the extractor.
    67  func (e Extractor) Requirements() *plugin.Capabilities { return &plugin.Capabilities{} }
    68  
    69  // FileRequired always returns false as RPM extractor is not supported.
    70  func (e Extractor) FileRequired(_ filesystem.FileAPI) bool {
    71  	return false
    72  }
    73  
    74  // Extract extracts packages from rpm status files passed through the scan input.
    75  func (e Extractor) Extract(ctx context.Context, input *filesystem.ScanInput) (inventory.Inventory, error) {
    76  	return inventory.Inventory{}, errors.New("not supported")
    77  }