File uyuni-releng-tools-git-16.c1feea8.obscpio of Package uyuni-releng-tools
07070100000000000041ED000003E9000003E9000000076907672700000000000000000000000000000000000000000000001300000000uyuni-releng-tools07070100000001000081A4000003E9000003E9000000016907672700000082000000000000000000000000000000000000004500000000uyuni-releng-tools/uyuni-releng-tools.changes.mackdk.improve-mkchlog- mkchlog: remove repeated and trailing spaces from the message
- mkchlog: fix the feature name when the branch name contains a /
07070100000002000041ED000003E9000003E9000000026907672700000000000000000000000000000000000000000000001C00000000uyuni-releng-tools/LICENSES07070100000003000081A4000003E9000003E9000000016907672700002828000000000000000000000000000000000000002B00000000uyuni-releng-tools/LICENSES/Apache-2.0.txtApache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
(a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
07070100000004000081A4000003E9000003E9000000016907672700001B88000000000000000000000000000000000000002800000000uyuni-releng-tools/LICENSES/CC0-1.0.txtCreative Commons Legal Code
CC0 1.0 Universal
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
HEREUNDER.
Statement of Purpose
The laws of most jurisdictions throughout the world automatically confer
exclusive Copyright and Related Rights (defined below) upon the creator
and subsequent owner(s) (each and all, an "owner") of an original work of
authorship and/or a database (each, a "Work").
Certain owners wish to permanently relinquish those rights to a Work for
the purpose of contributing to a commons of creative, cultural and
scientific works ("Commons") that the public can reliably and without fear
of later claims of infringement build upon, modify, incorporate in other
works, reuse and redistribute as freely as possible in any form whatsoever
and for any purposes, including without limitation commercial purposes.
These owners may contribute to the Commons to promote the ideal of a free
culture and the further production of creative, cultural and scientific
works, or to gain reputation or greater distribution for their Work in
part through the use and efforts of others.
For these and/or other purposes and motivations, and without any
expectation of additional consideration or compensation, the person
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
is an owner of Copyright and Related Rights in the Work, voluntarily
elects to apply CC0 to the Work and publicly distribute the Work under its
terms, with knowledge of his or her Copyright and Related Rights in the
Work and the meaning and intended legal effect of CC0 on those rights.
1. Copyright and Related Rights. A Work made available under CC0 may be
protected by copyright and related or neighboring rights ("Copyright and
Related Rights"). Copyright and Related Rights include, but are not
limited to, the following:
i. the right to reproduce, adapt, distribute, perform, display,
communicate, and translate a Work;
ii. moral rights retained by the original author(s) and/or performer(s);
iii. publicity and privacy rights pertaining to a person's image or
likeness depicted in a Work;
iv. rights protecting against unfair competition in regards to a Work,
subject to the limitations in paragraph 4(a), below;
v. rights protecting the extraction, dissemination, use and reuse of data
in a Work;
vi. database rights (such as those arising under Directive 96/9/EC of the
European Parliament and of the Council of 11 March 1996 on the legal
protection of databases, and under any national implementation
thereof, including any amended or successor version of such
directive); and
vii. other similar, equivalent or corresponding rights throughout the
world based on applicable law or treaty, and any national
implementations thereof.
2. Waiver. To the greatest extent permitted by, but not in contravention
of, applicable law, Affirmer hereby overtly, fully, permanently,
irrevocably and unconditionally waives, abandons, and surrenders all of
Affirmer's Copyright and Related Rights and associated claims and causes
of action, whether now known or unknown (including existing as well as
future claims and causes of action), in the Work (i) in all territories
worldwide, (ii) for the maximum duration provided by applicable law or
treaty (including future time extensions), (iii) in any current or future
medium and for any number of copies, and (iv) for any purpose whatsoever,
including without limitation commercial, advertising or promotional
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
member of the public at large and to the detriment of Affirmer's heirs and
successors, fully intending that such Waiver shall not be subject to
revocation, rescission, cancellation, termination, or any other legal or
equitable action to disrupt the quiet enjoyment of the Work by the public
as contemplated by Affirmer's express Statement of Purpose.
3. Public License Fallback. Should any part of the Waiver for any reason
be judged legally invalid or ineffective under applicable law, then the
Waiver shall be preserved to the maximum extent permitted taking into
account Affirmer's express Statement of Purpose. In addition, to the
extent the Waiver is so judged Affirmer hereby grants to each affected
person a royalty-free, non transferable, non sublicensable, non exclusive,
irrevocable and unconditional license to exercise Affirmer's Copyright and
Related Rights in the Work (i) in all territories worldwide, (ii) for the
maximum duration provided by applicable law or treaty (including future
time extensions), (iii) in any current or future medium and for any number
of copies, and (iv) for any purpose whatsoever, including without
limitation commercial, advertising or promotional purposes (the
"License"). The License shall be deemed effective as of the date CC0 was
applied by Affirmer to the Work. Should any part of the License for any
reason be judged legally invalid or ineffective under applicable law, such
partial invalidity or ineffectiveness shall not invalidate the remainder
of the License, and in such case Affirmer hereby affirms that he or she
will not (i) exercise any of his or her remaining Copyright and Related
Rights in the Work or (ii) assert any associated claims and causes of
action with respect to the Work, in either case contrary to Affirmer's
express Statement of Purpose.
4. Limitations and Disclaimers.
a. No trademark or patent rights held by Affirmer are waived, abandoned,
surrendered, licensed or otherwise affected by this document.
b. Affirmer offers the Work as-is and makes no representations or
warranties of any kind concerning the Work, express, implied,
statutory or otherwise, including without limitation warranties of
title, merchantability, fitness for a particular purpose, non
infringement, or the absence of latent or other defects, accuracy, or
the present or absence of errors, whether or not discoverable, all to
the greatest extent permissible under applicable law.
c. Affirmer disclaims responsibility for clearing rights of other persons
that may apply to the Work or any use thereof, including without
limitation any person's Copyright and Related Rights in the Work.
Further, Affirmer disclaims responsibility for obtaining any necessary
consents, permissions or other rights required for any use of the
Work.
d. Affirmer understands and acknowledges that Creative Commons is not a
party to this document and has no duty or obligation with respect to
this CC0 or use of the Work.
07070100000005000081A4000003E9000003E900000001690767270000041C000000000000000000000000000000000000002B00000000uyuni-releng-tools/uyuni-releng-tools.spec# Copyright (c) 2023 SUSE LLC
# SPDX-FileCopyrightText: 2023 SUSE LLC
#
# SPDX-License-Identifier: Apache-2.0
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
Name: uyuni-releng-tools
Version: 0.0.6
Release: 0
Summary: Tools helping Uyuni release engineers
License: Apache-2.0
Group: System/Management
URL: https://github.com/uyuni-project/uyuni-releng-tools/
Source0: %{name}-%{version}.tar.gz
BuildArch: noarch
Requires: build
Requires: cpio
Requires: git-core
Requires: osc
Requires: tito
%description
Tools helping to prepare Uyuni release submissions.
%prep
%autosetup
%build
%install
install -m 0755 -vd %{buildroot}%{_bindir}
install -m 0755 -vp ./bin/* %{buildroot}%{_bindir}/
install -m 0755 -vd %{buildroot}%{_datadir}/%{name}
install -m 0644 -cp ./_service %{buildroot}%{_datadir}/%{name}/
%files
%defattr(-,root,root)
%doc README.md
%license LICENSES/Apache-2.0.txt
%{_bindir}/*
%{_datadir}/%{name}/
%changelog
07070100000006000081A4000003E9000003E9000000016907672700000034000000000000000000000000000000000000004F00000000uyuni-releng-tools/uyuni-releng-tools.changes.mcalmer.allow-build-without-cpio- Support building with tar archive instead of cpio
07070100000007000041ED000003E9000003E9000000036907672700000000000000000000000000000000000000000000001B00000000uyuni-releng-tools/.github07070100000008000081A4000003E9000003E900000001690767270000008C000000000000000000000000000000000000002600000000uyuni-releng-tools/.github/CODEOWNERS# SPDX-FileCopyrightText: 2023 SUSE LLC
#
# SPDX-License-Identifier: Apache-2.0
# Release Engineering
* @uyuni-project/release-engineering
07070100000009000041ED000003E9000003E9000000026907672700000000000000000000000000000000000000000000002500000000uyuni-releng-tools/.github/workflows0707010000000A000081A4000003E9000003E9000000016907672700000206000000000000000000000000000000000000002F00000000uyuni-releng-tools/.github/workflows/reuse.yml# SPDX-FileCopyrightText: 2022 Free Software Foundation Europe e.V. <https://fsfe.org>
#
# SPDX-License-Identifier: CC0-1.0
name: REUSE Compliance Check
on:
push:
branches:
- main
pull_request:
types:
- opened
- reopened
- synchronize
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
- name: REUSE Compliance Check
uses: fsfe/reuse-action@bb774aa972c2a89ff34781233d275075cbddf542 #v5.0.0
0707010000000B000081A4000003E9000003E900000001690767270000064D000000000000000000000000000000000000003400000000uyuni-releng-tools/.github/workflows/push-2-obs.yml# SPDX-FileCopyrightText: 2023 SUSE LLC
#
# SPDX-License-Identifier: Apache-2.0
name: Push to OBS
on:
push:
branches:
- main
jobs:
push_to_obs:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
with:
fetch-tags: true
fetch-depth: 0
- name: Add repositories
run: |
sudo sh -c 'echo "deb https://download.opensuse.org/repositories/systemsmanagement:/Uyuni:/Utils/xUbuntu_22.04-debbuild/ /" >/etc/apt/sources.list.d/utils.list'
curl -L https://download.opensuse.org/repositories/systemsmanagement:/Uyuni:/Utils/xUbuntu_22.04-debbuild/Release.key | sudo apt-key add -
sudo sh -c 'echo "deb https://download.opensuse.org/repositories/openSUSE:/Tools/xUbuntu_22.04/ /" >/etc/apt/sources.list.d/tools.list'
curl -L https://download.opensuse.org/repositories/openSUSE:/Tools/xUbuntu_22.04/Release.key | sudo apt-key add -
sudo apt update
- name: Install dependencies
run: sudo apt-get install -y --no-install-recommends tito osc
- name: Upload to OBS
run: |
mkdir -p ~/.config/osc
echo -e "[general]\napiurl=https://api.opensuse.org\n\n[https://api.opensuse.org]\nuser = ${{ secrets.OBS_USER }}\npass = ${{ secrets.OBS_PASS }}\n" >~/.config/osc/oscrc
chmod -R 700 ~/.config/osc
./bin/build-packages-for-obs && ./bin/push-packages-to-obs
env:
TEST: "--test"
OSCAPI: https://api.opensuse.org
OBS_PROJ: systemsmanagement:Uyuni:Utils
0707010000000C000041ED000003E9000003E9000000026907672700000000000000000000000000000000000000000000001A00000000uyuni-releng-tools/.reuse0707010000000D000081A4000003E9000003E90000000169076727000001FE000000000000000000000000000000000000001F00000000uyuni-releng-tools/.reuse/dep5Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: uyuni-releng-tools
Upstream-Contact: Uyuni Project
Source: https://github.com/uyuni-project/uyuni-releng-tools/
# Sample paragraph, commented out:
#
# Files: src/*
# Copyright: $YEAR $NAME <$CONTACT>
# License: ...
Files: uyuni-releng-tools.changes*
Copyright: 2023 SUSE LLC
License: Apache-2.0
Files: .tito/*
Copyright: 2023 SUSE LLC
License: Apache-2.0
Files: _service
Copyright: 2023 SUSE LLC
License: Apache-2.0
0707010000000E000041ED000003E9000003E9000000026907672700000000000000000000000000000000000000000000001700000000uyuni-releng-tools/bin0707010000000F000081ED000003E9000003E9000000016907672700001DBA000000000000000000000000000000000000002C00000000uyuni-releng-tools/bin/push-packages-to-git#! /bin/bash
# SPDX-FileCopyrightText: 2025 SUSE LLC and contributors
#
# SPDX-License-Identifier: Apache-2.0
set -e
#
# For all packages prepared by build-packages-for-obs.sh in
# $WORKSPACE/SRPMS/<package> prepare and submit changed packages
# to OBS.
#
# To execute push.sh you may need OSC access with credentials
# Use $OSCRC ot pass an osc configfile containing required credentials
# (otherwise ~/.config/oscrc)
#
# srpm_package_defs() has a hardcoded list of packages excluded by default.
#
WORKSPACE=${WORKSPACE:-/tmp/push-packages-to-obs}
PACKAGE="$@"
GIT_ORG=${GIT_ORG:-galaxy}
GIT_SRV=${GIT_SRV:-src.suse.de}
GIT_USR=${GIT_USR:-gitea}
NO_PUSH=${NO_PUSH:+1}
# Set KEEP_SRPMS environment variable to TRUE if you want to keep your SRPMS
# Useful if, for example, you are resubmitting the same set to several
# projects in row
KEEP_SRPMS=${KEEP_SRPMS:-FALSE}
# BRANCH in upstream git and in internal gitea should be the same in the standard case
GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
BRANCH=${BRANCH:-$GIT_BRANCH}
GIT_CURR_HEAD=$(git rev-parse --short HEAD)
## used for exec push.sh
OSCAPI=${OSCAPI:-https://api.suse.de}
GIT_DIR=$(git rev-parse --show-cdup)
test -z "$GIT_DIR" || cd "$GIT_DIR"
GIT_DIR=$(pwd)
##
grep -v -- "\(--help\|-h\|-?\)\>" <<<"$@" || {
cat <<EOF
Usage: push-packages-to-obs.sh [PACKAGE]..
Submit changed packages from \$WORKSPACE/SRPMS/<package> ($WORKSPACE)
to GIT ($GIT_ORG). Without argument all packages in SRPMS are processed.
This script add the packages to its own git repo.
Optionally you can provide the following environment valiables:
GIT_ORG: The git organization (Default: galaxy)
GIT_SRV: The git server (Default: src.suse.de)
BRANCH: The git default branch where to submit to (Default: the current branch you are in)
NO_PUSH: Specify when you do not want to push but check what commits were created
EOF
exit 0
}
function exists() {
[ -n "$1" -a -e "$1" ]
}
function srpm_package_defs() {
# - "PKG_NAME" from $SRPM_DIR, using a hardcoded blacklist
# of packages we do not submitt.
# - define $PACKAGE to build a specific set of packages.
# - usage:
# while read PKG_NAME; do
# ...
# done < <(srpm_package_defs)
#
PACKAGE=$(find "$SRPM_DIR" -mindepth 1 -maxdepth 1 -type d -printf "%P\n")
for N in $PACKAGE; do
test -d "$SRPM_DIR/$N" || {
echo "No package dir '$SRPM_DIR/$N'" >&2
exit 99
}
test -e $SRPM_DIR/$N/Dockerfile && { echo "$N is not an image. Skipping..." >&2; continue; }
test -e $SRPM_DIR/$N/Chart.yaml && { echo "$N is not an image. Skipping..." >&2; continue; }
exists $SRPM_DIR/$N/*.kiwi && { echo "$N is not an image. Skipping..." >&2; continue; }
# we cannot check for a spec file as images have also a spec
echo "$N"
done
}
# Here we have every file (incl. .changes) in git, thus inside the tarball.
# The tarballs rootdirs may differ, as they contain the revision number.
# The specfile also contains the revision number. So do a quick check
# for different .changes, then 'tardiff -p1'
function copy_changed_package()
{
local sdir="$1"
test -d "$sdir" || { echo "No source dir '$sdir'" >&2; return 2; }
local tdir="$2"
test -d "$tdir" || { echo "No target dir '$tdir'" >&2; return 2; }
local pkgname="$3"
test -n "$pkgname" || { echo "No package name" >&2; return 2; }
rm -rf "$tdir"/*
HAVE_CPIO=0
for F in "$sdir"/*; do
local stem="$(basename "$F")"
case "$stem" in
*.obscpio)
HAVE_CPIO=1
if [[ "$stem" =~ ^${pkgname}.*$ ]]; then
pushd $tdir
mkdir ${pkgname}
cpio -id < "$WORKSPACE/$F"
popd
else
# extract vendor.tar.gz in vendor/ and node_module.tar.gz in node_modules/
sdirname=${stem/.*/}
pushd $tdir
mkdir ${sdirname}
cpio -id < "$WORKSPACE/$F"
popd
fi
;;
*.tar.*|*.tar|*.tgz|*.tbz2)
if [[ "$stem" =~ ^${pkgname}.*$ ]]; then
pushd $tdir
mkdir ${pkgname}
tar -x --strip-components=1 -f $WORKSPACE/$F -C ${pkgname}
popd
else
# extract vendor.tar.gz in vendor/ and node_module.tar.gz in node_modules/
sdirname=${stem/.*/}
pushd $tdir
mkdir ${sdirname}
tar -x --strip-components=1 -f $WORKSPACE/$F -C ${sdirname}
popd
fi
;;
*.obsinfo) continue;;
*)
cp $F $tdir
;;
esac
done
pushd $tdir
if [ $HAVE_CPIO -eq 1 ]; then
# service to extract CPIO and create a tar. We do not need it
rm -f _service
fi
diffs=$(git status --short | wc -l)
test $diffs -gt 0 && {
popd
return 0
} || {
git reset --hard
popd
return 1
}
}
function git_checkout_or_create() {
pushd $GIT_ORG
git clone $GIT_USR@$GIT_SRV:$GIT_ORG/$PKG_NAME || {
log_and_add_failure $PKG_NAME "Repository does not exist. Please create it."
popd
exit 1
}
pushd $PKG_NAME
git checkout $BRANCH || git checkout -b $BRANCH || { popd; popd; exit 1; }
popd
popd
}
function log_and_add_failure() {
test $# -ge 1 || { echo "log_and_add_failure: Wrong args $#: $@" >&2; return 1; }
local pkg_name="$1"
local opt_msg="$2"
FAILED_CNT=$(($FAILED_CNT+1))
FAILED_PKG="$FAILED_PKG$(echo -ne "\n $pkg_name${opt_msg:+ ($opt_msg)}")"
echo "*** FAILED${opt_msg:+ ($opt_msg)} [$pkg_name]"
}
# go..
cd "$WORKSPACE"
T_LOG="$WORKSPACE/tmplog"
trap "test -f \"$T_LOG\" && /bin/rm -rf -- \"$T_LOG\" " 0 1 2 3 13 15
SRPM_DIR="SRPMS"
test -d "$SRPM_DIR" || {
echo "No'$SRPM_DIR' dir to process." >&2
exit 99
}
rm -rf "$GIT_ORG"
mkdir $GIT_ORG
echo "Going to update $GIT_ORG from $SRPM_DIR..."
UNCHANGED_CNT=0
SUCCEED_CNT=0
SUCCEED_PKG=
FAILED_CNT=0
FAILED_PKG=
while read PKG_NAME; do
echo "=== Processing package [$PKG_NAME]"
# prepare the srpm dir
SRPM_PKG_DIR="$SRPM_DIR/$PKG_NAME"
test -d "$SRPM_PKG_DIR" || {
log_and_add_failure "$PKG_NAME" "no srpm dir"
continue
}
# If there is a push.sh script call it and remove it right after
if [ -f "${SRPM_PKG_DIR}/push.sh" ]; then
bash "${SRPM_PKG_DIR}/push.sh" ${OSCAPI} ${GIT_DIR} ${PKG_NAME}
rm "${SRPM_PKG_DIR}/push.sh"
fi
GIT_PKG_DIR="$GIT_ORG/$PKG_NAME"
rm -rf "$GIT_PKG_DIR"
git_checkout_or_create
if copy_changed_package "$SRPM_PKG_DIR" "$GIT_PKG_DIR" "${PKG_NAME}"; then
echo "Package has changed, updating..."
(
set -e
cd "$GIT_PKG_DIR"
git add -A . # $OSC addremove >/dev/null
git status # $OSC status
git commit -m "Git submit $GIT_BRANCH($GIT_CURR_HEAD)" # $OSC ci -m "Git submit $GIT_BRANCH($GIT_CURR_HEAD)"
if [ -z "$NO_PUSH" ]; then
git push origin HEAD
else
echo "FAKE: Not pushing to GIT..."
false
fi
) || {
log_and_add_failure "$PKG_NAME" "${NO_PUSH:+fake }checkin"
continue
}
SUCCEED_CNT=$(($SUCCEED_CNT+1))
SUCCEED_PKG="$SUCCEED_PKG$(echo -ne "\n $PKG_NAME")"
else
echo "Package is unchanged."
UNCHANGED_CNT=$(($UNCHANGED_CNT+1))
fi
if [ "${KEEP_SRPMS}" == "FALSE" ]; then
rm -rf "$SRPM_PKG_DIR"
fi
done < <(srpm_package_defs)
echo "======================================================================"
echo "Unchanged packages: $UNCHANGED_CNT"
echo "Updated packages: $SUCCEED_CNT$SUCCEED_PKG"
test $FAILED_CNT != 0 && {
echo "Failed packages: $FAILED_CNT$FAILED_PKG"
}
echo "======================================================================"
exit $FAILED_CNT
07070100000010000081ED000003E9000003E900000001690767270000163F000000000000000000000000000000000000001F00000000uyuni-releng-tools/bin/mkchlog#!/bin/bash
# SPDX-FileCopyrightText: 2023 SUSE LLC
#
# SPDX-License-Identifier: Apache-2.0
function usage() {
cat << EOF
mkchlog - Create changelog entries for Uyuni packages
Usage: mkchlog [OPTIONS] [MESSAGE]
When called from a subdirectory of any Uyuni package, create a changelog file in
the following format:
<package_name>.changes.<username>.<feature_name>
If not explicitly specified, fetch username and feature_name from git email's
username part and the current branch name.
With no MESSAGE, open a text editor for manual input.
The default editor can be specified by setting the EDITOR environment variable.
-f, --feature set the feature name to use as a filename part
-u, --username set the username to use as a filename part
-r, --remove remove existing changelog file
-c, --commit do a git commit with MESSAGE as the commit message
-n, --no-wrap do not wrap automatically the message at 67 characters
-h, --help display this help and exit
Uyuni project: <https://github.com/uyuni-project/uyuni>
EOF
}
# Out of the box macOS ships with BSD getopt which doesn't support long args
if [ "$(uname -s)" == "Darwin" ] && (man getopt | grep -i -q "bsd"); then
echo "Error: This tool requires GNU getopt, but your system is using BSD getopt. Please install GNU getopt and add it to your PATH."
exit 1
fi
if ! ARGS=$(getopt -n mkchlog -o rhncf:u: --long remove,help,no-wrap,commit,feature:username: -- "$@"); then
exit 1
fi
eval set -- "$ARGS"
while [ $# -gt 0 ]; do
case "$1" in
-h|--help)
usage
exit
;;
-f|--feature)
FEATURE=$2
shift 2
;;
-u|--username)
USER=$2
shift 2
;;
-r|--remove)
REMOVE=1
shift
;;
-n|--no-wrap)
NO_WRAP=1
shift
;;
-c|--commit)
COMMIT=1
shift
;;
--)
shift
break
;;
esac
done
if ! command -v git &>/dev/null; then
echo "Error: git is not available in your system."
exit 1
fi
if [[ -z "$1" && -n "$COMMIT" ]]; then
echo "'--commit' option can only be used if the MESSAGE argument is provided."
exit 1
fi
if ! GITROOT=$(git rev-parse --show-toplevel 2>/dev/null); then
echo "Error: not in a git repository."
exit 1
fi
PKG_DIR=$(ls -d "$GITROOT"/{.tito,rel-eng}/packages 2>/dev/null)
if [ -z "$PKG_DIR" ] ; then
echo "Error: Not in Uyuni working directory."
exit 1
fi
CURDIR=$(git rev-parse --show-prefix) || exit 1
if [ -z "$USER" ]; then
GITMAIL=$(git config --get user.email 2>/dev/null)
if [ -n "$GITMAIL" ]; then
USER=${GITMAIL%@*}
else
echo "Cannot read the username from git config. Omitting the username part."
fi
fi
if [ -z "$FEATURE" ]; then
FEATURE=$(git rev-parse --abbrev-ref HEAD 2>/dev/null | tr '/' '-')
if [ -z "$FEATURE" ] || [ "HEAD" == "$FEATURE" ]; then
echo "Cannot read the branch name from the current HEAD. Omitting the feature name part."
unset FEATURE
fi
fi
if [ -z "$USER" ] && [ -z "$FEATURE" ]; then
echo "Error: Neither username nor branch name could be read. Please specify the values using --feature and --username options or create a changelog file manually."
exit 1
fi
# Returns the changelog file name in format <package>.changes.<username>.<feature>.
# Loops through the base directories of each package and tries to match one with the current directory.
# Returns 1 if no match found, which means the user is outside of a package directory.
function getChangelogFile() {
for pkg in $(cat "$PKG_DIR"/* | cut -d' ' -f2)
do
if [ "$pkg" = "./" ]; then
pkg=""
fi
if echo "$CURDIR" | grep -q "^$pkg"; then
local chfile
chfile=$(ls "$GITROOT"/"$pkg"*.changes)
echo "$chfile${USER:+.$USER}${FEATURE:+.$FEATURE}"
return
fi
done
exit 1
}
# Get user's default text editor, falling back to vi.
function getEditorCmd() {
local cmd
if [ -n "$EDITOR" ]; then
cmd=$EDITOR
elif command -v vim &>/dev/null; then
cmd="vim"
else
cmd="vi"
fi
# Specific CLI options for common text editors
case "$cmd" in
vi*)
cmd="$cmd +1 +startinsert!"
;;
*)
cmd="$cmd +1:3"
;;
esac
echo "$cmd"
}
if ! CHFILE=$(getChangelogFile); then
echo "Error: Not in a package directory."
exit 1
fi
# Remove option
if [ -n "$REMOVE" ]; then
if [ -f "$CHFILE" ]; then
git restore --staged "$CHFILE" 2>/dev/null
rm "$CHFILE" 2>/dev/null
exit
else
echo "Error: '$CHFILE' does not exist."
exit 1
fi
fi
# Add the new entry
if [ -z "$NO_WRAP" ]; then
echo "$1" | xargs | fold -s -w 65 | sed '1s/^\(.*\S\)\s*$/- \1/;2,$s/^\(.*\S\)\s*$/ \1/' > "$CHFILE.new"
else
echo "$1" | xargs | sed 's/^/- /' > "$CHFILE.new"
fi
# Append older entries
cat "$CHFILE" >> "$CHFILE.new" 2>/dev/null
# Open file for edit
if [ -z "$1" ]; then
$(getEditorCmd) "$CHFILE.new"
fi
# Move file into place
if [ -s "$CHFILE.new" ]; then
mv "$CHFILE.new" "$CHFILE"
# Stage in git
git add "$CHFILE"
if [[ -n "$COMMIT" && -n "$1" ]]; then
git commit -m "$1"
fi
else
# Unstage and remove
echo "No entries written. Discarding the changelog file."
git restore --staged "$CHFILE" 2>/dev/null
rm "$CHFILE.new" "$CHFILE" 2>/dev/null
fi
07070100000011000081ED000003E9000003E900000001690767270000273A000000000000000000000000000000000000002C00000000uyuni-releng-tools/bin/push-packages-to-obs#! /bin/bash
# SPDX-FileCopyrightText: 2023 SUSE LLC
#
# SPDX-License-Identifier: Apache-2.0
set -e
#
# For all packages prepared by build-packages-for-obs.sh in
# $WORKSPACE/SRPMS/<package> prepare and submitt changed packages
# to OBS.
#
# Use $OSCRC ot pass an osc configfile containing required credentials
# (otherwise ~/.oscrc)
#
# srpm_package_defs() has a hardcoded list of packages excluded by default.
#
WORKSPACE=${WORKSPACE:-/tmp/push-packages-to-obs}
PACKAGE="$@"
OSCRC=${OSCRC:+--config $OSCRC}
OSCAPI=${OSCAPI:-https://api.suse.de}
OSC="osc ${OSCRC} -A ${OSCAPI}"
if [ "$OSC_EXPAND" == "TRUE" ];then
OSC_CHECKOUT="$OSC checkout -e"
else
OSC_CHECKOUT="$OSC checkout -u"
fi
OBS_PROJ=${OBS_PROJ:-Devel:Galaxy:Manager:TEST}
FAKE_COMITTOBS=${FAKE_COMITTOBS:+1}
# Set KEEP_SRPMS environment variable to TRUE if you want to keep your SRPMS
# Useful if, for example, you are resubmitting the same set to several
# projects in row
KEEP_SRPMS=${KEEP_SRPMS:-FALSE}
# keep the no-dereference option or
# it could brake the diff of root.tar.gz with symlinks and empty folders
DIFF="diff -u --no-dereference"
GIT_DIR=$(git rev-parse --show-cdup)
test -z "$GIT_DIR" || cd "$GIT_DIR"
GIT_DIR=$(pwd)
GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
GIT_CURR_HEAD=$(git rev-parse --short HEAD)
grep -v -- "\(--help\|-h\|-?\)\>" <<<"$@" || {
cat <<EOF
Usage: push-packages-to-obs.sh [PACKAGE]..
Submit changed packages from \$WORKSPACE/SRPMS/<package> ($WORKSPACE)
to OBS ($OBS_PROJ). Without argument all packages in SRPMS are processed.
If OBS_TEST_PROJECT environment variable has been set, packages will be
submitted to it, instead. This is useful for, for example, building a project
that contains packages that have been changed in a Pull Request.
EOF
exit 0
}
function srpm_package_defs() {
# - "PKG_NAME" from $SRPM_DIR, using a hardcoded blacklist
# of packages we do not submitt.
# - define $PACKAGE to build a specific set of packages.
# - usage:
# while read PKG_NAME; do
# ...
# done < <(srpm_package_defs)
#
PACKAGE=$(find "$SRPM_DIR" -mindepth 1 -maxdepth 1 -type d -printf "%P\n")
for N in $PACKAGE; do
test -d "$SRPM_DIR/$N" || {
echo "No package dir '$SRPM_DIR/$N'" >&2
exit 99
}
echo "$N"
done
}
# checking for changed packages
#
function unrpm_to.d()
{
local srpm="$1"
test -f "$srpm" || { echo "No .rpm to unpack: '$srpm'" >&2; return 1; }
local tdir="$srpm".d
rm -rf "$tdir"
mkdir -p "$tdir"
( set -e; cd "$tdir"; unrpm ../"$(basename "$srpm")"; ) >/dev/null 2>&1
echo "$tdir"
}
function tar_cat() {
case "$1" in
*.gz|*.tgz) gzip -dc "$1" ;;
*.bz2|*.tbz2) bzip2 -dc "$1" ;;
*) cat "$1" ;;
esac
}
function tar_diff_p1() {
local ltar="$1"
local rtar="$2"
local tdir="$3"
test -d "$tdir" || { echo "No tmpdir for tar_diff '$tdir'"; return 1; }
mkdir "$tdir/L";
case "$ltar" in
*.obscpio) (FDIR=${PWD}; cd $tdir/L; cpio -id < "${FDIR}/$ltar");;
*) tar_cat "$ltar" | tar xf - -C "$tdir/L" || return 2;;
esac
mkdir "$tdir/R";
case "$ltar" in
*.obscpio) (FDIR=${PWD}; cd $tdir/R; cpio -id < "${FDIR}/$rtar");;
*) tar_cat "$rtar" | tar xf - -C "$tdir/R" || return 2;;
esac
if $DIFF -r "$tdir/L"/. "$tdir/R"/.; then
echo "Content $ltar and $rtar is the same"
return 0
else
echo "Content $ltar and $rtar differs"
return 1
fi
}
# Here we have eveyfile (incl. .changes) in git, thus inside the tarball.
# The tarballs rootdirs may differ, as they contain the revision number.
# The specfile also contains the revision number. So do a quick check
# for different .changes, then 'tardiff -p1'
function copy_changed_package()
{
local sdir="$1"
test -d "$sdir" || { echo "No source dir '$sdir'" >&2; return 2; }
local tdir="$2"
test -d "$tdir" || { echo "No target dir '$tdir'" >&2; return 2; }
# track changes so we can later decide whether we must tar_diff.
local diffs=0
local ttar=""
# check excess target files (except new tarball version)
for F in "$tdir"/*; do
local stem="$(basename "$F")"
case "$stem" in
*.tar.*|*.tar|*.tgz|*.tbz2|*.obscpio)
# If there is a matching file, diff it now
if [ -f "$sdir/$stem" ]; then
local tmpd=$(mktemp -d)
tar_diff_p1 "$tdir/$stem" "$sdir/$stem" "$tmpd" || {
diffs=1
}
rm -rf "$tmpd"
else
# tarball diff or rename not necessarily implies content change!
# May be a renamed file, maybe a new one, store for diffing later
ttar="$tdir/$stem"
fi
;;
*-rpmlintrc)
# ignore rpmlintrc files
continue
;;
*)
test -f "$sdir/$stem" || {
rm -f "$F"
diffs=1
}
;;
esac
done
if [ $diffs == 1 ]; then
test -z "$ttar" || rm "$ttar"
cp "$sdir"/* "$tdir"
return 0
fi
# check non-tarball changes
local star=""
for F in "$sdir"/*; do
local stem="$(basename "$F")"
case "$stem" in
*.tar.*|*.tar|*.tgz|*.tbz2|*.obscpio)
# Skip the files already in the target since we already diffed them
if [ ! -f "$tdir/$stem" ]; then
# tarball diff or rename not necessarily implies content change!
star="$sdir/$stem"
fi
;;
*.obsinfo) break;;
*)
if [ -f "$tdir/$stem" ]; then
# In sec files ignore Source and %setup lines containing
# '-git-<revision>'.
# Source0: MessageQueue-git-4a9144649ae82fab60f4f11b08c75d46275f47bf.tar.gz
# %setup -q -n MessageQueue-git-4a9144649ae82fab60f4f11b08c75d46275f47bf
#
$DIFF -I '^\(Source\|%setup\).*-git-' "$tdir/$stem" "$F" || {
diffs=1
ls -l "$tdir/$stem" "$F"
break
}
else
# new source file
diffs=1
break
fi
;;
esac
done
if [ $diffs == 1 -o "${star:+1}" != "${ttar:+1}" ]; then
test -z "$ttar" || rm "$ttar"
cp "$sdir"/* "$tdir"
return 0
fi
# HERE: star and ttar are either both present or not
test -z "$ttar" || {
# finally do tardiffs
local tmpd=$(mktemp -d)
tar_diff_p1 "$ttar" "$star" "$tmpd" || {
diffs=1
}
rm -rf "$tmpd"
if [ $diffs == 1 ]; then
test -z "$ttar" || rm "$ttar"
cp "$sdir"/* "$tdir"
return 0
fi
}
# No changes
return 1
}
function log_and_add_failure() {
test $# -ge 1 || { echo "log_and_add_failure: Wrong args $#: $@" >&2; return 1; }
local pkg_name="$1"
local opt_msg="$2"
FAILED_CNT=$(($FAILED_CNT+1))
FAILED_PKG="$FAILED_PKG$(echo -ne "\n $pkg_name${opt_msg:+ ($opt_msg)}")"
echo "*** FAILED${opt_msg:+ ($opt_msg)} [$pkg_name]"
}
# go..
cd "$WORKSPACE"
T_LOG="$WORKSPACE/tmplog"
trap "test -f \"$T_LOG\" && /bin/rm -rf -- \"$T_LOG\" " 0 1 2 3 13 15
SRPM_DIR="SRPMS"
test -d "$SRPM_DIR" || {
echo "No'$SRPM_DIR' dir to process." >&2
exit 99
}
rm -rf "$OBS_PROJ"
echo "Going to update $OBS_PROJ from $SRPM_DIR..."
UNCHANGED_CNT=0
SUCCEED_CNT=0
SUCCEED_PKG=
FAILED_CNT=0
FAILED_PKG=
while read PKG_NAME; do
echo "=== Processing package [$PKG_NAME]"
# prepare the srpm dir
SRPM_PKG_DIR="$SRPM_DIR/$PKG_NAME"
test -d "$SRPM_PKG_DIR" || {
log_and_add_failure "$PKG_NAME" "no srpm dir"
continue
}
# Is there is a push.sh script call it and remove it right after
if [ -f "${SRPM_PKG_DIR}/push.sh" ]; then
bash "${SRPM_PKG_DIR}/push.sh" ${OSCAPI} ${GIT_DIR} ${PKG_NAME}
rm "${SRPM_PKG_DIR}/push.sh"
fi
# update from obs (create missing package on the fly)
for tries in 1 2 3; do
echo "Try: $tries"
OBS_PKG_DIR="$OBS_PROJ/$PKG_NAME"
rm -rf "$OBS_PKG_DIR"
$OSC_CHECKOUT "$OBS_PROJ" "$PKG_NAME" 2>"$T_LOG" || {
if grep 'does not exist in project' "$T_LOG" || grep '404: Not Found' "$T_LOG"; then
test -d "$OBS_PROJ" || ( mkdir "$OBS_PROJ"; cd "$OBS_PROJ"; $OSC init "$OBS_PROJ"; )
( set -e; cd "$OBS_PROJ"; $OSC mkpac "$PKG_NAME"; )
break
elif [ $tries -eq 3 ]; then
cat "$T_LOG"
log_and_add_failure "$PKG_NAME" "checkout"
continue 2
fi
continue
}
for F in "$OBS_PKG_DIR"/*; do
test -e "$F" || continue
test -s "$F" || test $tries -eq 3 || continue 2
test -s "$F" || {
log_and_add_failure "$PKG_NAME" "zero size file in checkout : $F"
continue 3
}
done
break
done
test -z "$FAKE_COMITTOBS" || {
echo "FAKE: Not comitting to OBS..."
continue
}
if copy_changed_package "$SRPM_PKG_DIR" "$OBS_PKG_DIR"; then
echo "Package has changed, updating..."
(
set -e
cd "$OBS_PKG_DIR"
$OSC addremove >/dev/null
$OSC status
if [ -z "$FAKE_COMITTOBS" ]; then
if [ -z "$OBS_TEST_PROJECT" ]; then
$OSC ci -m "Git submit $GIT_BRANCH($GIT_CURR_HEAD)"
else
$OSC linkpac -c -f $OBS_PROJ $PKG_NAME $OBS_TEST_PROJECT
$OSC co $OBS_TEST_PROJECT $PKG_NAME
cd $OBS_TEST_PROJECT/$PKG_NAME/
$OSC rm *
cd -
cp -v * $OBS_TEST_PROJECT/$PKG_NAME
cd $OBS_TEST_PROJECT/$PKG_NAME
$OSC add *
$OSC ci -m "Git submit $GIT_BRANCH($GIT_CURR_HEAD)"
cd -
fi
else
echo "FAKE: Not comitting to OBS..."
false
fi
) || {
log_and_add_failure "$PKG_NAME" "${FAKE_COMITTOBS:+fake }checkin"
continue
}
SUCCEED_CNT=$(($SUCCEED_CNT+1))
SUCCEED_PKG="$SUCCEED_PKG$(echo -ne "\n $PKG_NAME")"
else
echo "Package is unchanged."
UNCHANGED_CNT=$(($UNCHANGED_CNT+1))
fi
if [ "${KEEP_SRPMS}" == "FALSE" ]; then
rm -rf "$SRPM_PKG_DIR"
fi
rm -rf "$OBS_PKG_DIR"
done < <(srpm_package_defs)
echo "======================================================================"
echo "Unchanged packages: $UNCHANGED_CNT"
echo "Updated packages: $SUCCEED_CNT$SUCCEED_PKG"
test $FAILED_CNT != 0 && {
echo "Failed packages: $FAILED_CNT$FAILED_PKG"
}
echo "======================================================================"
exit $FAILED_CNT
07070100000012000081ED000003E9000003E9000000016907672700001AFE000000000000000000000000000000000000002E00000000uyuni-releng-tools/bin/build-packages-for-obs#! /bin/bash
# SPDX-FileCopyrightText: 2023 SUSE LLC
#
# SPDX-License-Identifier: Apache-2.0
BASE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
SHARE_DIR="/usr/share/uyuni-releng-tools/"
set -e
#
# For all packages in git:/rel-eng/packages or git:/.tito/packages (or defined in $PACKAGES)
# provide tarball, spec and changes in $WORKSPACE/SRPMS/<package>
#
# git_package_defs() has a hardcoded list of packages excluded by default.
#
WORKSPACE=${WORKSPACE:-/tmp/push-packages-to-obs}
PACKAGE="$@"
grep -v -- "\(--help\|-h\|-?\)\>" <<<"$@" || {
cat <<EOF
Usage: build-packages-for-obs.sh [PACKAGE]..
Build package for submission to OBS from the current HEAD. Without argument
all packages mentioned in .tito/packages or rel-eng/packages are processed.
Package directories will be created in \$WORKSPACE/SRPMS/<package> ($WORKSPACE).
To build tar archives instead of CPIO, set "NOCPIO" environment variable.
EOF
exit 0
}
# check cwd is in git
GIT_DIR=$(git rev-parse --show-cdup)
test -z "$GIT_DIR" || cd "$GIT_DIR"
GIT_DIR=$(pwd)
# check presence of tito
test -x "/usr/bin/tito" || {
echo "Missing '/usr/bin/tito' needed for build." >&2
exit 2
}
TITO="/usr/bin/tito"
# check for unrpm
which unrpm &> /dev/null || {
echo "unrpm not found in the PATH, do 'zypper install build'" >&2
exit 2
}
# create workspace
test -d "$WORKSPACE" || mkdir -p "$WORKSPACE"
# build the src rpms...
SRPM_DIR="$WORKSPACE/SRPMS"
rm -rf "$SRPM_DIR"
mkdir -p "$SRPM_DIR"
SRPMBUILD_DIR="$WORKSPACE/SRPMBUILD"
rm -rf "$SRPMBUILD_DIR"
mkdir -p "$SRPMBUILD_DIR"
trap "test -d \"$SRPMBUILD_DIR\" && /bin/rm -rf -- \"$SRPMBUILD_DIR\" " 0 1 2 3 13 15
# not nice but tito does not take it via CLI, via .rc
# file prevents parallel execution for different OBS
# projects.Thus we patched tito to take the builddir
# from environment:
export RPMBUILD_BASEDIR=$SRPMBUILD_DIR
function git_package_defs() {
# - "PKG_NAME PKG_VER PKG_DIR" from git:/rel-eng/packages/ or git:/.tito/packages
# - define $PACKAGE to build a specific set of packages.
# - usage:
# while read PKG_NAME PKG_VER PKG_DIR; do
# ...
# done < <(git_package_defs)
#
local PKG_DIR=`ls -d $GIT_DIR/{.tito,rel-eng}/packages 2>/dev/null`
if [ -z "$PKG_DIR" ]; then
echo "Error: Not in Uyuni or tito managed working directory."
exit 1
fi
test -n "$PACKAGE" || {
PACKAGE=$(ls "$PKG_DIR")
}
for N in $PACKAGE; do
awk -vN=$N '{printf "%s %s %s\n", N, $1, $2}' "$PKG_DIR"/$N
done
}
echo "Going to build new obs packages in $SRPM_DIR..."
T_DIR="$SRPMBUILD_DIR/.build"
T_LOG="$SRPMBUILD_DIR/.log"
SUCCEED_CNT=0
FAILED_CNT=0
FAILED_PKG=
VERBOSE=$VERBOSE
while read PKG_NAME PKG_VER PKG_DIR; do
for tries in 1 2 3; do
echo "=== Building package [$PKG_NAME-$PKG_VER] from $PKG_DIR (Try $tries)"
rm -rf "$SRPMBUILD_DIR"
mkdir -p "$SRPMBUILD_DIR"
cd "$GIT_DIR/$PKG_DIR"
$TITO build ${VERBOSE:+--debug} ${TEST:+--test} --srpm >"$T_LOG" 2>&1 || {
cat "$T_LOG"
test $tries -eq 3 || continue
FAILED_CNT=$(($FAILED_CNT+1))
FAILED_PKG="$FAILED_PKG$(echo -ne "\n $PKG_NAME-$PKG_VER")"
echo "*** FAILED Building package [$PKG_NAME-$PKG_VER]"
continue 2
}
${VERBOSE:+cat "$T_LOG"}
eval $(awk '/^Wrote:.*src.rpm/{srpm=$2}/^Wrote:.*.changes/{changes=$2}END{ printf "SRPM=\"%s\"\n",srpm; printf "CHANGES=\"%s\"\n",changes; }' "$T_LOG")
EXTRA_CHANGELOGS=0
if [ "$(head -n1 ${CHANGES}|grep '^- ')" == "" ]; then
PREVIOUS_CHANGELOGS=0
else
PREVIOUS_CHANGELOGS=1
fi
FILELIST="$(ls ${GIT_DIR}/${PKG_DIR}${PKG_NAME}.changes.* 2> /dev/null; true)"
for FILE in $FILELIST; do
if [ ${PREVIOUS_CHANGELOGS} -eq 0 -a ${EXTRA_CHANGELOGS} -eq 0 ]; then
sed -i '1i\\' ${CHANGES}
fi
EXTRA_CHANGELOGS=1
LINENUMBER=1
while IFS= read -r LINE; do
if [ "${LINE}" != "" ]; then
sed -i "${LINENUMBER}i\\${LINE}" ${CHANGES}
LINENUMBER=$((LINENUMBER+1))
fi
done < ${FILE}
done
if [ "$(head -n1 ${CHANGES}|grep '^- ')" != "" ]; then
echo "*** Untagged package, adding fake header..."
sed -i "1i Fri Jan 01 00:00:00 CEST 2038 - faketagger@suse.inet\n" ${CHANGES}
sed -i '1i -------------------------------------------------------------------' ${CHANGES}
fi
if [ -e "$SRPM" -a -e "$CHANGES" ]; then
mkdir "$T_DIR"
( set -e; cd "$T_DIR"; unrpm "$SRPM"; ) >/dev/null 2>&1
test -z "$CHANGES" || mv "$CHANGES" "$T_DIR"
else
test $tries -eq 3 || continue
FAILED_CNT=$(($FAILED_CNT+1))
FAILED_PKG="$FAILED_PKG$(echo -ne "\n $PKG_NAME-$PKG_VER")"
echo "*** FAILED Building package [$PKG_NAME-$PKG_VER] - src.rpm or changes file does not exist"
continue 2
fi
if [ -n "$NOCPIO" ]; then
# Move to destination
mv "$T_DIR" "$SRPM_DIR/$PKG_NAME"
else
# Convert to obscpio
SPEC_VER=$(sed -n -e 's/^Version:\s*\(.*\)/\1/p' ${T_DIR}/${PKG_NAME}.spec)
SOURCE=$(sed -n -e 's/^\(Source\|Source0\):\s*.*[[:space:]\/]\(.*\)/\2/p' ${T_DIR}/${PKG_NAME}.spec|sed -e "s/%{name}/${PKG_NAME}/"|sed -e "s/%{version}/${SPEC_VER}/")
SPEC_REL=$(sed -n -e 's/^Release: \+\([0-9]\).*/\1/p' ${T_DIR}/${PKG_NAME}.spec)
# If the package does not have sources, we don't need to repackage them
if [ "${SOURCE}" != "" ]; then
FOLDER=$(tar -tf ${T_DIR}/${SOURCE}|head -1|sed -e 's/\///')
(cd ${T_DIR}; tar -xf ${SOURCE}; rm ${SOURCE}; mv ${FOLDER} ${PKG_NAME}; find ${PKG_NAME} | cpio --create --format=newc --reproducible > ${FOLDER}.obscpio; rm -rf ${PKG_NAME})
fi
# Move to destination
mv "$T_DIR" "$SRPM_DIR/$PKG_NAME"
# If the package does not have sources, we don't need service or .obsinfo file
if [ "${SOURCE}" != "" ]; then
# Copy service
if [ -e "${BASE_DIR}/../_service" ]; then
cp ${BASE_DIR}/../_service "${SRPM_DIR}/${PKG_NAME}"
else
cp ${SHARE_DIR}/_service "${SRPM_DIR}/${PKG_NAME}"
fi
# Create .obsinfo file
cat > "${SRPM_DIR}/${PKG_NAME}/${PKG_NAME}.obsinfo" <<EOF
name: ${PKG_NAME}
version: $(echo ${FOLDER}|sed -e "s/${PKG_NAME}-//")
mtime: $(date +%s)
commit: $(git rev-parse --verify HEAD)
EOF
fi
fi
# Release is handled by the Buildservice
# With untagged changes we can only build using --test with tito build.
# tito build with --test appends the git hash to the release version and we do not want this.
# Remove everything preventing us from submitting
sed -i "s/^Release.*$/Release: ${SPEC_REL}/i" ${SRPM_DIR}/${PKG_NAME}/${PKG_NAME}.spec
SUCCEED_CNT=$(($SUCCEED_CNT+1))
break
done
done < <(git_package_defs)
echo "======================================================================"
echo "Built obs packages: $SUCCEED_CNT"
test $FAILED_CNT != 0 && {
echo "Failed obs packages: $FAILED_CNT$FAILED_PKG"
}
echo "======================================================================"
exit $FAILED_CNT
07070100000013000081ED000003E9000003E90000000169076727000008B1000000000000000000000000000000000000002A00000000uyuni-releng-tools/bin/create-gitea-repos#! /bin/bash
# SPDX-FileCopyrightText: 2025 SUSE LLC and contributors
#
# SPDX-License-Identifier: Apache-2.0
set -e
OTOKEN=${TOKEN}
GIT_ORG=${GIT_ORG:-Galaxy}
GIT_SRV=${GIT_SRV:-src.suse.de}
GIT_REPOS=$@
GIT_BRANCH=${GIT_BRANCH:-mlm-5.2}
GIT_USR="gitea"
function git_create() {
local REPO="$1"
curl --fail-with-body -X POST -H "Authorization: token $OTOKEN" \
-H 'content-type: application/json' \
--data "{\"name\":\"${REPO//+/_}\", \"object_format_name\":\"sha256\", \"default_branch\":\"${GIT_BRANCH}\"}" \
"https://$GIT_SRV/api/v1/orgs/$GIT_ORG/repos" || return 1
#curl -X POST -H "Authorization: token $OTOKEN" \
# -H 'content-type: application/json' \
# --data "{\"name\":\"${PKG_NAME//+/_}\", \"object_format_name\":\"sha256\"}}" \
# "https://$GIT_SRV/api/v1/user/repos"
return 0
}
function git_clone() {
local REPO="$1"
git clone $GIT_USR@$GIT_SRV:$GIT_ORG/$REPO || return 1
return 0
}
function git_initialize() {
local REPO="$1"
pushd $REPO
/usr/bin/obs-git-init . || { popd; return 2; }
git commit -m initialize || { popd; return 1; }
git push origin HEAD:$GIT_BRANCH || { popd; return 1; }
popd
return 0
}
function usage() {
cat <<EOF
Usage: create-gitea-repos REPONAME [REPONAME...]
Create one or multiple git repos in gitea with the given names provided as
arguments.
You have to specify a "TOKEN" via environment variable to access the gitea API.
Optionally you can provide the following environment valiables:
GIT_ORG: The git organization (Default: Galaxy)
GIT_SRV: The git server (Default: src.suse.de)
GIT_BRANCH: The git default branch which should be initialized (Default: mlm-5.2)
EOF
exit 1
}
grep -v -- "\(--help\|-h\|-?\)\>" <<<"$@" || usage
if [ -z "${GIT_REPOS}" ]; then
usage
fi
if [ ! -x /usr/bin/obs-git-init ]; then
echo "Please install 'obs-git-init'. Aborting" >&2
exit 1
fi
for RNAME in ${GIT_REPOS}; do
if [ -d $RNAME ]; then
echo "Directory $RNAME already exists. Skipping..."
continue
fi
git_create $RNAME
NEW_CREATED=$?
git_clone $RNAME
if [ $NEW_CREATED -eq 0 ]; then
git_initialize $RNAME
else
echo "Git Repo $RNAME is already initialized"
fi
done
07070100000014000081ED000003E9000003E9000000016907672700001850000000000000000000000000000000000000002A00000000uyuni-releng-tools/bin/push-images-to-git#! /bin/bash
# SPDX-FileCopyrightText: 2025 SUSE LLC and contributors
#
# SPDX-License-Identifier: Apache-2.0
set -e
#
# For all images prepared by build-packages-for-obs.sh in
# $WORKSPACE/SRPMS/<package> prepare and submit changed images
# to one GIT repository.
#
# To exec push.sh you may need OSC access with credentials
# Use $OSCRC ot pass an osc configfile containing required credentials
# (otherwise ~/.config/oscrc)
#
# srpm_package_defs() has a hardcoded list of packages excluded by default.
#
WORKSPACE=${WORKSPACE:-/tmp/push-packages-to-obs}
PACKAGE="$@"
GIT_ORG=${GIT_ORG:-galaxy}
GIT_PRODUCT_REPO=${GIT_PRODUCT_REPO:-MLM-products}
GIT_SRV=${GIT_SRV:-src.suse.de}
GIT_USR=${GIT_USR:-gitea}
NO_PUSH=${NO_PUSH:+1}
# Set KEEP_SRPMS environment variable to TRUE if you want to keep your SRPMS
# Useful if, for example, you are resubmitting the same set to several
# projects in row
KEEP_SRPMS=${KEEP_SRPMS:-FALSE}
# BRANCH in upstream git and in internal gitea should be the same in the standard case
GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
BRANCH=${BRANCH:-$GIT_BRANCH}
GIT_CURR_HEAD=$(git rev-parse --short HEAD)
## used for exec push.sh
OSCAPI=${OSCAPI:-https://api.suse.de}
GIT_DIR=$(git rev-parse --show-cdup)
test -z "$GIT_DIR" || cd "$GIT_DIR"
GIT_DIR=$(pwd)
##
grep -v -- "\(--help\|-h\|-?\)\>" <<<"$@" || {
cat <<EOF
Usage: push-images-to-obs.sh [IMAGE]..
Submit changed images from \$WORKSPACE/SRPMS/<image> ($WORKSPACE)
to GIT ($GIT_ORG). Without argument all images in SRPMS are processed.
This script add all images to 1 git repo in a sub directory.
Optionally you can provide the following environment valiables:
GIT_ORG: The git organization (Default: galaxy)
GIT_SRV: The git server (Default: src.suse.de)
GIT_PRODUCT_REPO: The git repository name (Default: MLM-products)
BRANCH: The git default branch where to submit to (Default: the current branch you are in)
NO_PUSH: Specify when you do not want to push but check what commits were created
EOF
exit 0
}
function exists() {
[ -n "$1" -a -e "$1" ]
}
function srpm_package_defs() {
# - "PKG_NAME" from $SRPM_DIR, using a hardcoded blacklist
# of packages we do not submitt.
# - define $PACKAGE to build a specific set of packages.
# - usage:
# while read PKG_NAME; do
# ...
# done < <(srpm_package_defs)
#
PACKAGE=$(find "$SRPM_DIR" -mindepth 1 -maxdepth 1 -type d -printf "%P\n")
for N in $PACKAGE; do
test -d "$SRPM_DIR/$N" || {
echo "No package dir '$SRPM_DIR/$N'" >&2
exit 99
}
test -e $SRPM_DIR/$N/Dockerfile && { echo "$N"; continue; }
test -e $SRPM_DIR/$N/Chart.yaml && { echo "$N"; continue; }
exists $SRPM_DIR/$N/*.kiwi && { echo "$N"; continue; }
echo "$N is not an image. Skipping..." >&2
done
}
# Here we have every file (incl. .changes) in git, thus inside the tarball.
# The tarballs rootdirs may differ, as they contain the revision number.
# The specfile also contains the revision number. So do a quick check
# for different .changes, then 'tardiff -p1'
function copy_changed_package()
{
local sdir="$1"
test -d "$sdir" || { echo "No source dir '$sdir'" >&2; return 2; }
local tdir="$2"
test -d "$tdir" || mkdir "$tdir"
rm -rf "$tdir"/*
if [ ! -d "$tdir" ]; then
mkdir "$tdir"
fi
for F in "$sdir"/*; do
cp $F $tdir
done
pushd $tdir
diffs=$(git status --short | wc -l)
test $diffs -gt 0 && {
popd
return 0
} || {
git reset --hard
popd
return 1
}
}
function git_checkout_or_create() {
pushd $GIT_ORG
git clone $GIT_USR@$GIT_SRV:$GIT_ORG/$GIT_PRODUCT_REPO || { popd; exit 1; } #git_create
pushd $GIT_PRODUCT_REPO
git checkout $BRANCH || git checkout -b $BRANCH || { popd; popd; exit 1; }
popd
popd
}
function log_and_add_failure() {
test $# -ge 1 || { echo "log_and_add_failure: Wrong args $#: $@" >&2; return 1; }
local pkg_name="$1"
local opt_msg="$2"
FAILED_CNT=$(($FAILED_CNT+1))
FAILED_IMG="$FAILED_IMG$(echo -ne "\n $pkg_name${opt_msg:+ ($opt_msg)}")"
echo "*** FAILED${opt_msg:+ ($opt_msg)} [$pkg_name]"
}
# go..
cd "$WORKSPACE"
T_LOG="$WORKSPACE/tmplog"
trap "test -f \"$T_LOG\" && /bin/rm -rf -- \"$T_LOG\" " 0 1 2 3 13 15
SRPM_DIR="SRPMS"
test -d "$SRPM_DIR" || {
echo "No'$SRPM_DIR' dir to process." >&2
exit 99
}
rm -rf "$GIT_ORG"
mkdir $GIT_ORG
echo "Going to update $GIT_ORG from $SRPM_DIR..."
UNCHANGED_CNT=0
SUCCEED_CNT=0
SUCCEED_IMG=
FAILED_CNT=0
FAILED_IMG=
git_checkout_or_create
while read PKG_NAME; do
echo "=== Processing image [$PKG_NAME]"
# prepare the srpm dir
SRPM_PKG_DIR="$SRPM_DIR/$PKG_NAME"
test -d "$SRPM_PKG_DIR" || {
log_and_add_failure "$PKG_NAME" "no srpm dir"
continue
}
# If there is a push.sh script call it and remove it right after
if [ -f "${SRPM_PKG_DIR}/push.sh" ]; then
bash "${SRPM_PKG_DIR}/push.sh" ${OSCAPI} ${GIT_DIR} ${PKG_NAME}
rm "${SRPM_PKG_DIR}/push.sh"
fi
GIT_IMG_DIR="$GIT_ORG/$GIT_PRODUCT_REPO/${PKG_NAME}"
if copy_changed_package "$SRPM_PKG_DIR" "$GIT_IMG_DIR"; then
echo "Package has changed, updating..."
(
set -e
cd "$GIT_ORG/$GIT_PRODUCT_REPO"
git add -A . # $OSC addremove >/dev/null
git status # $OSC status
git commit -m "Git submit ${PKG_NAME} $GIT_BRANCH($GIT_CURR_HEAD)" # $OSC ci -m "Git submit $GIT_BRANCH($GIT_CURR_HEAD)"
) || {
log_and_add_failure "$PKG_NAME" "${NO_PUSH:+fake }checkin"
continue
}
SUCCEED_CNT=$(($SUCCEED_CNT+1))
SUCCEED_IMG="$SUCCEED_IMG$(echo -ne "\n $PKG_NAME")"
else
echo "Image is unchanged."
UNCHANGED_CNT=$(($UNCHANGED_CNT+1))
fi
if [ "${KEEP_SRPMS}" == "FALSE" ]; then
rm -rf "$SRPM_PKG_DIR"
fi
done < <(srpm_package_defs)
if [ -z "$NO_PUSH" ]; then
git push origin HEAD
else
echo "FAKE: Not pushing to GIT..."
fi
echo "======================================================================"
echo "Unchanged images: $UNCHANGED_CNT"
echo "Updated images: $SUCCEED_CNT$SUCCEED_IMG"
test $FAILED_CNT != 0 && {
echo "Failed images: $FAILED_CNT$FAILED_IMG"
}
echo "======================================================================"
exit $FAILED_CNT
07070100000015000081A4000003E9000003E9000000016907672700000155000000000000000000000000000000000000001C00000000uyuni-releng-tools/_service<services>
<service name="extract_file" mode="disabled">
<param name="archive">*.obscpio</param>
<param name="files">*</param>
</service>
<service name="tar" mode="buildtime"/>
<service name="recompress" mode="buildtime">
<param name="file">*.tar</param>
<param name="compression">gz</param>
</service>
</services>
07070100000016000041ED000003E9000003E9000000036907672700000000000000000000000000000000000000000000001900000000uyuni-releng-tools/.tito07070100000017000081A4000003E9000003E90000000169076727000000A6000000000000000000000000000000000000002400000000uyuni-releng-tools/.tito/tito.props[buildconfig]
builder = tito.builder.Builder
tagger = tito.tagger.SUSETagger
changelog_with_email = 0
changelog_do_not_remove_cherrypick = 0
no_default_changelog = 1
07070100000018000041ED000003E9000003E9000000026907672700000000000000000000000000000000000000000000002200000000uyuni-releng-tools/.tito/packages07070100000019000081A4000003E9000003E900000001690767270000000B000000000000000000000000000000000000003500000000uyuni-releng-tools/.tito/packages/uyuni-releng-tools0.0.6-0 ./
0707010000001A000081A4000003E9000003E9000000016907672700000798000000000000000000000000000000000000001D00000000uyuni-releng-tools/README.md<!--
SPDX-FileCopyrightText: 2025 SUSE LLC
SPDX-License-Identifier: Apache-2.0
-->
[](https://api.reuse.software/info/git.fsfe.org/reuse/api)
These are tools used to help Uyuni release engineers package and submit the various projects.
These used to be in the `uyuni` repository and have been extracted to be used for other repositories.
# Dependencies
* `tito` from [systemsmanagement:Uyuni:Utils](https://build.opensuse.org/project/show/systemsmanagement:Uyuni:Utils)
# Existing tools
## mkchlog
This tool creates a changelog entry that can be later on tagged with tito.
~~~
Usage: mkchlog [OPTIONS] [MESSAGE]
When called from a subdirectory of any Uyuni package, create a changelog file in
the following format:
<package_name>.changes.<username>.<feature_name>
If not explicitly specified, fetch username and feature_name from git email's
username part and the current branch name.
With no MESSAGE, open a text editor for manual input.
The default editor can be specified by setting the EDITOR environment variable.
-f, --feature set the feature name to use as a filename part
-u, --username set the username to use as a filename part
-r, --remove remove existing changelog file
-c, --commit do a git commit with MESSAGE as the commit message
-n, --no-wrap do not wrap automatically the message at 67 characters
-h, --help display this help and exit
~~~
## build-packages-for-obs and push-packages-to-obs
The script `build-packages-for-obs` is used together with `push-packages-to-obs` for building a source from git and pushing it to a project on the Open Build Service and build it there.
A comprehensive how-to is available at the following wiki page [Building-an-RPM-in-an-OBS-branch-package](https://github.com/uyuni-project/uyuni/wiki/Building-an-RPM-in-an-OBS-branch-package)
0707010000001B000081A4000003E9000003E9000000016907672700000022000000000000000000000000000000000000004400000000uyuni-releng-tools/uyuni-releng-tools.changes.mcalmer.submit-to-git- Add push-packages-to-git script
0707010000001C000081A4000003E9000003E90000000169076727000005F4000000000000000000000000000000000000002E00000000uyuni-releng-tools/uyuni-releng-tools.changes-------------------------------------------------------------------
Wed Mar 05 20:17:19 CET 2025 - marina.latini@suse.com
- version 0.0.6-0
* push-packages-to-obs: add no-dereference option while diffing
-------------------------------------------------------------------
Mon Jun 03 13:51:48 CEST 2024 - marina.latini@suse.com
- version 0.0.5-0
* Specify the oscrc file using --config instead of -c
* Add '-c|--commit' option to mkchlog for convenience
-------------------------------------------------------------------
Tue Apr 09 16:07:58 CEST 2024 - marina.latini@suse.com
- version 0.0.4-0
* Do not hardcode a fixed release value but align it with the
value used while tagging
-------------------------------------------------------------------
Mon Apr 08 14:21:12 CEST 2024 - marina.latini@suse.com
- version 0.0.3-0
* Ensure that the Release version is set to 0 and not to 1
-------------------------------------------------------------------
Tue Mar 19 18:01:15 CET 2024 - marina.latini@suse.com
- version 0.0.2-0
* Use product version in Dockerfile and Charts.yaml
* Remove the container-related hacks in push and build scripts
* Handle pushes of packages with multiple archives
* Fix the path when pushing containers and helm charts to OBS
* Remove unneeded replaces from push-packages-to-obs
-------------------------------------------------------------------
Mon Nov 27 10:50:47 UTC 2023 - Cédric Bosdonnat <cbosdonnat@suse.com>
- Initial packaging of uyuni-releng-tools 0.0.1
07070100000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000B00000000TRAILER!!!