Git Product home page Git Product logo

rpm-adapter's Introduction

EO principles respected here DevOps By Rultor.com We recommend IntelliJ IDEA

Javadoc License codecov Hits-of-Code Maven Central PDD status

This Java library turns your binary storage (files, S3 objects, anything) into an RPM repository. You may add it to your binary storage and it will become a fully-functionable RPM repository, which yum and dnf will perfectly understand.

Similar solutions:

Some valuable references:

This is the dependency you need:

<dependency>
  <groupId>com.artipie</groupId>
  <artifactId>rpm-adapter</artifactId>
  <version>[...]</version>
</dependency>

Then, use one of the existing com.artipie.asto.Storage implementations to create the Storage. Artipie/asto supports FileStorage, S3 and other storages. Or you can implement com.artipie.asto.Storage by yourself.

Then, you make an instance of Rpm class with your storage as an argument. Finally, you put your artifacts to the storage specifying repository key (rpm-repo in our example) and instruct Rpm to update the meta info:

import com.artipie.rpm.Rpm;
final Storage storage = new FileStorage(Paths.get("my-artipie"));
final String name = "rpm-repo";
storage.save(
    new Key.From(name, "pkg.rpm"), 
    new Content.From(Files.readAllBytes(Paths.get("pkg.rpm")))
).join();
final Rpm rpm = new Rpm(storage);
rpm.batchUpdate(new Key.From(name));

Read the Javadoc for more technical details.

Naming policy and checksum computation algorithm

RPM may use different names to store metadata files in the package, by default we use StandardNamingPolicy.PLAIN. To change naming policy use secondary constructor of Rpm to configure it. For instance to add SHA1 prefixes for metadata files use StandardNamingPolicy.SHA1.

RPM may use different algorithms to calculate rpm packages checksum for metadata. By default, we use sha-256 algorithms for hashing. To change checksum calculation algorithm use secondary constructor of Rpm and Digest enum to specify the algorithm:

Rpm rpm = new Rpm(storage, StandardNamingPolicy.SHA1, Digest.SHA256);

Include filelists.xml metadata

RPM repository may include filelists.xml metadata, this metadata is not required by all rpm package managers. By default, we generate this metadata file but this behaviour can be configured with the help of Rpm secondary constructor.

How it works?

First, you upload your .rpm artifact to the repository. Then, you call batchUpdate() and these four system XML files are updated in the repodata directory: repomd.xml, primary.xml.gz, filelists.xml.gz, and others.xml.gz.

Examples of these files you can find in this repo.

Cli

Build the Cli tool using mvn clean package -Pcli. You can run it as following

java -jar target/rpm-adapter.jar ./repo-dir/

Options are:

  • naming-policy - (optional, default simple) configures NamingPolicy for Rpm
  • digest - (optional, default sha256) configures Digest instance for Rpm
  • filelists - (optional, default true) includes File Lists for Rpm

How to contribute

Fork repository, make changes, send us a pull request. We will review your changes and apply them to the master branch shortly, provided they don't violate our quality standards. To avoid frustration, before sending us your pull request please run full Maven build:

$ mvn clean install -Pqulice

To avoid build errors use Maven 3.2+.

rpm-adapter's People

Contributors

olenagerasimova avatar g4s8 avatar paulodamaso avatar victornoel avatar olegmoz avatar yegor256 avatar sammers21 avatar ammaratef45 avatar brastak avatar marceloamadeu avatar dependabot-preview[bot] avatar carlosmiranda avatar hdouss avatar genryxy avatar guseyn avatar acheshkov avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.