Skip to content

Commit

Permalink
Use uyuni-releng-tools to push the package to OBS
Browse files Browse the repository at this point in the history
  • Loading branch information
cbosdo committed Nov 30, 2023
1 parent 36e9bf7 commit e423608
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 22 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
.idea/
rhn.conf
inter-server-sync
vendor.tar.gz
*.pyc
__pycache__
30 changes: 30 additions & 0 deletions .tito/custom/custom.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright (c) 2018 SUSE Linux Products GmbH
# SPDX-FileCopyrightText: 2023 SUSE LLC
#
# SPDX-License-Identifier: GPL-2.0-only

"""
Code for building packages in SUSE that need generated code not tracked in git.
"""
import os

from tito.builder import Builder
from tito.common import info_out, run_command

class SuseGitExtraGenerationBuilder(Builder):

def _setup_sources(self):

Builder._setup_sources(self)
setup_execution_file_name = "setup.sh"
setup_file_dir = os.path.join(self.git_root, self.relative_project_dir)
setup_file_path = os.path.join(setup_file_dir, setup_execution_file_name)
if os.path.exists(setup_file_path):
info_out("Executing %s" % setup_file_path)
output = run_command("[[ -x %s ]] && %s" % (setup_file_path, setup_file_path), True)
filename = output.split('\n')[-1]
if filename and os.path.exists(os.path.join(setup_file_dir, filename)):
info_out("Copying %s to %s" % (os.path.join(setup_file_dir, filename), self.rpmbuild_sourcedir))
run_command("cp %s %s/" % (os.path.join(setup_file_dir, filename), self.rpmbuild_sourcedir), True)
self.sources.append(os.path.join(self.rpmbuild_sourcedir, filename))

7 changes: 7 additions & 0 deletions .tito/tito.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[buildconfig]
builder = custom.SuseGitExtraGenerationBuilder
tagger = tito.tagger.SUSETagger
changelog_with_email = 0
changelog_do_not_remove_cherrypick = 0
no_default_changelog = 1
lib_dir=.tito/custom
32 changes: 16 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,36 +40,36 @@ Steps to run in locally in development mode:

### 1. Create tag

- Create a tag with the version number using the format "v0.0.0" and push it to github
- Install `uyuni-releng-tools` from [systemsmanagement:Uyuni:Utils](https://build.opensuse.org/project/show/systemsmanagement:Uyuni:Utils)
- Create a tag with the version number using `tito` and push it to github
```
git tag v0.0.0
git push origin v0.0.0
tito tag
git push origin inter-server-sync-x.y.z-1
```

### 2. Create a github release (optional)

- On github create a new version release based on the previous tag

### 3. OBS: project preparetion
### 3. OBS: project preparation

- Projects names:
- Uyuni: `systemsmanagement:Uyuni:Master`
- Head: Devel: `Galaxy:Manager:Head`
- Manager 4.2: `Devel:Galaxy:Manager:4.2`
- Pakcage name: `inter-server-sync`
- Manager 4.3: `Devel:Galaxy:Manager:4.3`
- Package name: `inter-server-sync`

On porject working directory:
In the checked out git repo:

1. Adapt the `_services` file to be able to download the correct tag for the version
2. Run all services: `osc service runall`
3. Check the changes files is correctly updated
4. Check spec file was correctly updated with the release version
5. Add all files: `osc ar`
6. Remove old version files `tar` and `osinfo` (`osc rm filename`)
7. Commit everything with `osc commit`
```
export OSCAPI=https://api.opensuse.org
osc -A https://api.opensuse.org branch systemsmanagement:Uyuni:Master
export OBS_PROJ=home:<your_nick>:branches:systemsmanagement:Uyuni:Master
build-packages-for-obs && push-packages-to-obs
```

### 4. OBS: create submit requests

Uyuni: `osc sr --no-cleanup <your_project> inter-server-sync systemsmanagement:Uyuni:Master`
Manager Head: `iosc sr --no-cleanup openSUSE.org:<your_project> inter-server-sync Devel:Galaxy:Manager:Head`
Uyuni: `osc -A https://api.opensuse.org sr --no-cleanup <your_project> inter-server-sync systemsmanagement:Uyuni:Master`
Manager Head: `osc -A https://api.suse.de sr --no-cleanup openSUSE.org:<your_project> inter-server-sync Devel:Galaxy:Manager:Head`
For each maintained SUSE Manager version, one SR in the form: `iosc sr --no-cleanup openSUSE.org:<your_project> inter-server-sync Devel:Galaxy:Manager:X.Y`
1 change: 1 addition & 0 deletions inter-server-sync.changes.cbosdonnat.tito
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Use tito to push to OBS and help releasing
10 changes: 4 additions & 6 deletions inter-server-sync.spec
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
%global provider_prefix %{provider}.%{provider_tld}/%{org}/%{project}

Name: %{project}
Version: 0.0.0
Release: 0
Version: 0.3.1
Release: 1
Summary: Export/import data on a uyuni server
License: Apache-2.0
Group: System/Management
Expand Down Expand Up @@ -71,16 +71,14 @@ export GOFLAGS=-mod=vendor

%gofilelist

%define _release_dir %{_builddir}/%{project}-%{version}/release

# Add config files for hub
install -d -m 0750 %{buildroot}%{_var}/log/hub

# Add syslog config to redirect logs to /var/log/hub/iss2.log
install -D -m 0644 %{_release_dir}/hub-iss-syslogs.conf %{buildroot}%{_sysconfdir}/rsyslog.d/hub-iss.conf
install -D -m 0644 release/hub-iss-syslogs.conf %{buildroot}%{_sysconfdir}/rsyslog.d/hub-iss.conf

#logrotate config
install -D -m 0644 %{_release_dir}/hub-iss-logrotate.conf %{buildroot}%{_sysconfdir}/logrotate.d/inter-server-sync
install -D -m 0644 release/hub-iss-logrotate.conf %{buildroot}%{_sysconfdir}/logrotate.d/inter-server-sync

%check
%if 0%{?rhel}
Expand Down
9 changes: 9 additions & 0 deletions setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# SPDX-FileCopyrightText: 2023 SUSE LLC
#
# SPDX-License-Identifier: Apache-2.0

set -euxo pipefail

go mod vendor && tar czvf vendor.tar.gz vendor >/dev/null && rm -rf vendor

echo "vendor.tar.gz"

0 comments on commit e423608

Please sign in to comment.