rpm-files

Turns your files/objects into RPM artifacts

License

License

MIT
GroupId

GroupId

com.yegor256
ArtifactId

ArtifactId

rpm-files
Last Version

Last Version

0.1.0
Release Date

Release Date

Type

Type

jar
Description

Description

rpm-files
Turns your files/objects into RPM artifacts
Project URL

Project URL

https://github.com/yegor256/rpm-files
Project Organization

Project Organization

jcabi.com
Source Code Management

Source Code Management

https://github.com/yegor256/rpm-files

Download rpm-files

How to add to project

<!-- https://jarcasting.com/artifacts/com.yegor256/rpm-files/ -->
<dependency>
    <groupId>com.yegor256</groupId>
    <artifactId>rpm-files</artifactId>
    <version>0.1.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.yegor256/rpm-files/
implementation 'com.yegor256:rpm-files:0.1.0'
// https://jarcasting.com/artifacts/com.yegor256/rpm-files/
implementation ("com.yegor256:rpm-files:0.1.0")
'com.yegor256:rpm-files:jar:0.1.0'
<dependency org="com.yegor256" name="rpm-files" rev="0.1.0">
  <artifact name="rpm-files" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.yegor256', module='rpm-files', version='0.1.0')
)
libraryDependencies += "com.yegor256" % "rpm-files" % "0.1.0"
[com.yegor256/rpm-files "0.1.0"]

Dependencies

compile (7)

Group / Artifact Type Version
org.redline-rpm : redline jar 1.2.9
com.jcabi.incubator : xembly jar 0.22
org.cactoos : cactoos jar 0.42
com.jcabi : jcabi-xml jar 0.22.1
javax.xml.bind : jaxb-api jar 2.3.0
com.jcabi : jcabi-log jar 0.18.1
com.yegor256 : asto jar 0.0.1

test (3)

Group / Artifact Type Version
com.jcabi : jcabi-matchers jar 1.4
commons-io : commons-io jar 2.5
org.xmlunit : xmlunit-core jar 2.6.3

Project Modules

There are no modules declared in this project.

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+.

Versions

Version
0.1.0
0.0.4
0.0.3
0.0.2
0.0.1