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:
- RPM format
- Yum repository internals (blog post)
- YUM repository and package management: Complete Tutorial (blog post)
- The Origin of RPM Content
If you have any question or suggestions, do not hesitate to create an issue
or contact us in Telegram.
Artipie roadmap.
This is the dependency you need:
<dependency>
<groupId>com.artipie</groupId>
<artifactId>rpm-adapter</artifactId>
<version>[...]</version>
</dependency>
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.
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);
RPM repository may include filelists.xml
metadata, this metadata is not required by all rpm package
managers. By default, we do not generate this metadata file but this behaviour can be configured
with the help of Rpm
secondary constructor.
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.
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, defaultsimple
) configures NamingPolicy for Rpmdigest
- (optional, defaultsha256
) configures Digest instance for Rpmfilelists
- (optional, defaulttrue
) includes File Lists for Rpmupdate
- (optional, default empty, no update) allows to set schedule to update repository in cron format. This option allows performing repository update periodically, according to schedule.
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+ and please read contributing rules.