Skip to content

Commit 1be2fa6

Browse files
several enhancements to README (#363)
several enhancements to README and one fix in documentation (or confusion). Reviewed-by: Nikola Forró Reviewed-by: Laura Barcziová
2 parents 6fc5bee + 4e76565 commit 1be2fa6

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

README.md

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ Prep macros are macros that often appear in (and only in, they don't make sense
3636

3737
4 such macros are recognized by this library, [`%setup`](https://rpm-packaging-guide.github.io/#setup), [`%patch`](http://ftp.rpm.org/max-rpm/s1-rpm-inside-macros.html#S2-RPM-INSIDE-PATCH-MACRO), [`%autosetup`](https://rpm-software-management.github.io/rpm/manual/autosetup.html#autosetup-description) and [`%autopatch`](https://rpm-software-management.github.io/rpm/manual/autosetup.html#autopatch). A typical spec file uses either `%autosetup` or a combination of `%setup` and `%patch` or `%autopatch`.
3838

39+
## Documentation
40+
41+
[Full documentation generated from code](https://packit.dev/specfile/api/specfile).
42+
3943
## Examples and use cases
4044

4145
The following examples should cover use cases required by [packit](https://github.com/packit/research/blob/main/specfile/README.md).
@@ -175,20 +179,36 @@ specfile.set_version_and_release('2.1', release='3')
175179
specfile.set_version_and_release('2.1', preserve_macros=True)
176180
```
177181

182+
#### Bumping release
183+
184+
To bump release and add a new changelog entry, you could use the following code:
185+
186+
```python
187+
from specfile import Specfile
188+
189+
with Specfile("example.spec") as spec:
190+
spec.release = str(int(spec.expanded_release) + 1)
191+
spec.add_changelog_entry("- Bumped release for test purposes")
192+
```
193+
178194
#### Changelog
179195

180196
```python
181197
# adding a new entry, author is automatically determined
182198
# (using the same heuristics that rpmdev-packager uses) if possible
183-
specfile.add_changelog_entry('New upstream release 2.1')
199+
# this function already honors autochangelog
200+
specfile.add_changelog_entry('- New upstream release 2.1')
184201

185202
# adding a new entry, specifying author and timestamp explicitly
186203
specfile.add_changelog_entry(
187-
'New upstream release 2.1',
204+
'- New upstream release 2.1',
188205
author='Nikola Forró',
189206
190207
timestamp=datetime.date(2021, 11, 20),
191208
)
209+
210+
if specfile.has_autochangelog:
211+
# do something
192212
```
193213

194214
#### Sources and patches

0 commit comments

Comments
 (0)