Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package linuxrc-devtools for
openSUSE:Factory checked in at 2021-04-15 16:57:39
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/linuxrc-devtools (Old)
and /work/SRC/openSUSE:Factory/.linuxrc-devtools.new.12324 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "linuxrc-devtools"
Thu Apr 15 16:57:39 2021 rev:14 rq:885391 version:1.0
Changes:
--------
--- /work/SRC/openSUSE:Factory/linuxrc-devtools/linuxrc-devtools.changes
2021-04-08 21:32:53.583855040 +0200
+++
/work/SRC/openSUSE:Factory/.linuxrc-devtools.new.12324/linuxrc-devtools.changes
2021-04-15 16:58:21.430763528 +0200
@@ -1,0 +2,20 @@
+Wed Apr 14 14:26:15 UTC 2021 - [email protected]
+
+- merge gh#openSUSE/linuxrc-devtools#30
+- improved git2log parser
+- fix handling of %setup macro
+- rewrite tobs script to not rely on config file but to use command
+ line options instead
+- update build_it jenkins wrapper script
+- update submit_it jenkins wrapper script
+- update README and move to asciidoc
+- 1.0
+
+--------------------------------------------------------------------
+Mon Apr 12 09:51:32 UTC 2021 - [email protected]
+
+- merge gh#openSUSE/linuxrc-devtools#29
+- fix handling of %setup macro
+- 0.21
+
+--------------------------------------------------------------------
Old:
----
linuxrc-devtools-0.20.tar.xz
New:
----
linuxrc-devtools-1.0.tar.xz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ linuxrc-devtools.spec ++++++
--- /var/tmp/diff_new_pack.dSj7ez/_old 2021-04-15 16:58:21.854764199 +0200
+++ /var/tmp/diff_new_pack.dSj7ez/_new 2021-04-15 16:58:21.858764205 +0200
@@ -17,7 +17,7 @@
Name: linuxrc-devtools
-Version: 0.20
+Version: 1.0
Release: 0
Source: %{name}-%{version}.tar.xz
++++++ linuxrc-devtools-0.20.tar.xz -> linuxrc-devtools-1.0.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/linuxrc-devtools-0.20/README.adoc
new/linuxrc-devtools-1.0/README.adoc
--- old/linuxrc-devtools-0.20/README.adoc 1970-01-01 01:00:00.000000000
+0100
+++ new/linuxrc-devtools-1.0/README.adoc 2021-04-14 16:26:15.000000000
+0200
@@ -0,0 +1,183 @@
+# Linuxrc development tools
+
+This is a collection of scripts used to connect http://github.com[Github]
+via http://jenkins-ci.org[Jenkins] to the https://build.opensuse.org[Open
Build Service].
+
+For these to work the git project must fulfill some requirements:
+
+* there must be a `clean` or `distclean` make target that really cleans up
+ everything
+* there must be an `archive` target that creates a source tar file (details see
+ below)
+
+## Tools
+
+### git2log
+
+Generate a changelog file based on git commit messages.
+
+If your commit message is split into a single line short comment and a
+detailed description separated by an empty line, just the short comment is
+used. Alternatively, precede each commit line with a dash '-' to get
+multiple changelog entries.
+
+Expects numerical tags matching version number, like 1.2.3. For branches !=
+master, tags should be `<branch>-<version>`.
+
+You can create test branches from any main branch (e.g. for pull requests,
+with `git co -b`). _git2log_ recognizes those branches and treats them as
+continuation of the main branch.
+
+### tobs
+
+Sample usage (submit current git state to `foo:bar:devel` devel project in
+open build service:
+
+```
+tobs --target obs://foo:bar:devel
+```
+
+You can append a package name to the target spec, like:
+
+```
+tobs --target obs://foo:bar:devel/zap
+```
+
+This is useful if the git repository name and the package name differ.
+
+There must be a make target `archive` that has created:
+
+* a `VERSION` file
+* a `changelog` file
+* a source archive `package/<name>-<version>.tar.xz`
+* optionally other source files (that will be mentioned in `+*.spec+`) below
`package/`
+
+Ideally, repeated make runs should produce exactly the same archive file as
+long as the git repo stays unchanged.
+
+The script gets the current build service package, updates it with the new
+sources, adjust the `+*.spec+` file to remove any old patches, updates the
+`+*.changes+` file and commits the new package back to the build service (to
the
+same project). It will auto-add comments about removed patches and
+removed/added source files.
+
+If it does not yet exist it creates a new version number tag in the git
+repo.
+
+Note that you need a `$HOME/.oscrc` file with sufficient authentication info
+to access the build service and to write to the git repo (to push the tag).
+
+There is a `--try` option that does everything except actually submitting
+the changes to the build service or setting the new tag. Use together with
+`--save-temp` to debug things.
+
+#### tobs --sr
+
+Sample usage (wait for the package to build sucessfully in `foo:bar:devel`,
+then submit to `openSUSE:Factory`):
+
+```
+tobs --target obs://foo:bar:devel --sr obs://openSUSE:Factory --wait-for-ok
+```
+
+If you use the `--sr` option _tobs_ will create a build service submit request.
+With `--wait-for-ok` it optionally waits until the package has been built
+successfully in the development project.
+
+#### $HOME/.tobsrc
+
+_tobs_ uses a config file with basic data about the open build service. It
+can also have a list of aliases for bvuild service projects.
+
+It uses ini-file syntax.
+
+Sample file:
+
+```
+[obs]
+api=api.opensuse.org
+
+[xbs]
+api=api.example.org
+prefix[obs]=openSUSE.org
+
+[aliases]
+factory=obs://openSUSE:Factory
+devel-factory=obs://foo:bar:devel
+```
+
+This means
+
+- `obs` refers to api.opensuse.org
+- `xbs` refers to api.example.org
+- `obs` can be accessed via `xbs` by using an `openSUSE.org` prefix to project
names
+- `factory` and `devel-factory` can be used as aliases in _tobs_ to specify
projects; this means
++
+--
+```
+tobs --target devel-factory --sr factory
+```
+would be equivalent to
+```
+tobs --target obs://foo:bar:devel --sr obs://openSUSE:Factory
+```
+--
+
+### build_it
+
+Wrapper script for _tobs_ to be run by Jenkins.
+
+For example
+
+```
+build_it --target obs://foo:bar:devel --branch main
+```
+
+checks out branch `main`, runs `make archive`, and then `tobs` to submit the
package.
+
+
+### submit_it
+
+Wrapper script for `tobs --sr` to be run by Jenkins.
+
+For example
+
+```
+submit_it --target obs://foo:bar:devel/zap --sr obs://openSUSE:Factory
+```
+
+Waits for package `zap` to be built at `foo:bar:devel` and then submits to
`openSUSE:Factory`.
+
+## openSUSE development
+
+### Workflow
+
+At a first glance, Linuxrc (and related projects) follows the same approach as
other YaST projects:
+changes are tracked on Github and Jenkins CI will take care of submitting them
to OBS. However,
+tools used by these projects are different from the ones used for YaST.
+
+Those tools are available in
http://github.com/openSUSE/linuxrc-devtools[linuxrc-devtools].
+Next we'll introduce them (and how are they related to Jenkins) but it's
recommended to check the
+https://github.com/openSUSE/linuxrc-devtools/blob/master/README.adoc[documentation]
+in the repository.
+
+When Jenkins detect changes on, for example,
+http://github.com/openSUSE/linuxrc[linuxrc] Git repository, it will build the
+project using the
+https://github.com/openSUSE/linuxrc-devtools/blob/master/build_it[build_it]
script.
+This script is just a wrapper that, after building the `make archive` target,
+will invoke
+https://github.com/openSUSE/linuxrc-devtools/blob/master/tobs[tobs] which
+will take care of submitting the new version to the development project on OBS.
+
+If the previous step ran successfully, then a submit request to the final
+project will be created through the
+https://github.com/openSUSE/linuxrc-devtools/blob/master/submit_it[submit_it]
script,
+which is just another wrapper script that will rely on `tobs`.
+
+### linuxrc-devtools
+
+The package is automatically submitted from the `master` branch to
+https://build.opensuse.org/package/show/system:install:head/linuxrc-devtools[system:install:head]
+OBS project. From that place it is forwarded to
+https://build.opensuse.org/project/show/openSUSE:Factory[openSUSE Factory].
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/linuxrc-devtools-0.20/README.md
new/linuxrc-devtools-1.0/README.md
--- old/linuxrc-devtools-0.20/README.md 2021-04-08 13:25:31.000000000 +0200
+++ new/linuxrc-devtools-1.0/README.md 1970-01-01 01:00:00.000000000 +0100
@@ -1,192 +0,0 @@
-# Linuxrc development tools
-
-This is a collection of scripts used to connect [Github](http://github.com/)
-via [Jenkins](http://jenkins-ci.org/) to the [Open Build
-Service](https://build.opensuse.org/).
-
-For these to work the git project must fulfill some requirements:
-
-* there must be a `clean` or `distclean` make target that really cleans up
- everything
-* there must be an `archive` target that creates a source tar file (details see
- below)
-
-## Tools
-
-### git2log
-
-Generate a changelog file based on git commit messages.
-
-If your commit message is split into a single line short comment and a
-detailed description separated by an empty line, just the short comment is
-used. Alternatively, precede each commit line with a dash '-' to get
-multiple changelog entries.
-
-Expects numerical tags matching version number, like 1.2.3. For branches !=
-master, tags should be `<branch>-<version>`.
-
-You can create test branches from any main branch (e.g. for pull requests,
-with `git co -b`). _git2log_ recognizes those branches and treats them as
-continuation of the main branch.
-
-From _git2log's_ perspective a test branch is just a branch without tags in
-it. But it should also have a name starting with either 'test' or 'bnc' as
-_tobs_ expects this.
-
-### tobs
-
-Commit current git state to build service.
-
-There must be a make target `archive` that **has created**:
-
-* a `VERSION` file
-* a `changelog` file
-* a source archive `package/<name>-<version>.tar.xz`
-* optionally other source files (that will be mentioned in `*.spec`) below
`package/`
-
-Ideally, repeated make runs should produce exactly the same archive file as
-long as the git repo stays unchanged.
-
-The script gets the current build service package, updates it with the new
-sources, adjust the `*.spec` file to remove any old patches, updates the
-`*.changes` file and commits the new package back to the build service (to the
-same project). It will auto-add comments about removed patches and
-removed/added source files.
-
-If it does not yet exist it creates a new version number tag in the git
-repo.
-
-Note that you need a `$HOME/.oscrc` file with sufficient authentication info
-to access the build service and to write to the git repo (to push the tag).
-
-There is a `--try` option that does everything except actually submitting
-the changes to the build service or setting the new tag. Use together with
-`--save-temp` to debug things.
-
-If you are on a branch with a name starting with either 'test' or 'bnc',
-_tobs_ handles this as a test build. That is, the package is submitted to a
-special test project (see 'test' entry in config file) and no submit
-requests are created.
-
-#### tobs --sr
-
-If you use the `--sr` option it will create a build service submit request.
-With `--wait-for-ok` it optionally waits until the package has been built
-successfully in the originating project.
-
-#### $HOME/.tobsrc
-
-_tobs_ uses a config file to relate build service projects to git repos.
-
-Note: section names are arbitrary and used only for logging. You can have
-multiple sections with the same name. If several sections match (based on
-package and branch names) the first match is used. So put more general
-sections last.
-
-Examples:
-
- [factory]
- branch=master
- prj=system:install:head
- test=home:xxx:factory
- sr=openSUSE:Factory
- bs=api.opensuse.org
-
-If you are on branch master, look up a package with the same name as the
-git project in the system:install:head build service project ('devel
-project'). When creating a submit request, submit to openSUSE:Factory. Use
-the opensuse.org build service.
-
-Test builds are done in home:xxx:factory.
-
- [factory]
- package=perl-Bootloader
- gitname=perl-bootloader
- branch=master
- prj=Base:System
- sr=openSUSE:Factory
- bs=api.opensuse.org
-
-Similar as above but git project name and build service package name
-differ. Note that `make archive` must produce a name matching the build
-service package, not the git repo name.
-
- [factory]
- package=installation-images
- branch=master
- prj=system:install:head
- sr=openSUSE:Factory/installation-images-openSUSE
- bs=api.opensuse.org
-
-Similar to first example but build service package names differ in devel
-project and target project (e.g. you have several `*.spec` files).
-
-If the submit request should go to a different buildservice than the one
-where the project was built, use the 'bs_sr' entry to specify the build
-service for the sr and the prefix to access one bs from the other.
-
-For example:
-
- [sle12]
- branch=master
- prj=system:install:head
- test=home:xxx:factory
- sr=SUSE:SLE-12:Update
- bs=api.opensuse.org
- bs_sr=api.foo.bar,openSUSE.org:
-
-Sources are built in system:install:head on api.opensuse.org but the result
-is submitted from openSUSE.org:system:install:head to SUSE:SLE-12:Update on
-api.foo.bar.
-
-### build_it
-
- Wrapper script for _tobs_ to be run by Jenkins.
-
- `tobs <branch>` checks out <branch>, runs `make archive`, and then `tobs`.
-
-
-### submit_it
-
- Wrapper script for `tobs --sr` to be run by Jenkins.
-
- This assumes the Jenkins job name to be `<foo>-sr` and a previously
- finished Jenkins job `<foo>`. It changes to the `<foo>` workspace and runs
- `tobs --wait-for-ok --sr`.
-
-## openSUSE development
-
-### Workflow
-
-At a first glance, Linuxrc (and related projects) follows the same approach as
other YaST projects:
-changes are tracked on Github and Jenkins CI will take care of submitting them
to OBS. However,
-tools used by these projects are different from the ones used for YaST.
-
-Those tools are available in
[linuxrc-devtools](http://github.com/openSUSE/linuxrc-devtools).
-Next we'll introduce them (and how are they related to Jenkins) but it's
recommended to check the
-[documentation](https://github.com/openSUSE/linuxrc-devtools/blob/master/README.md)
-in the repository.
-
-When Jenkins detect changes on, for example,
-[Linuxrc](http://github.com/openSUSE/linuxrc) Git repository, it will build the
-project using [build_it
-script](https://github.com/openSUSE/linuxrc-devtools/blob/master/build_it).
-This script is just a wrapper that, after building the `make archive` target,
-will invoke
-[tobs](https://github.com/openSUSE/linuxrc-devtools/blob/master/tobs) which
-will take care of submitting the new version to the development project on OBS.
-Branches, projects, etc. to submit to are defined in `tobs` configuration. For
-example, for _Factory_, `master` branch will be submitted to
`system:install:head/linuxrc`.
-
-If the previous step ran successfully, then a submit request to the final
-project will be created through the [submit_it
-script](https://github.com/openSUSE/linuxrc-devtools/blob/master/submit_it),
-which is just another wrapper script that will rely on `tobs`. For example, for
-_Factory_, the project will be submitted to `openSUSE:Factory/linuxrc`.
-
-### linuxrc-devtools
-
-The package is automatically submitted from the `master` branch to
-[system:install:head](https://build.opensuse.org/package/show/system:install:head/linuxrc-devtools)
-OBS project. From that place it is forwarded to
-[openSUSE Factory](https://build.opensuse.org/project/show/openSUSE:Factory).
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/linuxrc-devtools-0.20/VERSION
new/linuxrc-devtools-1.0/VERSION
--- old/linuxrc-devtools-0.20/VERSION 2021-04-08 13:25:31.000000000 +0200
+++ new/linuxrc-devtools-1.0/VERSION 2021-04-14 16:26:15.000000000 +0200
@@ -1 +1 @@
-0.20
+1.0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/linuxrc-devtools-0.20/build_it
new/linuxrc-devtools-1.0/build_it
--- old/linuxrc-devtools-0.20/build_it 2021-04-08 13:25:31.000000000 +0200
+++ new/linuxrc-devtools-1.0/build_it 2021-04-14 16:26:15.000000000 +0200
@@ -5,8 +5,8 @@
branch=master
while true ; do
- if [ "$1" = "--dist" -o "$1" = "--target" ] ; then
- dist="--target $2"
+ if [ "$1" = "--target" ] ; then
+ target="--target $2"
shift
shift
continue
@@ -43,10 +43,6 @@
break
done
-if [ -n "$1" ] ; then
- branch=$1
-fi
-
git status
git checkout $branch
git pull
@@ -67,7 +63,7 @@
$prepare
fi
-tobs $spec_opt $obs_opt $dist
+tobs $target $spec_opt $obs_opt
if [ -z "$prepare" ] ; then
make $clean_target
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/linuxrc-devtools-0.20/changelog
new/linuxrc-devtools-1.0/changelog
--- old/linuxrc-devtools-0.20/changelog 2021-04-08 13:25:31.000000000 +0200
+++ new/linuxrc-devtools-1.0/changelog 2021-04-14 16:26:15.000000000 +0200
@@ -1,3 +1,17 @@
+2021-04-14: 1.0
+ - merge gh#openSUSE/linuxrc-devtools#30
+ - improved git2log parser
+ - fix handling of %setup macro
+ - rewrite tobs script to not rely on config file but to use command
+ line options instead
+ - update build_it jenkins wrapper script
+ - update submit_it jenkins wrapper script
+ - update README and move to asciidoc
+
+2021-04-12: 0.21
+ - merge gh#openSUSE/linuxrc-devtools#29
+ - fix handling of %setup macro
+
2021-04-08: 0.20
- merge gh#openSUSE/linuxrc-devtools#27
- rebuild changelog file if needed
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/linuxrc-devtools-0.20/submit_it
new/linuxrc-devtools-1.0/submit_it
--- old/linuxrc-devtools-0.20/submit_it 2021-04-08 13:25:31.000000000 +0200
+++ new/linuxrc-devtools-1.0/submit_it 2021-04-14 16:26:15.000000000 +0200
@@ -5,15 +5,15 @@
wait_opt=--wait-for-ok
while true; do
- if [ "$1" = "--dist" -o "$1" = "--target" ] ; then
- dist="--target $2"
+ if [ "$1" = "--target" ] ; then
+ target="--target $2"
shift
shift
continue
fi
- if [ "$1" = "--package" ] ; then
- package="--package $2"
+ if [ "$1" = "--sr" ] ; then
+ sr="--sr $2"
shift
shift
continue
@@ -28,16 +28,4 @@
break
done
-# we need neither git directory nor JOB_NAME if package has been specified
-if [ -z "$package" ] ; then
- job_name=${JOB_NAME%-sr}
-
- if [ -z "$job_name" -o "$job_name" = "$JOB_NAME" ] ; then
- echo "$JOB_NAME: unexpected job"
- exit 1
- fi
-
- cd "../$job_name"
-fi
-
-tobs $wait_opt --sr $dist $package
+tobs $wait_opt $target $sr
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/linuxrc-devtools-0.20/tobs
new/linuxrc-devtools-1.0/tobs
--- old/linuxrc-devtools-0.20/tobs 2021-04-08 13:25:31.000000000 +0200
+++ new/linuxrc-devtools-1.0/tobs 2021-04-14 16:26:15.000000000 +0200
@@ -130,8 +130,9 @@
sub usage;
sub get_rc;
-sub get_gitdata;
-sub get_dist;
+sub get_git_branch_and_tags;
+sub get_git_package;
+sub get_target;
sub update_spec;
sub update_changelog;
sub update_tag;
@@ -145,21 +146,17 @@
my $opt_wait;
my $opt_save_temp;
my $opt_try;
-my $opt_test;
my $opt_delay = 30;
my $opt_target;
-my $opt_package;
my $opt_spec;
my $opt_obs;
GetOptions(
- 'sr' => \$opt_sr,
+ 'sr=s' => \$opt_sr,
'wait-for-ok' => \$opt_wait,
'delay=i' => \$opt_delay,
'try' => \$opt_try,
- 'test' => \$opt_test,
'target=s' => \$opt_target,
- 'package=s' => \$opt_package,
'spec=s' => \$opt_spec,
'obs=s' => \$opt_obs,
'save-temp' => \$opt_save_temp,
@@ -170,31 +167,22 @@
my $tmp = Tmp::new($opt_save_temp);
my $tmpdir = $tmp->dir('package');
-my $tmpdir2 = $tmp->dir('testpackage');
$ENV{PATH} = "$ENV{HOME}/bin:/usr/bin:/bin:/usr/sbin:/sbin";
get_rc;
-
-if($opt_package) {
- $config->{package} = $opt_package;
-}
-else {
- get_gitdata;
-}
-
-usage 1 unless $config->{package};
-
-get_dist;
+get_target;
exit do_sr if $opt_sr;
+get_git_branch_and_tags;
+
chomp($config->{version} = `git2log --version`);
die "no version info\n" if $config->{version} eq "";
my @s = map { s#^[^/]*/##; $_ } glob("package/*");
@s = grep { !/\.changes$/ } @s;
-die "no source files\n" if !@s;
+die "no source files; maybe run 'make archive'\n" if !@s;
$config->{archive} = "$config->{package}-$config->{version}.tar";
for (sort @s) {
@@ -210,10 +198,7 @@
print " GIT Branch: $config->{branch}\n";
print " Spec File: $opt_spec\n" if $opt_spec;
print " OBS Sources: $opt_obs\n" if $opt_obs;
-print " Dist: $config->{dist}\n";
print " Project: $config->{prj}\n";
-print " Test Project: $config->{test}\n" if $config->{test};
-print " Submit To: $config->{sr}\n";
print " Maintainer: $config->{email}\n";
print " BS: $config->{bs}\n";
print " TMP Dir: $tmpdir\n";
@@ -222,14 +207,6 @@
system "cd $tmpdir ; osc -A https://$config->{bs} co -c
$config->{prj}/$config->{package} >/dev/null";
system "ls -og $tmpdir/$config->{package} | tail -n +2";
-if($config->{test}) {
- print "Checking out $config->{test}/$config->{package}...\n";
- if(system "cd $tmpdir2 ; osc -A https://$config->{bs} co -c
$config->{test}/$config->{package} >/dev/null") {
- die "missing test project $config->{test}/$config->{package}\n"
- }
- # system "ls -og $tmpdir2/$config->{package} | tail -n +2";
-}
-
my @specs = map { s#.*/##; s#\.spec$##; $_ }
glob("$tmpdir/$config->{package}/*.spec");
if(@specs) {
$config->{spec_name} = $specs[0];
@@ -314,24 +291,12 @@
}
# create new tag if needed
-update_tag if !$config->{test};
+update_tag;
-# updating bs project
-if($config->{test}) {
- system "rm -f $tmpdir2/$config->{package}/*";
- system "cp -a $tmpdir/$config->{package}/* $tmpdir2/$config->{package}/";
-
- system "cd $tmpdir2/$config->{package} ; osc -A https://$config->{bs}
addremove";
- print "Submitting changes to $config->{test}/$config->{package}...\n";
- system "cd $tmpdir2/$config->{package} ; osc -A https://$config->{bs} ci -m
'- release $config->{version}'" if !$opt_try;
- system "ls -og $tmpdir2/$config->{package} | tail -n +2";
-}
-else {
- system "cd $tmpdir/$config->{package} ; osc -A https://$config->{bs}
addremove";
- print "Submitting changes to $config->{prj}/$config->{package}...\n";
- system "cd $tmpdir/$config->{package} ; osc -A https://$config->{bs} ci -m
'- release $config->{version}'" if !$opt_try;
- system "ls -og $tmpdir/$config->{package} | tail -n +2";
-}
+system "cd $tmpdir/$config->{package} ; osc -A https://$config->{bs}
addremove";
+print "Submitting changes to $config->{prj}/$config->{package}...\n";
+system "cd $tmpdir/$config->{package} ; osc -A https://$config->{bs} ci -m '-
release $config->{version}'" if !$opt_try;
+system "ls -og $tmpdir/$config->{package} | tail -n +2";
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -347,23 +312,25 @@
General options:
- --target TARGET Choose config from section TARGET in config file.
+ --target TARGET Submit to TARGET.
+ TARGET has the form BS://PROJECT[/PACKAGE], where:
+ BS is the section name of the open build service
api server,
+ as specified in .tobsrc,
+ PROJECT ist the project name,
+ PACKAGE is the (optional) package name - in case
it does not
+ match the git project name.
--spec FILE Use FILE as spec file template instead of the spec
file from
the build service project.
--obs DIR Commit everything in DIR to OBS. Note that
*.changes is still
automatically created.
--try Don\'t actually do anything.
- --test Submit to test project. A test project is an
alternative
- project defined in .tobsrc. Sources are taken from
the regular
- project but the new code is submitted to the test
project.
-
--version Show tobs version.
--save-temp Keep temporary files.
--help Write this help text.
Create submit request:
- --sr Create submit request from devel project to target
project.
+ --sr BS://PROJECT Create submit request.
--wait-for-ok Wait until package has built ok on at least one
architecture
in devel project.
--delay N Wait N seconds between polling for build results
(default: 30).
@@ -381,19 +348,19 @@
Typical .ini style with entries in key=value form and section names in
brackets ('[]').
- Section names are arbitrary but can be thought of as target distribution.
+ Section names are used for the BS part in the TARGET specification.
See README for some config entry examples.
Examples:
- # submit from current git dir to devel project
- tobs
+ # submit from current git dir to foo:bar:devel project
+ tobs --target obs://foo:bar:devel
- # prepare everything but don't actually submit anything
- tobs --try
+ # the same, but don't actually submit the package
+ tobs --try --target obs://foo:bar:devel
- # create submit request from devel project to target project
- tobs --sr
+ # create submit request from devel project foo:bar:devel to openSUSE:Factory
+ tobs --target obs://foo:bar:devel --sr obs://openSUSE:Factory
= = = = = = = =
@@ -405,27 +372,36 @@
sub get_rc
{
my $sec;
- my @sections;
if(open my $f, "$ENV{HOME}/.tobsrc") {
while(<$f>) {
if(/^\s*\[(\S+)\]/) {
- push @sections, $sec = { dist => $1 };
+ $sec = {};
+ $config->{rc}{$1} = $sec;
next;
}
- $sec->{$1} = $2 if /^\s*(\S+)\s*=\s*(\S+)/;
+ next unless $sec;
+
+ if(/^\s*(\S+)\s*=\s*(\S+)/) {
+ my $key = $1;
+ my $val = $2;
+ if($key =~ /^(\S+)\[(\S+)\]$/) {
+ $sec->{$1}{$2} = $val;
+ }
+ else {
+ $sec->{$key} = $val;
+ }
+ }
}
close $f;
}
-
- $config->{rc} = \@sections;
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-sub get_gitdata
+sub get_git_branch_and_tags
{
die "no git repository found\n" unless -d '.git';
@@ -437,6 +413,21 @@
$config->{branch} = $branch;
+ if(open my $p, "git tag 2>/dev/null |") {
+ while(<$p>) {
+ s/\/?\s*$//;
+ $config->{tags}{$_} = 1 if $_ ne "";
+ }
+ close $p;
+ }
+}
+
+
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+sub get_git_package
+{
+ die "no git repository found\n" unless -d '.git';
+
my $pack = `git config --get remote.origin.url 2>/dev/null`;
if($pack =~ m#([^/.]+)\.git\s*$#) {
@@ -447,55 +438,43 @@
}
$config->{package} = $pack if $pack ne "";
-
- if(open my $p, "git tag 2>/dev/null |") {
- while(<$p>) {
- s/\/?\s*$//;
- $config->{tags}{$_} = 1 if $_ ne "";
- }
- close $p;
- }
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-sub get_dist
+sub get_target
{
- my $dist;
+ die "target spec missing; use --target option\n" if !$opt_target;
- for (@{$config->{rc}}) {
- next if $opt_target && $_->{dist} ne $opt_target;
- if($_->{branch} eq $config->{branch} || $opt_target) {
- # when git repo and package name differ...
- if($_->{package} ne "" && $_->{gitname} eq $config->{package}) {
- $config->{package} = $_->{package};
- $dist = $_;
- last;
- }
- elsif($_->{package} eq $config->{package}) {
- $dist = $_;
- last;
- }
- $dist = $_, last if !$_->{package};
- }
+ my $bs_name;
+
+ $config->{package} = $2 if $opt_sr =~ s#([^/])/([^/]+)$#$1#;
+ $config->{package} = $2 if $opt_target =~ s#([^/])/([^/]+)$#$1#;
+
+ $opt_sr = $config->{rc}{aliases}{$opt_sr} if $config->{rc}{aliases}{$opt_sr};
+ $opt_target = $config->{rc}{aliases}{$opt_target} if
$config->{rc}{aliases}{$opt_target};
+
+ if($opt_target =~ m#^([^:]+)://([^/]+)$#) {
+ $bs_name = $1;
+ $config->{bs} = $config->{rc}{$bs_name}{api};
+ $config->{prj} = $2;
+ }
+ else {
+ die "invalid target spec: $opt_target\n";
}
- die "no config for " . ($opt_target ? $opt_target : $config->{branch}) .
"\n" unless $dist;
+ if($opt_sr =~ m#^([^:]+)://([^/]+)$#) {
+ $config->{sr}{api} = $config->{rc}{$1}{api};
+ my $pref = $config->{rc}{$1}{prefix}{$bs_name};
+ $config->{sr}{prefix} = "$pref:" if defined $pref;
+ $config->{sr}{prj} = $2;
+ }
- $config->{dist} = $dist->{dist};
- $config->{prj} = $dist->{prj};
- $config->{bs} = $dist->{bs};
- $config->{bs_sr} = $dist->{bs_sr};
- if($opt_test) {
- if($dist->{test}) {
- $config->{test} = $dist->{test};
- }
- else {
- die "no test project defined for $config->{package} in
$config->{dist}\n";
- }
+ get_git_package if !$config->{package};
+
+ if(!$config->{prj} || !$config->{package} || !$config->{bs}) {
+ die "incomplete config\n project = $config->{prj}\n package =
$config->{package}\n api = $config->{bs}\n";
}
- $config->{sr} = $dist->{sr};
- $config->{sr} .= "/$config->{package}" if $config->{sr} && $config->{sr} !~
m#/#;
if($ENV{USER_NAME}) {
$config->{email} = $ENV{USER_NAME};
@@ -514,7 +493,6 @@
}
$config->{email} = (getpwuid $<)[0] if !$config->{email};
-
$config->{email} .= "\@suse.com" if $config->{email} !~ /\@/;
}
@@ -602,11 +580,6 @@
}
else {
$setup = 1;
- my $i = 1;
- for my $x (keys %{$config->{sources}}) {
- $_ .= "%setup -T -D -a $i\n";
- $i++;
- }
}
}
}
@@ -684,29 +657,19 @@
#
sub do_sr
{
- my $bs = $config->{bs};
- my $bs_prefix;
-
- if($config->{bs_sr}) {
- ($bs, $bs_prefix) = split /,/, $config->{bs_sr};
- }
+ my $sr = $config->{sr};
print " Package: $config->{package}\n";
- print " Dist: $config->{dist}\n";
- print " Project: $bs_prefix$config->{prj}\n";
- print " Test Project: $bs_prefix$config->{test}\n" if $config->{test};
- print " Submit To: $config->{sr}\n";
+ print " Project: $sr->{prefix}$config->{prj}\n";
+ print " Submit To: $sr->{prj}\n";
print " Maintainer: $config->{email}\n";
- print " BS: $bs\n";
-
- my $err = 0;
+ print " BS: $sr->{api}\n";
- if($config->{test}) {
- print "\n=== No submit requests from test projects! ===\n";
- return $err;
+ if($sr->{api} ne $config->{bs} && !$sr->{prefix}) {
+ die "submitting from $config->{bs} to $sr->{api} not possible\n";
}
- my @s = split '/', $config->{sr};
+ my $err = 0;
if($opt_wait) {
my $ok;
@@ -714,12 +677,12 @@
my $building;
my $delay = $opt_delay;
- print "Waiting for build results of $config->{prj}/$s[1]...\n";
+ print "Waiting for build results of
$config->{prj}/$config->{package}...\n";
$| = 1;
do {
sleep $delay;
- if(open my $p, "osc -A https://$bs r --csv $bs_prefix$config->{prj}
$s[1] |") {
+ if(open my $p, "osc -A https://$sr->{api} r --csv
$sr->{prefix}$config->{prj} $config->{package} |") {
# sample line:
#
# openSUSE_Factory|x86_64|unpublished|False|succeeded|
@@ -779,19 +742,13 @@
print "Build ok\n";
}
- if(!$config->{sr}) {
- print "No submit request created\n";
-
- return $err;
- }
-
- print "Creating submit request to $config->{sr}\n";
+ print "Creating submit request to $sr->{prj}\n";
if(!$opt_try) {
my $sr_resp = $tmp->file();
my $user = $config->{email};
$user =~ s/\@.*$//;
- system "echo y | osc -A https://$bs sr -m 'submitted by $user via jenkins'
--yes --nodevelproject $bs_prefix$config->{prj} $s[1] $s[0] >$sr_resp 2>&1";
+ system "echo y | osc -A https://$sr->{api} sr -m 'submitted by $user via
jenkins' --yes --nodevelproject $sr->{prefix}$config->{prj} $config->{package}
$sr->{prj} >$sr_resp 2>&1";
$err = $? >> 8;
my $resp_msg;