#7 Spec preprocessing and related changes
Merged 6 years ago by clime. Opened 6 years ago by clime.

fix setup.py
clime • 6 years ago  
fix typo
clime • 6 years ago  
small doc tweak
clime • 6 years ago  
update man pages
clime • 6 years ago  
bb .tito
clime • 6 years ago  
update doc/index.rst
clime • 6 years ago  
example typo fixes
clime • 6 years ago  
1 unittest and bugfix
clime • 6 years ago  
basic macro test suite
clime • 6 years ago  
macro tests initial setup
clime • 6 years ago  
code improvements
clime • 6 years ago  
fix Summary in spec
clime • 6 years ago  
add missing quotes
clime • 6 years ago  
update README.md
clime • 6 years ago  
no HEAD handling
clime • 6 years ago  
propagate errors
clime • 6 years ago  
update README.md
clime • 6 years ago  
fix git_changelog
clime • 6 years ago  
fix missing import
clime • 6 years ago  
unhide rpkg.sh
clime • 6 years ago  
fix git archive functions
clime • 6 years ago  
subcommand fixes
clime • 6 years ago  
help message for tagging
clime • 6 years ago  
fix silent logging
clime • 6 years ago  
fix git_changelog date
clime • 6 years ago  
strip_at fix
clime • 6 years ago  
initialize spec_template
clime • 6 years ago  
add `rpkg spec`
clime • 6 years ago  
fix deps and update README
clime • 6 years ago  
file removed
-3
@@ -1,3 +0,0 @@ 

- the .tito/packages directory contains metadata files

- named after their packages. Each file has the latest tagged

- version and the project's relative directory.

@@ -1,1 +0,0 @@ 

- 0.8-1 ./

file removed
-5
@@ -1,5 +0,0 @@ 

- [buildconfig]

- builder = tito.builder.Builder

- tagger = tito.tagger.VersionTagger

- changelog_do_not_remove_cherrypick = 0

- changelog_format = %s (%ae)

file modified
+97 -42
@@ -1,55 +1,110 @@ 

- This application is an RPM packaging utility based on python-rpkg library. It works with both [DistGit](https://github.com/release-engineering/dist-git)

- and Git repositories and it handles two types of directory content: _packed_ content and _unpacked_ content.

+ `rpkg` is an RPM packaging utility based on python-rpkg library.

  

- - Packed (unexpanded) content is that composed of tarballs, patches, and a .spec file.

- - Unpacked (expanded) content is that composed of plain source files and a .spec file.

+ It works with both [DistGit](https://github.com/release-engineering/dist-git)

+ and standard Git repositories.

  

- For packed content, if you ask `rpkg` to make srpm (`rpkg srpm`), it will download any external

- files from the appropriate storage (e.g. lookaside cache for DistGit) and then it will invoke

- `rpmbuild -bs` with `_sourcedir`, `_specdir`, `_builddir`, `_srcrpmdir`,`_rpmdir` macros all

- set to the working directory.

+ It handles two types of directory content: _packed_ and _unpacked_.

  

- For unpacked content, if you ask `rpkg` to do the same thing, it will download external sources (if any)

- and then it will also generate a tarball from the whole content of the working directory named according

- to `Source0` definition present in the associated .spec file. This tarball and the .spec are then passed

- to the same rpmbuild command as above for the packed content.

+ - *Packed (unexpanded) content is that composed of tarballs, patches, and a .spec file*

+ - *Unpacked (expanded) content is that composed of plain source files and a .spec file*

  

- Note that by dynamically creating the tarball in the working directory according to the `Source0`

- definition, the directory content becomes packed because there is at least one file, which is referenced

- from the .spec file as `Source` or `Patch`. You can find the exact definitions of "packed" and "unpacked"

- in `rpkg` man pages (see PACKED VS UNPACKED section for examples) or with `rpkg make-source --help`.

+ There are currently two ways of handling those two different content types:

  

- Apart from generating srpms from the application sources, you can also run other useful packaging commands

- like `rpkg lint` to check the .spec file and the overall package conformance to RPM standard, `rpkg local`

- to locally build the package into an rpm, or `rpkg copr-build` to build an srpm and send it for build to

- [COPR](https://copr.fedorainfracloud.org).

+ - spec templates

+ - autopacking (deprecated)

+ 

+ 

+ Spec templates

+ --------------

+ 

+ Apart from being useful as a means to handle unpacked (as well as packed) content,

+ they also make it possible to generate potentially large parts of your spec file

+ automatically from a Git repository where your spec file is located.

+ 

+ An example spec template might look like this:

  

- Examples:

  ```

-     $ cd unpacked-copr-build-example

-     $ ls .

-     doc  LICENSE  README.md  rpkg  rpkg.bash  rpkg-client.spec  rpkg.conf  rpkglib  run_tests.sh  setup.py  tests

-     $ rpkg copr-build user/project

-     Wrote: copr-build-example/rpkg-client-0.8.tar.gz

-     Wrote: copr-build-example/rpkg-client-0.8-1.fc25.src.rpm

-     Uploading package rpkg-client-0.8-1.fc25.src.rpm

-     100% |################################| 49kB 263kB/s eta 0:00:00

-     Build was added to example:

-       https://copr.fedorainfracloud.org/coprs/build/625402/

-     Created builds: 625402

-     ...

+ Name:       {{{ git_name }}}

+ Version:    {{{ git_version }}}

+ Release:    1%{?dist}

+ Summary:    This is a test package.

+ 

+ License:    GPLv2+

+ URL:        https://someurl.org

+ 

+ Source: {{{ git_pack }}}

+ 

+ %description

+ This is a test package.

+ 

+ %prep

+ {{{ git_setup_macro }}}

+ 

+ %changelog

+ {{{ git_changelog }}}

  ```

+ 

+ Having a spec template like this in your project (instead of just a plain spec file)

+ allows your built source packages to automatically follow git history of your project.

+ 

+ Read more [here](https://docs.pagure.org/rpkg-util/tutorials.html#spec-templates-from-scratch).

+ 

+ 

+ Auto-packing (deprecated)

+ -------------------------

+ 

+ Auto-packing works only if `auto_pack` configuration option is set to `True` and only if the content

+ you are working with is not packed (see `rpkg is-packed`).

+ 

+ When invoking `rpkg srpm` on an unpacked content, `rpkg` will download external sources (if any)

+ and then it will generate a tarball from the whole content of the working directory named according

+ to `Source0` definition present in the associated .spec file. This tarball and the .spec file are

+ then passed to rpmbuild to generate the resulting srpm.

+ 

+ 

+ More examples

+ -------------

+ 

+ Run %prep phase of an rpm build:

+ 

  ```

-     $ cd prep-example

-     $ ls .

-     doc  LICENSE  README.md  rpkg  rpkg.bash  rpkg-client.spec  rpkg.conf  rpkglib  run_tests.sh  setup.py  tests

-     $ rpkg make-source

-     Wrote: rpkg-client/rpkg-client-0.8.tar.gz

      $ rpkg prep

-     Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.bd5cCF

+     git_pack: Source file already exists. No action taken.

+     Wrote: /tmp/rpkg/rpkg-client.spec

+     Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.4iFciz

      + umask 022

-     ...

-     $ rpkg clean

+     + cd /tmp/rpkg/

+     + cd /tmp/rpkg

+     + rm -rf rpkg-client-1.0.git.122.e59a5b11

+     + /usr/bin/gzip -dc /tmp/rpkg/rpkg-client-1.0.git.122.e59a5b11.tar.gz

+     + /usr/bin/tar -xof -

+     + STATUS=0

+     + '[' 0 -ne 0 ']'

+     + cd rpkg-client-1.0.git.122.e59a5b11

+     + /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w .

+     + exit 0

+ ```

+ 

+ For the following command, you need to have a project in COPR created.

+ See quick tutorial [here](https://docs.pagure.org/copr.copr/user_documentation.html#quick-start) on how to do it.

+ 

+ ```

+     $ rpkg copr-build @releng/rpkg-util

+     git_pack: Wrote: /tmp/rpkg/rpkg-util-1.0.git.122.e59a5b11.tar.gz

+     Wrote: /tmp/rpkg/rpkg-util.spec

+     Wrote: /tmp/rpkg/rpkg-util-1.0.git.122.e59a5b11-1.fc27.src.rpm

+     Uploading package /tmp/rpkg/rpkg-util-1.0.git.122.e59a5b11-1.fc27.src.rpm

+     100% |################################| 57kB 339kB/s eta 0:00:00

+     Build was added to rpkg-util:

+       https://copr.fedorainfracloud.org/coprs/build/724892/

+     Created builds: 724892

+     Watching build(s): (this may be safely interrupted)

+       15:50:12 Build 724892: importing ...

  ```

  

- You can find more information and more examples in rpkg man pages (`man rpkg`).

+ Other useful commands that you can use:

+ 

+ - `rpkg lint` to check the .spec file and the overall package conformance to RPM standard

+ - `rpkg local` to locally build the package into an rpm

+ - `rpkg upload` to upload a new source to DistGit lookaside cache

+ - `rpkg ...` (see `rpkg --help` or `man rpkg`)

file modified
+4 -3
@@ -4,7 +4,7 @@ 

  * *If you are looking for an easy way to make installation packages out of your application sources...*

  * *If you want to make free and open-source software out there easily available to end users...*

  * *If you like configurability without limits...*

-         

+ 

  

  Preview

  -------
@@ -13,7 +13,7 @@ 

  It is designed to work on top of Git repositories but it can also handle just any plain

  directory content. It will allow you to easily transform raw sources into an rpm source

  package that you can build (also by using rpkg) in a public build system, which will

- produce rpm(s) that any user can install into their system and start using.

+ produce packages that any user can install into their system and start using.

  

  

  Content
@@ -58,7 +58,8 @@ 

  

      $ git clone https://pagure.io/rpkg-util

      $ cd rpkg-util

-     $ sudo rpkg local -i

+     $ rpkg local

+     $ sudo dnf -C install /tmp/rpkg/noarch/rpkg*.noarch.rpm

  

  But the easier way to always get the latest, greatest `rpkg` is:

  

file modified
+159 -105
@@ -20,6 +20,7 @@ 

  

      License:    GPLv2+

      URL:        https://someurl.org

+     VCS:        {{{ git_vcs }}}

  

      Source: {{{ git_pack }}}

  
@@ -34,21 +35,22 @@ 

      EOF

      git init

  

+ 

  Those commands will create a local git repository called `test-project`

  containing our first spec template called ``simple-template.spec.rpkg``.

  

- We can now try to invoke `rpkg` to generate a real spec file from the template:

+ We can now try to invoke ``rpkg`` to generate a real spec file from the template:

  

  ::

  

      $ rpkg spec

      git_name: Start by setting origin URL.

-     subcmd ['git_name'] failed with value 1

+     git_name failed with value 1

  

  ...well, not so fast :).

  

- Remote origin URL needs to be setup first and that's because

- the ``git_name`` macro determines the value of package name from the "origin" URL.

+ Remote origin URL needs to be setup first and that's because the ``git_name``

+ macro determines the value of package name from that URL.

  

  We can set it up by running:

  
@@ -57,7 +59,7 @@ 

      git remote add origin ssh://git@pagure.io/test-project.git

  

  Note that we don't really need `pagure.io/test-project.git` project

- to exist publicly at this point. Only the "origin" needs to be set.

+ to exist publicly at this point. Only the "origin" variable needs to be set.

  

  Let's try again:

  
@@ -72,28 +74,39 @@ 

  

      $ cat /tmp/rpkg/simple-template.spec

      Name:       test-project

-     Version:    0.0

+     Version:    0.0.wtree.zf4r62

      Release:    1%{?dist}

      Summary:    This is a test package.

  

      License:    GPLv2+

      URL:        https://someurl.org

+     VCS:        git+ssh://git@pagure.io/test-project.git#HEAD:

  

-     Source: test-project-0.0.tar.gz

+     Source: test-project-0.0.wtree.zf4r62.tar.gz

  

      %description

      This is a test package.

  

      %prep

-     %setup -q -n test-project-0.0

+     %setup -q -n test-project-0.0.wtree.zf4r62

  

      %changelog

  

+ You can see that the version in the resulting spec file is ``0.0`` followed

+ by a curious ``.wtree.zf4r62`` suffix. The fact that the suffix is present means

+ that our working tree is dirty. The ``zf4r62`` substring encodes the time of

+ the latest uncommitted file status change.

+ 

+ You can also notice that the same suffix is present in the ``Source`` filename

+ as well as in the parameter given to ``%setup -n`` macro. That's because the output

+ of ``git_version`` is remembered and the subsequent rpkg macro invocations

+ may use it as part of their own output value.

  

- You can see that the version in the resulting spec file is "0.0" 

- for a freshly initialized project. 

+ The ``.wtree.*`` suffix will disappear once we make our first commit (see below).

+ The version will stay at ``0.0``, however, and it will be incremented later to

+ ``0.1`` when we make our first tag.

  

- Now let's make the first commit in our test project and see what happens.

+ Now let's make the first commit in our test project and see what happens:

  

  ::

  
@@ -105,7 +118,7 @@ 

  ::

  

      $ git log --oneline

-     647071e (HEAD -> master) first commit

+     dadef2a (HEAD -> master) first commit

  

  Regenerating the spec file:

  
@@ -113,40 +126,55 @@ 

  

      rpkg spec

  

- and finally getting:

+ Finally getting:

  

  ::

  

-     $ cat /tmp/rpkg/simple-template.spec

      Name:       test-project

-     Version:    0.0.git.1.647071e

+     Version:    0.0.git.1.dadef2a

      Release:    1%{?dist}

      Summary:    This is a test package.

  

      License:    GPLv2+

      URL:        https://someurl.org

+     VCS:        git+ssh://git@pagure.io/test-project.git#dadef2a8b9554e94797a7336261192e02d5d9351:

  

-     Source: test-project-0.0.git.1.647071e.tar.gz

+     Source: test-project-0.0.git.1.dadef2a.tar.gz

  

      %description

      This is a test package.

  

      %prep

-     %setup -q -n test-project-0.0.git.1.647071e

+     %setup -q -n test-project-0.0.git.1.dadef2a

  

      %changelog

  

  

- You can see that a dynamically generated suffix based on the latest commit hash

- was appended to ``Version:``, ``Source:``, and to the value of ``%setup -n`` parameter. 

- This becomes useful when we actually want to build a source package by using the spec file.

- Thanks to the ``git_version`` macro, each source package version corresponds to 

- a particular commit in the source repository history.

+ You can see that the ``.wtree.*`` suffix was replaced by ``.git.1.dadef2a``.

+ This suffix is based on the latest commit in the currently checked out branch.

+ The number ``1`` is given by number of commits from the latest git tag created

+ for our ``test-project`` package or from the repository initialization if no

+ such tag exists yet (our case).

  

- Now let's examine how commit tagging works with ``rpkg`` because commit tagging

- becomes actually very handy when your application reaches a certain stable (feature-complete)

- state that you would like to share with people. We will need to assume that we have already

- reached that state after just the first commit in our test-project :) (which is very rare).

+ The ``dadef2a`` part is the first seven characters of the full commit hash and you can

+ use this short hash to checkout the commit:

+ 

+ ::

+ 

+     git checkout dadef2a

+ 

+ This is not useful at the moment because we have just made the commit and we have it checked

+ out already in our repository but it becomes useful when you build a source rpm from the

+ generated spec file.

+ 

+ That's because the value in the spec file's version field gets propagated into the built srpm name,

+ which means that if you store that srpm somewhere and you will later come back to it, you will

+ know from which commit it was built and what it contains consequently.

+ 

+ Now let's examine how tagging works with ``rpkg`` because tagging becomes actually very handy

+ when your application reaches a certain stable (feature-complete) state that you would like

+ to share with people. We will need to assume that we have already reached that state after

+ just the first commit in our test-project :) (which is very rare).

  

  ::

  
@@ -164,26 +192,38 @@ 

  

  

  The intial content of the tag message gets populated from the first lines

- of all commit messages since the last tag. Because we didn't have any existing

+ of all commit messages since the last tag. Because we don't have any existing

  tag before this one, commit messages since the repository initialization are

- collected and used to populate the initial content.

+ collected and used to populate the initial message content.

  

  You can keep this pre-generated tag message as it is, edit it in any way,

  or just delete it and write your own stuff but note that this message

- consitutes the basic information about your application release (and what

+ constitutes the basic information about our application release (and what

  have changed since the previous realease), so it is quite important.

  

- After you are finally satisfied with your message, you can save 

+ After you are finally satisfied with your message, you can save

  the content and close the editor. The new tag will be generated:

  

  ::

  

      $ rpkg tag

+     Wrote: /tmp/rpkg/simple-template.spec

      Created tag: test-project-0.1-1

      Wrote: /tmp/rpkg/simple-template.spec

  

- Note that a new spec was automatically regenerated from our spec template after the

- tag was created. Let's view it:

+ You might wonder about the two lines ``Wrote: /tmp/rpkg/simple-template.spec``.

+ The first line is there because the tag name is derived from the `Name:`, `Version:`,

+ and `Release:` field values in the generated spec file.

+ 

+ `EXPERT INFO:`

+ 

+ When tagging takes place, ``rpkg`` sets a special variable ``VERSION_BUMP``

+ into the spec preprocessing environment. ``git_version`` macro is aware of this variable

+ and if it is set, an incremented version value is generated. This incremented value

+ then gets carried over into the tag name together with the package name and release.

+ 

+ When the tag is finally created, the spec is regenerated to get the latest tag

+ changelog into it as well. Let's view that final spec file:

  

  ::

  
@@ -195,6 +235,7 @@ 

  

      License:    GPLv2+

      URL:        https://someurl.org

+     VCS:        git+ssh://git@pagure.io/test-project.git#dadef2a8b9554e94797a7336261192e02d5d9351:

  

      Source: test-project-0.1.tar.gz

  
@@ -208,44 +249,40 @@ 

      * Wed Mar 07 2018 clime <clime@redhat.com> 0.1-1

      - first commit

  

- You can see that the dynamic version suffix has

- not been generated into the ``Version:`` field this time.

- This happens every time the currently checked out commit

- is tagged.

- 

- The reason is that tagged commits can be identified just

- by the version "base" because that base gets carried over

- into the tag name (together with package name and release).

- Knowing a tag name, we can easily get back to a particular

- commit (and the tag name can be easily obtained from

- a source package name - we will see that later).

- 

- Version substrings in ``Source:`` field and in the

- ``%setup`` macro has been, of course, adjusted as well.

- 

- And finally, the changelog has been also automatically

- generated for us based on the currently existing tags

- and their content. Note that the changelog contains the 

- exact tag message we were previously editing in the editor 

- window :).

- 

- If you prefer to edit your changelog messages

- directly in the spec file instead of having them

- generated from tags, you can. Just do

- not use the ``git_changelog`` macro and instead do

- your edits directly in the spec file template.

- 

- You can also configure the ``git_changelog`` macro

- to generate changelog entries only since a certain

- point in history by specifying its ``since_tag`` parameter

- (e.g. ``git_changelog since_tag=test-project-0.1-1``).

- 

- There are plenty of parameters also for the other

- macros to give you that same freedom you experience

- when you are dealing with just plain spec files.

- For example, you can increment the lead version number

- (the first number in the version string) by setting ``lead``

- parameter of ``git_version``:

+ You can see that no dynamic version suffix has been generated into the

+ ``Version:`` field this time.  This happens every time the currently

+ checked out commit is a tagged one.

+ 

+ The reason is that if you know a tag name, you can just

+ directly pass it to ``git checkout``:

+ 

+ ::

+ 

+     $ git checkout test-project-0.1

+ 

+ and you will get back to the respective commit for which

+ the tag was created.

+ 

+ You can also see that the changelog has been automatically generated

+ for us based on the currently existing tags and their content.

+ 

+ If you don't like this and you prefer editing your changelog messages

+ directly in the source spec file instead of having them generated from tags,

+ no problem. Just don't use the ``git_changelog`` macro and instead do your

+ edits directly in the spec file template. Any normal text (not enclosed in

+ ``{{{``, ``}}}`` brace triplets) will be copied verbatim into the resulting

+ spec file.

+ 

+ If you like the ``git_changelog`` macro but you don't have every single

+ changelog message stored in a tag, you can configure it to generate

+ changelog entries only since a certain point in history by specifying its

+ ``since_tag`` parameter (e.g. ``git_changelog since_tag=test-project-0.1-1``).

+ 

+ There are plenty of parameters also for the other macros to give you that

+ same freedom you experience when you are dealing with just plain spec files.

+ 

+ For example, you can increment the major version number (the first number in

+ the version string) by setting ``lead`` parameter of ``git_version``:

  

  ::

  
@@ -254,6 +291,18 @@ 

      Release:    1%{?dist}

      ...

  

+ For our project this will now generate something like:

+ 

+ ::

+ 

+     Name:       test-project

+     Version:    1.0.wtree.zf4657

+     Release:    1%{?dist}

+     ...

+ 

+ The ``.wtree.*`` suffix is telling us that our working tree

+ is dirty again after adding ``lead=1`` and not commiting yet.

+ 

  Read more about the macros and their parameters here.

  

  And of course, you can fallback to using the plain spec
@@ -261,48 +310,51 @@ 

  you will lose the advantage of the certain spec parts

  being generated automatically for you.

  

- But so far we have only seen generating spec from

- template but what if you want to generate the whole

- source package that you would like to build and

- and distribute afterwards.

+ So far, we have only seen generating spec from a template

+ but what if we want to generate a whole source package.

  

- You can do that with ``rpkg srpm``:

+ We can do that with ``rpkg srpm``:

  

  ::

  

      $ rpkg srpm

-     git_pack: Wrote: /tmp/rpkg/test-project-0.1.tar.gz

+     git_pack: Wrote: /tmp/rpkg/test-project-1.0.wtree.zf4657.tar.gz

      Wrote: /tmp/rpkg/simple-template.spec

-     Wrote: /tmp/rpkg/test-project-0.1-1.fc27.src.rpm

+     Wrote: /tmp/rpkg/test-project-1.0.wtree.zf4657-1.fc27.src.rpm

+ 

+ Now, actually we don't usually want to build an srpm from a dirty

+ tree because srpm is something, which eventually gets built into

+ a final installable rpm package.

  

- If you call ``rpkg srpm`` now, three files are created.

- The generated spec (you can see the relevant log 

- message on the second line). The tarball that packs

- all your application sources (first line). And the source rpm

- that bundles the generated spec file and the sources

- and can be used for building an rpm installation

- package (third line).

+ It should be always possible to track that rpm package back to a

+ particular commit in a git history, so that you can look at the

+ exact sources it was built from. This becomes impossible if we build

+ an srpm from a dirty tree. It might be still useful for local development,

+ however.

  

- You can also just generate the spec and the tarball

- only by ``rpkg spec --sources`` command. If you call it

- now, rpkg will tell you the tarball already exists

- so it does not need to be regenerated:

+ So let's reset to the latest commit (which is also a tagged one) and

+ continue from there:

  

  ::

  

-     $ rpkg spec --sources

-     git_pack: Source file already exists. No action taken.

+     $ git reset --hard test-project-0.1-1

+     HEAD is now at dadef2a first commit

+     $ rpkg srpm

+     git_pack: Wrote: /tmp/rpkg/test-project-0.1.tar.gz

      Wrote: /tmp/rpkg/simple-template.spec

+     Wrote: /tmp/rpkg/test-project-0.1-1.fc27.src.rpm

  

- If you want the tarball to be generated even though it 

- already exists, you can delete it from ``/tmp/rpkg`` 

- (default output dir) before continuing.

+ Three files were created. The spec (you can see the relevant

+ log message on the second line). The tarball that packs all our application

+ sources for the current commit (on the first line). And the source rpm that

+ bundles the generated spec file and the tarball and can be used for building

+ an rpm installation package (the third line).

  

- ::

+ Note that the names of the tarball and of the source srpm match the tag name

+ of the currently checked out commit as they should.

  

-     rm /tmp/rpkg/test-project-0.1.tar.gz

- 

- Then you can call:

+ You can generate just a spec and a tarball with ``rpkg spec --sources``

+ command:

  

  ::

  
@@ -310,16 +362,18 @@ 

      git_pack: Wrote: /tmp/rpkg/test-project-0.1.tar.gz

      Wrote: /tmp/rpkg/simple-template.spec

  

- ...and the gzipped tarball will be generated.

+ In the previous examples, we could see that ``git_pack`` macro

+ generates the source tarball only when needed (e.g. when calling

+ ``rpkg srpm``) or when explicitly asked to do it (``rpkg spec --sources``).

+ 

+ This is a useful optimization.

  

- In the previous examples, you could see that ``git_pack``

- macro generates the source tarball only when needed

- (e.g. when calling ``rpkg srpm``) or when explicitly asked 

- to (``rpkg spec --sources``). This is a useful optimization.

- By the way, ``git_archive`` macro (which uses ``git archive`` 

- command instead of ``tar`` to do the job) behaves the same way.

+ By the way, there is also ``git_archive`` rpkg macro (which uses

+ ``git archive`` command instead of ``tar`` to do the packing), which behaves

+ the same way in this regard. With this macro, however, all your changes

+ need to be committed before you can generate a tarball or a source rpm.

  

- In this tutorial, we have seen:

+ In this tutorial, we have learned:

  

  - how to create a simple spec file template

  - how to generate a real rpm spec from the template

@@ -0,0 +1,50 @@ 

+ # vim: syntax=spec

+ 

+ # git_cwd_* macros work with the current

+ # working directory by default (you can

+ # override the working directory with

+ # `rpkg --path` switch).

+ #

+ # For example, git_cwd_name will take

+ # repository origin URL basename and

+ # appends to it the path (after slash to

+ # dash substitution) from the repository

+ # root to the current working directory.

+ #

+ # git_cwd_pack macro will pack the content

+ # of the current working directory and

+ # outputs filename to be used as Source0.

+ #

+ # Note that git_cwd_* macros are just

+ # tiny wrappers over the base git

+ # macro calls (see simple-example.spec.rpkg)

+ #

+ # They exists just to save you some typing

+ # and you can think of them only as aliases.

+ #

+ # The underlying git macros do all the job

+ # and are the ones being cached.

+ #

+ # For example, calling git_cwd_name is

+ # equivalent to calling:

+ #

+ # git_name append="-$(git -C "$(pwd)" rev-parse --show-prefix | name_convert)"

+ 

+ Name:       {{{ git_cwd_name }}}

+ Version:    {{{ git_cwd_version }}}

+ Release:    1%{?dist}

+ Summary:    This is a test package.

+ 

+ License:    GPLv2+

+ URL:        https://someurl.org

+ 

+ Source0:    {{{ git_cwd_pack }}}

+ 

+ %description

+ This is a test package.

+ 

+ %prep

+ {{{ git_cwd_setup_macro }}}

+ 

+ %changelog

+ {{{ git_cwd_changelog }}}

@@ -0,0 +1,51 @@ 

+ # vim: syntax=spec

+ 

+ # git_dir_* macros work with the directory

+ # where the input spec file template is placed.

+ #

+ # For example, git_dir_name will take

+ # repository origin URL basename and

+ # appends to it the path (after slash to

+ # dash substitution) from the repository

+ # root to the spec file's directory.

+ #

+ # git_dir_pack macro will pack the content

+ # of that directory and outputs filename

+ # to be assigned as Source0.

+ #

+ # Note that git_dir_* macros are just

+ # tiny wrappers over the base git

+ # macro calls (see simple-example.spec.rpkg)

+ #

+ # They exists just to save you some typing

+ # and you can think of them only as aliases.

+ #

+ # The underlying git macros do all the job

+ # and are the ones being cached.

+ #

+ # For example, calling git_dir_name is

+ # equivalent to calling:

+ #

+ # git_name append="-$(git -C "$(dirname "$INPUT_PATH")" rev-parse --show-prefix | name_convert)"

+ #

+ # INPUT_PATH is an environment variable

+ # storing path to the input spec file.

+ 

+ Name:       {{{ git_dir_name }}}

+ Version:    {{{ git_dir_version }}}

+ Release:    1%{?dist}

+ Summary:    This is a test package.

+ 

+ License:    GPLv2+

+ URL:        https://someurl.org

+ 

+ Source0:    {{{ git_dir_pack }}}

+ 

+ %description

+ This is a test package.

+ 

+ %prep

+ {{{ git_dir_setup_macro }}}

+ 

+ %changelog

+ {{{ git_dir_changelog }}}

@@ -0,0 +1,128 @@ 

+ # vim: syntax=spec

+ 

+ # This example shows the basic usage

+ # of rpkg macros. Without any parameters,

+ # these macros work on repository level

+ # and use globally available repository

+ # information.

+ #

+ # For example, git_name will, by default,

+ # read repository origin URL basename and

+ # outputs it to stdout. The output value

+ # then replaces the {{{ git_name }}} invocation.

+ #

+ # git_pack macro will take the whole repository

+ # content, packs it into a gzipped tarball, and

+ # outputs its filename.

+ #

+ # By specifying certain parameters (see

+ # section SPEC TEMPLATES in rpkg man pages),

+ # you can influence the behavior of those

+ # macros to basically any extent.

+ #

+ # For example, {{{ git_pack path=subdir }}}

+ # will pack content of the "subdir"

+ # directory in the current working directory

+ # instead of packing the whole repository.

+ #

+ # If you want to pack a directory called

+ # "subdir" under the repository root (and not

+ # under the current working directory as

+ # in the previous example), you can use:

+ #

+ # {{{ git_pack path="$(git rev-parse --show-toplevel)/subdir" }}}

+ #

+ # There is also git_archive macro which is

+ # very similar to git_pack (and even has

+ # the same parameters) but uses `git archive`

+ # for packing instead of tar.

+ #

+ # If you use {{{ git_archive }}}, all your

+ # changes need to be committed before you

+ # can build the source tarball, for example

+ # by calling `rpkg srpm`.

+ #

+ # Note that both git_archive and git_pack

+ # macros derive the name of the resulting

+ # tarball and also the name of the top

+ # directory in the tarball from the previous

+ # invocations of git_name and git_version macros.

+ #

+ # For example:

+ #

+ # Name:    {{{ git_name }}}

+ # Version: {{{ git_version }}}

+ # Source0: {{{ git_pack }}}

+ #

+ # If the first two lines get resolved to:

+ #

+ # Name:    test

+ # Version: 1.0

+ #

+ # Then the third line gets resolved to:

+ #

+ # Source0: test-1.0.tar.gz

+ #

+ # The top directory in the created tarball

+ # will be named test-1.0.

+ #

+ # If you parametrize the git_name and git_version

+ # calls to give you other than default values (see

+ # SPEC TEMPLATES section in rpkg man pages):

+ #

+ # Name:    {{{ git_name name=foo }}}

+ # Version: {{{ git_version lead=1 follow=3 }}}

+ # Source0: {{{ git_pack }}}

+ #

+ # Then the git_pack macro will adjust its results

+ # according to that. The previous three lines

+ # will be resolved as:

+ #

+ # Name:    foo

+ # Version: 1.3

+ # Source0: foo-1.3.tar.gz

+ #

+ # Output of every git macro call is cached and

+ # other macros are made to take those cached values

+ # into account by default. If you look at the definion

+ # of git_pack macro, you will see it:

+ #

+ # function git_pack {

+ #    declare path="$(git rev-parse --show-toplevel)" dir_name="$(cached_name_version)" source_name="$(cached_name_version).tar.gz" "$@"

+ #    ...

+ # }

+ #

+ # Of course, you can override the default parameter values:

+ #

+ # Source0: {{{ git_pack dir_name=foo source_name=bar.tar.gz }}}

+ #

+ # This will always give you:

+ #

+ # Source0: bar.tar.gz

+ #

+ # not matter what and the top directory in the bar.tar.gz tarball will be named foo.

+ #

+ # You can experiment on this spec file by executing:

+ #

+ # rpkg spec --spec simple-template.spec.rpkg

+ #

+ # from command line.

+ 

+ Name:       {{{ git_name }}}

+ Version:    {{{ git_version }}}

+ Release:    1%{?dist}

+ Summary:    This is a test package.

+ 

+ License:    GPLv2+

+ URL:        https://someurl.org

+ 

+ Source0:    {{{ git_pack }}}

+ 

+ %description

+ This is a test package.

+ 

+ %prep

+ {{{ git_setup_macro }}}

+ 

+ %changelog

+ {{{ git_changelog }}}

file modified
+349 -41
@@ -20,7 +20,7 @@ 

  .\\" man page for rpkg

  .TH rpkg 1 "%(today)s" "" "rpm\\-packager"

  .SH "NAME"

- rpkg \\- RPM Packaging utility

+ rpkg \\- RPM packaging utility

  .SH "SYNOPSIS"

  .B "rpkg"

  [
@@ -42,52 +42,364 @@ 

  .B "\\-\\-help"

  .SH "DESCRIPTION"

  .B "rpkg"

- is a script to maintain RPM package content. It is designed to work with expanded sources as well

- as with tarballs and patches. Note that you should trust the .spec files you work with because

- many operations (like `rpkg srpm`, `rpkg lint`, or `rpkg is-packed`) involve parsing the spec file,

- which brings along evalution of any shell or lua scriplets.

+ is a script to manage spec-enriched Git repositories - meaning any repositories which contain

+ an rpm spec file. It is designed to work with expanded application sources as well as with standard DistGit

+ tarballs and patches. Note that you should trust the .spec files you work with because many operations

+ (like `rpkg srpm` or `rpkg lint`) involve parsing the spec file, which brings along evaluation

+ of any shell or lua scriplets present in it.

  """

  

  man_footer = """\

+ .SH "CONFIGURATION"

+ 

+ rpkg reads configuration options from the following files in this order:

+ 

+     /etc/rpkg.conf, ~/.config/rpkg, ./rpkg.conf

+ 

+ Configuration found in ./rpkg.conf has the highest priority.

+ 

+ .SS "EXAMPLE CONFIGURATION"

+ 

+     [rpkg]

+     preprocess_spec = True

+     # auto-packing is deprecated:

+     auto_pack = False

+ 

+     [dist-git]

+     lookaside = https://src.fedoraproject.org/repo/pkgs/%(ns1)s/%(pkg)s/%(filename)s/%(hashtype)s/%(hash)s/%(filename)s

+     lookaside_cgi = https://src.fedoraproject.org/repo/pkgs/upload.cgi

+     gitbaseurl = ssh://%(user)s@pkgs.fedoraproject.org/%(module)s

+     anongiturl = https://src.fedoraproject.org/%(module)s

+ 

  .SH "EXAMPLES"

  

-     $ cd prep-example

-     $ ls .

-     doc  LICENSE  README.md  rpkg  rpkg.bash  rpkg-client.spec  rpkg.conf  rpkglib  run_tests.sh  setup.py  tests

-     $ rpkg prep

-     error: File rpkg-client/rpkg-client-0.8.tar.gz: No such file or directory

-     $ rpkg make-source

-     Wrote: rpkg-client/rpkg-client-0.8.tar.gz

+ Run %prep phase of an rpm build:

+ 

      $ rpkg prep

-     Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.bd5cCF

+     Wrote: /tmp/rpkg/rpkg-util.spec

+     Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.4iFciz

      + umask 022

-     ...

-     $ rpkg clean

+     + cd /tmp/rpkg/

+     + cd /tmp/rpkg

+     + rm -rf rpkg-util-1.0.git.122.e59a5b11

+     + /usr/bin/gzip -dc /tmp/rpkg/rpkg-util-1.0.git.122.e59a5b11.tar.gz

+     + /usr/bin/tar -xof -

+     + STATUS=0

+     + '[' 0 -ne 0 ']'

+     + cd rpkg-util-1.0.git.122.e59a5b11

+     + /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w .

+     + exit 0

  

-     In this example, we run prep phase of rpmbuild process in an originally unpacked directory. At first we get

-     an error about the tarball not being present. We first need to run `rpkg make-source` manually to create it

-     (which makes the working directory content "packed" by the way). Then `rpkg prep` can be successfully executed.

-     The following applies also to `rpkg local` and `rpkg install`. In the end, the generated tarball can be removed

-     with `rpkg clean` if the working directory is a Git repo.

+ For the following command, you need to have a project in COPR created. See quick tutorial at

  

-     $ cd unpacked-copr-build-example

-     $ ls .

-     doc  LICENSE  README.md  rpkg  rpkg.bash  rpkg-client.spec  rpkg.conf  rpkglib  run_tests.sh  setup.py  tests

-     $ rpkg copr-build user/project

-     Wrote: copr-build-example/rpkg-client-0.8.tar.gz

-     Wrote: copr-build-example/rpkg-client-0.8-1.fc25.src.rpm

-     Uploading package rpkg-client-0.8-1.fc25.src.rpm

-     100% |################################| 49kB 263kB/s eta 0:00:00

-     Build was added to example:

-       https://copr.fedorainfracloud.org/coprs/build/625402/

-     Created builds: 625402

-     ...

- 

-     This example illustrates launching a COPR build directly from an unpacked (expanded) content.

-     SRPM is first build and then sent to COPR with copr-cli tool.

+ https://docs.pagure.org/copr.copr/user_documentation.html#quick-start

+ 

+ on how to do it.

+ 

+     $ rpkg copr-build @releng/rpkg-util

+     git_pack: Wrote: /tmp/rpkg/rpkg-util-1.0.git.122.e59a5b11.tar.gz

+     Wrote: /tmp/rpkg/rpkg-util.spec

+     Wrote: /tmp/rpkg/rpkg-util-1.0.git.122.e59a5b11-1.fc27.src.rpm

+     Uploading package /tmp/rpkg/rpkg-util-1.0.git.122.e59a5b11-1.fc27.src.rpm

+     100% |################################| 57kB 339kB/s eta 0:00:00

+     Build was added to rpkg-util:

+       https://copr.fedorainfracloud.org/coprs/build/724892/

+     Created builds: 724892

+     Watching build(s): (this may be safely interrupted)

+       15:50:12 Build 724892: importing ...

+ 

+ Here you can see a simple operation of generation spec file from a template:

+ 

+     $ rpkg spec

+     git_pack: Wrote: /tmp/rpkg/rpkg-util.spec

+ 

+ .SH "SPEC TEMPLATES"

+ 

+ Apart from being useful as a means to handle unpacked as well as packed content,

+ they also make it possible to generate certain parts of your spec file automatically

+ from a Git repository where your spec file is located. You need to have "spec_preprocess"

+ configuration option set to True in rpkg config to use this functionality.

+ 

+ .SS "BASIC EXAMPLE"

+ 

+     Name:       {{{ git_name }}}

+     Version:    {{{ git_version }}}

+     Release:    1%{?dist}

+     Summary:    This is a test package.

+ 

+     License:    GPLv2+

+     URL:        https://someurl.org

+     VCS:        {{{ git_vcs }}}

+ 

+     Source:     {{{ git_pack }}}

+ 

+     %description

+     This is a test package.

+ 

+     %prep

+     {{{ git_setup_macro }}}

+ 

+     %changelog

+     {{{ git_changelog }}}

+ 

+ Having a spec template like this in your project (instead of just a plain spec file)

+ allows you to build source and rpm packages automatically following git history of your project.

+ 

+ .SS "MACRO REFERENCE"

+ 

+ .TP

+ 

+ BASE GIT MACROS

+ 

+ Without any parameters, these macros work on repository level and use globally available repository information.

+ Output of every git macro call is cached and other macros are made to take those cached values into account by default.

+ You can see that a macro uses a cached value as a default input parameter value by looking at its function header definition and searching for the `cached` keyword.

+ 

+ E.g.

+ 

+     git_version [name="$(cached git_name)"] [lead=0] [follow=]

+ 

+ Default value for name in this definition is derived from the cached output of the

+ previously invoked `git_name` macro. If `git_name` macro has not been invoked

+ or if its output was an empty string, the default value for the `name=` parameter

+ above will be also an empty string.

+ 

+ Note that $(cached_name_version) in the function header definitions below

+ is an alias for "$(cached git_name)-$(cached git_version)".

+ 

+ .B git_name [name=] [prepend=] [append=]

+ 

+ Without any parameters, output the "origin" URL basename with .git suffix stripped.

+ 

+     Optional arguments:

+         name     the base name to be output

+         prepend  string to be prepended to the base name

+         append   string to be appended to the base name

+ 

+ .B git_version [name="$(cached git_name)"] [lead=0] [follow=]

+ 

+ Output version of a subpackage given by ${name}. The version

+ is a string constructed of the following parts:

+ 

+     "${lead}.${follow}${commit_count_appendix}${wtree_appendix}"

+ 

+ ${lead} is a mandatory argument of the macro. By default it is set

+ to zero.

+ 

+ ${follow} (if not specified) is obtained from the follow part of

+ the latest tag made for the subpackage given by ${name}.

+ 

+ ${commit_count_appendix} is generated only if the current commit

+ is not tagged for the given subpackage and it is composed of the

+ following parts

+ 

+     .git.<commit_count>.<latest_commit_short_hash>

+ 

+ Commit count is a number of commits from the latest tag on the

+ given subpackage.

+ 

+ ${wtree_appendix} is generated only if the currently checked

+ out working tree is dirty. It is composed of the following parts:

+ 

+     .wtree.<encoded_latest_file_status_change>

+ 

+     Optional arguments:

+         name     name of a subpackage

+         lead     major version substring

+         follow   minor version substring, dynamically generated if not specified

+ 

+     Environment variables:

+         VERSION_BUMP: if set to a non-empty value, the following procedure is applied

+         to get the version string:

+ 

+         If $follow is specified by user explicitly, return $lead.$follow.

+ 

+         Otherwise, extract $follow from the latest tag as the last version component (after the last dot)

+         and return $lead.$follow+1. If $follow is not a number, throw an error (manual setting of follow

+         is needed).

+ 

+         rpkg sets the VERSION_BUMP variable into the preprocessing environment during

+         execution of `rpkg tag` subcommand. Otherwise, it is unset.

+ 

+ .B git_vcs [subtree=]

+ 

+ Output pseudo repository URL pointing the currently checked out tree.

+ 

+ Example output: git+ssh://git@pagure.io/test-project.git#dadef2a8b9554e94797a7336261192e02d5d9351:

+ 

+     Optional arguments:

+         subtree     path to a subtree to generate the URL for

+ 

+ .B git_pack [path="$(git rev-parse --show-toplevel)"] [dir_name="$(cached_name_version)"] [source_name="$(cached_name_version).tar.gz"]

+ 

+ Pack the whole working tree content into a gzipped source tarball and output $source_name, which is a filename of the created tarball.

+ Uses `tar caf --exclude-vcs --exclude-vcs-ignores` to do the job.

+ 

+     Optional arguments:

+         path         path to a specific subdirectory to be packed

+         dir_name     top-level directory name in the created tarball

+         source_name  filename of the created source tarball

+ 

+     Enviroment variables:

+         OUTDIR: if empty, git_pack will not generate any sources, only outputs the source filename

+ 

+         rpkg sets OUTDIR, only if the tarball is actually needed to be generated. It does not set it

+         when `rpkg spec` is called (without any additional arguments).

+ 

+ .B git_archive [path="$(git rev-parse --show-toplevel)"] [dir_name="$(cached_name_version)"] [source_name="$(cached_name_version).tar.gz"]

+ 

+ Pack the whole working tree content into a gzipped source tarball and output $source_name, which is a filename of the created tarball.

+ Uses `git archive` to do the job. Note that this macro will refuse to generate a tarball if your working tree is dirty.

+ 

+     Optional arguments:

+         path         path to a specific subdirectory to be packed

+         dir_name     top-level directory name in the created tarball

+         source_name  filename of the created source tarball

+ 

+     Enviroment variables:

+         OUTDIR: if empty, git_pack will not generate any sources, only outputs the source filename

+ 

+         rpkg sets OUTDIR, only if the tarball is actually needed to be generated. It does not set it

+         when `rpkg spec` is called (without any additional arguments).

+ 

+ .B git_setup_macro [dir_name="$(cached_name_version)"]

+ 

+ Output %setup rpm macro for the given top-level source-tarball directory.

+ 

+     Optional arguments:

+         dir_name     name of the top-level directory in the source-tarball

+ 

+ .B git_changelog [name="$(cached git_name)"] [since_tag=] [until_tag=] [header_locale=POSIX] [header_date_format="%a %b %d %Y"] [body_wrap=80]

+ 

+ Output rpm spec changelog as generated from tag messages for the subpackage given by ${name}.

+ 

+     Optional arguments:

+         name                name of the subpackage to generate the ehangelog for

+         since_tag           start the changelog records with this tag

+         until_tag           end the changelog records with this tag

+         header_locale       locale to be used when changelog record date is being generated

+         header_date_format  date format to be used in the changelog record headers

+         body_wrap           maximum allowed line length for changelog body

+ 

+ When `rpkg tag` is called, it allows you to specify a tag message. This is the message

+ that will be used as a changelog record body.

+ 

+ .TP

+ 

+ GIT_DIR MACROS

+ 

+ These macros operate on a directory level. In particular, on a directory where the input spec file template is located. They are basically

+ aliases to the GIT BASE MACROS with some input values set specifically for the directory-level operation. The input spec template location is

+ given by INPUT_PATH environment variable set by rpkg. You can influence it from the command line by explicitly specifying --spec <template_path>

+ argument for rpkg subcommands that support it.

+ 

+ Below you can see to what the GIT DIR macros expand. In some cases, the macro is a direct alias to the underlying git base macro.

+ 

+ .B git_dir_name

+ 

+     git_name append="-$(git -C "$(dirname "$INPUT_PATH")" rev-parse --show-prefix | name_convert)"

+ 

+     Outputs repository origin URL basename appended with the path (after slash to dash substitution) from the repository

+     root to the spec file's directory.

+ 

+ .B git_dir_version

+ 

+     git_version

+ 

+ .B git_dir_vcs

+ 

+     git_vcs subtree="$(git -C "$(dirname "$INPUT_PATH")" rev-parse --show-prefix)"

+ 

+     Outputs VCS pseudo URL pointing to the spec file's subdirectory.

+ 

+ .B git_dir_pack

+ 

+     git_pack path="$(dirname "$INPUT_PATH")"

+ 

+     Packs spec file's subdirectory by using `tar`.

+ 

+ .B git_dir_archive

+ 

+     git_archive path="$(dirname "$INPUT_PATH")"

+ 

+     Packs spec file's subdirectory by using `git archive`.

+ 

+ .B git_dir_setup_macro

+ 

+     git_setup_macro

+ 

+ .B git_dir_changelog

+ 

+     git_changelog

+ 

+ .TP

+ 

+ GIT_CWD MACROS

+ 

+ These macros operate on a directory level. In particular, on a rpkg's working directory. Again, they are

+ aliases to the GIT BASE MACROS with some input values set specifically for the directory-level operation.

+ 

+ You can influence the rpkg's working dir from the command line by explicitly specifying its --path argument.

+ 

+ Below you can see to what the GIT_CWD macros expand. In some cases, the macro is a direct alias for the underlying git base macro.

+ 

+ .B git_cwd_name

+ 

+     git_name append="-$(git -C "$(pwd)" rev-parse --show-prefix | name_convert)"

+ 

+     Outputs repository origin URL basename appended with the rpkg's working directory path (after slash to dash substitution).

+ 

+ .B git_cwd_version

+ 

+     git_version

+ 

+ .B git_cwd_vcs

+ 

+     git_vcs subtree="$(git -C "$(pwd)" rev-parse --show-prefix)"

+ 

+     Outputs VCS pseudo URL pointing to the rpkg's working directory.

+ 

+ .B git_cwd_pack

+ 

+     git_pack path="$(pwd)"

+ 

+     Packs rpkg's working directory by using `tar`.

+ 

+ .B git_cwd_archive

+ 

+     git_archive path="$(pwd)"

+ 

+     Packs rpkg's working directory by using `git archive`.

+ 

+ .B git_cwd_setup_macro

+ 

+     git_setup_macro

+ 

+ .B git_cwd_changelog

+ 

+     git_changelog

+ 

+ .SH USER-DEFINED MACROS

+ 

+ You can define your own macros (basically just bash functions) by putting them

+ into rpkg.macros file in rpkg's working directory. You can even override the

+ default macros provided by rpkg.

+ 

+ .SH AUTO-PACKING (DEPRECATED)

+ 

+ Auto-packing works only if auto_pack configuration option is set to True and

+ only if the content you are working with is not packed (see `rpkg is-packed`).

+ 

+ When invoking `rpkg srpm` on an unpacked content, rpkg will download external sources

+ (if any) and then it will generate a tarball from the whole content of the working

+ directory named according to Source0 definition present in the associated .spec file.

+ This tarball and the .spec file are then passed to rpmbuild to generate the resulting

+ srpm.

  

  .SH "PACKED VS UNPACKED"

  

+ NOTE: This article relates to deprecated auto_pack feature. You can safely ignore it.

+ 

  While it is quite intuitive what is packed content (.spec + tarballs + patches)

  and what is unpacked content (.spec + original application source files), it

  might be useful to know how exactly rpkg differentiates between these two.
@@ -157,8 +469,8 @@ 

      we have run `git init .` and `git remote add ...`.

  

  .SH "SEE ALSO"

- .UR "https://pagure.io/rpkg-client/"

- .BR "https://pagure.io/rpkg-client/"

+ .UR "https://pagure.io/rpkg-util/"

+ .BR "https://pagure.io/rpkg-util/"

  """

  

  
@@ -231,8 +543,6 @@ 

  

      for command in k:

          cmdparser = choices[command]

-         if not cmdparser.add_help:

-             continue

          usage = cmdparser.format_usage()

          usage = strip_usage(usage)

          usage = ''.join(usage.split('\n'))
@@ -245,8 +555,6 @@ 

      man_file.write('.SH "COMMAND REFERENCE"\n')

      for command in k:

          cmdparser = choices[command]

-         if not cmdparser.add_help:

-             continue

  

          man_file.write('.SS "%s"\n' % cmdparser.prog)

  

file modified
+14 -21
@@ -10,34 +10,29 @@ 

  # option) any later version.  See http://www.gnu.org/copyleft/gpl.html for

  # the full text of the license.

  

- import pyrpkg

- import pyrpkg.cli

  import pyrpkg.utils

  import os

  import sys

  import logging

- from six.moves import configparser

+ import configparser

  import argparse

+ 

  from rpkglib.cli import rpkgClient

  from os.path import expanduser

  

  # Setup an argparser and parse the known commands to get the config file

  parser = argparse.ArgumentParser(add_help=False)

- parser.add_argument('-C', '--config', help='Specify a config file to use. '

-                     'If not specified, ~/.config/rpkg is used and if that '

-                     'does not exists, then /etc/rpkg.conf is tried.')

- 

+ parser.add_argument('-C', '--config', help='Specify a config file to use.'

+                     'If not specified, /etc/rpkg.conf, ~/.config/rpkg, and '

+                     './rpkg.conf are read in this order.')

  (args, other) = parser.parse_known_args()

  

- config_to_use = '/etc/rpkg.conf'

- for custom_config in [args.config, expanduser('~/.config/rpkg')]:

-     if custom_config and os.path.exists(custom_config):

-         config_to_use = custom_config

-         break

- 

  # Setup a configuration object and read config file data

  config = configparser.SafeConfigParser()

- config.read(config_to_use)

+ if args.config:

+     config.read([args.config])

+ else:

+     config.read(['/etc/rpkg.conf', os.path.expanduser('~/.config/rpkg'), './rpkg.conf'])

  

  client = rpkgClient(config)

  client.do_imports('rpkglib')
@@ -65,14 +60,12 @@ 

  else:

      log.setLevel(logging.INFO)

  

- # Run the necessary command

  try:

-     sys.exit(client.args.command())

- except KeyboardInterrupt:

-     pass

+     client.args.command()

  except Exception as e:

-     log.error('Could not execute %s: %s' %

-               (client.args.command.__name__, str(e)))

      if client.args.v:

          raise

-     sys.exit(1)

+     else:

+         log.error(str(e))

+ except KeyboardInterrupt:

+     pass

rpkg-util.spec.rpkg rpkg-client.spec
file renamed
+23 -11
@@ -1,15 +1,12 @@ 

- Name: rpkg-client

- Version: 0.14

+ # vim: syntax=spec

+ Name: {{{ git_name }}}

+ Version: {{{ git_version lead=1 }}}

  Release: 1%{?dist}

- Summary: RPM packaging utitility

+ Summary: RPM packaging utility

  License: GPLv2+

- URL: https://pagure.io/rpkg-client.git

- 

- # How to obtain the sources

- # git clone https://pagure.io/rpkg-client.git

- # cd rpkg-client

- # tito build --tgz

- Source0: %{name}-%{version}.tar.gz

+ URL: https://pagure.io/rpkg-util.git

+ VCS: {{{ git_vcs }}}

+ Source0: {{{ git_pack }}}

  

  BuildArch: noarch

  
@@ -20,7 +17,7 @@ 

  however, does not actually produce rpkg rpm whereas rpkg-client does.

  

  %package -n rpkg

- Summary: RPM packaging utitility

+ Summary: RPM packaging utility

  BuildArch: noarch

  

  BuildRequires: python2
@@ -28,15 +25,28 @@ 

  BuildRequires: python2-devel

  BuildRequires: python2-rpkg

  BuildRequires: python2-mock

+ BuildRequires: python-munch

  

  %if 0%{?rhel}

  BuildRequires: pytest

+ BuildRequires: pyparsing

+ BuildRequires: python-configparser

  %else

  BuildRequires: python2-pytest

+ BuildRequires: python2-pyparsing

+ BuildRequires: python2-configparser

  %endif

  

  Requires: python2-rpkg

  

+ %if 0%{?rhel}

+ Requires: pyparsing

+ Requires: python-configparser

+ %else

+ Requires: python2-pyparsing

+ Requires: python2-configparser

+ %endif

+ 

  %description -n rpkg

  This is an RPM packaging utility based on python-rpkg library.

  It works with both DistGit and standard Git repositories and
@@ -74,6 +84,8 @@ 

  %{_mandir}/*/*

  

  %changelog

+ {{{ git_changelog }}}

+ 

  * Sun Feb 18 2018 clime <clime@redhat.com> 0.14-1

  - fix error when redownloading sources

  - do not invoke parent's module_name in load_ns_module_name

file modified
+6 -1
@@ -1,4 +1,9 @@ 

- [distgit]

+ [rpkg]

+ preprocess_spec = True

+ # auto-packing is deprecated:

+ auto_pack = False

+ 

+ [dist-git]

  lookaside = https://src.fedoraproject.org/repo/pkgs/%(ns1)s/%(pkg)s/%(filename)s/%(hashtype)s/%(hash)s/%(filename)s

  lookaside_cgi = https://src.fedoraproject.org/repo/pkgs/upload.cgi

  gitbaseurl = ssh://%(user)s@pkgs.fedoraproject.org/%(module)s

file modified
+200 -49
@@ -2,6 +2,10 @@ 

  import rpm

  import shutil

  import re

+ import subprocess

+ import tempfile

+ import git

+ import glob

  

  import pyrpkg

  from pyrpkg.utils import cached_property
@@ -9,19 +13,26 @@ 

  from pyrpkg.sources import SourcesFile

  

  from rpkglib.lookaside import CGILookasideCache

+ from rpkglib.preproc import preprocess

  from rpkglib import utils

  

  from exceptions import NotUnpackedException, RpmSpecParseException, NoSourceZeroException

  

+ 

  class Commands(pyrpkg.Commands):

      def __init__(self, *args, **kwargs):

          """Init the object and some configuration details."""

+         self.outdir = kwargs.pop("outdir")

+         self.preprocess = kwargs.pop("preprocess")

+         self.dump_spec_only = False

+         self.version_bump = False

          super(Commands, self).__init__(*args, **kwargs)

          self.source_entry_type = 'bsd'

          self.distgit_namespaced = True

          self.lookaside_namespaced = True

          self._specloc = self.path

          self._ns_module_name = None

+         self._repo_spec = None

  

      def set_specloc(self, specloc):

          if not specloc:
@@ -29,40 +40,55 @@ 

          else:

              self._specloc = specloc

  

-         self.load_spec()

- 

      def load_rpmdefines(self):

-         """Populate rpmdefines"""

-         if os.path.isdir(self._specloc):

-             specdir = self._specloc

-         else:

-             specdir = os.path.dirname(self._specloc)

- 

          self._rpmdefines = [

-             "--define '_sourcedir %s'" % self.path,

-             "--define '_specdir %s'" % specdir,

-             "--define '_builddir %s'" % self.path,

-             "--define '_srcrpmdir %s'" % self.path,

-             "--define '_rpmdir %s'" % self.path,

+             "--define '_sourcedir %s'" % self.outdir,

+             "--define '_specdir %s'" % self.outdir,

+             "--define '_builddir %s'" % self.outdir,

+             "--define '_srcrpmdir %s'" % self.outdir,

+             "--define '_rpmdir %s'" % self.outdir,

          ]

  

-     def load_spec(self):

-         """This sets the spec attribute"""

+     def load_repo(self):

+         """Create a repo object from our path"""

+         self.log.debug('Creating repo object from %s', self.path)

+         try:

+             self._repo = git.Repo(self.path, search_parent_directories=True)

+         except (git.InvalidGitRepositoryError, git.NoSuchPathError):

+             raise rpkgError('%s is not a valid repo' % self.path)

+ 

+     @property

+     def repo_spec(self):

+         if not self._repo_spec:

+             self.load_repo_spec()

+         return self._repo_spec

+ 

+     def load_repo_spec(self):

          if not os.path.isdir(self._specloc):

-             self._spec = os.path.abspath(self._specloc)

+             self._repo_spec = os.path.abspath(self._specloc)

              return

  

-         # Get a list of files in the path we're looking at

          files = os.listdir(self._specloc)

+         spec = None

  

-         # Search the files for the first one that ends with ".spec"

          for f in files:

              if f.endswith('.spec') and not f.startswith('.'):

-                 self._spec = os.path.abspath(os.path.join(self._specloc, f))

-                 return

+                 spec = os.path.abspath(os.path.join(self._specloc, f))

  

-         raise rpkgError('No spec file found.')

+         if self.preprocess:

+             for f in files:

+                 if f.endswith('.spec.rpkg') and not f.startswith('.'):

+                     spec = os.path.abspath(os.path.join(self._specloc, f))

  

+         if not spec:

+             raise rpkgError('No spec file found at {}.'

+                             .format(self._specloc))

+ 

+         self._repo_spec = spec

+ 

+     def load_spec(self):

+         """This sets the spec attribute"""

+         self._spec = self.preprocess_spec(self.repo_spec)

  

      @cached_property

      def lookasidecache(self):
@@ -76,6 +102,10 @@ 

              self.load_ns_module_name()

          return self._ns_module_name

  

+     @ns_module_name.setter

+     def ns_module_name(self, ns_module_name):

+         self._ns_module_name = ns_module_name

+ 

      def load_ns_module_name(self):

          """Loads the namespace module name"""

          try:
@@ -96,44 +126,38 @@ 

          except rpkgError:

              pass

  

-         self.load_nameverrel()

-         if self._module_name_spec:

-             self.log.info('Getting module name from spec file.')

-             self._ns_module_name = self._module_name_spec

-             return

+         self.log.info('Getting module name from spec file.')

+         self._ns_module_name = self.module_name

  

-         raise rpkgError('Could not find current module name.'

-                         ' Use --module-name.')

+         if not self._ns_module_name:

+             raise rpkgError('Could not find current module name.'

+                             ' Use --module-name.')

  

-     def sources(self, outdir=None):

+     def sources(self):

          """Download source files"""

          if not os.path.exists(self.sources_filename):

              return

  

-         # Default to putting the files where the module is

-         if not outdir:

-             outdir = self.path

- 

-         sourcesf = SourcesFile(self.sources_filename, self.source_entry_type)

+         sourcesf = SourcesFile(

+             self.sources_filename, self.source_entry_type)

  

          for entry in sourcesf.entries:

-             outfile = os.path.join(outdir, entry.file)

+             outfile = os.path.join(self.outdir, entry.file)

              self.lookasidecache.download(

                  self.ns_module_name,

                  entry.file, entry.hash, outfile,

                  hashtype=entry.hashtype)

  

-     def srpm(self, outdir=None):

+     def srpm(self):

          """Create an srpm using hashtype from content in the module

  

          Requires sources already downloaded.

          """

- 

-         self.srpmname = os.path.join(self.path, "%s-%s-%s.src.rpm"

+         srpm_path = os.path.join(self.outdir, "%s-%s-%s.src.rpm"

                                       % (self.module_name, self.ver, self.rel))

  

          # See if we need to build the srpm

-         if os.path.exists(self.srpmname):

+         if os.path.exists(srpm_path):

              self.log.debug('Srpm found, rewriting it.')

  

          cmd = ['rpmbuild']
@@ -146,14 +170,52 @@ 

                          % self.hashtype,

                          "--define '_binary_filedigest_algorithm %s'"

                          % self.hashtype])

-         if outdir:

-             cmd.extend(["--define '_srcrpmdir %s'" % outdir])

  

          cmd.extend(['--nodeps', '-bs', self.spec])

          self._run_command(cmd, shell=True)

+         return srpm_path

+ 

+     def lint(self, info=False, rpmlintconf=None):

+         """Run rpmlint over a built srpm

+ 

+         Log the output and returns nothing

+         rpmlintconf is the name of the config file passed to rpmlint if

+         specified by the command line argument.

+         """

+ 

+         # Check for srpm

+         srpm = "%s-%s-%s.src.rpm" % (self.module_name, self.ver, self.rel)

+         if not os.path.exists(os.path.join(self.outdir, srpm)):

+             self.log.warning('No srpm found')

+ 

+         # Get the possible built arches

+         arches = set(self._get_build_arches_from_spec())

+         rpms = set()

+         for arch in arches:

+             if os.path.exists(os.path.join(self.outdir, arch)):

+                 # For each available arch folder, lists file and keep

+                 # those ending with .rpm

+                 rpms.update(glob.glob(os.path.join(self.outdir, arch, '*.rpm')))

+         if not rpms:

+             self.log.warning('No rpm found')

+         cmd = ['rpmlint']

+         if info:

+             cmd.extend(['-i'])

+         if rpmlintconf:

+             cmd.extend(["-f", os.path.join(self.path, rpmlintconf)])

+         elif os.path.exists(os.path.join(self.path, ".rpmlint")):

+             cmd.extend(["-f", os.path.join(self.path, ".rpmlint")])

+         cmd.append(os.path.join(self.outdir, self.spec))

+         if os.path.exists(os.path.join(self.outdir, srpm)):

+             cmd.append(os.path.join(self.outdir, srpm))

+         cmd.extend(sorted(rpms))

+         # Run the command

+         self._run_command(cmd, shell=True)

  

      def is_unpacked(self, dirpath, rpm_sources):

          """

+         @deprecated

+ 

          Decide, whether we are dealing with "unpacked"

          or "packed" type of source content at the

          given dirpath.
@@ -202,13 +264,15 @@ 

          ignored_file_filter = lambda f: not re.search(

              ignore_file_regex, f, re.IGNORECASE)

  

-         if not list(filter(ignored_file_filter, os.listdir(dirpath))):

+         if not list(filter(ignored_file_filter, os.listdir(self.path))):

              return False

  

          return True

  

-     def make_source(self, destdir=None):

+     def make_source(self):

          """

+         @deprecated

+ 

          Create source mentioned according to Source0 spec

          directive from an unpacked repository. Does nothing

          on a packed repo.
@@ -230,26 +294,23 @@ 

          The behaviour is the same as if you called rpmbuild

          directly in your system.

  

-         :param str destdir: where to put the generated sources

- 

          :returns path to the packed archive (alias Source0)

          """

          ts = rpm.ts()

          try:

-             rpm.addMacro("_sourcedir", self.path)

+             rpm.addMacro("_sourcedir", self.outdir)

              rpm_spec = ts.parseSpec(self.spec)

          except ValueError as e:

              raise RpmSpecParseException(str(e))

  

-         if not self.is_unpacked(self.path, rpm_spec.sources):

+         if not self.is_unpacked(self.outdir, rpm_spec.sources):

              raise NotUnpackedException("Not an unpacked content.")

  

          source_zero_name = utils.find_source_zero(rpm_spec.sources)

          if not source_zero_name:

              raise NoSourceZeroException("Source zero not found")

  

-         target_source_path = os.path.join(

-             destdir or self.path, source_zero_name)

+         target_source_path = os.path.join(self.outdir, source_zero_name)

  

          name = rpm.expandMacro("%{name}")

          version = rpm.expandMacro("%{version}")
@@ -263,3 +324,93 @@ 

          )

          self.log.info('Wrote: {}'.format(target_source_path))

          return target_source_path

+ 

+     def preprocess_spec(self, spec_templ):

+         out_spec_basename = os.path.basename(

+             spec_templ[:-5] if spec_templ.endswith('.rpkg') else spec_templ)

+ 

+         out_spec_path = os.path.join(self.outdir, out_spec_basename)

+ 

+         if self.preprocess:

+             preprocess(self.path, spec_templ, out_spec_path,

+                        self.log, self.dump_spec_only, self.version_bump)

+         else:

+             shutil.copy(spec_templ, out_spec_path)

+ 

+         self.log.info('Wrote: {}'.format(out_spec_path))

+         return out_spec_path

+ 

+     @property

+     def module_name(self):

+         """This property ensures the name attribute"""

+         if not self._module_name_spec:

+             self.load_nameverrel()

+         return self._module_name_spec

+ 

+     def add_tag(self, tagname, force=False, message=None, file=None):

+         """Add a git tag to the repository

+ 

+         Takes a tagname

+ 

+         Optionally can force the tag, include a message,

+         or reference a message file.

+ 

+         Runs the tag command and returns nothing

+         """

+         if not re.match(r'^.*-[^-]+-[^-]+$', tagname) and not force:

+             raise rpkgError("Tag {} does not have n-v-r format.".format(tagname))

+ 

+         if tagname in self.repo.tags and not force:

+             raise rpkgError("Tag {} already exists.".format(tagname))

+ 

+         if not message and not file:

+             message = self.get_tag_message(tagname)

+ 

+         cmd = ['git', 'tag', '-a']

+ 

+         if force:

+             cmd.extend(['-f'])

+         if message:

+             cmd.extend(['-m', message])

+         elif file:

+             cmd.extend(['-F', os.path.abspath(file)])

+ 

+         cmd.append(tagname)

+         utils.run_command(cmd, cwd=self.path)

+         self.log.info('Created tag: %s', tagname)

+ 

+         self.version_bump = False

+         self.load_spec()

+ 

+     def get_tag_message(self, new_tagname):

+         tag_pattern = '{}*'.format(self.module_name)

+ 

+         tagnames = self.repo.git.tag(

+             '--list', '--sort=-taggerdate:unix', tag_pattern,

+             '--merged').split()

+ 

+         last_matching_tagname = None

+         for tagname in tagnames:

+             expr = r'^{}-[^-]+-[^-]+$'.format(self.module_name)

+             if re.match(expr, tagname):

+                 last_matching_tagname = tagname

+                 break

+ 

+         if last_matching_tagname:

+             rev_list_expr = '{}..HEAD'.format(last_matching_tagname)

+         else:

+             rev_list_expr = 'HEAD'

+ 

+         entries = [utils.get_changelog_entry(commit.message)

+                    for commit in self.repo.iter_commits(rev_list_expr)]

+ 

+         editor = self.repo.git.var('GIT_EDITOR')

+         subject = "Commits: {0}".format(rev_list_expr)

+ 

+         help_text = ("#\n"

+         "# Write a changelog for tag:\n"

+         "#   " + new_tagname + "\n"

+         "# Lines starting with '#' will be ignored.\n")

+ 

+         body = utils.edit(editor, entries, help_text)

+         return '{0}\n\n{1}'.format(subject, body)

file modified
+141 -117
@@ -1,42 +1,53 @@ 

+ from __future__ import print_function

+ 

  import argparse

  import os

  import rpm

+ import sys

  

  from pyrpkg.cli import cliClient

  from pyrpkg import utils

  

  from exceptions import NotUnpackedException, RpmSpecParseException

  

+ DEFAULT_OUTDIR = "/tmp/rpkg/"

+ 

  class rpkgClient(cliClient):

      def __init__(self, config, name=None):

          self.DEFAULT_CLI_NAME = 'rpkg'

+ 

+         if not os.path.isdir(DEFAULT_OUTDIR):

+             os.makedirs(DEFAULT_OUTDIR)

+ 

+         if config:

+             self.auto_pack = config['rpkg'].getboolean('auto_pack', False)

+         else:

+             self.auto_pack = False

+ 

          super(rpkgClient, self).__init__(config, name)

  

      def setup_argparser(self):

          """Setup the argument parser and register some basic commands."""

+         self.rpm_spec_parser = argparse.ArgumentParser(add_help=False)

+         self.rpm_spec_parser.add_argument('--outdir', action='store', default=DEFAULT_OUTDIR,

+                                           help='Where to put generated or downloaded rpm content.')

+         self.rpm_spec_parser.add_argument('--spec', action='store', default=None,

+                                           help='An input spec template. If not given, '

+                                           'the spec template is auto-located in path as a '

+                                           'file ending with ".spec.rpkg" or ".spec" suffix '

+                                           'in this order.')

  

          self.parser = argparse.ArgumentParser(

-             prog=self.name,

-             epilog='For detailed help pass --help to a target')

- 

-         # Add some basic arguments that should be used by all.

-         # Add a config file

-         self.parser.add_argument('--config', '-C',

-                                  default=None,

-                                  help='Specify a config file to use')

-         # Allow forcing the package name

+             prog=self.name, epilog='For detailed help pass --help to a target')

+ 

          self.parser.add_argument('--module-name',

-                                  help='Override the module name. Otherwise'

-                                       ' it is discovered from: Git push URL'

-                                       ' or Git URL. ')

-         # Override the  discovered user name

+                                  help='Override the module name. Otherwise '

+                                  'it is discovered from: Git push URL '

+                                  'or Git URL.')

          self.parser.add_argument('--user', default=None,

                                   help='Override the discovered user name')

-         # Let the user define a path to work in rather than cwd

-         self.parser.add_argument('--path', default=None,

-                                  type=utils.u,

-                                  help='Define the directory to work in '

-                                  '(defaults to cwd)')

+         self.parser.add_argument('--path', action='store', default=None, type=utils.u,

+                                  help='Define the directory to work in (defaults to cwd)')

          # Verbosity

          self.parser.add_argument('--verbose', '-v', dest='v',

                                   action='store_true',
@@ -63,9 +74,9 @@ 

          self.register_clean()

          self.register_clog()

          self.register_clone()

-         self.register_copr_build()

          self.register_commit()

          self.register_compile()

+         self.register_copr_build()

          self.register_diff()

          self.register_gimmespec()

          self.register_giturl()
@@ -81,6 +92,7 @@ 

          self.register_pull()

          self.register_push()

          self.register_sources()

+         self.register_spec()

          self.register_srpm()

          self.register_switch_branch()

          self.register_tag()
@@ -89,11 +101,29 @@ 

          self.register_verify_files()

          self.register_verrel()

  

+         self.extend_subparsers()

+ 

+     def extend_subparsers(self):

+         cmds = set(['make-source', 'clean', 'clog', 'clone', 'commit',

+                     'compile', 'copr-build', 'diff', 'gimmespec', 'giturl',

+                     'import', 'install', 'is-packed', 'lint', 'local',

+                     'new', 'new-sources', 'patch', 'prep', 'pull', 'push',

+                     'sources', 'spec', 'srpm', 'switch-branch', 'tag',

+                     'unused-patches', 'upload', 'verify-files', 'verrel'])

+ 

+         spec_parse_cmds = cmds - set(['clean', 'clone', 'commit', 'diff',

+                                       'import', 'new', 'switch-branch'])

+ 

+         for spec_parse_cmd in spec_parse_cmds:

+             self.subparsers.add_parser(name=spec_parse_cmd, add_help=False,

+                 description=self.subparsers.choices[spec_parse_cmd].description,

+                 parents=[self.subparsers.choices[spec_parse_cmd], self.rpm_spec_parser])

+ 

      def load_cmd(self):

          """This sets up the cmd object"""

  

          # load items from the config file

-         items = dict(self.config.items('distgit', raw=True))

+         items = dict(self.config.items('dist-git', raw=True))

  

          # Read comma separated list of kerberos realms

          realms = [realm
@@ -112,68 +142,72 @@ 

                                         build_client=None,

                                         user=self.args.user,

                                         quiet=self.args.q,

-                                        realms=realms

-                                        )

+                                        realms=realms,

+                                        outdir=getattr(self.args, 'outdir', None),

+                                        preprocess=items.get('preprocess_spec', True))

  

-         self._cmd.module_name = self.args.module_name

+         self._cmd.ns_module_name = self.args.module_name

          self._cmd.debug = self.args.debug

          self._cmd.verbose = self.args.v

          self._cmd.clone_config = items.get('clone_config')

+         self._cmd.set_specloc(getattr(self.args, 'spec', None))

  

-     def register_make_source(self):

-         make_source_parser = self.subparsers.add_parser(

-             'make-source', help='Create Source0 from the '

-             'content of the current working directory '

-             'after downloading any external sources. '

-             'The content must be of unpacked type.',

-             description='Puts content of the current '

-             'working directory into a gzip-compressed archive named '

-             'according to Source0 filename as specfied in the .spec file. '

-             'The content must be of unpacked type, otherwise no action is taken. '

-             'Unpacked content is such that it contains a .spec file '

-             'that references no present source or patch '

-             '(typically it contains only Source0 being '

-             'generated automatically) and there is at least '

-             'one file not in the list of ignored content (README, '

-             'README.md, sources, LICENSE, tito.props, hidden files, '

-             '.spec file). Note that by invoking this command '

-             'with --outdir ./, the directory content becomes '

-             '"packed".')

-         make_source_parser.add_argument(

-             '--spec', action='store', default=None,

-             help='Path to the spec file or directory where the '

-             'spec file can be found. By default .spec file '

-             'is autodiscovered in the working directory.')

-         make_source_parser.add_argument(

-             '--outdir', default=os.getcwd(),

-             help='Where to put the generated source. '

-             'By default cwd.')

-         make_source_parser.set_defaults(command=self.make_source)

+     def clog(self):

+         self.cmd.dump_spec_only = True

+         self.cmd.clog(raw=self.args.raw)

  

      def tag(self):

+         self.cmd.dump_spec_only = True

+         if not self.args.tag:

+             self.cmd.version_bump = True

          self.cmd._rpmdefines = self.cmd.rpmdefines + ["--define 'dist %nil'"]

          super(rpkgClient, self).tag()

  

+     def lint(self):

+         self.cmd.dump_spec_only = True

+         self.cmd.lint(self.args.info, self.args.rpmlintconf)

+ 

+     def verrel(self):

+         self.cmd.dump_spec_only = True

+         super(rpkgClient, self).verrel()

+ 

      def make_source(self):

+         print('This function is deprecated and will be removed in a future release.', file=sys.stderr)

          self.cmd.sources()

-         self.cmd.set_specloc(self.args.spec)

-         self.cmd.make_source(self.args.outdir)

+         self.cmd.make_source()

  

      def srpm(self):

          self.cmd.sources()

-         self.cmd.set_specloc(self.args.spec)

-         try:

-             self.cmd.make_source()

-         except NotUnpackedException:

-             pass

-         self.cmd.srpm(self.args.outdir)

+         if self.auto_pack:

+             try:

+                 self.cmd.make_source()

+             except NotUnpackedException:

+                 pass

+             else:

+                 print('Auto-packing is deprecated and will be removed in a future release.', file=sys.stderr)

+         return self.cmd.srpm()

+ 

+     def gimmespec(self):

+         print(self.cmd.repo_spec)

+ 

+     def spec(self):

+         if not self.args.sources:

+             self.cmd.dump_spec_only = True

+         self.cmd.load_spec()

+ 

+     def sources(self):

+         self.cmd.sources()

  

      def copr_build(self):

-         self.args.outdir = None

-         super(rpkgClient, self).copr_build()

+         srpm_path = self.srpm()

+         self.cmd.copr_build(self.args.project[0],

+                             srpm_path,

+                             self.args.nowait,

+                             self.args.copr_config)

  

      def is_packed(self):

-         self.cmd.set_specloc(self.args.spec)

+         print('This function is deprecated and will be removed in a future release.', file=sys.stderr)

+         self.cmd.dump_spec_only = True

          ts = rpm.ts()

          try:

              rpm.addMacro("_sourcedir", self.cmd.path)
@@ -181,69 +215,59 @@ 

          except ValueError as e:

              raise RpmSpecParseException(str(e))

  

-         if self.cmd.is_unpacked(self.cmd.path, rpm_spec.sources):

+         if self.cmd.is_unpacked(self.cmd.outdir, rpm_spec.sources):

              self.log.info('No')

          else:

              self.log.info('Yes')

  

-     def register_srpm(self):

-         """Register the srpm target"""

-         srpm_parser = self.subparsers.add_parser(

-             'srpm', help='Create a source rpm',

-             description='Create a source rpm out of '

-             'packed or unpacked content. See '

-             'make-sources for the description of the '

-             'two content types and their recognition.')

-         srpm_parser.add_argument(

-             '--spec', action='store', default=None,

-             help='Path to the spec file or directory where the '

-             'spec file can be found. By default .spec file '

-             'is autodiscovered in the working directory.')

-         srpm_parser.add_argument(

-             '--outdir', default=os.getcwd(),

-             help='Where to put the generated srpm.')

-         srpm_parser.set_defaults(command=self.srpm)

+     def register_make_source(self):

+         make_source_parser = self.subparsers.add_parser(

+             name='make-source', help='Deprecated. Create Source0 from the '

+             'content of the current working directory '

+             'after downloading any external sources. '

+             'The content must be of unpacked type.',

+             description='Deprecated. Puts content of the current '

+             'working directory into a gzip-compressed archive named '

+             'according to Source0 filename as specfied in the .spec file. '

+             'The content must be of unpacked type, otherwise no action is taken. '

+             'Unpacked content is such that it contains a .spec file '

+             'that references no present source or patch '

+             '(typically it contains only Source0 being '

+             'generated automatically) and there is at least '

+             'one file not in the list of ignored content (README, '

+             'README.md, sources, LICENSE, tito.props, hidden files, '

+             '.spec file). Note that by invoking this command '

+             'with --outdir ./, the directory content becomes '

+             '"packed".')

+         make_source_parser.set_defaults(command=self.make_source)

+ 

+     def register_spec(self):

+         """Register the spec target"""

+         spec_parser = self.subparsers.add_parser(

+             name='spec', help='Generate spec file from a spec template',

+             description='Preprocess a given spec template '

+             'and put the resulting spec file into outdir. '

+             'The spec template is simply copied into the outdir if '

+             'spec preprocessing is turned off or if the input spec template '

+             'does not contain any preprocessor macros.')

+         spec_parser.add_argument(

+             '--sources', action='store_true', default=False,

+             help='Enable source generation by the input '

+             'spec template. By default disabled.')

+         spec_parser.set_defaults(command=self.spec)

  

      def register_is_packed(self):

          """Determine whether the package content is packed or not"""

          is_packed_parser = self.subparsers.add_parser(

-             'is-packed', help='Tell user whether content is packed',

-             description='Determine whether the package content '

+             name='is-packed', help='Deprecated. Tell user whether content is packed',

+             description='Deprecated. Determine whether the package content '

              'in the working directory is packed or unpacked '

              'and print that information to the screen.')

-         is_packed_parser.add_argument(

-             '--spec', action='store', default=None,

-             help='Path to an alternative spec file or to directory '

-             'where the spec file can be found. Note that '

-             'whether the content is packed on unpacked depends '

-             'on Source and Patch definitions in the spec '

-             'file as well as on the actual content in the '

-             'working directory.')

          is_packed_parser.set_defaults(command=self.is_packed)

  

-     def register_copr_build(self):

-         """Register the copr-build target"""

-         copr_parser = self.subparsers.add_parser(

-             'copr-build', help='Build package in COPR',

-             formatter_class=argparse.RawDescriptionHelpFormatter,

-             description="""

-             Build package in COPR.

- 

-             Note: you need to have set up correct api key. For more information

-             see API KEY section of copr-cli(1) man page.

-             """)

-         copr_parser.add_argument(

-             '--spec', action='store', default=None,

-             help='Path to the spec file or directory where the '

-             'spec file can be found. By default .spec file '

-             'is autodiscovered.')

-         copr_parser.add_argument(

-             '--config', required=False,

-             metavar='CONFIG', dest='copr_config',

-             help="Path to an alternative Copr configuration file")

-         copr_parser.add_argument(

-             '--nowait', action='store_true', default=False,

-             help="Don't wait on build")

-         copr_parser.add_argument(

-             'project', nargs=1, help='Name of the project in format USER/PROJECT')

-         copr_parser.set_defaults(command=self.copr_build)

+     def register_sources(self):

+         """Register the sources target"""

+         sources_parser = self.subparsers.add_parser(

+             'sources', help='Download source files',

+             description='Download source files')

+         sources_parser.set_defaults(command=self.sources)

file modified
-3
@@ -7,6 +7,3 @@ 

  

  class NoSourceZeroException(Exception):

      pass

- 

- class SourceArchiveAlreadyExists(Exception):

-     pass

file added
+96
@@ -0,0 +1,96 @@ 

+ import os

+ import subprocess

+ import tempfile

+ import re

+ 

+ from pyrpkg.errors import rpkgError

+ from pyparsing import Combine, CharsNotIn, Regex, ZeroOrMore, Group, Suppress, Literal

+ 

+ setup_path = os.path.join(

+     os.path.dirname(__file__), 'preproc', 'setup')

+ 

+ 

+ def log_line_strip(line):

+     return re.sub(r'(DEBUG|INFO|ERROR):\s*(.*)\s*', r'\2', line)

+ 

+ 

+ def invoke_wrapper(cwd, input_path, outdir, version_bump, env_store_name, app_log, break_on_failure):

+     version_bump = str(version_bump) if version_bump else ''

+ 

+     def invoke(tokens):

+         retval = ""

+         for token in tokens:

+             cmd = ['/bin/bash', '-c' , '. {}; {};'.format(setup_path, token)]

+ 

+             env = {

+                 'OUTDIR': outdir,

+                 'VERSION_BUMP': version_bump,

+                 'INPUT_PATH': input_path,

+                 'ENV_STORE': env_store_name,

+             }

+             p = subprocess.Popen(cmd, env=env, cwd=cwd,

+                                  stderr=subprocess.PIPE,

+                                  stdout=subprocess.PIPE)

+ 

+             app_log.debug('> {}'.format(token))

+             app_log.debug('> cwd: {}'.format(cwd))

+             app_log.debug('> env: {}'.format(env))

+ 

+             (stdout, stderr) = p.communicate()

+ 

+             for line in stderr.split('\n'):

+                 if not line:

+                     continue

+ 

+                 if line.startswith('DEBUG:'):

+                     log_func = app_log.debug

+                 elif line.startswith('INFO:'):

+                     log_func = app_log.info

+                 else:

+                     log_func = app_log.error

+ 

+                 stripped_line = log_line_strip(line)

+                 log_func(stripped_line)

+ 

+             if p.returncode != 0:

+                 error_msg = "{} failed with value {}".format(

+                     token, p.returncode)

+ 

+                 if break_on_failure:

+                     raise rpkgError(error_msg)

+ 

+                 app_log.error(error_msg)

+ 

+             app_log.debug('---')

+             retval += '\n' if retval else ''

+             retval += stdout

+ 

+         return retval

+     return invoke

+ 

+ 

+ def get_parse_expr():

+     opener, closer = '{{{', '}}}'

+     nonquoted = ~Literal(opener) + ~Literal(closer) + CharsNotIn('\n', exact=1)

+     quoted = Regex(r'".*"') ^ Regex(r"'.*'")

+     content = Combine(ZeroOrMore(nonquoted^quoted)).setParseAction(lambda t:t[0].strip())

+     return Suppress(opener) + content + Suppress(closer)

+ 

+ 

+ def preprocess(path, input_path, output_path, app_log, dump_spec_only=False, version_bump=False, break_on_failure=True):

+     outdir = os.path.dirname(output_path) if not dump_spec_only else ''

+     env_store_file = tempfile.NamedTemporaryFile(delete=False)

+ 

+     with open(input_path, 'r') as f:

+         in_data = f.read()

+ 

+         expr = get_parse_expr().setParseAction(invoke_wrapper(

+             path, input_path, outdir, version_bump, env_store_file.name, app_log, break_on_failure))

+         out_data = expr.transformString(in_data)

+ 

+         outfile = open(output_path, 'w')

+         outfile.write(out_data)

+         outfile.close()

+ 

+     env_store_file.close()

+     os.unlink(env_store_file.name)

file added
+384
@@ -0,0 +1,384 @@ 

+ #!/bin/bash

+ 

+ export SCRIPTDIR="$(builtin cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

+ 

+ declare -Ax __cached

+ 

+ ############## HELPER FUNCTIONS ##############

+ 

+ function encode_decimal {

+     radixdigits=({a..z} {0..9})

+     x="$1"

+     result=

+     while [ "$x" -gt 0 ]; do

+         div=$(($x/${#radixdigits[@]}))

+         mod=$(($x-$div*${#radixdigits[@]}))

+         result="${radixdigits[$mod]}${result}"

+         x="$div"

+     done

+     echo -n "$result"

+ }

+ 

+ function git_latest_ctime {

+     mapfile -t files < <(git status --porcelain | cut -c 4- | sed -E -e 's|(.*) -> (.*)|\1\n\2|')

+     latest_ctime=0

+     for f in "${files[@]}"; do

+         if [ -e "$(git rev-parse --show-toplevel)/$f" ]; then

+             ctime=$(stat --format='%Z' "$(git rev-parse --show-toplevel)/$f")

+             if [ "$ctime" -gt "$latest_ctime" ]; then

+                 latest_ctime="$ctime"

+             fi

+         fi

+     done

+     echo -n "$latest_ctime"

+ }

+ 

+ function name_convert {

+     sed -e 's|/|-|g' -e 's|-$||'

+ }

+ 

+ function filter_tags {

+     grep -E "^$1-[^-]+-[^-]+$"

+ }

+ 

+ function output {

+     __cached["${FUNCNAME[1]}"]="$*"

+     echo -n "${__cached[${FUNCNAME[1]}]}"

+ }

+ 

+ function cached {

+     if [ -n "${__cached[$1]}" ]; then

+         echo -n "${__cached[$1]}"

+     fi

+ }

+ 

+ function log_debug {

+     log "DEBUG" "$@"

+ }

+ 

+ function log_info {

+     log "INFO" "$@"

+ }

+ 

+ function log_error {

+     log "ERROR" "$@"

+ }

+ 

+ function log {

+     PREFIX=$1

+     shift

+ 

+     regexp="^\s*$"

+     if [[ "$*" =~ $regexp ]]; then

+         return

+     fi

+ 

+     if [ "${FUNCNAME[-1]}" != "main" ]; then

+         echo "$PREFIX: ${FUNCNAME[-1]}: $*"

+     else

+         echo "$PREFIX: ${FUNCNAME[-2]}: $*"

+     fi > /dev/stderr

+ }

+ 

+ function cached_name_version {

+     echo -n "$(cached git_name)-$(cached git_version)"

+ }

+ 

+ ############## REPO FUNCTIONS ##############

+ 

+ function git_name {

+     declare name= prepend= append= "$@"

+ 

+     if [ -n "$name" ]; then

+         output "${prepend}${name}${append}"

+         return

+     fi

+ 

+     url="$(git config --get remote.origin.url)"

+ 

+     if [ -z "$url" ]; then

+         log_error "Start by setting origin URL."

+         return 1

+     fi

+ 

+     url_last_part="$(basename "$url")"

+     name="${url_last_part%.git}"

+ 

+     output "${prepend}${name}${append}"

+ }

+ 

+ function git_bumped_version {

+     declare lead=0 follow= latest_tag_version= "$@"

+ 

+     if [ -n "$follow" ]; then

+         echo -n "$lead.$follow"

+         return

+     fi

+ 

+     follow="$(echo "$latest_tag_version" | sed -E -n "s/^$lead\.([^.]*)$/\1/p")"

+ 

+     if [ -z "$follow" ] && [ "$lead" -ne 0 ]; then

+         echo -n "$lead.0"

+         return

+     fi

+ 

+     if echo "$follow" | grep -q '[^0-9]'; then

+         log_error "$follow is not a number. Please, bump version manually."

+         return 1

+     fi

+ 

+     bumped_follow=$(( $follow + 1 ))

+     echo -n "$lead.$bumped_follow"

+ }

+ 

+ function git_version {

+     declare name="$(cached git_name)" lead=0 follow= "$@"

+ 

+     if [ -z "$name" ]; then

+         log_error "name cannot be empty."

+         return 1

+     fi

+ 

+     if echo "$lead.$follow" | grep -q '-'; then

+         log_error "lead and follow cannot contain dashes."

+         return 1

+     fi

+ 

+     if echo "$follow" | grep -q '\.'; then

+         log_error "follow cannot contain dots."

+         return 1

+     fi

+     

+     mapfile -t tags < <(git tag --list --sort=taggerdate:unix "$name*" --merged 2> /dev/null | filter_tags "$name")

+ 

+     if [ ${#tags[@]} -gt 0 ]; then

+         latest_tag="${tags[-1]}"

+         latest_tag_version="$(echo $latest_tag | sed -E -n "s/^$name-([^-]+)-[^-]+$/\1/p")"

+     else

+         latest_tag=

+         latest_tag_version=

+     fi

+ 

+     if [ -n "$VERSION_BUMP" ]; then

+         version="$(git_bumped_version lead="$lead" follow="$follow" latest_tag_version="$latest_tag_version")"

+ 

+         retcode=$?

+         if [ $retcode -ne 0 ]; then

+             return $retcode

+         fi

+ 

+         output "$version"

+         return

+     fi

+ 

+     if [ -n "$latest_tag" ]; then

+         commit_count="$(git rev-list $latest_tag..HEAD --count)"

+     else

+         commit_count="$(git rev-list HEAD --count 2> /dev/null || printf 0)"

+     fi

+ 

+     if [ "$commit_count" -eq 0 ]; then

+         commit_count_appendix=

+     else

+         commit_count_appendix=".git.$commit_count.$(git rev-parse --short HEAD)"

+     fi

+ 

+     latest_ctime="$(git_latest_ctime)"

+     if [ "$latest_ctime" -eq 0 ]; then

+         wtree_appendix=

+     else

+         wtree_appendix=".wtree.$(encode_decimal "$latest_ctime")"

+     fi

+ 

+     if [ -z "$follow" ]; then

+         follow="$(echo "$latest_tag_version" | sed -E -n "s/^$lead\.([^.]*)$/\1/p")"

+     fi

+ 

+     output "${lead}.${follow:-0}${commit_count_appendix}${wtree_appendix}"

+ }

+ 

+ function git_vcs {

+     declare subtree= "$@"

+ 

+     url="$(git config --get remote.origin.url)"

+ 

+     if [ -z "$url" ]; then

+         log_error "Start by setting origin URL."

+         return 1

+     fi

+ 

+     ref="$(git rev-parse HEAD 2> /dev/null)"

+ 

+     if [ -n "$ref" ]; then

+         treeish_suffix="#$ref:$subtree"

+     else

+         treeish_suffix=

+     fi

+ 

+     output "git+${url}${treeish_suffix}"

+ }

+ 

+ function git_pack {

+     declare path="$(git rev-parse --show-toplevel)" dir_name="$(cached_name_version)" source_name="$(cached_name_version).tar.gz" "$@"

+ 

+     if [ -z "$OUTDIR" ]; then

+         log_debug "OUTDIR is not set. No action taken."

+         output "$source_name"

+         return

+     fi

+ 

+     cmd_stdout="$($SCRIPTDIR/scripts/pack_sources.sh "$path" "$dir_name" "$OUTDIR/$source_name")"

+     cmd_retcode=$?

+ 

+     log_debug "$cmd_stdout"

+ 

+     if [ $cmd_retcode -eq 0 ]; then

+         log_info "Wrote: $OUTDIR/$source_name"

+     else

+         log_error "Error during source creation."

+         return $cmd_retcode

+     fi

+ 

+     output "$source_name"

+ }

+ 

+ function git_archive {

+     declare path="$(git rev-parse --show-toplevel)" dir_name="$(cached_name_version)" source_name="$(cached_name_version).tar.gz" "$@"

+ 

+     if [ -z "$OUTDIR" ]; then

+         log_debug "OUTDIR is not set. No action taken."

+         output "$source_name"

+         return

+     fi

+ 

+     if ! git rev-parse HEAD &> /dev/null; then

+         log_error "No commits yet. Cannot archive the content."

+         return 1

+     fi

+ 

+     if [ "$(git status --porcelain)" ]; then

+         log_error "Your working tree is dirty. Commit first."

+         return 2

+     fi

+ 

+     cmd_stdout="$(git -C "$path" archive --prefix="$dir_name/" -o "$OUTDIR/$source_name" HEAD)"

+     cmd_retcode=$?

+ 

+     log_debug "$cmd_stdout"

+ 

+     if [ $cmd_retcode -eq 0 ]; then

+         log_info "Wrote: $OUTDIR/$source_name"

+     else

+         log_error "Error during source creation."

+         return $cmd_retcode

+     fi

+ 

+     output "$source_name"

+ }

+ 

+ function git_setup_macro {

+     declare dir_name="$(cached_name_version)" "$@"

+     output "%setup -q -n $dir_name"

+ }

+ 

+ function git_changelog {

+     declare name="$(cached git_name)" since_tag= until_tag= header_locale=POSIX header_date_format="%a %b %d %Y" body_wrap=80 "$@"

+ 

+     mapfile -t tags < <(git tag --list --sort=-taggerdate:unix "$name*" --merged 2> /dev/null | filter_tags "$name")

+ 

+     if [ -n "$header_date_format" ]; then

+         header_date_format_suffix=":format:$header_date_format"

+     else

+         header_date_format_suffix=

+     fi

+ 

+     changelog=

+     until_tag_hit=

+     for tag in "${tags[@]}"; do

+         if [ -n "$until_tag" ] && [ -z "$until_tag_hit" ] && [ "$until_tag" != "$tag" ]; then

+             continue

+         fi

+         until_tag_hit=1

+ 

+         data="$(git tag -l "$tag" --format='%(body)')"

+         if [ -z "$data" ]; then

+             log_debug "Skipping $tag with empty body."

+             continue

+         fi

+ 

+         verrel="$(echo "$tag" | sed -E -n "s/^$name-([^-]+)(-[^-]+)$/\1\2/p")"

+         header="$(LC_ALL="$header_locale" git tag -l "$tag" --format="* %(taggerdate$header_date_format_suffix) %(taggername) %(taggeremail)") $verrel"

+         if [ -n "$changelog" ]; then

+             changelog="$changelog"$'\n\n'

+         fi

+ 

+         formatted_data="$(echo "$data" | fold -cs --width="$body_wrap" | sed -E -e 's/(\s+)%([^%])/\1%%\2/g' -e 's/\s*$//')"

+         changelog="${changelog}${header}"$'\n'"${formatted_data}"

+ 

+         if [ "$since_tag" = "$tag" ]; then

+             break

+         fi

+     done

+ 

+     output "$changelog"

+ }

+ 

+ ############## DIR FUNCTIONS ##############

+ 

+ function git_dir_name {

+     git_name append="-$(git -C "$(dirname "$INPUT_PATH")" rev-parse --show-prefix | name_convert)" "$@"

+ }

+ 

+ function git_dir_version {

+     git_version "$@"

+ }

+ 

+ function git_dir_vcs {

+     git_vcs subtree="$(git -C "$(dirname "$INPUT_PATH")" rev-parse --show-prefix)" "$@"

+ }

+ 

+ function git_dir_pack {

+     git_pack path="$(dirname "$INPUT_PATH")" "$@"

+ }

+ 

+ function git_dir_archive {

+     git_archive path="$(dirname "$INPUT_PATH")" "$@"

+ }

+ 

+ function git_dir_setup_macro {

+     git_setup_macro "$@"

+ }

+ 

+ function git_dir_changelog {

+     git_changelog "$@"

+ }

+ 

+ ############## CURRENT WORKING DIR FUNCTIONS ##############

+ 

+ function git_cwd_name {

+     git_name append="-$(git -C "$(pwd)" rev-parse --show-prefix | name_convert)" "$@"

+ }

+ 

+ function git_cwd_version {

+     git_version "$@"

+ }

+ 

+ function git_cwd_vcs {

+     git_vcs subtree="$(git -C "$(pwd)" rev-parse --show-prefix)" "$@"

+ }

+ 

+ function git_cwd_pack {

+     git_pack path="$(pwd)" "$@"

+ }

+ 

+ function git_cwd_archive {

+     git_archive path="$(pwd)" "$@"

+ }

+ 

+ function git_cwd_setup_macro {

+     git_setup_macro "$@"

+ }

+ 

+ function git_cwd_changelog {

+     git_changelog "$@"

+ }

@@ -0,0 +1,61 @@ 

+ #!/bin/bash

+ 

+ # Creates a tarball out of content at the specified directory path.

+ 

+ usage() {

+     cat <<EOF

+ Usage:

+     $0 [--include-vcs] [--include-vcs-ignores] path dir_name source_name

+ 

+     Creates a compressed tarball out of the

+     specified path content. Uses tar to do the job.

+     By default, omits any VCS-specific files

+     as well as files mentioned in a VCS-ignore file.

+ 

+ Options:

+     -h, --help             Print help

+     --include-vcs          Include version control system directories. By default excluded.

+     --include-vcs-ignores  Include files that match patterns present in VCS-specific ignore file. By default excluded.

+ 

+ Arguments:

+     path                   Path to the content that should be packed.

+     dir_name               Name of the directory in the created tarball.

+     source_name            Name of the resulting tarball file.

+ EOF

+ }

+ 

+ CONTENT_PATH=""

+ DIR_NAME=""

+ SOURCE_NAME=""

+ EXCLUDE_VCS="--exclude-vcs"

+ EXCLUDE_VCS_IGNORES="--exclude-vcs-ignores"

+ 

+ while [ -n "$1" ] ; do

+     case "$1" in

+     -h|--help)

+         usage

+         exit 0

+         ;;

+     --include-vcs)

+         EXCLUDE_VCS=""

+         ;;

+     --include-vcs-ignores)

+         EXCLUDE_VCS_IGNORES=""

+         ;;

+     *)

+         CONTENT_PATH="$1"

+         shift

+         DIR_NAME="$1"

+         shift

+         SOURCE_NAME="$1"

+         ;;

+     esac

+     shift

+ done

+ 

+ if [ -z "$CONTENT_PATH" ] || [ -z "$SOURCE_NAME" ] || [ -z "$DIR_NAME" ]; then

+     usage

+     exit -1

+ fi

+ 

+ tar caf "$SOURCE_NAME" -C "$CONTENT_PATH" "$EXCLUDE_VCS" "$EXCLUDE_VCS_IGNORES" --transform "s|^|$DIR_NAME/|" .

@@ -0,0 +1,22 @@ 

+ #!/bin/bash

+ 

+ source $ENV_STORE

+ 

+ SCRIPTDIR="$(builtin cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

+ source $SCRIPTDIR/lib.sh

+ 

+ if [ -f ./rpkg.macros ]; then

+     source ./rpkg.macros

+ fi

+ 

+ function end {

+     retcode=$?

+ 

+     if [ $retcode -eq 0 ]; then

+         declare -x > $ENV_STORE

+     fi

+ 

+     exit $retcode

+ }

+ 

+ trap end EXIT

file modified
+34 -5
@@ -3,8 +3,11 @@ 

  import re

  import shutil

  import tarfile

+ import textwrap

+ import subprocess

+ import tempfile

  

- from exceptions import SourceArchiveAlreadyExists

+ from pyrpkg.errors import rpkgError

  

  log = logging.getLogger("__main__")

  
@@ -17,10 +20,6 @@ 

      :param str target_path: path to the resulting archive

      :param str pack_dir_as: packed directory name inside the archive

      """

-     if os.path.exists(target_path):

-         raise SourceArchiveAlreadyExists("{} already exists"

-                                          .format(target_path))

- 

      log.debug("Packing {} as {} into {}...".format(

          dir_to_pack, pack_dir_as, target_path))

  
@@ -49,3 +48,33 @@ 

          if num == 0 and flags == 1:

              return os.path.basename(filepath)

      return None

+ 

+ 

+ def get_changelog_entry(commit_message):

+     entry = '- ' + commit_message.split('\n')[0] if commit_message else ''

+     return '\n'.join(textwrap.wrap(re.sub(r'(\s+)%([^%])', r'\1%%\2', entry), 80))

+ 

+ 

+ def run_command(cmd, shell=False, env=None, cwd=None):

+     try:

+         output = subprocess.check_output(cmd, shell=shell, env=env, cwd=cwd)

+     except (subprocess.CalledProcessError, OSError) as e:

+         raise rpkgError(e)

+     except KeyboardInterrupt:

+         raise rpkgError('Command is terminated by user.')

+     except Exception as e:

+         raise rpkgError(e)

+     return output

+ 

+ 

+ def edit(editor, lines, help_text):

+     data = '\n'.join(lines) + '\n' + help_text

+     tmp_f = tempfile.NamedTemporaryFile('w', delete=False)

+     tmp_f.write(data)

+     tmp_f.close()

+     subprocess.check_call([editor, tmp_f.name])

+     tmp_f = open(tmp_f.name, 'r')

+     result = tmp_f.read()

+     tmp_f.close()

+     os.unlink(tmp_f.name)

+     return result

file modified
+5 -2
@@ -1,2 +1,5 @@ 

- #!/bin/sh

- PYTHONPATH=.:$PYTHONPATH python2 -m pytest tests -s $@

+ #!/bin/bash

+ 

+ path="${1:-tests}"

+ 

+ PYTHONPATH=.:$PYTHONPATH python2 -m pytest -s $path

file modified
+9 -7
@@ -1,18 +1,17 @@ 

  #!/usr/bin/env python3

  

  import rpm

+ import subprocess

  from setuptools import setup, find_packages

  

- spec_file = rpm.ts().parseSpec('rpkg-client.spec')

- 

  setup(

-     name=spec_file.sourceHeader.name.decode("utf-8"),

-     version=spec_file.sourceHeader.version.decode("utf-8"),

-     description=spec_file.sourceHeader.summary.decode("utf-8"),

-     long_description=spec_file.sourceHeader.description.decode("utf-8"),

+     name="rpkg",

+     version="1.0",

+     description="RPM packaging utility",

+     long_description="A tool to manage spec-enriched Git repositories.",

      author='clime',

      author_email='clime@redhat.com',

-     download_url='https://pagure.io/rpkg-client.git',

+     download_url='https://pagure.io/rpkg-util.git',

      license='GPLv2+',

      classifiers=[

          "License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)",
@@ -20,6 +19,9 @@ 

          "Topic :: Software Development :: Build Tools",

      ],

      packages=find_packages(),

+     package_data={

+         '': ['preproc/*', 'preproc/*/*'],

+     },

      scripts=['rpkg'],

      include_package_data=True,

  )

file modified
+21 -4
@@ -3,6 +3,7 @@ 

  import shutil

  import rpm

  import tempfile

+ from rpkglib import utils

  

  from spec_templates import SPEC_TEMPLATE

  
@@ -13,15 +14,19 @@ 

      def tearDown(self):

          shutil.rmtree(self.tmpdir)

  

-     def dump_spec(self, template, pkgname='testpkg', subdir=None, **kwargs):

-         spec_content = template.substitute(kwargs, pkgname=pkgname)

+     def dump_spec(self, template, pkgname='testpkg', subdir=None, version="1",

+                   release="1", source0='source0.tar.gz', **kwargs):

+ 

+         spec_content = template.substitute(

+             kwargs, pkgname=pkgname, version=version,

+             release=release, source0=source0)

+ 

          if subdir:

              dirpath = os.path.join(self.tmpdir, subdir)

              os.makedirs(dirpath)

          else:

              dirpath = self.tmpdir

-         spec_path = os.path.join(

-             dirpath, '{}.spec'.format(pkgname))

+         spec_path = os.path.join(dirpath, '{}.spec'.format(pkgname))

          spec_file = open(spec_path, 'w')

          spec_file.write(spec_content)

          spec_file.close()
@@ -49,3 +54,15 @@ 

      def make_unpacked_content(self):

          spec_path = self.dump_spec(SPEC_TEMPLATE, source0='source0.tar.gz')

          self.touch_file('foobar.py')

+ 

+     def init_repo_with_commit(self):

+         cmds = (

+             ['git', 'init'],

+             ['touch', 'README'],

+             ['git', 'add', '-A'],

+             ['git', 'config', 'user.name', 'tester'],

+             ['git', 'config', 'user.email', 'tester@example.com'],

+             ['git', 'commit', '-m', '"Add README"'],

+         )

+         for cmd in cmds:

+             utils.run_command(cmd, cwd=self.tmpdir)

file added
+23
@@ -0,0 +1,23 @@ 

+ To run all the tests:

+ $ run.sh

+ 

+ To regenereate expected output and log for all tests:

+ $ run.sh copy

+ 

+ To run a particular test:

+ $ cd test_<name> && run.sh

+ 

+ To regenerate expected output and log for a particular test:

+ $ cd test_<name> && run.sh copy

+ 

+ Regenerating expected output and log is particularly useful

+ when you update a test - either by updating its input or by

+ updating its run.sh script. You should check that the log and

+ output file you get really contain something which is expected.

+ 

+ For instructions how to write a new test, just see run.sh

+ script in any of the test_* subdirs. They mostly make use

+ of generic_test function defined in ./lib.sh.

+ 

+ ./input file in this directory defines a basic set of macro

+ invocations.

file added
+135
@@ -0,0 +1,135 @@ 

+ git_name

+ git_name name=foo

+ git_name append=-baz

+ git_name prepend=bar-

+ git_name prepend=bar- append=-baz

+ git_name name=foo prepend=bar- append=-baz

+ 

+ git_version

+ git_version name=foo

+ git_version name=foo lead=1

+ git_version lead=0

+ git_version lead=1

+ git_version lead=0.1

+ git_version follow=1

+ git_version lead=1 follow=2

+ git_version lead=x follow=x

+ git_version lead=1-1 # invalid

+ git_version follow=2.0 # invalid

+ git_version follow=2-2 # invalid

+ git_version name= # invalid

+ git_version name="$(git_name)"

+ 

+ git_vcs

+ git_vcs subtree=foo

+ 

+ git_pack

+ git_pack dir_name=foo

+ git_pack dir_name=foo source_name=foo.tar.gz

+ git_pack path=foo dir_name=bar source_name=foo.tar.gz

+ 

+ git_archive

+ git_archive dir_name=foo

+ git_archive dir_name=foo source_name=foo.tar.gz

+ git_archive path=foo dir_name=bar source_name=foo.tar.gz

+ 

+ git_setup_macro

+ git_setup_macro dir_name=foo

+ 

+ git_changelog header_date_format="@@@" ::

+ git_changelog name=foo since_tag=foo-1.2-1 header_date_format="@@@" ::

+ git_changelog name=foo until_tag=foo-1.2-1 header_date_format="@@@" ::

+ git_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_date_format="@@@" ::

+ git_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_locale=POSIX header_date_format="@@@" body_wrap=42 ::

+ 

+ :::::::::::::::::::::

+ 

+ git_dir_name

+ git_dir_name name=foo

+ git_dir_name append=-baz

+ git_dir_name prepend=bar-

+ git_dir_name prepend=bar- append=-baz

+ git_dir_name name=foo prepend=bar- append=-baz

+ 

+ git_dir_version

+ git_dir_version name=foo

+ git_dir_version name=foo lead=1

+ git_dir_version lead=0

+ git_dir_version lead=1

+ git_dir_version lead=0.1

+ git_dir_version follow=1

+ git_dir_version lead=1 follow=2

+ git_dir_version lead=x follow=x

+ git_dir_version lead=1-1 # invalid

+ git_dir_version follow=2.0 # invalid

+ git_dir_version follow=2-2 # invalid

+ git_dir_version name= # invalid

+ git_dir_version name="$(git_name)"

+ 

+ git_dir_vcs

+ git_dir_vcs subtree=foo

+ 

+ git_dir_pack

+ git_dir_pack dir_name=foo

+ git_dir_pack dir_name=foo source_name=foo.tar.gz

+ git_dir_pack path=foo dir_name=bar source_name=foo.tar.gz

+ 

+ git_dir_archive

+ git_dir_archive dir_name=foo

+ git_dir_archive dir_name=foo source_name=foo.tar.gz

+ git_dir_archive path=foo dir_name=bar source_name=foo.tar.gz

+ 

+ git_dir_setup_macro

+ git_dir_setup_macro dir_name=foo

+ 

+ git_dir_changelog header_date_format="@@@" ::

+ git_dir_changelog name=foo since_tag=foo-1.2-1 header_date_format="@@@" ::

+ git_dir_changelog name=foo until_tag=foo-1.2-1 header_date_format="@@@" ::

+ git_dir_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_date_format="@@@" ::

+ git_dir_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_locale=POSIX header_date_format="@@@" body_wrap=42 ::

+ 

+ :::::::::::::::::::::

+ 

+ git_cwd_name

+ git_cwd_name name=foo

+ git_cwd_name append=-baz

+ git_cwd_name prepend=bar-

+ git_cwd_name prepend=bar- append=-baz

+ git_cwd_name name=foo prepend=bar- append=-baz

+ 

+ git_cwd_version

+ git_cwd_version name=foo

+ git_cwd_version name=foo lead=1

+ git_cwd_version lead=0

+ git_cwd_version lead=1

+ git_cwd_version lead=0.1

+ git_cwd_version follow=1

+ git_cwd_version lead=1 follow=2

+ git_cwd_version lead=x follow=x

+ git_cwd_version lead=1-1 # invalid

+ git_cwd_version follow=2.0 # invalid

+ git_cwd_version follow=2-2 # invalid

+ git_cwd_version name= # invalid

+ git_cwd_version name="$(git_cwd_name)"

+ 

+ git_cwd_vcs

+ git_cwd_vcs subtree=foo

+ 

+ git_cwd_pack

+ git_cwd_pack dir_name=foo

+ git_cwd_pack dir_name=foo source_name=foo.tar.gz

+ git_cwd_pack path=foo dir_name=bar source_name=foo.tar.gz

+ 

+ git_cwd_archive

+ git_cwd_archive dir_name=foo

+ git_cwd_archive dir_name=foo source_name=foo.tar.gz

+ git_cwd_archive path=foo dir_name=bar source_name=foo.tar.gz

+ 

+ git_cwd_setup_macro

+ git_cwd_setup_macro dir_name=foo

+ 

+ git_cwd_changelog header_date_format="@@@" ::

+ git_cwd_changelog name=foo since_tag=foo-1.2-1 header_date_format="@@@" ::

+ git_cwd_changelog name=foo until_tag=foo-1.2-1 header_date_format="@@@" ::

+ git_cwd_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_date_format="@@@" ::

+ git_cwd_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_locale=POSIX header_date_format="@@@" body_wrap=42 ::

file added
+54
@@ -0,0 +1,54 @@ 

+ export libdir="$(builtin cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

+ 

+ . $libdir/../../rpkglib/preproc/lib.sh

+   

+ function die {

+     echo fail.

+     exit 1

+ }

+ 

+ function log_filter {

+     grep -Ev -e '^> (env|cwd):' -e 'Wrote: /tmp/'

+ }

+ 

+ function run {

+     echo '>' $@;

+     eval $@;

+ }

+ 

+ function wtree_sub {

+     latest_ctime="$(builtin cd "$1"; encode_decimal $(git_latest_ctime))"

+     sed -Ei "s/\.wtree\.[a-zA-Z0-9]+/.wtree.$latest_ctime/" "$2"

+ }

+ 

+ function head_commit_sub {

+     full_hash=$(git -C "$1" rev-parse HEAD)

+     short_hash=$(git -C "$1" rev-parse --short HEAD)

+     sed -Ei -e "s|(\.git\.[0-9]+)\.[a-zA-Z0-9]+|\1.$short_hash|" -e "s|#\w{40}:|#$full_hash:|" "$2"

+ }

+ 

+ function prepare_input {

+     cat "$1" | sed -Ee 's|^(.+) ::$|\1:\n{{{ \1 }}}\n|' | sed -Ee 's|^(.+) :$|\1:\n{{{ \1 }}}|' | sed -Ee 's|^(.*[^:}])$|\1: {{{ \1 }}}|' > "$2"

+ }

+ 

+ function generic_test {

+     declare opts= path= input= expected_output= expected_log= custom_test= copy_only= "$@"

+ 

+     local out="$(mktemp -d)"

+ 

+     run "../preproc.py --path $path --input $input --output $out/output $opts | log_filter &> $out/log"

+ 

+     if [ -n "$copy_only" ]; then

+         cp "$out/log" "$out/output" .

+         echo copied.

+         rm -r "$out"

+         exit

+     fi

+ 

+     run "diff $expected_output $out/output || die"

+     run "diff $expected_log $out/log || die"

+     run "$custom_test out=$out || die"

+ 

+     rm -r "$out"

+     echo success.

+ }

@@ -0,0 +1,39 @@ 

+ #!/usr/bin/python2

+ 

+ import os

+ import sys

+ import logging

+ import argparse

+ 

+ project_path = os.path.realpath(os.path.join(os.path.realpath(__file__), '../../../'))

+ sys.path.insert(0, project_path)

+ 

+ from rpkglib.preproc import preprocess

+ 

+ log = logging.getLogger(__name__)

+ log.addHandler(logging.StreamHandler(sys.stdout))

+ log.setLevel(logging.DEBUG)

+ 

+ parser = argparse.ArgumentParser()

+ 

+ parser.add_argument('--path', default='.')

+ parser.add_argument('--input', required=True)

+ parser.add_argument('--output', required=True)

+ parser.add_argument('--dump-spec-only', action='store_true')

+ parser.add_argument('--version-bump', action='store_true')

+ parser.add_argument('--break-on-failure', action='store_true')

+ 

+ args = parser.parse_args()

+ 

+ try:

+     preprocess(

+         path=args.path,

+         input_path=args.input,

+         output_path=args.output,

+         dump_spec_only=args.dump_spec_only,

+         version_bump=args.version_bump,

+         break_on_failure=args.break_on_failure,

+         app_log=log)

+ 

+ except Exception as e:

+     log.error(str(e))

@@ -0,0 +1,8 @@ 

+ #!/bin/bash

+ 

+ export scriptdir="$(builtin cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

+ 

+ for dir in `ls -d $scriptdir/test_*/`; do

+     echo "====================== $(basename ${dir}) ======================"

+     (builtin cd $dir && run.sh $1) || exit 1

+ done

@@ -0,0 +1,3 @@ 

+ echo -n 1.4

+ echo -n 1; echo -n .; echo -n 4

+ date --date='@2147483647' +%y%m%d

@@ -0,0 +1,6 @@ 

+ > echo -n 1.4

+ ---

+ > echo -n 1; echo -n .; echo -n 4

+ ---

+ > date --date='@2147483647' +%y%m%d

+ ---

@@ -0,0 +1,4 @@ 

+ echo -n 1.4: 1.4

+ echo -n 1; echo -n .; echo -n 4: 1.4

+ date --date='@2147483647' +%y%m%d: 380119

+ 

@@ -0,0 +1,17 @@ 

+ #!/bin/bash

+ 

+ . ../lib.sh

+ 

+ repo=`mktemp -d`

+ output=`mktemp`

+ 

+ prepare_input input $repo/input

+ git init $repo

+ 

+ touch output && cp output $output

+ wtree_sub $repo $output

+ 

+ generic_test opts='' path=$repo input=$repo/input expected_output=$output expected_log=log copy_only=$1

+ 

+ rm -rf $repo

+ rm $output

@@ -0,0 +1,11 @@ 

+ git_bumped_version

+ git_bumped_version lead=1

+ git_bumped_version follow=2

+ git_bumped_version lead=1 follow=2

+ git_bumped_version lead=1 latest_tag_version=1.2

+ git_bumped_version follow=1 latest_tag_version=1.4

+ git_bumped_version latest_tag_version=1.2

+ git_bumped_version latest_tag_version=1.x

+ git_bumped_version latest_tag_version=0.1.x

+ git_bumped_version follow=2.0 # invalid but allowed here

+ git_bumped_version latest_tag_version=1-2 # invalid but allowed here

@@ -0,0 +1,22 @@ 

+ > git_bumped_version

+ ---

+ > git_bumped_version lead=1

+ ---

+ > git_bumped_version follow=2

+ ---

+ > git_bumped_version lead=1 follow=2

+ ---

+ > git_bumped_version lead=1 latest_tag_version=1.2

+ ---

+ > git_bumped_version follow=1 latest_tag_version=1.4

+ ---

+ > git_bumped_version latest_tag_version=1.2

+ ---

+ > git_bumped_version latest_tag_version=1.x

+ ---

+ > git_bumped_version latest_tag_version=0.1.x

+ ---

+ > git_bumped_version follow=2.0 # invalid but allowed here

+ ---

+ > git_bumped_version latest_tag_version=1-2 # invalid but allowed here

+ ---

@@ -0,0 +1,11 @@ 

+ git_bumped_version: 0.1

+ git_bumped_version lead=1: 1.0

+ git_bumped_version follow=2: 0.2

+ git_bumped_version lead=1 follow=2: 1.2

+ git_bumped_version lead=1 latest_tag_version=1.2: 1.3

+ git_bumped_version follow=1 latest_tag_version=1.4: 0.1

+ git_bumped_version latest_tag_version=1.2: 0.1

+ git_bumped_version latest_tag_version=1.x: 0.1

+ git_bumped_version latest_tag_version=0.1.x: 0.1

+ git_bumped_version follow=2.0 # invalid but allowed here: 0.2.0

+ git_bumped_version latest_tag_version=1-2 # invalid but allowed here: 0.1

@@ -0,0 +1,15 @@ 

+ #!/bin/bash

+ 

+ . ../lib.sh

+ 

+ repo=`mktemp -d`

+ output=`mktemp`

+ 

+ prepare_input input $repo/input

+ 

+ touch output && cp output $output

+ 

+ generic_test opts='--dump-spec-only' path=$repo input=$repo/input expected_output=$output expected_log=log copy_only=$1

+ 

+ rm -rf $repo

+ rm $output

@@ -0,0 +1,270 @@ 

+ > git_name

+ ---

+ > git_name name=foo

+ ---

+ > git_name append=-baz

+ ---

+ > git_name prepend=bar-

+ ---

+ > git_name prepend=bar- append=-baz

+ ---

+ > git_name name=foo prepend=bar- append=-baz

+ ---

+ > git_version

+ ---

+ > git_version name=foo

+ ---

+ > git_version name=foo lead=1

+ ---

+ > git_version lead=0

+ ---

+ > git_version lead=1

+ ---

+ > git_version lead=0.1

+ ---

+ > git_version follow=1

+ ---

+ > git_version lead=1 follow=2

+ ---

+ > git_version lead=x follow=x

+ ---

+ > git_version lead=1-1 # invalid

+ git_version: lead and follow cannot contain dashes.

+ git_version lead=1-1 # invalid failed with value 1

+ ---

+ > git_version follow=2.0 # invalid

+ git_version: follow cannot contain dots.

+ git_version follow=2.0 # invalid failed with value 1

+ ---

+ > git_version follow=2-2 # invalid

+ git_version: lead and follow cannot contain dashes.

+ git_version follow=2-2 # invalid failed with value 1

+ ---

+ > git_version name= # invalid

+ git_version: name cannot be empty.

+ git_version name= # invalid failed with value 1

+ ---

+ > git_version name="$(git_name)"

+ ---

+ > git_vcs

+ ---

+ > git_vcs subtree=foo

+ ---

+ > git_pack

+ git_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_pack dir_name=foo

+ git_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_pack dir_name=foo source_name=foo.tar.gz

+ git_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_pack path=foo dir_name=bar source_name=foo.tar.gz

+ git_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_archive

+ git_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_archive dir_name=foo

+ git_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_archive dir_name=foo source_name=foo.tar.gz

+ git_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_archive path=foo dir_name=bar source_name=foo.tar.gz

+ git_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_setup_macro

+ ---

+ > git_setup_macro dir_name=foo

+ ---

+ > git_changelog header_date_format="@@@"

+ ---

+ > git_changelog name=foo since_tag=foo-1.2-1 header_date_format="@@@"

+ ---

+ > git_changelog name=foo until_tag=foo-1.2-1 header_date_format="@@@"

+ ---

+ > git_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_date_format="@@@"

+ ---

+ > git_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_locale=POSIX header_date_format="@@@" body_wrap=42

+ ---

+ > git_dir_name

+ ---

+ > git_dir_name name=foo

+ ---

+ > git_dir_name append=-baz

+ ---

+ > git_dir_name prepend=bar-

+ ---

+ > git_dir_name prepend=bar- append=-baz

+ ---

+ > git_dir_name name=foo prepend=bar- append=-baz

+ ---

+ > git_dir_version

+ ---

+ > git_dir_version name=foo

+ ---

+ > git_dir_version name=foo lead=1

+ ---

+ > git_dir_version lead=0

+ ---

+ > git_dir_version lead=1

+ ---

+ > git_dir_version lead=0.1

+ ---

+ > git_dir_version follow=1

+ ---

+ > git_dir_version lead=1 follow=2

+ ---

+ > git_dir_version lead=x follow=x

+ ---

+ > git_dir_version lead=1-1 # invalid

+ git_dir_version: lead and follow cannot contain dashes.

+ git_dir_version lead=1-1 # invalid failed with value 1

+ ---

+ > git_dir_version follow=2.0 # invalid

+ git_dir_version: follow cannot contain dots.

+ git_dir_version follow=2.0 # invalid failed with value 1

+ ---

+ > git_dir_version follow=2-2 # invalid

+ git_dir_version: lead and follow cannot contain dashes.

+ git_dir_version follow=2-2 # invalid failed with value 1

+ ---

+ > git_dir_version name= # invalid

+ git_dir_version: name cannot be empty.

+ git_dir_version name= # invalid failed with value 1

+ ---

+ > git_dir_version name="$(git_name)"

+ ---

+ > git_dir_vcs

+ ---

+ > git_dir_vcs subtree=foo

+ ---

+ > git_dir_pack

+ git_dir_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_dir_pack dir_name=foo

+ git_dir_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_dir_pack dir_name=foo source_name=foo.tar.gz

+ git_dir_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_dir_pack path=foo dir_name=bar source_name=foo.tar.gz

+ git_dir_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_dir_archive

+ git_dir_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_dir_archive dir_name=foo

+ git_dir_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_dir_archive dir_name=foo source_name=foo.tar.gz

+ git_dir_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_dir_archive path=foo dir_name=bar source_name=foo.tar.gz

+ git_dir_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_dir_setup_macro

+ ---

+ > git_dir_setup_macro dir_name=foo

+ ---

+ > git_dir_changelog header_date_format="@@@"

+ ---

+ > git_dir_changelog name=foo since_tag=foo-1.2-1 header_date_format="@@@"

+ ---

+ > git_dir_changelog name=foo until_tag=foo-1.2-1 header_date_format="@@@"

+ ---

+ > git_dir_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_date_format="@@@"

+ ---

+ > git_dir_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_locale=POSIX header_date_format="@@@" body_wrap=42

+ ---

+ > git_cwd_name

+ ---

+ > git_cwd_name name=foo

+ ---

+ > git_cwd_name append=-baz

+ ---

+ > git_cwd_name prepend=bar-

+ ---

+ > git_cwd_name prepend=bar- append=-baz

+ ---

+ > git_cwd_name name=foo prepend=bar- append=-baz

+ ---

+ > git_cwd_version

+ ---

+ > git_cwd_version name=foo

+ ---

+ > git_cwd_version name=foo lead=1

+ ---

+ > git_cwd_version lead=0

+ ---

+ > git_cwd_version lead=1

+ ---

+ > git_cwd_version lead=0.1

+ ---

+ > git_cwd_version follow=1

+ ---

+ > git_cwd_version lead=1 follow=2

+ ---

+ > git_cwd_version lead=x follow=x

+ ---

+ > git_cwd_version lead=1-1 # invalid

+ git_cwd_version: lead and follow cannot contain dashes.

+ git_cwd_version lead=1-1 # invalid failed with value 1

+ ---

+ > git_cwd_version follow=2.0 # invalid

+ git_cwd_version: follow cannot contain dots.

+ git_cwd_version follow=2.0 # invalid failed with value 1

+ ---

+ > git_cwd_version follow=2-2 # invalid

+ git_cwd_version: lead and follow cannot contain dashes.

+ git_cwd_version follow=2-2 # invalid failed with value 1

+ ---

+ > git_cwd_version name= # invalid

+ git_cwd_version: name cannot be empty.

+ git_cwd_version name= # invalid failed with value 1

+ ---

+ > git_cwd_version name="$(git_cwd_name)"

+ ---

+ > git_cwd_vcs

+ ---

+ > git_cwd_vcs subtree=foo

+ ---

+ > git_cwd_pack

+ git_cwd_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_cwd_pack dir_name=foo

+ git_cwd_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_cwd_pack dir_name=foo source_name=foo.tar.gz

+ git_cwd_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_cwd_pack path=foo dir_name=bar source_name=foo.tar.gz

+ git_cwd_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_cwd_archive

+ git_cwd_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_cwd_archive dir_name=foo

+ git_cwd_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_cwd_archive dir_name=foo source_name=foo.tar.gz

+ git_cwd_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_cwd_archive path=foo dir_name=bar source_name=foo.tar.gz

+ git_cwd_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_cwd_setup_macro

+ ---

+ > git_cwd_setup_macro dir_name=foo

+ ---

+ > git_cwd_changelog header_date_format="@@@"

+ ---

+ > git_cwd_changelog name=foo since_tag=foo-1.2-1 header_date_format="@@@"

+ ---

+ > git_cwd_changelog name=foo until_tag=foo-1.2-1 header_date_format="@@@"

+ ---

+ > git_cwd_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_date_format="@@@"

+ ---

+ > git_cwd_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_locale=POSIX header_date_format="@@@" body_wrap=42

+ ---

@@ -0,0 +1,165 @@ 

+ git_name: test

+ git_name name=foo: foo

+ git_name append=-baz: test-baz

+ git_name prepend=bar-: bar-test

+ git_name prepend=bar- append=-baz: bar-test-baz

+ git_name name=foo prepend=bar- append=-baz: bar-foo-baz

+ 

+ git_version: 0.0.git.3.3a65415

+ git_version name=foo: 0.0.git.3.3a65415

+ git_version name=foo lead=1: 1.0.git.3.3a65415

+ git_version lead=0: 0.0.git.3.3a65415

+ git_version lead=1: 1.0.git.3.3a65415

+ git_version lead=0.1: 0.1.0.git.3.3a65415

+ git_version follow=1: 0.1.git.3.3a65415

+ git_version lead=1 follow=2: 1.2.git.3.3a65415

+ git_version lead=x follow=x: x.x.git.3.3a65415

+ git_version lead=1-1 # invalid: 

+ git_version follow=2.0 # invalid: 

+ git_version follow=2-2 # invalid: 

+ git_version name= # invalid: 

+ git_version name="$(git_name)": 0.0.git.3.3a65415

+ 

+ git_vcs: git+https://pagure.io/clime/test.git#3a654158d0451b7e7a079e33cd71e06d65b4da15:

+ git_vcs subtree=foo: git+https://pagure.io/clime/test.git#3a654158d0451b7e7a079e33cd71e06d65b4da15:foo

+ 

+ git_pack: bar-foo-baz-0.0.git.3.3a65415.tar.gz

+ git_pack dir_name=foo: bar-foo-baz-0.0.git.3.3a65415.tar.gz

+ git_pack dir_name=foo source_name=foo.tar.gz: foo.tar.gz

+ git_pack path=foo dir_name=bar source_name=foo.tar.gz: foo.tar.gz

+ 

+ git_archive: bar-foo-baz-0.0.git.3.3a65415.tar.gz

+ git_archive dir_name=foo: bar-foo-baz-0.0.git.3.3a65415.tar.gz

+ git_archive dir_name=foo source_name=foo.tar.gz: foo.tar.gz

+ git_archive path=foo dir_name=bar source_name=foo.tar.gz: foo.tar.gz

+ 

+ git_setup_macro: %setup -q -n bar-foo-baz-0.0.git.3.3a65415

+ git_setup_macro dir_name=foo: %setup -q -n foo

+ 

+ git_changelog header_date_format="@@@":

+ 

+ 

+ git_changelog name=foo since_tag=foo-1.2-1 header_date_format="@@@":

+ 

+ 

+ git_changelog name=foo until_tag=foo-1.2-1 header_date_format="@@@":

+ 

+ 

+ git_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_date_format="@@@":

+ 

+ 

+ git_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_locale=POSIX header_date_format="@@@" body_wrap=42:

+ 

+ 

+ 

+ :::::::::::::::::::::

+ 

+ git_dir_name: test-

+ git_dir_name name=foo: foo-

+ git_dir_name append=-baz: test-baz

+ git_dir_name prepend=bar-: bar-test-

+ git_dir_name prepend=bar- append=-baz: bar-test-baz

+ git_dir_name name=foo prepend=bar- append=-baz: bar-foo-baz

+ 

+ git_dir_version: 0.0.git.3.3a65415

+ git_dir_version name=foo: 0.0.git.3.3a65415

+ git_dir_version name=foo lead=1: 1.0.git.3.3a65415

+ git_dir_version lead=0: 0.0.git.3.3a65415

+ git_dir_version lead=1: 1.0.git.3.3a65415

+ git_dir_version lead=0.1: 0.1.0.git.3.3a65415

+ git_dir_version follow=1: 0.1.git.3.3a65415

+ git_dir_version lead=1 follow=2: 1.2.git.3.3a65415

+ git_dir_version lead=x follow=x: x.x.git.3.3a65415

+ git_dir_version lead=1-1 # invalid: 

+ git_dir_version follow=2.0 # invalid: 

+ git_dir_version follow=2-2 # invalid: 

+ git_dir_version name= # invalid: 

+ git_dir_version name="$(git_name)": 0.0.git.3.3a65415

+ 

+ git_dir_vcs: git+https://pagure.io/clime/test.git#3a654158d0451b7e7a079e33cd71e06d65b4da15:

+ git_dir_vcs subtree=foo: git+https://pagure.io/clime/test.git#3a654158d0451b7e7a079e33cd71e06d65b4da15:foo

+ 

+ git_dir_pack: bar-foo-baz-0.0.git.3.3a65415.tar.gz

+ git_dir_pack dir_name=foo: bar-foo-baz-0.0.git.3.3a65415.tar.gz

+ git_dir_pack dir_name=foo source_name=foo.tar.gz: foo.tar.gz

+ git_dir_pack path=foo dir_name=bar source_name=foo.tar.gz: foo.tar.gz

+ 

+ git_dir_archive: bar-foo-baz-0.0.git.3.3a65415.tar.gz

+ git_dir_archive dir_name=foo: bar-foo-baz-0.0.git.3.3a65415.tar.gz

+ git_dir_archive dir_name=foo source_name=foo.tar.gz: foo.tar.gz

+ git_dir_archive path=foo dir_name=bar source_name=foo.tar.gz: foo.tar.gz

+ 

+ git_dir_setup_macro: %setup -q -n bar-foo-baz-0.0.git.3.3a65415

+ git_dir_setup_macro dir_name=foo: %setup -q -n foo

+ 

+ git_dir_changelog header_date_format="@@@":

+ 

+ 

+ git_dir_changelog name=foo since_tag=foo-1.2-1 header_date_format="@@@":

+ 

+ 

+ git_dir_changelog name=foo until_tag=foo-1.2-1 header_date_format="@@@":

+ 

+ 

+ git_dir_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_date_format="@@@":

+ 

+ 

+ git_dir_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_locale=POSIX header_date_format="@@@" body_wrap=42:

+ 

+ 

+ 

+ :::::::::::::::::::::

+ 

+ git_cwd_name: test-

+ git_cwd_name name=foo: foo-

+ git_cwd_name append=-baz: test-baz

+ git_cwd_name prepend=bar-: bar-test-

+ git_cwd_name prepend=bar- append=-baz: bar-test-baz

+ git_cwd_name name=foo prepend=bar- append=-baz: bar-foo-baz

+ 

+ git_cwd_version: 0.0.git.3.3a65415

+ git_cwd_version name=foo: 0.0.git.3.3a65415

+ git_cwd_version name=foo lead=1: 1.0.git.3.3a65415

+ git_cwd_version lead=0: 0.0.git.3.3a65415

+ git_cwd_version lead=1: 1.0.git.3.3a65415

+ git_cwd_version lead=0.1: 0.1.0.git.3.3a65415

+ git_cwd_version follow=1: 0.1.git.3.3a65415

+ git_cwd_version lead=1 follow=2: 1.2.git.3.3a65415

+ git_cwd_version lead=x follow=x: x.x.git.3.3a65415

+ git_cwd_version lead=1-1 # invalid: 

+ git_cwd_version follow=2.0 # invalid: 

+ git_cwd_version follow=2-2 # invalid: 

+ git_cwd_version name= # invalid: 

+ git_cwd_version name="$(git_cwd_name)": 0.0.git.3.3a65415

+ 

+ git_cwd_vcs: git+https://pagure.io/clime/test.git#3a654158d0451b7e7a079e33cd71e06d65b4da15:

+ git_cwd_vcs subtree=foo: git+https://pagure.io/clime/test.git#3a654158d0451b7e7a079e33cd71e06d65b4da15:foo

+ 

+ git_cwd_pack: bar-foo-baz-0.0.git.3.3a65415.tar.gz

+ git_cwd_pack dir_name=foo: bar-foo-baz-0.0.git.3.3a65415.tar.gz

+ git_cwd_pack dir_name=foo source_name=foo.tar.gz: foo.tar.gz

+ git_cwd_pack path=foo dir_name=bar source_name=foo.tar.gz: foo.tar.gz

+ 

+ git_cwd_archive: bar-foo-baz-0.0.git.3.3a65415.tar.gz

+ git_cwd_archive dir_name=foo: bar-foo-baz-0.0.git.3.3a65415.tar.gz

+ git_cwd_archive dir_name=foo source_name=foo.tar.gz: foo.tar.gz

+ git_cwd_archive path=foo dir_name=bar source_name=foo.tar.gz: foo.tar.gz

+ 

+ git_cwd_setup_macro: %setup -q -n bar-foo-baz-0.0.git.3.3a65415

+ git_cwd_setup_macro dir_name=foo: %setup -q -n foo

+ 

+ git_cwd_changelog header_date_format="@@@":

+ 

+ 

+ git_cwd_changelog name=foo since_tag=foo-1.2-1 header_date_format="@@@":

+ 

+ 

+ git_cwd_changelog name=foo until_tag=foo-1.2-1 header_date_format="@@@":

+ 

+ 

+ git_cwd_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_date_format="@@@":

+ 

+ 

+ git_cwd_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_locale=POSIX header_date_format="@@@" body_wrap=42:

+ 

+ 

@@ -0,0 +1,28 @@ 

+ #!/bin/bash

+ 

+ . ../lib.sh

+ 

+ repo=`mktemp -d`

+ output=`mktemp`

+ 

+ prepare_input ../input $repo/input

+ 

+ git init $repo

+ git -C $repo remote add origin https://pagure.io/clime/test.git

+ git -C $repo add -A

+ git -C $repo commit -m 'commit 1'

+ touch $repo/foo

+ git -C $repo add foo

+ git -C $repo commit -m 'commit 2'

+ touch $repo/bar

+ git -C $repo add bar

+ git -C $repo commit -m 'commit 3'

+ 

+ touch output && cp output $output

+ wtree_sub $repo $output

+ head_commit_sub $repo $output

+ 

+ generic_test opts='--dump-spec-only' path=$repo input=$repo/input expected_output=$output expected_log=log copy_only=$1

+ 

+ rm -rf $repo

+ rm $output

@@ -0,0 +1,270 @@ 

+ > git_name

+ ---

+ > git_name name=foo

+ ---

+ > git_name append=-baz

+ ---

+ > git_name prepend=bar-

+ ---

+ > git_name prepend=bar- append=-baz

+ ---

+ > git_name name=foo prepend=bar- append=-baz

+ ---

+ > git_version

+ ---

+ > git_version name=foo

+ ---

+ > git_version name=foo lead=1

+ ---

+ > git_version lead=0

+ ---

+ > git_version lead=1

+ ---

+ > git_version lead=0.1

+ ---

+ > git_version follow=1

+ ---

+ > git_version lead=1 follow=2

+ ---

+ > git_version lead=x follow=x

+ ---

+ > git_version lead=1-1 # invalid

+ git_version: lead and follow cannot contain dashes.

+ git_version lead=1-1 # invalid failed with value 1

+ ---

+ > git_version follow=2.0 # invalid

+ git_version: follow cannot contain dots.

+ git_version follow=2.0 # invalid failed with value 1

+ ---

+ > git_version follow=2-2 # invalid

+ git_version: lead and follow cannot contain dashes.

+ git_version follow=2-2 # invalid failed with value 1

+ ---

+ > git_version name= # invalid

+ git_version: name cannot be empty.

+ git_version name= # invalid failed with value 1

+ ---

+ > git_version name="$(git_name)"

+ ---

+ > git_vcs

+ ---

+ > git_vcs subtree=foo

+ ---

+ > git_pack

+ git_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_pack dir_name=foo

+ git_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_pack dir_name=foo source_name=foo.tar.gz

+ git_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_pack path=foo dir_name=bar source_name=foo.tar.gz

+ git_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_archive

+ git_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_archive dir_name=foo

+ git_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_archive dir_name=foo source_name=foo.tar.gz

+ git_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_archive path=foo dir_name=bar source_name=foo.tar.gz

+ git_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_setup_macro

+ ---

+ > git_setup_macro dir_name=foo

+ ---

+ > git_changelog header_date_format="@@@"

+ ---

+ > git_changelog name=foo since_tag=foo-1.2-1 header_date_format="@@@"

+ ---

+ > git_changelog name=foo until_tag=foo-1.2-1 header_date_format="@@@"

+ ---

+ > git_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_date_format="@@@"

+ ---

+ > git_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_locale=POSIX header_date_format="@@@" body_wrap=42

+ ---

+ > git_dir_name

+ ---

+ > git_dir_name name=foo

+ ---

+ > git_dir_name append=-baz

+ ---

+ > git_dir_name prepend=bar-

+ ---

+ > git_dir_name prepend=bar- append=-baz

+ ---

+ > git_dir_name name=foo prepend=bar- append=-baz

+ ---

+ > git_dir_version

+ ---

+ > git_dir_version name=foo

+ ---

+ > git_dir_version name=foo lead=1

+ ---

+ > git_dir_version lead=0

+ ---

+ > git_dir_version lead=1

+ ---

+ > git_dir_version lead=0.1

+ ---

+ > git_dir_version follow=1

+ ---

+ > git_dir_version lead=1 follow=2

+ ---

+ > git_dir_version lead=x follow=x

+ ---

+ > git_dir_version lead=1-1 # invalid

+ git_dir_version: lead and follow cannot contain dashes.

+ git_dir_version lead=1-1 # invalid failed with value 1

+ ---

+ > git_dir_version follow=2.0 # invalid

+ git_dir_version: follow cannot contain dots.

+ git_dir_version follow=2.0 # invalid failed with value 1

+ ---

+ > git_dir_version follow=2-2 # invalid

+ git_dir_version: lead and follow cannot contain dashes.

+ git_dir_version follow=2-2 # invalid failed with value 1

+ ---

+ > git_dir_version name= # invalid

+ git_dir_version: name cannot be empty.

+ git_dir_version name= # invalid failed with value 1

+ ---

+ > git_dir_version name="$(git_name)"

+ ---

+ > git_dir_vcs

+ ---

+ > git_dir_vcs subtree=foo

+ ---

+ > git_dir_pack

+ git_dir_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_dir_pack dir_name=foo

+ git_dir_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_dir_pack dir_name=foo source_name=foo.tar.gz

+ git_dir_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_dir_pack path=foo dir_name=bar source_name=foo.tar.gz

+ git_dir_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_dir_archive

+ git_dir_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_dir_archive dir_name=foo

+ git_dir_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_dir_archive dir_name=foo source_name=foo.tar.gz

+ git_dir_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_dir_archive path=foo dir_name=bar source_name=foo.tar.gz

+ git_dir_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_dir_setup_macro

+ ---

+ > git_dir_setup_macro dir_name=foo

+ ---

+ > git_dir_changelog header_date_format="@@@"

+ ---

+ > git_dir_changelog name=foo since_tag=foo-1.2-1 header_date_format="@@@"

+ ---

+ > git_dir_changelog name=foo until_tag=foo-1.2-1 header_date_format="@@@"

+ ---

+ > git_dir_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_date_format="@@@"

+ ---

+ > git_dir_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_locale=POSIX header_date_format="@@@" body_wrap=42

+ ---

+ > git_cwd_name

+ ---

+ > git_cwd_name name=foo

+ ---

+ > git_cwd_name append=-baz

+ ---

+ > git_cwd_name prepend=bar-

+ ---

+ > git_cwd_name prepend=bar- append=-baz

+ ---

+ > git_cwd_name name=foo prepend=bar- append=-baz

+ ---

+ > git_cwd_version

+ ---

+ > git_cwd_version name=foo

+ ---

+ > git_cwd_version name=foo lead=1

+ ---

+ > git_cwd_version lead=0

+ ---

+ > git_cwd_version lead=1

+ ---

+ > git_cwd_version lead=0.1

+ ---

+ > git_cwd_version follow=1

+ ---

+ > git_cwd_version lead=1 follow=2

+ ---

+ > git_cwd_version lead=x follow=x

+ ---

+ > git_cwd_version lead=1-1 # invalid

+ git_cwd_version: lead and follow cannot contain dashes.

+ git_cwd_version lead=1-1 # invalid failed with value 1

+ ---

+ > git_cwd_version follow=2.0 # invalid

+ git_cwd_version: follow cannot contain dots.

+ git_cwd_version follow=2.0 # invalid failed with value 1

+ ---

+ > git_cwd_version follow=2-2 # invalid

+ git_cwd_version: lead and follow cannot contain dashes.

+ git_cwd_version follow=2-2 # invalid failed with value 1

+ ---

+ > git_cwd_version name= # invalid

+ git_cwd_version: name cannot be empty.

+ git_cwd_version name= # invalid failed with value 1

+ ---

+ > git_cwd_version name="$(git_cwd_name)"

+ ---

+ > git_cwd_vcs

+ ---

+ > git_cwd_vcs subtree=foo

+ ---

+ > git_cwd_pack

+ git_cwd_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_cwd_pack dir_name=foo

+ git_cwd_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_cwd_pack dir_name=foo source_name=foo.tar.gz

+ git_cwd_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_cwd_pack path=foo dir_name=bar source_name=foo.tar.gz

+ git_cwd_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_cwd_archive

+ git_cwd_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_cwd_archive dir_name=foo

+ git_cwd_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_cwd_archive dir_name=foo source_name=foo.tar.gz

+ git_cwd_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_cwd_archive path=foo dir_name=bar source_name=foo.tar.gz

+ git_cwd_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_cwd_setup_macro

+ ---

+ > git_cwd_setup_macro dir_name=foo

+ ---

+ > git_cwd_changelog header_date_format="@@@"

+ ---

+ > git_cwd_changelog name=foo since_tag=foo-1.2-1 header_date_format="@@@"

+ ---

+ > git_cwd_changelog name=foo until_tag=foo-1.2-1 header_date_format="@@@"

+ ---

+ > git_cwd_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_date_format="@@@"

+ ---

+ > git_cwd_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_locale=POSIX header_date_format="@@@" body_wrap=42

+ ---

@@ -0,0 +1,165 @@ 

+ git_name: test

+ git_name name=foo: foo

+ git_name append=-baz: test-baz

+ git_name prepend=bar-: bar-test

+ git_name prepend=bar- append=-baz: bar-test-baz

+ git_name name=foo prepend=bar- append=-baz: bar-foo-baz

+ 

+ git_version: 0.0.git.1.658a6b9.wtree.zf25ry

+ git_version name=foo: 0.0.git.1.658a6b9.wtree.zf25ry

+ git_version name=foo lead=1: 1.0.git.1.658a6b9.wtree.zf25ry

+ git_version lead=0: 0.0.git.1.658a6b9.wtree.zf25ry

+ git_version lead=1: 1.0.git.1.658a6b9.wtree.zf25ry

+ git_version lead=0.1: 0.1.0.git.1.658a6b9.wtree.zf25ry

+ git_version follow=1: 0.1.git.1.658a6b9.wtree.zf25ry

+ git_version lead=1 follow=2: 1.2.git.1.658a6b9.wtree.zf25ry

+ git_version lead=x follow=x: x.x.git.1.658a6b9.wtree.zf25ry

+ git_version lead=1-1 # invalid: 

+ git_version follow=2.0 # invalid: 

+ git_version follow=2-2 # invalid: 

+ git_version name= # invalid: 

+ git_version name="$(git_name)": 0.0.git.1.658a6b9.wtree.zf25ry

+ 

+ git_vcs: git+https://pagure.io/clime/test.git#658a6b9173503d2e90f57a848d44e8c4da2558d1:

+ git_vcs subtree=foo: git+https://pagure.io/clime/test.git#658a6b9173503d2e90f57a848d44e8c4da2558d1:foo

+ 

+ git_pack: bar-foo-baz-0.0.git.1.658a6b9.wtree.zf25ry.tar.gz

+ git_pack dir_name=foo: bar-foo-baz-0.0.git.1.658a6b9.wtree.zf25ry.tar.gz

+ git_pack dir_name=foo source_name=foo.tar.gz: foo.tar.gz

+ git_pack path=foo dir_name=bar source_name=foo.tar.gz: foo.tar.gz

+ 

+ git_archive: bar-foo-baz-0.0.git.1.658a6b9.wtree.zf25ry.tar.gz

+ git_archive dir_name=foo: bar-foo-baz-0.0.git.1.658a6b9.wtree.zf25ry.tar.gz

+ git_archive dir_name=foo source_name=foo.tar.gz: foo.tar.gz

+ git_archive path=foo dir_name=bar source_name=foo.tar.gz: foo.tar.gz

+ 

+ git_setup_macro: %setup -q -n bar-foo-baz-0.0.git.1.658a6b9.wtree.zf25ry

+ git_setup_macro dir_name=foo: %setup -q -n foo

+ 

+ git_changelog header_date_format="@@@":

+ 

+ 

+ git_changelog name=foo since_tag=foo-1.2-1 header_date_format="@@@":

+ 

+ 

+ git_changelog name=foo until_tag=foo-1.2-1 header_date_format="@@@":

+ 

+ 

+ git_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_date_format="@@@":

+ 

+ 

+ git_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_locale=POSIX header_date_format="@@@" body_wrap=42:

+ 

+ 

+ 

+ :::::::::::::::::::::

+ 

+ git_dir_name: test-

+ git_dir_name name=foo: foo-

+ git_dir_name append=-baz: test-baz

+ git_dir_name prepend=bar-: bar-test-

+ git_dir_name prepend=bar- append=-baz: bar-test-baz

+ git_dir_name name=foo prepend=bar- append=-baz: bar-foo-baz

+ 

+ git_dir_version: 0.0.git.1.658a6b9.wtree.zf25ry

+ git_dir_version name=foo: 0.0.git.1.658a6b9.wtree.zf25ry

+ git_dir_version name=foo lead=1: 1.0.git.1.658a6b9.wtree.zf25ry

+ git_dir_version lead=0: 0.0.git.1.658a6b9.wtree.zf25ry

+ git_dir_version lead=1: 1.0.git.1.658a6b9.wtree.zf25ry

+ git_dir_version lead=0.1: 0.1.0.git.1.658a6b9.wtree.zf25ry

+ git_dir_version follow=1: 0.1.git.1.658a6b9.wtree.zf25ry

+ git_dir_version lead=1 follow=2: 1.2.git.1.658a6b9.wtree.zf25ry

+ git_dir_version lead=x follow=x: x.x.git.1.658a6b9.wtree.zf25ry

+ git_dir_version lead=1-1 # invalid: 

+ git_dir_version follow=2.0 # invalid: 

+ git_dir_version follow=2-2 # invalid: 

+ git_dir_version name= # invalid: 

+ git_dir_version name="$(git_name)": 0.0.git.1.658a6b9.wtree.zf25ry

+ 

+ git_dir_vcs: git+https://pagure.io/clime/test.git#658a6b9173503d2e90f57a848d44e8c4da2558d1:

+ git_dir_vcs subtree=foo: git+https://pagure.io/clime/test.git#658a6b9173503d2e90f57a848d44e8c4da2558d1:foo

+ 

+ git_dir_pack: bar-foo-baz-0.0.git.1.658a6b9.wtree.zf25ry.tar.gz

+ git_dir_pack dir_name=foo: bar-foo-baz-0.0.git.1.658a6b9.wtree.zf25ry.tar.gz

+ git_dir_pack dir_name=foo source_name=foo.tar.gz: foo.tar.gz

+ git_dir_pack path=foo dir_name=bar source_name=foo.tar.gz: foo.tar.gz

+ 

+ git_dir_archive: bar-foo-baz-0.0.git.1.658a6b9.wtree.zf25ry.tar.gz

+ git_dir_archive dir_name=foo: bar-foo-baz-0.0.git.1.658a6b9.wtree.zf25ry.tar.gz

+ git_dir_archive dir_name=foo source_name=foo.tar.gz: foo.tar.gz

+ git_dir_archive path=foo dir_name=bar source_name=foo.tar.gz: foo.tar.gz

+ 

+ git_dir_setup_macro: %setup -q -n bar-foo-baz-0.0.git.1.658a6b9.wtree.zf25ry

+ git_dir_setup_macro dir_name=foo: %setup -q -n foo

+ 

+ git_dir_changelog header_date_format="@@@":

+ 

+ 

+ git_dir_changelog name=foo since_tag=foo-1.2-1 header_date_format="@@@":

+ 

+ 

+ git_dir_changelog name=foo until_tag=foo-1.2-1 header_date_format="@@@":

+ 

+ 

+ git_dir_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_date_format="@@@":

+ 

+ 

+ git_dir_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_locale=POSIX header_date_format="@@@" body_wrap=42:

+ 

+ 

+ 

+ :::::::::::::::::::::

+ 

+ git_cwd_name: test-

+ git_cwd_name name=foo: foo-

+ git_cwd_name append=-baz: test-baz

+ git_cwd_name prepend=bar-: bar-test-

+ git_cwd_name prepend=bar- append=-baz: bar-test-baz

+ git_cwd_name name=foo prepend=bar- append=-baz: bar-foo-baz

+ 

+ git_cwd_version: 0.0.git.1.658a6b9.wtree.zf25ry

+ git_cwd_version name=foo: 0.0.git.1.658a6b9.wtree.zf25ry

+ git_cwd_version name=foo lead=1: 1.0.git.1.658a6b9.wtree.zf25ry

+ git_cwd_version lead=0: 0.0.git.1.658a6b9.wtree.zf25ry

+ git_cwd_version lead=1: 1.0.git.1.658a6b9.wtree.zf25ry

+ git_cwd_version lead=0.1: 0.1.0.git.1.658a6b9.wtree.zf25ry

+ git_cwd_version follow=1: 0.1.git.1.658a6b9.wtree.zf25ry

+ git_cwd_version lead=1 follow=2: 1.2.git.1.658a6b9.wtree.zf25ry

+ git_cwd_version lead=x follow=x: x.x.git.1.658a6b9.wtree.zf25ry

+ git_cwd_version lead=1-1 # invalid: 

+ git_cwd_version follow=2.0 # invalid: 

+ git_cwd_version follow=2-2 # invalid: 

+ git_cwd_version name= # invalid: 

+ git_cwd_version name="$(git_cwd_name)": 0.0.git.1.658a6b9.wtree.zf25ry

+ 

+ git_cwd_vcs: git+https://pagure.io/clime/test.git#658a6b9173503d2e90f57a848d44e8c4da2558d1:

+ git_cwd_vcs subtree=foo: git+https://pagure.io/clime/test.git#658a6b9173503d2e90f57a848d44e8c4da2558d1:foo

+ 

+ git_cwd_pack: bar-foo-baz-0.0.git.1.658a6b9.wtree.zf25ry.tar.gz

+ git_cwd_pack dir_name=foo: bar-foo-baz-0.0.git.1.658a6b9.wtree.zf25ry.tar.gz

+ git_cwd_pack dir_name=foo source_name=foo.tar.gz: foo.tar.gz

+ git_cwd_pack path=foo dir_name=bar source_name=foo.tar.gz: foo.tar.gz

+ 

+ git_cwd_archive: bar-foo-baz-0.0.git.1.658a6b9.wtree.zf25ry.tar.gz

+ git_cwd_archive dir_name=foo: bar-foo-baz-0.0.git.1.658a6b9.wtree.zf25ry.tar.gz

+ git_cwd_archive dir_name=foo source_name=foo.tar.gz: foo.tar.gz

+ git_cwd_archive path=foo dir_name=bar source_name=foo.tar.gz: foo.tar.gz

+ 

+ git_cwd_setup_macro: %setup -q -n bar-foo-baz-0.0.git.1.658a6b9.wtree.zf25ry

+ git_cwd_setup_macro dir_name=foo: %setup -q -n foo

+ 

+ git_cwd_changelog header_date_format="@@@":

+ 

+ 

+ git_cwd_changelog name=foo since_tag=foo-1.2-1 header_date_format="@@@":

+ 

+ 

+ git_cwd_changelog name=foo until_tag=foo-1.2-1 header_date_format="@@@":

+ 

+ 

+ git_cwd_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_date_format="@@@":

+ 

+ 

+ git_cwd_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_locale=POSIX header_date_format="@@@" body_wrap=42:

+ 

+ 

@@ -0,0 +1,24 @@ 

+ #!/bin/bash

+ 

+ . ../lib.sh

+ 

+ repo=`mktemp -d`

+ output=`mktemp`

+ 

+ prepare_input ../input $repo/input

+ 

+ git init $repo

+ git -C $repo remote add origin https://pagure.io/clime/test.git

+ git -C $repo add -A

+ git -C $repo commit -a -m 'inital_commit'

+ 

+ touch $repo/foo

+ 

+ touch output && cp output $output

+ wtree_sub $repo $output

+ head_commit_sub $repo $output

+ 

+ generic_test opts='--dump-spec-only' path=$repo input=$repo/input expected_output=$output expected_log=log copy_only=$1

+ 

+ rm -rf $repo

+ rm $output

@@ -0,0 +1,315 @@ 

+ > git_name

+ git_name: Start by setting origin URL.

+ git_name failed with value 1

+ ---

+ > git_name name=foo

+ ---

+ > git_name append=-baz

+ git_name: Start by setting origin URL.

+ git_name append=-baz failed with value 1

+ ---

+ > git_name prepend=bar-

+ git_name: Start by setting origin URL.

+ git_name prepend=bar- failed with value 1

+ ---

+ > git_name prepend=bar- append=-baz

+ git_name: Start by setting origin URL.

+ git_name prepend=bar- append=-baz failed with value 1

+ ---

+ > git_name name=foo prepend=bar- append=-baz

+ ---

+ > git_version

+ ---

+ > git_version name=foo

+ ---

+ > git_version name=foo lead=1

+ ---

+ > git_version lead=0

+ ---

+ > git_version lead=1

+ ---

+ > git_version lead=0.1

+ ---

+ > git_version follow=1

+ ---

+ > git_version lead=1 follow=2

+ ---

+ > git_version lead=x follow=x

+ ---

+ > git_version lead=1-1 # invalid

+ git_version: lead and follow cannot contain dashes.

+ git_version lead=1-1 # invalid failed with value 1

+ ---

+ > git_version follow=2.0 # invalid

+ git_version: follow cannot contain dots.

+ git_version follow=2.0 # invalid failed with value 1

+ ---

+ > git_version follow=2-2 # invalid

+ git_version: lead and follow cannot contain dashes.

+ git_version follow=2-2 # invalid failed with value 1

+ ---

+ > git_version name= # invalid

+ git_version: name cannot be empty.

+ git_version name= # invalid failed with value 1

+ ---

+ > git_version name="$(git_name)"

+ git_name: Start by setting origin URL.

+ git_version: name cannot be empty.

+ git_version name="$(git_name)" failed with value 1

+ ---

+ > git_vcs

+ git_vcs: Start by setting origin URL.

+ git_vcs failed with value 1

+ ---

+ > git_vcs subtree=foo

+ git_vcs: Start by setting origin URL.

+ git_vcs subtree=foo failed with value 1

+ ---

+ > git_pack

+ git_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_pack dir_name=foo

+ git_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_pack dir_name=foo source_name=foo.tar.gz

+ git_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_pack path=foo dir_name=bar source_name=foo.tar.gz

+ git_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_archive

+ git_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_archive dir_name=foo

+ git_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_archive dir_name=foo source_name=foo.tar.gz

+ git_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_archive path=foo dir_name=bar source_name=foo.tar.gz

+ git_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_setup_macro

+ ---

+ > git_setup_macro dir_name=foo

+ ---

+ > git_changelog header_date_format="@@@"

+ ---

+ > git_changelog name=foo since_tag=foo-1.2-1 header_date_format="@@@"

+ ---

+ > git_changelog name=foo until_tag=foo-1.2-1 header_date_format="@@@"

+ ---

+ > git_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_date_format="@@@"

+ ---

+ > git_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_locale=POSIX header_date_format="@@@" body_wrap=42

+ ---

+ > git_dir_name

+ git_dir_name: Start by setting origin URL.

+ git_dir_name failed with value 1

+ ---

+ > git_dir_name name=foo

+ ---

+ > git_dir_name append=-baz

+ git_dir_name: Start by setting origin URL.

+ git_dir_name append=-baz failed with value 1

+ ---

+ > git_dir_name prepend=bar-

+ git_dir_name: Start by setting origin URL.

+ git_dir_name prepend=bar- failed with value 1

+ ---

+ > git_dir_name prepend=bar- append=-baz

+ git_dir_name: Start by setting origin URL.

+ git_dir_name prepend=bar- append=-baz failed with value 1

+ ---

+ > git_dir_name name=foo prepend=bar- append=-baz

+ ---

+ > git_dir_version

+ ---

+ > git_dir_version name=foo

+ ---

+ > git_dir_version name=foo lead=1

+ ---

+ > git_dir_version lead=0

+ ---

+ > git_dir_version lead=1

+ ---

+ > git_dir_version lead=0.1

+ ---

+ > git_dir_version follow=1

+ ---

+ > git_dir_version lead=1 follow=2

+ ---

+ > git_dir_version lead=x follow=x

+ ---

+ > git_dir_version lead=1-1 # invalid

+ git_dir_version: lead and follow cannot contain dashes.

+ git_dir_version lead=1-1 # invalid failed with value 1

+ ---

+ > git_dir_version follow=2.0 # invalid

+ git_dir_version: follow cannot contain dots.

+ git_dir_version follow=2.0 # invalid failed with value 1

+ ---

+ > git_dir_version follow=2-2 # invalid

+ git_dir_version: lead and follow cannot contain dashes.

+ git_dir_version follow=2-2 # invalid failed with value 1

+ ---

+ > git_dir_version name= # invalid

+ git_dir_version: name cannot be empty.

+ git_dir_version name= # invalid failed with value 1

+ ---

+ > git_dir_version name="$(git_name)"

+ git_name: Start by setting origin URL.

+ git_dir_version: name cannot be empty.

+ git_dir_version name="$(git_name)" failed with value 1

+ ---

+ > git_dir_vcs

+ git_dir_vcs: Start by setting origin URL.

+ git_dir_vcs failed with value 1

+ ---

+ > git_dir_vcs subtree=foo

+ git_dir_vcs: Start by setting origin URL.

+ git_dir_vcs subtree=foo failed with value 1

+ ---

+ > git_dir_pack

+ git_dir_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_dir_pack dir_name=foo

+ git_dir_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_dir_pack dir_name=foo source_name=foo.tar.gz

+ git_dir_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_dir_pack path=foo dir_name=bar source_name=foo.tar.gz

+ git_dir_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_dir_archive

+ git_dir_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_dir_archive dir_name=foo

+ git_dir_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_dir_archive dir_name=foo source_name=foo.tar.gz

+ git_dir_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_dir_archive path=foo dir_name=bar source_name=foo.tar.gz

+ git_dir_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_dir_setup_macro

+ ---

+ > git_dir_setup_macro dir_name=foo

+ ---

+ > git_dir_changelog header_date_format="@@@"

+ ---

+ > git_dir_changelog name=foo since_tag=foo-1.2-1 header_date_format="@@@"

+ ---

+ > git_dir_changelog name=foo until_tag=foo-1.2-1 header_date_format="@@@"

+ ---

+ > git_dir_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_date_format="@@@"

+ ---

+ > git_dir_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_locale=POSIX header_date_format="@@@" body_wrap=42

+ ---

+ > git_cwd_name

+ git_cwd_name: Start by setting origin URL.

+ git_cwd_name failed with value 1

+ ---

+ > git_cwd_name name=foo

+ ---

+ > git_cwd_name append=-baz

+ git_cwd_name: Start by setting origin URL.

+ git_cwd_name append=-baz failed with value 1

+ ---

+ > git_cwd_name prepend=bar-

+ git_cwd_name: Start by setting origin URL.

+ git_cwd_name prepend=bar- failed with value 1

+ ---

+ > git_cwd_name prepend=bar- append=-baz

+ git_cwd_name: Start by setting origin URL.

+ git_cwd_name prepend=bar- append=-baz failed with value 1

+ ---

+ > git_cwd_name name=foo prepend=bar- append=-baz

+ ---

+ > git_cwd_version

+ ---

+ > git_cwd_version name=foo

+ ---

+ > git_cwd_version name=foo lead=1

+ ---

+ > git_cwd_version lead=0

+ ---

+ > git_cwd_version lead=1

+ ---

+ > git_cwd_version lead=0.1

+ ---

+ > git_cwd_version follow=1

+ ---

+ > git_cwd_version lead=1 follow=2

+ ---

+ > git_cwd_version lead=x follow=x

+ ---

+ > git_cwd_version lead=1-1 # invalid

+ git_cwd_version: lead and follow cannot contain dashes.

+ git_cwd_version lead=1-1 # invalid failed with value 1

+ ---

+ > git_cwd_version follow=2.0 # invalid

+ git_cwd_version: follow cannot contain dots.

+ git_cwd_version follow=2.0 # invalid failed with value 1

+ ---

+ > git_cwd_version follow=2-2 # invalid

+ git_cwd_version: lead and follow cannot contain dashes.

+ git_cwd_version follow=2-2 # invalid failed with value 1

+ ---

+ > git_cwd_version name= # invalid

+ git_cwd_version: name cannot be empty.

+ git_cwd_version name= # invalid failed with value 1

+ ---

+ > git_cwd_version name="$(git_cwd_name)"

+ git_cwd_name: Start by setting origin URL.

+ git_cwd_version: name cannot be empty.

+ git_cwd_version name="$(git_cwd_name)" failed with value 1

+ ---

+ > git_cwd_vcs

+ git_cwd_vcs: Start by setting origin URL.

+ git_cwd_vcs failed with value 1

+ ---

+ > git_cwd_vcs subtree=foo

+ git_cwd_vcs: Start by setting origin URL.

+ git_cwd_vcs subtree=foo failed with value 1

+ ---

+ > git_cwd_pack

+ git_cwd_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_cwd_pack dir_name=foo

+ git_cwd_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_cwd_pack dir_name=foo source_name=foo.tar.gz

+ git_cwd_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_cwd_pack path=foo dir_name=bar source_name=foo.tar.gz

+ git_cwd_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_cwd_archive

+ git_cwd_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_cwd_archive dir_name=foo

+ git_cwd_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_cwd_archive dir_name=foo source_name=foo.tar.gz

+ git_cwd_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_cwd_archive path=foo dir_name=bar source_name=foo.tar.gz

+ git_cwd_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_cwd_setup_macro

+ ---

+ > git_cwd_setup_macro dir_name=foo

+ ---

+ > git_cwd_changelog header_date_format="@@@"

+ ---

+ > git_cwd_changelog name=foo since_tag=foo-1.2-1 header_date_format="@@@"

+ ---

+ > git_cwd_changelog name=foo until_tag=foo-1.2-1 header_date_format="@@@"

+ ---

+ > git_cwd_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_date_format="@@@"

+ ---

+ > git_cwd_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_locale=POSIX header_date_format="@@@" body_wrap=42

+ ---

@@ -0,0 +1,165 @@ 

+ git_name: 

+ git_name name=foo: foo

+ git_name append=-baz: 

+ git_name prepend=bar-: 

+ git_name prepend=bar- append=-baz: 

+ git_name name=foo prepend=bar- append=-baz: bar-foo-baz

+ 

+ git_version: 0.0.wtree.zf25r0

+ git_version name=foo: 0.0.wtree.zf25r0

+ git_version name=foo lead=1: 1.0.wtree.zf25r0

+ git_version lead=0: 0.0.wtree.zf25r0

+ git_version lead=1: 1.0.wtree.zf25r0

+ git_version lead=0.1: 0.1.0.wtree.zf25r0

+ git_version follow=1: 0.1.wtree.zf25r0

+ git_version lead=1 follow=2: 1.2.wtree.zf25r0

+ git_version lead=x follow=x: x.x.wtree.zf25r0

+ git_version lead=1-1 # invalid: 

+ git_version follow=2.0 # invalid: 

+ git_version follow=2-2 # invalid: 

+ git_version name= # invalid: 

+ git_version name="$(git_name)": 

+ 

+ git_vcs: 

+ git_vcs subtree=foo: 

+ 

+ git_pack: bar-foo-baz-x.x.wtree.zf25r0.tar.gz

+ git_pack dir_name=foo: bar-foo-baz-x.x.wtree.zf25r0.tar.gz

+ git_pack dir_name=foo source_name=foo.tar.gz: foo.tar.gz

+ git_pack path=foo dir_name=bar source_name=foo.tar.gz: foo.tar.gz

+ 

+ git_archive: bar-foo-baz-x.x.wtree.zf25r0.tar.gz

+ git_archive dir_name=foo: bar-foo-baz-x.x.wtree.zf25r0.tar.gz

+ git_archive dir_name=foo source_name=foo.tar.gz: foo.tar.gz

+ git_archive path=foo dir_name=bar source_name=foo.tar.gz: foo.tar.gz

+ 

+ git_setup_macro: %setup -q -n bar-foo-baz-x.x.wtree.zf25r0

+ git_setup_macro dir_name=foo: %setup -q -n foo

+ 

+ git_changelog header_date_format="@@@":

+ 

+ 

+ git_changelog name=foo since_tag=foo-1.2-1 header_date_format="@@@":

+ 

+ 

+ git_changelog name=foo until_tag=foo-1.2-1 header_date_format="@@@":

+ 

+ 

+ git_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_date_format="@@@":

+ 

+ 

+ git_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_locale=POSIX header_date_format="@@@" body_wrap=42:

+ 

+ 

+ 

+ :::::::::::::::::::::

+ 

+ git_dir_name: 

+ git_dir_name name=foo: foo-

+ git_dir_name append=-baz: 

+ git_dir_name prepend=bar-: 

+ git_dir_name prepend=bar- append=-baz: 

+ git_dir_name name=foo prepend=bar- append=-baz: bar-foo-baz

+ 

+ git_dir_version: 0.0.wtree.zf25r0

+ git_dir_version name=foo: 0.0.wtree.zf25r0

+ git_dir_version name=foo lead=1: 1.0.wtree.zf25r0

+ git_dir_version lead=0: 0.0.wtree.zf25r0

+ git_dir_version lead=1: 1.0.wtree.zf25r0

+ git_dir_version lead=0.1: 0.1.0.wtree.zf25r0

+ git_dir_version follow=1: 0.1.wtree.zf25r0

+ git_dir_version lead=1 follow=2: 1.2.wtree.zf25r0

+ git_dir_version lead=x follow=x: x.x.wtree.zf25r0

+ git_dir_version lead=1-1 # invalid: 

+ git_dir_version follow=2.0 # invalid: 

+ git_dir_version follow=2-2 # invalid: 

+ git_dir_version name= # invalid: 

+ git_dir_version name="$(git_name)": 

+ 

+ git_dir_vcs: 

+ git_dir_vcs subtree=foo: 

+ 

+ git_dir_pack: bar-foo-baz-x.x.wtree.zf25r0.tar.gz

+ git_dir_pack dir_name=foo: bar-foo-baz-x.x.wtree.zf25r0.tar.gz

+ git_dir_pack dir_name=foo source_name=foo.tar.gz: foo.tar.gz

+ git_dir_pack path=foo dir_name=bar source_name=foo.tar.gz: foo.tar.gz

+ 

+ git_dir_archive: bar-foo-baz-x.x.wtree.zf25r0.tar.gz

+ git_dir_archive dir_name=foo: bar-foo-baz-x.x.wtree.zf25r0.tar.gz

+ git_dir_archive dir_name=foo source_name=foo.tar.gz: foo.tar.gz

+ git_dir_archive path=foo dir_name=bar source_name=foo.tar.gz: foo.tar.gz

+ 

+ git_dir_setup_macro: %setup -q -n bar-foo-baz-x.x.wtree.zf25r0

+ git_dir_setup_macro dir_name=foo: %setup -q -n foo

+ 

+ git_dir_changelog header_date_format="@@@":

+ 

+ 

+ git_dir_changelog name=foo since_tag=foo-1.2-1 header_date_format="@@@":

+ 

+ 

+ git_dir_changelog name=foo until_tag=foo-1.2-1 header_date_format="@@@":

+ 

+ 

+ git_dir_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_date_format="@@@":

+ 

+ 

+ git_dir_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_locale=POSIX header_date_format="@@@" body_wrap=42:

+ 

+ 

+ 

+ :::::::::::::::::::::

+ 

+ git_cwd_name: 

+ git_cwd_name name=foo: foo-

+ git_cwd_name append=-baz: 

+ git_cwd_name prepend=bar-: 

+ git_cwd_name prepend=bar- append=-baz: 

+ git_cwd_name name=foo prepend=bar- append=-baz: bar-foo-baz

+ 

+ git_cwd_version: 0.0.wtree.zf25r0

+ git_cwd_version name=foo: 0.0.wtree.zf25r0

+ git_cwd_version name=foo lead=1: 1.0.wtree.zf25r0

+ git_cwd_version lead=0: 0.0.wtree.zf25r0

+ git_cwd_version lead=1: 1.0.wtree.zf25r0

+ git_cwd_version lead=0.1: 0.1.0.wtree.zf25r0

+ git_cwd_version follow=1: 0.1.wtree.zf25r0

+ git_cwd_version lead=1 follow=2: 1.2.wtree.zf25r0

+ git_cwd_version lead=x follow=x: x.x.wtree.zf25r0

+ git_cwd_version lead=1-1 # invalid: 

+ git_cwd_version follow=2.0 # invalid: 

+ git_cwd_version follow=2-2 # invalid: 

+ git_cwd_version name= # invalid: 

+ git_cwd_version name="$(git_cwd_name)": 

+ 

+ git_cwd_vcs: 

+ git_cwd_vcs subtree=foo: 

+ 

+ git_cwd_pack: bar-foo-baz-x.x.wtree.zf25r0.tar.gz

+ git_cwd_pack dir_name=foo: bar-foo-baz-x.x.wtree.zf25r0.tar.gz

+ git_cwd_pack dir_name=foo source_name=foo.tar.gz: foo.tar.gz

+ git_cwd_pack path=foo dir_name=bar source_name=foo.tar.gz: foo.tar.gz

+ 

+ git_cwd_archive: bar-foo-baz-x.x.wtree.zf25r0.tar.gz

+ git_cwd_archive dir_name=foo: bar-foo-baz-x.x.wtree.zf25r0.tar.gz

+ git_cwd_archive dir_name=foo source_name=foo.tar.gz: foo.tar.gz

+ git_cwd_archive path=foo dir_name=bar source_name=foo.tar.gz: foo.tar.gz

+ 

+ git_cwd_setup_macro: %setup -q -n bar-foo-baz-x.x.wtree.zf25r0

+ git_cwd_setup_macro dir_name=foo: %setup -q -n foo

+ 

+ git_cwd_changelog header_date_format="@@@":

+ 

+ 

+ git_cwd_changelog name=foo since_tag=foo-1.2-1 header_date_format="@@@":

+ 

+ 

+ git_cwd_changelog name=foo until_tag=foo-1.2-1 header_date_format="@@@":

+ 

+ 

+ git_cwd_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_date_format="@@@":

+ 

+ 

+ git_cwd_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_locale=POSIX header_date_format="@@@" body_wrap=42:

+ 

+ 

@@ -0,0 +1,17 @@ 

+ #!/bin/bash

+ 

+ . ../lib.sh

+ 

+ repo=`mktemp -d`

+ output=`mktemp`

+ 

+ prepare_input ../input $repo/input

+ git init $repo

+ 

+ touch output && cp output $output

+ wtree_sub $repo $output

+ 

+ generic_test opts='--dump-spec-only' path=$repo input=$repo/input expected_output=$output expected_log=log copy_only=$1

+ 

+ rm -rf $repo

+ rm $output

@@ -0,0 +1,270 @@ 

+ > git_name

+ ---

+ > git_name name=foo

+ ---

+ > git_name append=-baz

+ ---

+ > git_name prepend=bar-

+ ---

+ > git_name prepend=bar- append=-baz

+ ---

+ > git_name name=foo prepend=bar- append=-baz

+ ---

+ > git_version

+ ---

+ > git_version name=foo

+ ---

+ > git_version name=foo lead=1

+ ---

+ > git_version lead=0

+ ---

+ > git_version lead=1

+ ---

+ > git_version lead=0.1

+ ---

+ > git_version follow=1

+ ---

+ > git_version lead=1 follow=2

+ ---

+ > git_version lead=x follow=x

+ ---

+ > git_version lead=1-1 # invalid

+ git_version: lead and follow cannot contain dashes.

+ git_version lead=1-1 # invalid failed with value 1

+ ---

+ > git_version follow=2.0 # invalid

+ git_version: follow cannot contain dots.

+ git_version follow=2.0 # invalid failed with value 1

+ ---

+ > git_version follow=2-2 # invalid

+ git_version: lead and follow cannot contain dashes.

+ git_version follow=2-2 # invalid failed with value 1

+ ---

+ > git_version name= # invalid

+ git_version: name cannot be empty.

+ git_version name= # invalid failed with value 1

+ ---

+ > git_version name="$(git_name)"

+ ---

+ > git_vcs

+ ---

+ > git_vcs subtree=foo

+ ---

+ > git_pack

+ git_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_pack dir_name=foo

+ git_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_pack dir_name=foo source_name=foo.tar.gz

+ git_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_pack path=foo dir_name=bar source_name=foo.tar.gz

+ git_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_archive

+ git_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_archive dir_name=foo

+ git_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_archive dir_name=foo source_name=foo.tar.gz

+ git_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_archive path=foo dir_name=bar source_name=foo.tar.gz

+ git_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_setup_macro

+ ---

+ > git_setup_macro dir_name=foo

+ ---

+ > git_changelog header_date_format="@@@"

+ ---

+ > git_changelog name=foo since_tag=foo-1.2-1 header_date_format="@@@"

+ ---

+ > git_changelog name=foo until_tag=foo-1.2-1 header_date_format="@@@"

+ ---

+ > git_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_date_format="@@@"

+ ---

+ > git_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_locale=POSIX header_date_format="@@@" body_wrap=42

+ ---

+ > git_dir_name

+ ---

+ > git_dir_name name=foo

+ ---

+ > git_dir_name append=-baz

+ ---

+ > git_dir_name prepend=bar-

+ ---

+ > git_dir_name prepend=bar- append=-baz

+ ---

+ > git_dir_name name=foo prepend=bar- append=-baz

+ ---

+ > git_dir_version

+ ---

+ > git_dir_version name=foo

+ ---

+ > git_dir_version name=foo lead=1

+ ---

+ > git_dir_version lead=0

+ ---

+ > git_dir_version lead=1

+ ---

+ > git_dir_version lead=0.1

+ ---

+ > git_dir_version follow=1

+ ---

+ > git_dir_version lead=1 follow=2

+ ---

+ > git_dir_version lead=x follow=x

+ ---

+ > git_dir_version lead=1-1 # invalid

+ git_dir_version: lead and follow cannot contain dashes.

+ git_dir_version lead=1-1 # invalid failed with value 1

+ ---

+ > git_dir_version follow=2.0 # invalid

+ git_dir_version: follow cannot contain dots.

+ git_dir_version follow=2.0 # invalid failed with value 1

+ ---

+ > git_dir_version follow=2-2 # invalid

+ git_dir_version: lead and follow cannot contain dashes.

+ git_dir_version follow=2-2 # invalid failed with value 1

+ ---

+ > git_dir_version name= # invalid

+ git_dir_version: name cannot be empty.

+ git_dir_version name= # invalid failed with value 1

+ ---

+ > git_dir_version name="$(git_name)"

+ ---

+ > git_dir_vcs

+ ---

+ > git_dir_vcs subtree=foo

+ ---

+ > git_dir_pack

+ git_dir_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_dir_pack dir_name=foo

+ git_dir_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_dir_pack dir_name=foo source_name=foo.tar.gz

+ git_dir_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_dir_pack path=foo dir_name=bar source_name=foo.tar.gz

+ git_dir_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_dir_archive

+ git_dir_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_dir_archive dir_name=foo

+ git_dir_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_dir_archive dir_name=foo source_name=foo.tar.gz

+ git_dir_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_dir_archive path=foo dir_name=bar source_name=foo.tar.gz

+ git_dir_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_dir_setup_macro

+ ---

+ > git_dir_setup_macro dir_name=foo

+ ---

+ > git_dir_changelog header_date_format="@@@"

+ ---

+ > git_dir_changelog name=foo since_tag=foo-1.2-1 header_date_format="@@@"

+ ---

+ > git_dir_changelog name=foo until_tag=foo-1.2-1 header_date_format="@@@"

+ ---

+ > git_dir_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_date_format="@@@"

+ ---

+ > git_dir_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_locale=POSIX header_date_format="@@@" body_wrap=42

+ ---

+ > git_cwd_name

+ ---

+ > git_cwd_name name=foo

+ ---

+ > git_cwd_name append=-baz

+ ---

+ > git_cwd_name prepend=bar-

+ ---

+ > git_cwd_name prepend=bar- append=-baz

+ ---

+ > git_cwd_name name=foo prepend=bar- append=-baz

+ ---

+ > git_cwd_version

+ ---

+ > git_cwd_version name=foo

+ ---

+ > git_cwd_version name=foo lead=1

+ ---

+ > git_cwd_version lead=0

+ ---

+ > git_cwd_version lead=1

+ ---

+ > git_cwd_version lead=0.1

+ ---

+ > git_cwd_version follow=1

+ ---

+ > git_cwd_version lead=1 follow=2

+ ---

+ > git_cwd_version lead=x follow=x

+ ---

+ > git_cwd_version lead=1-1 # invalid

+ git_cwd_version: lead and follow cannot contain dashes.

+ git_cwd_version lead=1-1 # invalid failed with value 1

+ ---

+ > git_cwd_version follow=2.0 # invalid

+ git_cwd_version: follow cannot contain dots.

+ git_cwd_version follow=2.0 # invalid failed with value 1

+ ---

+ > git_cwd_version follow=2-2 # invalid

+ git_cwd_version: lead and follow cannot contain dashes.

+ git_cwd_version follow=2-2 # invalid failed with value 1

+ ---

+ > git_cwd_version name= # invalid

+ git_cwd_version: name cannot be empty.

+ git_cwd_version name= # invalid failed with value 1

+ ---

+ > git_cwd_version name="$(git_cwd_name)"

+ ---

+ > git_cwd_vcs

+ ---

+ > git_cwd_vcs subtree=foo

+ ---

+ > git_cwd_pack

+ git_cwd_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_cwd_pack dir_name=foo

+ git_cwd_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_cwd_pack dir_name=foo source_name=foo.tar.gz

+ git_cwd_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_cwd_pack path=foo dir_name=bar source_name=foo.tar.gz

+ git_cwd_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_cwd_archive

+ git_cwd_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_cwd_archive dir_name=foo

+ git_cwd_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_cwd_archive dir_name=foo source_name=foo.tar.gz

+ git_cwd_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_cwd_archive path=foo dir_name=bar source_name=foo.tar.gz

+ git_cwd_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_cwd_setup_macro

+ ---

+ > git_cwd_setup_macro dir_name=foo

+ ---

+ > git_cwd_changelog header_date_format="@@@"

+ ---

+ > git_cwd_changelog name=foo since_tag=foo-1.2-1 header_date_format="@@@"

+ ---

+ > git_cwd_changelog name=foo until_tag=foo-1.2-1 header_date_format="@@@"

+ ---

+ > git_cwd_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_date_format="@@@"

+ ---

+ > git_cwd_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_locale=POSIX header_date_format="@@@" body_wrap=42

+ ---

@@ -0,0 +1,165 @@ 

+ git_name: test

+ git_name name=foo: foo

+ git_name append=-baz: test-baz

+ git_name prepend=bar-: bar-test

+ git_name prepend=bar- append=-baz: bar-test-baz

+ git_name name=foo prepend=bar- append=-baz: bar-foo-baz

+ 

+ git_version: 0.0.wtree.zf25r2

+ git_version name=foo: 0.0.wtree.zf25r2

+ git_version name=foo lead=1: 1.0.wtree.zf25r2

+ git_version lead=0: 0.0.wtree.zf25r2

+ git_version lead=1: 1.0.wtree.zf25r2

+ git_version lead=0.1: 0.1.0.wtree.zf25r2

+ git_version follow=1: 0.1.wtree.zf25r2

+ git_version lead=1 follow=2: 1.2.wtree.zf25r2

+ git_version lead=x follow=x: x.x.wtree.zf25r2

+ git_version lead=1-1 # invalid: 

+ git_version follow=2.0 # invalid: 

+ git_version follow=2-2 # invalid: 

+ git_version name= # invalid: 

+ git_version name="$(git_name)": 0.0.wtree.zf25r2

+ 

+ git_vcs: git+https://pagure.io/clime/test.git#HEAD:

+ git_vcs subtree=foo: git+https://pagure.io/clime/test.git#HEAD:foo

+ 

+ git_pack: bar-foo-baz-0.0.wtree.zf25r2.tar.gz

+ git_pack dir_name=foo: bar-foo-baz-0.0.wtree.zf25r2.tar.gz

+ git_pack dir_name=foo source_name=foo.tar.gz: foo.tar.gz

+ git_pack path=foo dir_name=bar source_name=foo.tar.gz: foo.tar.gz

+ 

+ git_archive: bar-foo-baz-0.0.wtree.zf25r2.tar.gz

+ git_archive dir_name=foo: bar-foo-baz-0.0.wtree.zf25r2.tar.gz

+ git_archive dir_name=foo source_name=foo.tar.gz: foo.tar.gz

+ git_archive path=foo dir_name=bar source_name=foo.tar.gz: foo.tar.gz

+ 

+ git_setup_macro: %setup -q -n bar-foo-baz-0.0.wtree.zf25r2

+ git_setup_macro dir_name=foo: %setup -q -n foo

+ 

+ git_changelog header_date_format="@@@":

+ 

+ 

+ git_changelog name=foo since_tag=foo-1.2-1 header_date_format="@@@":

+ 

+ 

+ git_changelog name=foo until_tag=foo-1.2-1 header_date_format="@@@":

+ 

+ 

+ git_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_date_format="@@@":

+ 

+ 

+ git_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_locale=POSIX header_date_format="@@@" body_wrap=42:

+ 

+ 

+ 

+ :::::::::::::::::::::

+ 

+ git_dir_name: test-

+ git_dir_name name=foo: foo-

+ git_dir_name append=-baz: test-baz

+ git_dir_name prepend=bar-: bar-test-

+ git_dir_name prepend=bar- append=-baz: bar-test-baz

+ git_dir_name name=foo prepend=bar- append=-baz: bar-foo-baz

+ 

+ git_dir_version: 0.0.wtree.zf25r2

+ git_dir_version name=foo: 0.0.wtree.zf25r2

+ git_dir_version name=foo lead=1: 1.0.wtree.zf25r2

+ git_dir_version lead=0: 0.0.wtree.zf25r2

+ git_dir_version lead=1: 1.0.wtree.zf25r2

+ git_dir_version lead=0.1: 0.1.0.wtree.zf25r2

+ git_dir_version follow=1: 0.1.wtree.zf25r2

+ git_dir_version lead=1 follow=2: 1.2.wtree.zf25r2

+ git_dir_version lead=x follow=x: x.x.wtree.zf25r2

+ git_dir_version lead=1-1 # invalid: 

+ git_dir_version follow=2.0 # invalid: 

+ git_dir_version follow=2-2 # invalid: 

+ git_dir_version name= # invalid: 

+ git_dir_version name="$(git_name)": 0.0.wtree.zf25r2

+ 

+ git_dir_vcs: git+https://pagure.io/clime/test.git#HEAD:

+ git_dir_vcs subtree=foo: git+https://pagure.io/clime/test.git#HEAD:foo

+ 

+ git_dir_pack: bar-foo-baz-0.0.wtree.zf25r2.tar.gz

+ git_dir_pack dir_name=foo: bar-foo-baz-0.0.wtree.zf25r2.tar.gz

+ git_dir_pack dir_name=foo source_name=foo.tar.gz: foo.tar.gz

+ git_dir_pack path=foo dir_name=bar source_name=foo.tar.gz: foo.tar.gz

+ 

+ git_dir_archive: bar-foo-baz-0.0.wtree.zf25r2.tar.gz

+ git_dir_archive dir_name=foo: bar-foo-baz-0.0.wtree.zf25r2.tar.gz

+ git_dir_archive dir_name=foo source_name=foo.tar.gz: foo.tar.gz

+ git_dir_archive path=foo dir_name=bar source_name=foo.tar.gz: foo.tar.gz

+ 

+ git_dir_setup_macro: %setup -q -n bar-foo-baz-0.0.wtree.zf25r2

+ git_dir_setup_macro dir_name=foo: %setup -q -n foo

+ 

+ git_dir_changelog header_date_format="@@@":

+ 

+ 

+ git_dir_changelog name=foo since_tag=foo-1.2-1 header_date_format="@@@":

+ 

+ 

+ git_dir_changelog name=foo until_tag=foo-1.2-1 header_date_format="@@@":

+ 

+ 

+ git_dir_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_date_format="@@@":

+ 

+ 

+ git_dir_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_locale=POSIX header_date_format="@@@" body_wrap=42:

+ 

+ 

+ 

+ :::::::::::::::::::::

+ 

+ git_cwd_name: test-

+ git_cwd_name name=foo: foo-

+ git_cwd_name append=-baz: test-baz

+ git_cwd_name prepend=bar-: bar-test-

+ git_cwd_name prepend=bar- append=-baz: bar-test-baz

+ git_cwd_name name=foo prepend=bar- append=-baz: bar-foo-baz

+ 

+ git_cwd_version: 0.0.wtree.zf25r2

+ git_cwd_version name=foo: 0.0.wtree.zf25r2

+ git_cwd_version name=foo lead=1: 1.0.wtree.zf25r2

+ git_cwd_version lead=0: 0.0.wtree.zf25r2

+ git_cwd_version lead=1: 1.0.wtree.zf25r2

+ git_cwd_version lead=0.1: 0.1.0.wtree.zf25r2

+ git_cwd_version follow=1: 0.1.wtree.zf25r2

+ git_cwd_version lead=1 follow=2: 1.2.wtree.zf25r2

+ git_cwd_version lead=x follow=x: x.x.wtree.zf25r2

+ git_cwd_version lead=1-1 # invalid: 

+ git_cwd_version follow=2.0 # invalid: 

+ git_cwd_version follow=2-2 # invalid: 

+ git_cwd_version name= # invalid: 

+ git_cwd_version name="$(git_cwd_name)": 0.0.wtree.zf25r2

+ 

+ git_cwd_vcs: git+https://pagure.io/clime/test.git#HEAD:

+ git_cwd_vcs subtree=foo: git+https://pagure.io/clime/test.git#HEAD:foo

+ 

+ git_cwd_pack: bar-foo-baz-0.0.wtree.zf25r2.tar.gz

+ git_cwd_pack dir_name=foo: bar-foo-baz-0.0.wtree.zf25r2.tar.gz

+ git_cwd_pack dir_name=foo source_name=foo.tar.gz: foo.tar.gz

+ git_cwd_pack path=foo dir_name=bar source_name=foo.tar.gz: foo.tar.gz

+ 

+ git_cwd_archive: bar-foo-baz-0.0.wtree.zf25r2.tar.gz

+ git_cwd_archive dir_name=foo: bar-foo-baz-0.0.wtree.zf25r2.tar.gz

+ git_cwd_archive dir_name=foo source_name=foo.tar.gz: foo.tar.gz

+ git_cwd_archive path=foo dir_name=bar source_name=foo.tar.gz: foo.tar.gz

+ 

+ git_cwd_setup_macro: %setup -q -n bar-foo-baz-0.0.wtree.zf25r2

+ git_cwd_setup_macro dir_name=foo: %setup -q -n foo

+ 

+ git_cwd_changelog header_date_format="@@@":

+ 

+ 

+ git_cwd_changelog name=foo since_tag=foo-1.2-1 header_date_format="@@@":

+ 

+ 

+ git_cwd_changelog name=foo until_tag=foo-1.2-1 header_date_format="@@@":

+ 

+ 

+ git_cwd_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_date_format="@@@":

+ 

+ 

+ git_cwd_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_locale=POSIX header_date_format="@@@" body_wrap=42:

+ 

+ 

@@ -0,0 +1,19 @@ 

+ #!/bin/bash

+ 

+ . ../lib.sh

+ 

+ repo=`mktemp -d`

+ output=`mktemp`

+ 

+ prepare_input ../input $repo/input

+ 

+ git init $repo

+ git -C $repo remote add origin https://pagure.io/clime/test.git

+ 

+ touch output && cp output $output

+ wtree_sub $repo $output

+ 

+ generic_test opts='--dump-spec-only' path=$repo input=$repo/input expected_output=$output expected_log=log copy_only=$1

+ 

+ rm -rf $repo

+ rm $output

@@ -0,0 +1,2 @@ 

+ git_pack dir_name=foo source_name=foo.tar.gz

+ git_archive dir_name=bar source_name=bar.tar.gz

@@ -0,0 +1,6 @@ 

+ > git_pack dir_name=foo source_name=foo.tar.gz

+ ---

+ > git_archive dir_name=bar source_name=bar.tar.gz

+ git_archive: No commits yet. Cannot archive the content.

+ git_archive dir_name=bar source_name=bar.tar.gz failed with value 1

+ ---

@@ -0,0 +1,2 @@ 

+ git_pack dir_name=foo source_name=foo.tar.gz: foo.tar.gz

+ git_archive dir_name=bar source_name=bar.tar.gz: 

@@ -0,0 +1,27 @@ 

+ #!/bin/bash

+ 

+ . ../lib.sh

+ 

+ repo=`mktemp -d`

+ output=`mktemp`

+ 

+ prepare_input input $repo/input

+ git init $repo

+ 

+ touch output && cp output $output

+ 

+ echo 1 > $repo/cookie

+ 

+ function custom_test {

+     declare out= "$@"

+     local source_name=foo.tar.gz

+     local dir_name=foo

+ 

+     run "tar -C $out -xf $out/$source_name || die"

+     run "diff $out/$dir_name/cookie $repo/cookie || die"

+ }

+ 

+ generic_test opts='' path=$repo input=$repo/input expected_output=$output expected_log=log custom_test=custom_test copy_only=$1

+ 

+ rm -rf $repo

+ rm $output

@@ -0,0 +1,2 @@ 

+ git_pack dir_name=foo source_name=foo.tar.gz

+ git_archive dir_name=bar source_name=bar.tar.gz

@@ -0,0 +1,4 @@ 

+ > git_pack dir_name=foo source_name=foo.tar.gz

+ ---

+ > git_archive dir_name=bar source_name=bar.tar.gz

+ ---

@@ -0,0 +1,2 @@ 

+ git_pack dir_name=foo source_name=foo.tar.gz: foo.tar.gz

+ git_archive dir_name=bar source_name=bar.tar.gz: bar.tar.gz

@@ -0,0 +1,34 @@ 

+ #!/bin/bash

+ 

+ . ../lib.sh

+ 

+ repo=`mktemp -d`

+ output=`mktemp`

+ 

+ prepare_input input $repo/input

+ echo 1 > $repo/cookie

+ 

+ git init $repo

+ git -C $repo add -A

+ git -C $repo commit -m 'commit 1'

+ 

+ touch output && cp output $output

+ 

+ function custom_test {

+     declare out= "$@"

+     local source_name1=foo.tar.gz

+     local source_name2=bar.tar.gz

+     local dir_name1=foo

+     local dir_name2=bar

+ 

+     run "tar -C $out -xf $out/$source_name1 || die"

+     run "diff $out/$dir_name1/cookie $repo/cookie || die"

+ 

+     run "tar -C $out -xf $out/$source_name2 || die"

+     run "diff $out/$dir_name2/cookie $repo/cookie || die"

+ }

+ 

+ generic_test opts='' path=$repo input=$repo/input expected_output=$output expected_log=log custom_test=custom_test copy_only=$1

+ 

+ rm -rf $repo

+ rm $output

@@ -0,0 +1,26 @@ 

+ git_dir_name # cache

+ git_dir_version # cache

+ 

+ git_dir_pack source_name=foo_dir_nodirname.tar.gz

+ git_dir_archive source_name=bar_dir_nodirname.tar.gz

+ 

+ git_dir_pack dir_name=foo_dir source_name=foo_dir.tar.gz

+ git_dir_archive dir_name=bar_dir source_name=bar_dir.tar.gz

+ 

+ git_cwd_name # cache

+ git_cwd_version # cache

+ 

+ git_cwd_pack source_name=foo_cwd_nodirname.tar.gz

+ git_cwd_archive source_name=bar_cwd_nodirname.tar.gz

+ 

+ git_cwd_pack dir_name=foo_cwd source_name=foo_cwd.tar.gz

+ git_cwd_archive dir_name=bar_cwd source_name=bar_cwd.tar.gz

+ 

+ git_name # cache

+ git_version # cache

+ 

+ git_pack path=$(git rev-parse --show-toplevel)/subdir3 source_name=subdir3_foo_nodirname.tar.gz

+ git_archive path=$(git rev-parse --show-toplevel)/subdir3 source_name=subdir3_bar_nodirname.tar.gz

+ 

+ git_pack path=$(git rev-parse --show-toplevel)/subdir3 dir_name=subdir3_foo source_name=subdir3_foo.tar.gz

+ git_archive path=$(git rev-parse --show-toplevel)/subdir3 dir_name=subdir3_bar source_name=subdir3_bar.tar.gz

@@ -0,0 +1,36 @@ 

+ > git_dir_name # cache

+ ---

+ > git_dir_version # cache

+ ---

+ > git_dir_pack source_name=foo_dir_nodirname.tar.gz

+ ---

+ > git_dir_archive source_name=bar_dir_nodirname.tar.gz

+ ---

+ > git_dir_pack dir_name=foo_dir source_name=foo_dir.tar.gz

+ ---

+ > git_dir_archive dir_name=bar_dir source_name=bar_dir.tar.gz

+ ---

+ > git_cwd_name # cache

+ ---

+ > git_cwd_version # cache

+ ---

+ > git_cwd_pack source_name=foo_cwd_nodirname.tar.gz

+ ---

+ > git_cwd_archive source_name=bar_cwd_nodirname.tar.gz

+ ---

+ > git_cwd_pack dir_name=foo_cwd source_name=foo_cwd.tar.gz

+ ---

+ > git_cwd_archive dir_name=bar_cwd source_name=bar_cwd.tar.gz

+ ---

+ > git_name # cache

+ ---

+ > git_version # cache

+ ---

+ > git_pack path=$(git rev-parse --show-toplevel)/subdir3 source_name=subdir3_foo_nodirname.tar.gz

+ ---

+ > git_archive path=$(git rev-parse --show-toplevel)/subdir3 source_name=subdir3_bar_nodirname.tar.gz

+ ---

+ > git_pack path=$(git rev-parse --show-toplevel)/subdir3 dir_name=subdir3_foo source_name=subdir3_foo.tar.gz

+ ---

+ > git_archive path=$(git rev-parse --show-toplevel)/subdir3 dir_name=subdir3_bar source_name=subdir3_bar.tar.gz

+ ---

@@ -0,0 +1,26 @@ 

+ git_dir_name # cache: test-subdir2

+ git_dir_version # cache: 0.4

+ 

+ git_dir_pack source_name=foo_dir_nodirname.tar.gz: foo_dir_nodirname.tar.gz

+ git_dir_archive source_name=bar_dir_nodirname.tar.gz: bar_dir_nodirname.tar.gz

+ 

+ git_dir_pack dir_name=foo_dir source_name=foo_dir.tar.gz: foo_dir.tar.gz

+ git_dir_archive dir_name=bar_dir source_name=bar_dir.tar.gz: bar_dir.tar.gz

+ 

+ git_cwd_name # cache: test-subdir1

+ git_cwd_version # cache: 0.4

+ 

+ git_cwd_pack source_name=foo_cwd_nodirname.tar.gz: foo_cwd_nodirname.tar.gz

+ git_cwd_archive source_name=bar_cwd_nodirname.tar.gz: bar_cwd_nodirname.tar.gz

+ 

+ git_cwd_pack dir_name=foo_cwd source_name=foo_cwd.tar.gz: foo_cwd.tar.gz

+ git_cwd_archive dir_name=bar_cwd source_name=bar_cwd.tar.gz: bar_cwd.tar.gz

+ 

+ git_name # cache: test

+ git_version # cache: 0.4

+ 

+ git_pack path=$(git rev-parse --show-toplevel)/subdir3 source_name=subdir3_foo_nodirname.tar.gz: subdir3_foo_nodirname.tar.gz

+ git_archive path=$(git rev-parse --show-toplevel)/subdir3 source_name=subdir3_bar_nodirname.tar.gz: subdir3_bar_nodirname.tar.gz

+ 

+ git_pack path=$(git rev-parse --show-toplevel)/subdir3 dir_name=subdir3_foo source_name=subdir3_foo.tar.gz: subdir3_foo.tar.gz

+ git_archive path=$(git rev-parse --show-toplevel)/subdir3 dir_name=subdir3_bar source_name=subdir3_bar.tar.gz: subdir3_bar.tar.gz

@@ -0,0 +1,67 @@ 

+ #!/bin/bash

+ 

+ . ../lib.sh

+ 

+ repo=`mktemp -d`

+ output=`mktemp`

+ 

+ mkdir $repo/subdir1 $repo/subdir2 $repo/subdir3

+ prepare_input input $repo/subdir2/input

+ echo 1 > $repo/subdir1/cookie

+ echo 2 > $repo/subdir3/cookie

+ echo 3 > $repo/subdir2/cookie

+ 

+ git init $repo

+ git -C $repo remote add origin https://pagure.io/clime/test.git

+ git -C $repo add -A

+ git -C $repo commit -m 'commit 1'

+ git -C $repo tag -a -m 'tag message' test-0.4-1

+ git -C $repo tag -a -m 'tag message' test-subdir1-0.4-1

+ git -C $repo tag -a -m 'tag message' test-subdir2-0.4-1

+ git -C $repo tag -a -m 'tag message' test-subdir3-0.4-1

+ 

+ touch output && cp output $output

+ 

+ function custom_test {

+     declare out= "$@"

+     run "tar -C $out -xf $out/foo_dir_nodirname.tar.gz || die"

+     run "diff $out/test-subdir2-0.4/cookie $repo/subdir2/cookie || die"

+ 

+     run "tar -C $out -xf $out/bar_dir_nodirname.tar.gz || die"

+     run "diff $out/test-subdir2-0.4/cookie $repo/subdir2/cookie || die"

+ 

+     run "tar -C $out -xf $out/foo_dir.tar.gz || die"

+     run "diff $out/foo_dir/cookie $repo/subdir2/cookie || die"

+ 

+     run "tar -C $out -xf $out/bar_dir.tar.gz || die"

+     run "diff $out/bar_dir/cookie $repo/subdir2/cookie || die"

+ 

+     run "tar -C $out -xf $out/foo_cwd_nodirname.tar.gz || die"

+     run "diff $out/test-subdir1-0.4/cookie $repo/subdir1/cookie || die"

+ 

+     run "tar -C $out -xf $out/bar_cwd_nodirname.tar.gz || die"

+     run "diff $out/test-subdir1-0.4/cookie $repo/subdir1/cookie || die"

+ 

+     run "tar -C $out -xf $out/foo_cwd.tar.gz || die"

+     run "diff $out/foo_cwd/cookie $repo/subdir1/cookie || die"

+ 

+     run "tar -C $out -xf $out/bar_cwd.tar.gz || die"

+     run "diff $out/bar_cwd/cookie $repo/subdir1/cookie || die"

+ 

+     run "tar -C $out -xf $out/subdir3_foo_nodirname.tar.gz || die"

+     run "diff $out/test-0.4/cookie $repo/subdir3/cookie || die"

+ 

+     run "tar -C $out -xf $out/subdir3_foo_nodirname.tar.gz || die"

+     run "diff $out/test-0.4/cookie $repo/subdir3/cookie || die"

+ 

+     run "tar -C $out -xf $out/subdir3_foo.tar.gz || die"

+     run "diff $out/subdir3_foo/cookie $repo/subdir3/cookie || die"

+ 

+     run "tar -C $out -xf $out/subdir3_bar.tar.gz || die"

+     run "diff $out/subdir3_bar/cookie $repo/subdir3/cookie || die"

+ }

+ 

+ generic_test opts='' path=$repo/subdir1 input=$repo/subdir2/input expected_output=$output expected_log=log custom_test=custom_test copy_only=$1

+ 

+ rm -rf $repo

+ rm $output

@@ -0,0 +1,270 @@ 

+ > git_name

+ ---

+ > git_name name=foo

+ ---

+ > git_name append=-baz

+ ---

+ > git_name prepend=bar-

+ ---

+ > git_name prepend=bar- append=-baz

+ ---

+ > git_name name=foo prepend=bar- append=-baz

+ ---

+ > git_version

+ ---

+ > git_version name=foo

+ ---

+ > git_version name=foo lead=1

+ ---

+ > git_version lead=0

+ ---

+ > git_version lead=1

+ ---

+ > git_version lead=0.1

+ ---

+ > git_version follow=1

+ ---

+ > git_version lead=1 follow=2

+ ---

+ > git_version lead=x follow=x

+ ---

+ > git_version lead=1-1 # invalid

+ git_version: lead and follow cannot contain dashes.

+ git_version lead=1-1 # invalid failed with value 1

+ ---

+ > git_version follow=2.0 # invalid

+ git_version: follow cannot contain dots.

+ git_version follow=2.0 # invalid failed with value 1

+ ---

+ > git_version follow=2-2 # invalid

+ git_version: lead and follow cannot contain dashes.

+ git_version follow=2-2 # invalid failed with value 1

+ ---

+ > git_version name= # invalid

+ git_version: name cannot be empty.

+ git_version name= # invalid failed with value 1

+ ---

+ > git_version name="$(git_name)"

+ ---

+ > git_vcs

+ ---

+ > git_vcs subtree=foo

+ ---

+ > git_pack

+ git_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_pack dir_name=foo

+ git_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_pack dir_name=foo source_name=foo.tar.gz

+ git_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_pack path=foo dir_name=bar source_name=foo.tar.gz

+ git_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_archive

+ git_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_archive dir_name=foo

+ git_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_archive dir_name=foo source_name=foo.tar.gz

+ git_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_archive path=foo dir_name=bar source_name=foo.tar.gz

+ git_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_setup_macro

+ ---

+ > git_setup_macro dir_name=foo

+ ---

+ > git_changelog header_date_format="@@@"

+ ---

+ > git_changelog name=foo since_tag=foo-1.2-1 header_date_format="@@@"

+ ---

+ > git_changelog name=foo until_tag=foo-1.2-1 header_date_format="@@@"

+ ---

+ > git_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_date_format="@@@"

+ ---

+ > git_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_locale=POSIX header_date_format="@@@" body_wrap=42

+ ---

+ > git_dir_name

+ ---

+ > git_dir_name name=foo

+ ---

+ > git_dir_name append=-baz

+ ---

+ > git_dir_name prepend=bar-

+ ---

+ > git_dir_name prepend=bar- append=-baz

+ ---

+ > git_dir_name name=foo prepend=bar- append=-baz

+ ---

+ > git_dir_version

+ ---

+ > git_dir_version name=foo

+ ---

+ > git_dir_version name=foo lead=1

+ ---

+ > git_dir_version lead=0

+ ---

+ > git_dir_version lead=1

+ ---

+ > git_dir_version lead=0.1

+ ---

+ > git_dir_version follow=1

+ ---

+ > git_dir_version lead=1 follow=2

+ ---

+ > git_dir_version lead=x follow=x

+ ---

+ > git_dir_version lead=1-1 # invalid

+ git_dir_version: lead and follow cannot contain dashes.

+ git_dir_version lead=1-1 # invalid failed with value 1

+ ---

+ > git_dir_version follow=2.0 # invalid

+ git_dir_version: follow cannot contain dots.

+ git_dir_version follow=2.0 # invalid failed with value 1

+ ---

+ > git_dir_version follow=2-2 # invalid

+ git_dir_version: lead and follow cannot contain dashes.

+ git_dir_version follow=2-2 # invalid failed with value 1

+ ---

+ > git_dir_version name= # invalid

+ git_dir_version: name cannot be empty.

+ git_dir_version name= # invalid failed with value 1

+ ---

+ > git_dir_version name="$(git_name)"

+ ---

+ > git_dir_vcs

+ ---

+ > git_dir_vcs subtree=foo

+ ---

+ > git_dir_pack

+ git_dir_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_dir_pack dir_name=foo

+ git_dir_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_dir_pack dir_name=foo source_name=foo.tar.gz

+ git_dir_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_dir_pack path=foo dir_name=bar source_name=foo.tar.gz

+ git_dir_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_dir_archive

+ git_dir_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_dir_archive dir_name=foo

+ git_dir_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_dir_archive dir_name=foo source_name=foo.tar.gz

+ git_dir_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_dir_archive path=foo dir_name=bar source_name=foo.tar.gz

+ git_dir_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_dir_setup_macro

+ ---

+ > git_dir_setup_macro dir_name=foo

+ ---

+ > git_dir_changelog header_date_format="@@@"

+ ---

+ > git_dir_changelog name=foo since_tag=foo-1.2-1 header_date_format="@@@"

+ ---

+ > git_dir_changelog name=foo until_tag=foo-1.2-1 header_date_format="@@@"

+ ---

+ > git_dir_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_date_format="@@@"

+ ---

+ > git_dir_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_locale=POSIX header_date_format="@@@" body_wrap=42

+ ---

+ > git_cwd_name

+ ---

+ > git_cwd_name name=foo

+ ---

+ > git_cwd_name append=-baz

+ ---

+ > git_cwd_name prepend=bar-

+ ---

+ > git_cwd_name prepend=bar- append=-baz

+ ---

+ > git_cwd_name name=foo prepend=bar- append=-baz

+ ---

+ > git_cwd_version

+ ---

+ > git_cwd_version name=foo

+ ---

+ > git_cwd_version name=foo lead=1

+ ---

+ > git_cwd_version lead=0

+ ---

+ > git_cwd_version lead=1

+ ---

+ > git_cwd_version lead=0.1

+ ---

+ > git_cwd_version follow=1

+ ---

+ > git_cwd_version lead=1 follow=2

+ ---

+ > git_cwd_version lead=x follow=x

+ ---

+ > git_cwd_version lead=1-1 # invalid

+ git_cwd_version: lead and follow cannot contain dashes.

+ git_cwd_version lead=1-1 # invalid failed with value 1

+ ---

+ > git_cwd_version follow=2.0 # invalid

+ git_cwd_version: follow cannot contain dots.

+ git_cwd_version follow=2.0 # invalid failed with value 1

+ ---

+ > git_cwd_version follow=2-2 # invalid

+ git_cwd_version: lead and follow cannot contain dashes.

+ git_cwd_version follow=2-2 # invalid failed with value 1

+ ---

+ > git_cwd_version name= # invalid

+ git_cwd_version: name cannot be empty.

+ git_cwd_version name= # invalid failed with value 1

+ ---

+ > git_cwd_version name="$(git_cwd_name)"

+ ---

+ > git_cwd_vcs

+ ---

+ > git_cwd_vcs subtree=foo

+ ---

+ > git_cwd_pack

+ git_cwd_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_cwd_pack dir_name=foo

+ git_cwd_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_cwd_pack dir_name=foo source_name=foo.tar.gz

+ git_cwd_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_cwd_pack path=foo dir_name=bar source_name=foo.tar.gz

+ git_cwd_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_cwd_archive

+ git_cwd_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_cwd_archive dir_name=foo

+ git_cwd_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_cwd_archive dir_name=foo source_name=foo.tar.gz

+ git_cwd_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_cwd_archive path=foo dir_name=bar source_name=foo.tar.gz

+ git_cwd_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_cwd_setup_macro

+ ---

+ > git_cwd_setup_macro dir_name=foo

+ ---

+ > git_cwd_changelog header_date_format="@@@"

+ ---

+ > git_cwd_changelog name=foo since_tag=foo-1.2-1 header_date_format="@@@"

+ ---

+ > git_cwd_changelog name=foo until_tag=foo-1.2-1 header_date_format="@@@"

+ ---

+ > git_cwd_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_date_format="@@@"

+ ---

+ > git_cwd_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_locale=POSIX header_date_format="@@@" body_wrap=42

+ ---

@@ -0,0 +1,165 @@ 

+ git_name: test

+ git_name name=foo: foo

+ git_name append=-baz: test-baz

+ git_name prepend=bar-: bar-test

+ git_name prepend=bar- append=-baz: bar-test-baz

+ git_name name=foo prepend=bar- append=-baz: bar-foo-baz

+ 

+ git_version: 0.0.wtree.zf25r6

+ git_version name=foo: 0.0.wtree.zf25r6

+ git_version name=foo lead=1: 1.0.wtree.zf25r6

+ git_version lead=0: 0.0.wtree.zf25r6

+ git_version lead=1: 1.0.wtree.zf25r6

+ git_version lead=0.1: 0.1.0.wtree.zf25r6

+ git_version follow=1: 0.1.wtree.zf25r6

+ git_version lead=1 follow=2: 1.2.wtree.zf25r6

+ git_version lead=x follow=x: x.x.wtree.zf25r6

+ git_version lead=1-1 # invalid: 

+ git_version follow=2.0 # invalid: 

+ git_version follow=2-2 # invalid: 

+ git_version name= # invalid: 

+ git_version name="$(git_name)": 0.0.wtree.zf25r6

+ 

+ git_vcs: git+https://pagure.io/clime/test.git#HEAD:

+ git_vcs subtree=foo: git+https://pagure.io/clime/test.git#HEAD:foo

+ 

+ git_pack: bar-foo-baz-0.0.wtree.zf25r6.tar.gz

+ git_pack dir_name=foo: bar-foo-baz-0.0.wtree.zf25r6.tar.gz

+ git_pack dir_name=foo source_name=foo.tar.gz: foo.tar.gz

+ git_pack path=foo dir_name=bar source_name=foo.tar.gz: foo.tar.gz

+ 

+ git_archive: bar-foo-baz-0.0.wtree.zf25r6.tar.gz

+ git_archive dir_name=foo: bar-foo-baz-0.0.wtree.zf25r6.tar.gz

+ git_archive dir_name=foo source_name=foo.tar.gz: foo.tar.gz

+ git_archive path=foo dir_name=bar source_name=foo.tar.gz: foo.tar.gz

+ 

+ git_setup_macro: %setup -q -n bar-foo-baz-0.0.wtree.zf25r6

+ git_setup_macro dir_name=foo: %setup -q -n foo

+ 

+ git_changelog header_date_format="@@@":

+ 

+ 

+ git_changelog name=foo since_tag=foo-1.2-1 header_date_format="@@@":

+ 

+ 

+ git_changelog name=foo until_tag=foo-1.2-1 header_date_format="@@@":

+ 

+ 

+ git_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_date_format="@@@":

+ 

+ 

+ git_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_locale=POSIX header_date_format="@@@" body_wrap=42:

+ 

+ 

+ 

+ :::::::::::::::::::::

+ 

+ git_dir_name: test-subdir2

+ git_dir_name name=foo: foo-subdir2

+ git_dir_name append=-baz: test-baz

+ git_dir_name prepend=bar-: bar-test-subdir2

+ git_dir_name prepend=bar- append=-baz: bar-test-baz

+ git_dir_name name=foo prepend=bar- append=-baz: bar-foo-baz

+ 

+ git_dir_version: 0.0.wtree.zf25r6

+ git_dir_version name=foo: 0.0.wtree.zf25r6

+ git_dir_version name=foo lead=1: 1.0.wtree.zf25r6

+ git_dir_version lead=0: 0.0.wtree.zf25r6

+ git_dir_version lead=1: 1.0.wtree.zf25r6

+ git_dir_version lead=0.1: 0.1.0.wtree.zf25r6

+ git_dir_version follow=1: 0.1.wtree.zf25r6

+ git_dir_version lead=1 follow=2: 1.2.wtree.zf25r6

+ git_dir_version lead=x follow=x: x.x.wtree.zf25r6

+ git_dir_version lead=1-1 # invalid: 

+ git_dir_version follow=2.0 # invalid: 

+ git_dir_version follow=2-2 # invalid: 

+ git_dir_version name= # invalid: 

+ git_dir_version name="$(git_name)": 0.0.wtree.zf25r6

+ 

+ git_dir_vcs: git+https://pagure.io/clime/test.git#HEAD:subdir2/

+ git_dir_vcs subtree=foo: git+https://pagure.io/clime/test.git#HEAD:foo

+ 

+ git_dir_pack: bar-foo-baz-0.0.wtree.zf25r6.tar.gz

+ git_dir_pack dir_name=foo: bar-foo-baz-0.0.wtree.zf25r6.tar.gz

+ git_dir_pack dir_name=foo source_name=foo.tar.gz: foo.tar.gz

+ git_dir_pack path=foo dir_name=bar source_name=foo.tar.gz: foo.tar.gz

+ 

+ git_dir_archive: bar-foo-baz-0.0.wtree.zf25r6.tar.gz

+ git_dir_archive dir_name=foo: bar-foo-baz-0.0.wtree.zf25r6.tar.gz

+ git_dir_archive dir_name=foo source_name=foo.tar.gz: foo.tar.gz

+ git_dir_archive path=foo dir_name=bar source_name=foo.tar.gz: foo.tar.gz

+ 

+ git_dir_setup_macro: %setup -q -n bar-foo-baz-0.0.wtree.zf25r6

+ git_dir_setup_macro dir_name=foo: %setup -q -n foo

+ 

+ git_dir_changelog header_date_format="@@@":

+ 

+ 

+ git_dir_changelog name=foo since_tag=foo-1.2-1 header_date_format="@@@":

+ 

+ 

+ git_dir_changelog name=foo until_tag=foo-1.2-1 header_date_format="@@@":

+ 

+ 

+ git_dir_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_date_format="@@@":

+ 

+ 

+ git_dir_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_locale=POSIX header_date_format="@@@" body_wrap=42:

+ 

+ 

+ 

+ :::::::::::::::::::::

+ 

+ git_cwd_name: test-subdir1

+ git_cwd_name name=foo: foo-subdir1

+ git_cwd_name append=-baz: test-baz

+ git_cwd_name prepend=bar-: bar-test-subdir1

+ git_cwd_name prepend=bar- append=-baz: bar-test-baz

+ git_cwd_name name=foo prepend=bar- append=-baz: bar-foo-baz

+ 

+ git_cwd_version: 0.0.wtree.zf25r6

+ git_cwd_version name=foo: 0.0.wtree.zf25r6

+ git_cwd_version name=foo lead=1: 1.0.wtree.zf25r6

+ git_cwd_version lead=0: 0.0.wtree.zf25r6

+ git_cwd_version lead=1: 1.0.wtree.zf25r6

+ git_cwd_version lead=0.1: 0.1.0.wtree.zf25r6

+ git_cwd_version follow=1: 0.1.wtree.zf25r6

+ git_cwd_version lead=1 follow=2: 1.2.wtree.zf25r6

+ git_cwd_version lead=x follow=x: x.x.wtree.zf25r6

+ git_cwd_version lead=1-1 # invalid: 

+ git_cwd_version follow=2.0 # invalid: 

+ git_cwd_version follow=2-2 # invalid: 

+ git_cwd_version name= # invalid: 

+ git_cwd_version name="$(git_cwd_name)": 0.0.wtree.zf25r6

+ 

+ git_cwd_vcs: git+https://pagure.io/clime/test.git#HEAD:subdir1/

+ git_cwd_vcs subtree=foo: git+https://pagure.io/clime/test.git#HEAD:foo

+ 

+ git_cwd_pack: bar-foo-baz-0.0.wtree.zf25r6.tar.gz

+ git_cwd_pack dir_name=foo: bar-foo-baz-0.0.wtree.zf25r6.tar.gz

+ git_cwd_pack dir_name=foo source_name=foo.tar.gz: foo.tar.gz

+ git_cwd_pack path=foo dir_name=bar source_name=foo.tar.gz: foo.tar.gz

+ 

+ git_cwd_archive: bar-foo-baz-0.0.wtree.zf25r6.tar.gz

+ git_cwd_archive dir_name=foo: bar-foo-baz-0.0.wtree.zf25r6.tar.gz

+ git_cwd_archive dir_name=foo source_name=foo.tar.gz: foo.tar.gz

+ git_cwd_archive path=foo dir_name=bar source_name=foo.tar.gz: foo.tar.gz

+ 

+ git_cwd_setup_macro: %setup -q -n bar-foo-baz-0.0.wtree.zf25r6

+ git_cwd_setup_macro dir_name=foo: %setup -q -n foo

+ 

+ git_cwd_changelog header_date_format="@@@":

+ 

+ 

+ git_cwd_changelog name=foo since_tag=foo-1.2-1 header_date_format="@@@":

+ 

+ 

+ git_cwd_changelog name=foo until_tag=foo-1.2-1 header_date_format="@@@":

+ 

+ 

+ git_cwd_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_date_format="@@@":

+ 

+ 

+ git_cwd_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_locale=POSIX header_date_format="@@@" body_wrap=42:

+ 

+ 

@@ -0,0 +1,21 @@ 

+ #!/bin/bash

+ 

+ . ../lib.sh

+ 

+ repo=`mktemp -d`

+ output=`mktemp`

+ 

+ mkdir $repo/subdir1 $repo/subdir2

+ prepare_input ../input $repo/subdir2/input

+ 

+ git init $repo

+ git -C $repo remote add origin https://pagure.io/clime/test.git

+ 

+ touch output && cp output $output

+ wtree_sub $repo $output

+ 

+ generic_test opts='--dump-spec-only' path=$repo/subdir1 input=$repo/subdir2/input expected_output=$output expected_log=log copy_only=$1

+ 

+ echo $repo

+ #rm -rf $repo

+ rm $output

@@ -0,0 +1,270 @@ 

+ > git_name

+ ---

+ > git_name name=foo

+ ---

+ > git_name append=-baz

+ ---

+ > git_name prepend=bar-

+ ---

+ > git_name prepend=bar- append=-baz

+ ---

+ > git_name name=foo prepend=bar- append=-baz

+ ---

+ > git_version

+ ---

+ > git_version name=foo

+ ---

+ > git_version name=foo lead=1

+ ---

+ > git_version lead=0

+ ---

+ > git_version lead=1

+ ---

+ > git_version lead=0.1

+ ---

+ > git_version follow=1

+ ---

+ > git_version lead=1 follow=2

+ ---

+ > git_version lead=x follow=x

+ ---

+ > git_version lead=1-1 # invalid

+ git_version: lead and follow cannot contain dashes.

+ git_version lead=1-1 # invalid failed with value 1

+ ---

+ > git_version follow=2.0 # invalid

+ git_version: follow cannot contain dots.

+ git_version follow=2.0 # invalid failed with value 1

+ ---

+ > git_version follow=2-2 # invalid

+ git_version: lead and follow cannot contain dashes.

+ git_version follow=2-2 # invalid failed with value 1

+ ---

+ > git_version name= # invalid

+ git_version: name cannot be empty.

+ git_version name= # invalid failed with value 1

+ ---

+ > git_version name="$(git_name)"

+ ---

+ > git_vcs

+ ---

+ > git_vcs subtree=foo

+ ---

+ > git_pack

+ git_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_pack dir_name=foo

+ git_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_pack dir_name=foo source_name=foo.tar.gz

+ git_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_pack path=foo dir_name=bar source_name=foo.tar.gz

+ git_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_archive

+ git_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_archive dir_name=foo

+ git_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_archive dir_name=foo source_name=foo.tar.gz

+ git_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_archive path=foo dir_name=bar source_name=foo.tar.gz

+ git_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_setup_macro

+ ---

+ > git_setup_macro dir_name=foo

+ ---

+ > git_changelog header_date_format="@@@"

+ ---

+ > git_changelog name=foo since_tag=foo-1.2-1 header_date_format="@@@"

+ ---

+ > git_changelog name=foo until_tag=foo-1.2-1 header_date_format="@@@"

+ ---

+ > git_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_date_format="@@@"

+ ---

+ > git_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_locale=POSIX header_date_format="@@@" body_wrap=42

+ ---

+ > git_dir_name

+ ---

+ > git_dir_name name=foo

+ ---

+ > git_dir_name append=-baz

+ ---

+ > git_dir_name prepend=bar-

+ ---

+ > git_dir_name prepend=bar- append=-baz

+ ---

+ > git_dir_name name=foo prepend=bar- append=-baz

+ ---

+ > git_dir_version

+ ---

+ > git_dir_version name=foo

+ ---

+ > git_dir_version name=foo lead=1

+ ---

+ > git_dir_version lead=0

+ ---

+ > git_dir_version lead=1

+ ---

+ > git_dir_version lead=0.1

+ ---

+ > git_dir_version follow=1

+ ---

+ > git_dir_version lead=1 follow=2

+ ---

+ > git_dir_version lead=x follow=x

+ ---

+ > git_dir_version lead=1-1 # invalid

+ git_dir_version: lead and follow cannot contain dashes.

+ git_dir_version lead=1-1 # invalid failed with value 1

+ ---

+ > git_dir_version follow=2.0 # invalid

+ git_dir_version: follow cannot contain dots.

+ git_dir_version follow=2.0 # invalid failed with value 1

+ ---

+ > git_dir_version follow=2-2 # invalid

+ git_dir_version: lead and follow cannot contain dashes.

+ git_dir_version follow=2-2 # invalid failed with value 1

+ ---

+ > git_dir_version name= # invalid

+ git_dir_version: name cannot be empty.

+ git_dir_version name= # invalid failed with value 1

+ ---

+ > git_dir_version name="$(git_name)"

+ ---

+ > git_dir_vcs

+ ---

+ > git_dir_vcs subtree=foo

+ ---

+ > git_dir_pack

+ git_dir_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_dir_pack dir_name=foo

+ git_dir_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_dir_pack dir_name=foo source_name=foo.tar.gz

+ git_dir_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_dir_pack path=foo dir_name=bar source_name=foo.tar.gz

+ git_dir_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_dir_archive

+ git_dir_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_dir_archive dir_name=foo

+ git_dir_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_dir_archive dir_name=foo source_name=foo.tar.gz

+ git_dir_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_dir_archive path=foo dir_name=bar source_name=foo.tar.gz

+ git_dir_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_dir_setup_macro

+ ---

+ > git_dir_setup_macro dir_name=foo

+ ---

+ > git_dir_changelog header_date_format="@@@"

+ ---

+ > git_dir_changelog name=foo since_tag=foo-1.2-1 header_date_format="@@@"

+ ---

+ > git_dir_changelog name=foo until_tag=foo-1.2-1 header_date_format="@@@"

+ ---

+ > git_dir_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_date_format="@@@"

+ ---

+ > git_dir_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_locale=POSIX header_date_format="@@@" body_wrap=42

+ ---

+ > git_cwd_name

+ ---

+ > git_cwd_name name=foo

+ ---

+ > git_cwd_name append=-baz

+ ---

+ > git_cwd_name prepend=bar-

+ ---

+ > git_cwd_name prepend=bar- append=-baz

+ ---

+ > git_cwd_name name=foo prepend=bar- append=-baz

+ ---

+ > git_cwd_version

+ ---

+ > git_cwd_version name=foo

+ ---

+ > git_cwd_version name=foo lead=1

+ ---

+ > git_cwd_version lead=0

+ ---

+ > git_cwd_version lead=1

+ ---

+ > git_cwd_version lead=0.1

+ ---

+ > git_cwd_version follow=1

+ ---

+ > git_cwd_version lead=1 follow=2

+ ---

+ > git_cwd_version lead=x follow=x

+ ---

+ > git_cwd_version lead=1-1 # invalid

+ git_cwd_version: lead and follow cannot contain dashes.

+ git_cwd_version lead=1-1 # invalid failed with value 1

+ ---

+ > git_cwd_version follow=2.0 # invalid

+ git_cwd_version: follow cannot contain dots.

+ git_cwd_version follow=2.0 # invalid failed with value 1

+ ---

+ > git_cwd_version follow=2-2 # invalid

+ git_cwd_version: lead and follow cannot contain dashes.

+ git_cwd_version follow=2-2 # invalid failed with value 1

+ ---

+ > git_cwd_version name= # invalid

+ git_cwd_version: name cannot be empty.

+ git_cwd_version name= # invalid failed with value 1

+ ---

+ > git_cwd_version name="$(git_cwd_name)"

+ ---

+ > git_cwd_vcs

+ ---

+ > git_cwd_vcs subtree=foo

+ ---

+ > git_cwd_pack

+ git_cwd_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_cwd_pack dir_name=foo

+ git_cwd_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_cwd_pack dir_name=foo source_name=foo.tar.gz

+ git_cwd_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_cwd_pack path=foo dir_name=bar source_name=foo.tar.gz

+ git_cwd_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_cwd_archive

+ git_cwd_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_cwd_archive dir_name=foo

+ git_cwd_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_cwd_archive dir_name=foo source_name=foo.tar.gz

+ git_cwd_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_cwd_archive path=foo dir_name=bar source_name=foo.tar.gz

+ git_cwd_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_cwd_setup_macro

+ ---

+ > git_cwd_setup_macro dir_name=foo

+ ---

+ > git_cwd_changelog header_date_format="@@@"

+ ---

+ > git_cwd_changelog name=foo since_tag=foo-1.2-1 header_date_format="@@@"

+ ---

+ > git_cwd_changelog name=foo until_tag=foo-1.2-1 header_date_format="@@@"

+ ---

+ > git_cwd_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_date_format="@@@"

+ ---

+ > git_cwd_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_locale=POSIX header_date_format="@@@" body_wrap=42

+ ---

@@ -0,0 +1,264 @@ 

+ git_name: test

+ git_name name=foo: foo

+ git_name append=-baz: test-baz

+ git_name prepend=bar-: bar-test

+ git_name prepend=bar- append=-baz: bar-test-baz

+ git_name name=foo prepend=bar- append=-baz: bar-foo-baz

+ 

+ git_version: 0.0.git.1.26c899e

+ git_version name=foo: 0.0

+ git_version name=foo lead=1: 1.5

+ git_version lead=0: 0.0.git.1.26c899e

+ git_version lead=1: 1.0.git.1.26c899e

+ git_version lead=0.1: 0.1.0.git.1.26c899e

+ git_version follow=1: 0.1.git.1.26c899e

+ git_version lead=1 follow=2: 1.2.git.1.26c899e

+ git_version lead=x follow=x: x.x.git.1.26c899e

+ git_version lead=1-1 # invalid: 

+ git_version follow=2.0 # invalid: 

+ git_version follow=2-2 # invalid: 

+ git_version name= # invalid: 

+ git_version name="$(git_name)": 0.0.git.1.26c899e

+ 

+ git_vcs: git+https://pagure.io/clime/test.git#26c899e51c3051157a77e8b8505786e2af49855e:

+ git_vcs subtree=foo: git+https://pagure.io/clime/test.git#26c899e51c3051157a77e8b8505786e2af49855e:foo

+ 

+ git_pack: bar-foo-baz-0.0.git.1.26c899e.tar.gz

+ git_pack dir_name=foo: bar-foo-baz-0.0.git.1.26c899e.tar.gz

+ git_pack dir_name=foo source_name=foo.tar.gz: foo.tar.gz

+ git_pack path=foo dir_name=bar source_name=foo.tar.gz: foo.tar.gz

+ 

+ git_archive: bar-foo-baz-0.0.git.1.26c899e.tar.gz

+ git_archive dir_name=foo: bar-foo-baz-0.0.git.1.26c899e.tar.gz

+ git_archive dir_name=foo source_name=foo.tar.gz: foo.tar.gz

+ git_archive path=foo dir_name=bar source_name=foo.tar.gz: foo.tar.gz

+ 

+ git_setup_macro: %setup -q -n bar-foo-baz-0.0.git.1.26c899e

+ git_setup_macro dir_name=foo: %setup -q -n foo

+ 

+ git_changelog header_date_format="@@@":

+ 

+ 

+ git_changelog name=foo since_tag=foo-1.2-1 header_date_format="@@@":

+ * @@@ clime <clime@redhat.com> 1.5-1

+ - message

+ 

+ * @@@ clime <clime@redhat.com> 1.4-1

+ - message

+ 

+ * @@@ clime <clime@redhat.com> 1.3-1

+ - message that should be %%very long because we need to test git changelog

+ family of macros and changelong body wrapping.

+ 

+ * @@@ clime <clime@redhat.com> 1.2-1

+ - message

+ 

+ git_changelog name=foo until_tag=foo-1.2-1 header_date_format="@@@":

+ * @@@ clime <clime@redhat.com> 1.2-1

+ - message

+ 

+ * @@@ clime <clime@redhat.com> 1.1-1

+ - message

+ 

+ git_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_date_format="@@@":

+ * @@@ clime <clime@redhat.com> 1.4-1

+ - message

+ 

+ * @@@ clime <clime@redhat.com> 1.3-1

+ - message that should be %%very long because we need to test git changelog

+ family of macros and changelong body wrapping.

+ 

+ * @@@ clime <clime@redhat.com> 1.2-1

+ - message

+ 

+ git_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_locale=POSIX header_date_format="@@@" body_wrap=42:

+ * @@@ clime <clime@redhat.com> 1.4-1

+ - message

+ 

+ * @@@ clime <clime@redhat.com> 1.3-1

+ - message that should be %%very long

+ because we need to test git changelog

+ family of macros and changelong body

+ wrapping.

+ 

+ * @@@ clime <clime@redhat.com> 1.2-1

+ - message

+ 

+ 

+ :::::::::::::::::::::

+ 

+ git_dir_name: test-

+ git_dir_name name=foo: foo-

+ git_dir_name append=-baz: test-baz

+ git_dir_name prepend=bar-: bar-test-

+ git_dir_name prepend=bar- append=-baz: bar-test-baz

+ git_dir_name name=foo prepend=bar- append=-baz: bar-foo-baz

+ 

+ git_dir_version: 0.0.git.1.26c899e

+ git_dir_version name=foo: 0.0

+ git_dir_version name=foo lead=1: 1.5

+ git_dir_version lead=0: 0.0.git.1.26c899e

+ git_dir_version lead=1: 1.0.git.1.26c899e

+ git_dir_version lead=0.1: 0.1.0.git.1.26c899e

+ git_dir_version follow=1: 0.1.git.1.26c899e

+ git_dir_version lead=1 follow=2: 1.2.git.1.26c899e

+ git_dir_version lead=x follow=x: x.x.git.1.26c899e

+ git_dir_version lead=1-1 # invalid: 

+ git_dir_version follow=2.0 # invalid: 

+ git_dir_version follow=2-2 # invalid: 

+ git_dir_version name= # invalid: 

+ git_dir_version name="$(git_name)": 0.0.git.1.26c899e

+ 

+ git_dir_vcs: git+https://pagure.io/clime/test.git#26c899e51c3051157a77e8b8505786e2af49855e:

+ git_dir_vcs subtree=foo: git+https://pagure.io/clime/test.git#26c899e51c3051157a77e8b8505786e2af49855e:foo

+ 

+ git_dir_pack: bar-foo-baz-0.0.git.1.26c899e.tar.gz

+ git_dir_pack dir_name=foo: bar-foo-baz-0.0.git.1.26c899e.tar.gz

+ git_dir_pack dir_name=foo source_name=foo.tar.gz: foo.tar.gz

+ git_dir_pack path=foo dir_name=bar source_name=foo.tar.gz: foo.tar.gz

+ 

+ git_dir_archive: bar-foo-baz-0.0.git.1.26c899e.tar.gz

+ git_dir_archive dir_name=foo: bar-foo-baz-0.0.git.1.26c899e.tar.gz

+ git_dir_archive dir_name=foo source_name=foo.tar.gz: foo.tar.gz

+ git_dir_archive path=foo dir_name=bar source_name=foo.tar.gz: foo.tar.gz

+ 

+ git_dir_setup_macro: %setup -q -n bar-foo-baz-0.0.git.1.26c899e

+ git_dir_setup_macro dir_name=foo: %setup -q -n foo

+ 

+ git_dir_changelog header_date_format="@@@":

+ 

+ 

+ git_dir_changelog name=foo since_tag=foo-1.2-1 header_date_format="@@@":

+ * @@@ clime <clime@redhat.com> 1.5-1

+ - message

+ 

+ * @@@ clime <clime@redhat.com> 1.4-1

+ - message

+ 

+ * @@@ clime <clime@redhat.com> 1.3-1

+ - message that should be %%very long because we need to test git changelog

+ family of macros and changelong body wrapping.

+ 

+ * @@@ clime <clime@redhat.com> 1.2-1

+ - message

+ 

+ git_dir_changelog name=foo until_tag=foo-1.2-1 header_date_format="@@@":

+ * @@@ clime <clime@redhat.com> 1.2-1

+ - message

+ 

+ * @@@ clime <clime@redhat.com> 1.1-1

+ - message

+ 

+ git_dir_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_date_format="@@@":

+ * @@@ clime <clime@redhat.com> 1.4-1

+ - message

+ 

+ * @@@ clime <clime@redhat.com> 1.3-1

+ - message that should be %%very long because we need to test git changelog

+ family of macros and changelong body wrapping.

+ 

+ * @@@ clime <clime@redhat.com> 1.2-1

+ - message

+ 

+ git_dir_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_locale=POSIX header_date_format="@@@" body_wrap=42:

+ * @@@ clime <clime@redhat.com> 1.4-1

+ - message

+ 

+ * @@@ clime <clime@redhat.com> 1.3-1

+ - message that should be %%very long

+ because we need to test git changelog

+ family of macros and changelong body

+ wrapping.

+ 

+ * @@@ clime <clime@redhat.com> 1.2-1

+ - message

+ 

+ 

+ :::::::::::::::::::::

+ 

+ git_cwd_name: test-

+ git_cwd_name name=foo: foo-

+ git_cwd_name append=-baz: test-baz

+ git_cwd_name prepend=bar-: bar-test-

+ git_cwd_name prepend=bar- append=-baz: bar-test-baz

+ git_cwd_name name=foo prepend=bar- append=-baz: bar-foo-baz

+ 

+ git_cwd_version: 0.0.git.1.26c899e

+ git_cwd_version name=foo: 0.0

+ git_cwd_version name=foo lead=1: 1.5

+ git_cwd_version lead=0: 0.0.git.1.26c899e

+ git_cwd_version lead=1: 1.0.git.1.26c899e

+ git_cwd_version lead=0.1: 0.1.0.git.1.26c899e

+ git_cwd_version follow=1: 0.1.git.1.26c899e

+ git_cwd_version lead=1 follow=2: 1.2.git.1.26c899e

+ git_cwd_version lead=x follow=x: x.x.git.1.26c899e

+ git_cwd_version lead=1-1 # invalid: 

+ git_cwd_version follow=2.0 # invalid: 

+ git_cwd_version follow=2-2 # invalid: 

+ git_cwd_version name= # invalid: 

+ git_cwd_version name="$(git_cwd_name)": 0.0.git.1.26c899e

+ 

+ git_cwd_vcs: git+https://pagure.io/clime/test.git#26c899e51c3051157a77e8b8505786e2af49855e:

+ git_cwd_vcs subtree=foo: git+https://pagure.io/clime/test.git#26c899e51c3051157a77e8b8505786e2af49855e:foo

+ 

+ git_cwd_pack: bar-foo-baz-0.0.git.1.26c899e.tar.gz

+ git_cwd_pack dir_name=foo: bar-foo-baz-0.0.git.1.26c899e.tar.gz

+ git_cwd_pack dir_name=foo source_name=foo.tar.gz: foo.tar.gz

+ git_cwd_pack path=foo dir_name=bar source_name=foo.tar.gz: foo.tar.gz

+ 

+ git_cwd_archive: bar-foo-baz-0.0.git.1.26c899e.tar.gz

+ git_cwd_archive dir_name=foo: bar-foo-baz-0.0.git.1.26c899e.tar.gz

+ git_cwd_archive dir_name=foo source_name=foo.tar.gz: foo.tar.gz

+ git_cwd_archive path=foo dir_name=bar source_name=foo.tar.gz: foo.tar.gz

+ 

+ git_cwd_setup_macro: %setup -q -n bar-foo-baz-0.0.git.1.26c899e

+ git_cwd_setup_macro dir_name=foo: %setup -q -n foo

+ 

+ git_cwd_changelog header_date_format="@@@":

+ 

+ 

+ git_cwd_changelog name=foo since_tag=foo-1.2-1 header_date_format="@@@":

+ * @@@ clime <clime@redhat.com> 1.5-1

+ - message

+ 

+ * @@@ clime <clime@redhat.com> 1.4-1

+ - message

+ 

+ * @@@ clime <clime@redhat.com> 1.3-1

+ - message that should be %%very long because we need to test git changelog

+ family of macros and changelong body wrapping.

+ 

+ * @@@ clime <clime@redhat.com> 1.2-1

+ - message

+ 

+ git_cwd_changelog name=foo until_tag=foo-1.2-1 header_date_format="@@@":

+ * @@@ clime <clime@redhat.com> 1.2-1

+ - message

+ 

+ * @@@ clime <clime@redhat.com> 1.1-1

+ - message

+ 

+ git_cwd_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_date_format="@@@":

+ * @@@ clime <clime@redhat.com> 1.4-1

+ - message

+ 

+ * @@@ clime <clime@redhat.com> 1.3-1

+ - message that should be %%very long because we need to test git changelog

+ family of macros and changelong body wrapping.

+ 

+ * @@@ clime <clime@redhat.com> 1.2-1

+ - message

+ 

+ git_cwd_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_locale=POSIX header_date_format="@@@" body_wrap=42:

+ * @@@ clime <clime@redhat.com> 1.4-1

+ - message

+ 

+ * @@@ clime <clime@redhat.com> 1.3-1

+ - message that should be %%very long

+ because we need to test git changelog

+ family of macros and changelong body

+ wrapping.

+ 

+ * @@@ clime <clime@redhat.com> 1.2-1

+ - message

+ 

@@ -0,0 +1,27 @@ 

+ #!/bin/bash

+ 

+ . ../lib.sh

+ 

+ repo=`mktemp -d`

+ output=`mktemp`

+ 

+ prepare_input ../input $repo/input

+ 

+ git init $repo

+ git -C $repo remote add origin https://pagure.io/clime/test.git

+ git -C $repo add -A

+ git -C $repo commit -a -m 'inital_commit'

+ git -C $repo tag -a -m 'subject' -m '- message' foo-1.1-1

+ git -C $repo tag -a -m 'subject' -m '- message' foo-1.2-1

+ git -C $repo tag -a -m 'subject' -m '- message that should be %very long because we need to test git changelog family of macros and changelong body wrapping.' foo-1.3-1

+ git -C $repo tag -a -m 'subject' -m '- message' foo-1.4-1

+ git -C $repo tag -a -m 'subject' -m '- message' foo-1.5-1

+ 

+ touch output && cp output $output

+ wtree_sub $repo $output

+ head_commit_sub $repo $output

+ 

+ generic_test opts='--dump-spec-only' path=$repo input=$repo/input expected_output=$output expected_log=log copy_only=$1

+ 

+ rm -rf $repo

+ rm $output

@@ -0,0 +1,270 @@ 

+ > git_name

+ ---

+ > git_name name=foo

+ ---

+ > git_name append=-baz

+ ---

+ > git_name prepend=bar-

+ ---

+ > git_name prepend=bar- append=-baz

+ ---

+ > git_name name=foo prepend=bar- append=-baz

+ ---

+ > git_version

+ ---

+ > git_version name=foo

+ ---

+ > git_version name=foo lead=1

+ ---

+ > git_version lead=0

+ ---

+ > git_version lead=1

+ ---

+ > git_version lead=0.1

+ ---

+ > git_version follow=1

+ ---

+ > git_version lead=1 follow=2

+ ---

+ > git_version lead=x follow=x

+ ---

+ > git_version lead=1-1 # invalid

+ git_version: lead and follow cannot contain dashes.

+ git_version lead=1-1 # invalid failed with value 1

+ ---

+ > git_version follow=2.0 # invalid

+ git_version: follow cannot contain dots.

+ git_version follow=2.0 # invalid failed with value 1

+ ---

+ > git_version follow=2-2 # invalid

+ git_version: lead and follow cannot contain dashes.

+ git_version follow=2-2 # invalid failed with value 1

+ ---

+ > git_version name= # invalid

+ git_version: name cannot be empty.

+ git_version name= # invalid failed with value 1

+ ---

+ > git_version name="$(git_name)"

+ ---

+ > git_vcs

+ ---

+ > git_vcs subtree=foo

+ ---

+ > git_pack

+ git_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_pack dir_name=foo

+ git_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_pack dir_name=foo source_name=foo.tar.gz

+ git_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_pack path=foo dir_name=bar source_name=foo.tar.gz

+ git_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_archive

+ git_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_archive dir_name=foo

+ git_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_archive dir_name=foo source_name=foo.tar.gz

+ git_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_archive path=foo dir_name=bar source_name=foo.tar.gz

+ git_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_setup_macro

+ ---

+ > git_setup_macro dir_name=foo

+ ---

+ > git_changelog header_date_format="@@@"

+ ---

+ > git_changelog name=foo since_tag=foo-1.2-1 header_date_format="@@@"

+ ---

+ > git_changelog name=foo until_tag=foo-1.2-1 header_date_format="@@@"

+ ---

+ > git_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_date_format="@@@"

+ ---

+ > git_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_locale=POSIX header_date_format="@@@" body_wrap=42

+ ---

+ > git_dir_name

+ ---

+ > git_dir_name name=foo

+ ---

+ > git_dir_name append=-baz

+ ---

+ > git_dir_name prepend=bar-

+ ---

+ > git_dir_name prepend=bar- append=-baz

+ ---

+ > git_dir_name name=foo prepend=bar- append=-baz

+ ---

+ > git_dir_version

+ ---

+ > git_dir_version name=foo

+ ---

+ > git_dir_version name=foo lead=1

+ ---

+ > git_dir_version lead=0

+ ---

+ > git_dir_version lead=1

+ ---

+ > git_dir_version lead=0.1

+ ---

+ > git_dir_version follow=1

+ ---

+ > git_dir_version lead=1 follow=2

+ ---

+ > git_dir_version lead=x follow=x

+ ---

+ > git_dir_version lead=1-1 # invalid

+ git_dir_version: lead and follow cannot contain dashes.

+ git_dir_version lead=1-1 # invalid failed with value 1

+ ---

+ > git_dir_version follow=2.0 # invalid

+ git_dir_version: follow cannot contain dots.

+ git_dir_version follow=2.0 # invalid failed with value 1

+ ---

+ > git_dir_version follow=2-2 # invalid

+ git_dir_version: lead and follow cannot contain dashes.

+ git_dir_version follow=2-2 # invalid failed with value 1

+ ---

+ > git_dir_version name= # invalid

+ git_dir_version: name cannot be empty.

+ git_dir_version name= # invalid failed with value 1

+ ---

+ > git_dir_version name="$(git_name)"

+ ---

+ > git_dir_vcs

+ ---

+ > git_dir_vcs subtree=foo

+ ---

+ > git_dir_pack

+ git_dir_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_dir_pack dir_name=foo

+ git_dir_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_dir_pack dir_name=foo source_name=foo.tar.gz

+ git_dir_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_dir_pack path=foo dir_name=bar source_name=foo.tar.gz

+ git_dir_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_dir_archive

+ git_dir_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_dir_archive dir_name=foo

+ git_dir_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_dir_archive dir_name=foo source_name=foo.tar.gz

+ git_dir_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_dir_archive path=foo dir_name=bar source_name=foo.tar.gz

+ git_dir_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_dir_setup_macro

+ ---

+ > git_dir_setup_macro dir_name=foo

+ ---

+ > git_dir_changelog header_date_format="@@@"

+ ---

+ > git_dir_changelog name=foo since_tag=foo-1.2-1 header_date_format="@@@"

+ ---

+ > git_dir_changelog name=foo until_tag=foo-1.2-1 header_date_format="@@@"

+ ---

+ > git_dir_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_date_format="@@@"

+ ---

+ > git_dir_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_locale=POSIX header_date_format="@@@" body_wrap=42

+ ---

+ > git_cwd_name

+ ---

+ > git_cwd_name name=foo

+ ---

+ > git_cwd_name append=-baz

+ ---

+ > git_cwd_name prepend=bar-

+ ---

+ > git_cwd_name prepend=bar- append=-baz

+ ---

+ > git_cwd_name name=foo prepend=bar- append=-baz

+ ---

+ > git_cwd_version

+ ---

+ > git_cwd_version name=foo

+ ---

+ > git_cwd_version name=foo lead=1

+ ---

+ > git_cwd_version lead=0

+ ---

+ > git_cwd_version lead=1

+ ---

+ > git_cwd_version lead=0.1

+ ---

+ > git_cwd_version follow=1

+ ---

+ > git_cwd_version lead=1 follow=2

+ ---

+ > git_cwd_version lead=x follow=x

+ ---

+ > git_cwd_version lead=1-1 # invalid

+ git_cwd_version: lead and follow cannot contain dashes.

+ git_cwd_version lead=1-1 # invalid failed with value 1

+ ---

+ > git_cwd_version follow=2.0 # invalid

+ git_cwd_version: follow cannot contain dots.

+ git_cwd_version follow=2.0 # invalid failed with value 1

+ ---

+ > git_cwd_version follow=2-2 # invalid

+ git_cwd_version: lead and follow cannot contain dashes.

+ git_cwd_version follow=2-2 # invalid failed with value 1

+ ---

+ > git_cwd_version name= # invalid

+ git_cwd_version: name cannot be empty.

+ git_cwd_version name= # invalid failed with value 1

+ ---

+ > git_cwd_version name="$(git_cwd_name)"

+ ---

+ > git_cwd_vcs

+ ---

+ > git_cwd_vcs subtree=foo

+ ---

+ > git_cwd_pack

+ git_cwd_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_cwd_pack dir_name=foo

+ git_cwd_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_cwd_pack dir_name=foo source_name=foo.tar.gz

+ git_cwd_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_cwd_pack path=foo dir_name=bar source_name=foo.tar.gz

+ git_cwd_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_cwd_archive

+ git_cwd_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_cwd_archive dir_name=foo

+ git_cwd_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_cwd_archive dir_name=foo source_name=foo.tar.gz

+ git_cwd_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_cwd_archive path=foo dir_name=bar source_name=foo.tar.gz

+ git_cwd_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_cwd_setup_macro

+ ---

+ > git_cwd_setup_macro dir_name=foo

+ ---

+ > git_cwd_changelog header_date_format="@@@"

+ ---

+ > git_cwd_changelog name=foo since_tag=foo-1.2-1 header_date_format="@@@"

+ ---

+ > git_cwd_changelog name=foo until_tag=foo-1.2-1 header_date_format="@@@"

+ ---

+ > git_cwd_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_date_format="@@@"

+ ---

+ > git_cwd_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_locale=POSIX header_date_format="@@@" body_wrap=42

+ ---

@@ -0,0 +1,168 @@ 

+ git_name: test

+ git_name name=foo: foo

+ git_name append=-baz: test-baz

+ git_name prepend=bar-: bar-test

+ git_name prepend=bar- append=-baz: bar-test-baz

+ git_name name=foo prepend=bar- append=-baz: bar-foo-baz

+ 

+ git_version: 0.0.git.2.d518d5b

+ git_version name=foo: 0.1.git.1.d518d5b

+ git_version name=foo lead=1: 1.0.git.1.d518d5b

+ git_version lead=0: 0.0.git.2.d518d5b

+ git_version lead=1: 1.0.git.2.d518d5b

+ git_version lead=0.1: 0.1.0.git.2.d518d5b

+ git_version follow=1: 0.1.git.2.d518d5b

+ git_version lead=1 follow=2: 1.2.git.2.d518d5b

+ git_version lead=x follow=x: x.x.git.2.d518d5b

+ git_version lead=1-1 # invalid: 

+ git_version follow=2.0 # invalid: 

+ git_version follow=2-2 # invalid: 

+ git_version name= # invalid: 

+ git_version name="$(git_name)": 0.0.git.2.d518d5b

+ 

+ git_vcs: git+https://pagure.io/clime/test.git#d518d5b21db87e1e5b81794c0eea98348c4dd0e0:

+ git_vcs subtree=foo: git+https://pagure.io/clime/test.git#d518d5b21db87e1e5b81794c0eea98348c4dd0e0:foo

+ 

+ git_pack: bar-foo-baz-0.0.git.2.d518d5b.tar.gz

+ git_pack dir_name=foo: bar-foo-baz-0.0.git.2.d518d5b.tar.gz

+ git_pack dir_name=foo source_name=foo.tar.gz: foo.tar.gz

+ git_pack path=foo dir_name=bar source_name=foo.tar.gz: foo.tar.gz

+ 

+ git_archive: bar-foo-baz-0.0.git.2.d518d5b.tar.gz

+ git_archive dir_name=foo: bar-foo-baz-0.0.git.2.d518d5b.tar.gz

+ git_archive dir_name=foo source_name=foo.tar.gz: foo.tar.gz

+ git_archive path=foo dir_name=bar source_name=foo.tar.gz: foo.tar.gz

+ 

+ git_setup_macro: %setup -q -n bar-foo-baz-0.0.git.2.d518d5b

+ git_setup_macro dir_name=foo: %setup -q -n foo

+ 

+ git_changelog header_date_format="@@@":

+ 

+ 

+ git_changelog name=foo since_tag=foo-1.2-1 header_date_format="@@@":

+ * @@@ clime <clime@redhat.com> 0.1-1

+ - message.

+ 

+ git_changelog name=foo until_tag=foo-1.2-1 header_date_format="@@@":

+ 

+ 

+ git_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_date_format="@@@":

+ 

+ 

+ git_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_locale=POSIX header_date_format="@@@" body_wrap=42:

+ 

+ 

+ 

+ :::::::::::::::::::::

+ 

+ git_dir_name: test-

+ git_dir_name name=foo: foo-

+ git_dir_name append=-baz: test-baz

+ git_dir_name prepend=bar-: bar-test-

+ git_dir_name prepend=bar- append=-baz: bar-test-baz

+ git_dir_name name=foo prepend=bar- append=-baz: bar-foo-baz

+ 

+ git_dir_version: 0.0.git.2.d518d5b

+ git_dir_version name=foo: 0.1.git.1.d518d5b

+ git_dir_version name=foo lead=1: 1.0.git.1.d518d5b

+ git_dir_version lead=0: 0.0.git.2.d518d5b

+ git_dir_version lead=1: 1.0.git.2.d518d5b

+ git_dir_version lead=0.1: 0.1.0.git.2.d518d5b

+ git_dir_version follow=1: 0.1.git.2.d518d5b

+ git_dir_version lead=1 follow=2: 1.2.git.2.d518d5b

+ git_dir_version lead=x follow=x: x.x.git.2.d518d5b

+ git_dir_version lead=1-1 # invalid: 

+ git_dir_version follow=2.0 # invalid: 

+ git_dir_version follow=2-2 # invalid: 

+ git_dir_version name= # invalid: 

+ git_dir_version name="$(git_name)": 0.0.git.2.d518d5b

+ 

+ git_dir_vcs: git+https://pagure.io/clime/test.git#d518d5b21db87e1e5b81794c0eea98348c4dd0e0:

+ git_dir_vcs subtree=foo: git+https://pagure.io/clime/test.git#d518d5b21db87e1e5b81794c0eea98348c4dd0e0:foo

+ 

+ git_dir_pack: bar-foo-baz-0.0.git.2.d518d5b.tar.gz

+ git_dir_pack dir_name=foo: bar-foo-baz-0.0.git.2.d518d5b.tar.gz

+ git_dir_pack dir_name=foo source_name=foo.tar.gz: foo.tar.gz

+ git_dir_pack path=foo dir_name=bar source_name=foo.tar.gz: foo.tar.gz

+ 

+ git_dir_archive: bar-foo-baz-0.0.git.2.d518d5b.tar.gz

+ git_dir_archive dir_name=foo: bar-foo-baz-0.0.git.2.d518d5b.tar.gz

+ git_dir_archive dir_name=foo source_name=foo.tar.gz: foo.tar.gz

+ git_dir_archive path=foo dir_name=bar source_name=foo.tar.gz: foo.tar.gz

+ 

+ git_dir_setup_macro: %setup -q -n bar-foo-baz-0.0.git.2.d518d5b

+ git_dir_setup_macro dir_name=foo: %setup -q -n foo

+ 

+ git_dir_changelog header_date_format="@@@":

+ 

+ 

+ git_dir_changelog name=foo since_tag=foo-1.2-1 header_date_format="@@@":

+ * @@@ clime <clime@redhat.com> 0.1-1

+ - message.

+ 

+ git_dir_changelog name=foo until_tag=foo-1.2-1 header_date_format="@@@":

+ 

+ 

+ git_dir_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_date_format="@@@":

+ 

+ 

+ git_dir_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_locale=POSIX header_date_format="@@@" body_wrap=42:

+ 

+ 

+ 

+ :::::::::::::::::::::

+ 

+ git_cwd_name: test-

+ git_cwd_name name=foo: foo-

+ git_cwd_name append=-baz: test-baz

+ git_cwd_name prepend=bar-: bar-test-

+ git_cwd_name prepend=bar- append=-baz: bar-test-baz

+ git_cwd_name name=foo prepend=bar- append=-baz: bar-foo-baz

+ 

+ git_cwd_version: 0.0.git.2.d518d5b

+ git_cwd_version name=foo: 0.1.git.1.d518d5b

+ git_cwd_version name=foo lead=1: 1.0.git.1.d518d5b

+ git_cwd_version lead=0: 0.0.git.2.d518d5b

+ git_cwd_version lead=1: 1.0.git.2.d518d5b

+ git_cwd_version lead=0.1: 0.1.0.git.2.d518d5b

+ git_cwd_version follow=1: 0.1.git.2.d518d5b

+ git_cwd_version lead=1 follow=2: 1.2.git.2.d518d5b

+ git_cwd_version lead=x follow=x: x.x.git.2.d518d5b

+ git_cwd_version lead=1-1 # invalid: 

+ git_cwd_version follow=2.0 # invalid: 

+ git_cwd_version follow=2-2 # invalid: 

+ git_cwd_version name= # invalid: 

+ git_cwd_version name="$(git_cwd_name)": 0.0.git.2.d518d5b

+ 

+ git_cwd_vcs: git+https://pagure.io/clime/test.git#d518d5b21db87e1e5b81794c0eea98348c4dd0e0:

+ git_cwd_vcs subtree=foo: git+https://pagure.io/clime/test.git#d518d5b21db87e1e5b81794c0eea98348c4dd0e0:foo

+ 

+ git_cwd_pack: bar-foo-baz-0.0.git.2.d518d5b.tar.gz

+ git_cwd_pack dir_name=foo: bar-foo-baz-0.0.git.2.d518d5b.tar.gz

+ git_cwd_pack dir_name=foo source_name=foo.tar.gz: foo.tar.gz

+ git_cwd_pack path=foo dir_name=bar source_name=foo.tar.gz: foo.tar.gz

+ 

+ git_cwd_archive: bar-foo-baz-0.0.git.2.d518d5b.tar.gz

+ git_cwd_archive dir_name=foo: bar-foo-baz-0.0.git.2.d518d5b.tar.gz

+ git_cwd_archive dir_name=foo source_name=foo.tar.gz: foo.tar.gz

+ git_cwd_archive path=foo dir_name=bar source_name=foo.tar.gz: foo.tar.gz

+ 

+ git_cwd_setup_macro: %setup -q -n bar-foo-baz-0.0.git.2.d518d5b

+ git_cwd_setup_macro dir_name=foo: %setup -q -n foo

+ 

+ git_cwd_changelog header_date_format="@@@":

+ 

+ 

+ git_cwd_changelog name=foo since_tag=foo-1.2-1 header_date_format="@@@":

+ * @@@ clime <clime@redhat.com> 0.1-1

+ - message.

+ 

+ git_cwd_changelog name=foo until_tag=foo-1.2-1 header_date_format="@@@":

+ 

+ 

+ git_cwd_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_date_format="@@@":

+ 

+ 

+ git_cwd_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_locale=POSIX header_date_format="@@@" body_wrap=42:

+ 

+ 

@@ -0,0 +1,26 @@ 

+ #!/bin/bash

+ 

+ . ../lib.sh

+ 

+ repo=`mktemp -d`

+ output=`mktemp`

+ 

+ prepare_input ../input $repo/input

+ 

+ git init $repo

+ git -C $repo remote add origin https://pagure.io/clime/test.git

+ git -C $repo add -A

+ git -C $repo commit -a -m 'inital_commit'

+ git -C $repo tag -a -m 'subject' -m '- message.' foo-0.1-1

+ touch $repo/foo

+ git -C $repo add foo

+ git -C $repo commit -m 'commit after tag'

+ 

+ touch output && cp output $output

+ wtree_sub $repo $output

+ head_commit_sub $repo $output

+ 

+ generic_test opts='--dump-spec-only' path=$repo input=$repo/input expected_output=$output expected_log=log copy_only=$1

+ 

+ rm -rf $repo

+ rm $output

@@ -0,0 +1,451 @@ 

+ > git_name

+ git_name: Start by setting origin URL.

+ git_name failed with value 1

+ ---

+ > git_name name=foo

+ ---

+ > git_name append=-baz

+ git_name: Start by setting origin URL.

+ git_name append=-baz failed with value 1

+ ---

+ > git_name prepend=bar-

+ git_name: Start by setting origin URL.

+ git_name prepend=bar- failed with value 1

+ ---

+ > git_name prepend=bar- append=-baz

+ git_name: Start by setting origin URL.

+ git_name prepend=bar- append=-baz failed with value 1

+ ---

+ > git_name name=foo prepend=bar- append=-baz

+ ---

+ > git_version

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ ---

+ > git_version name=foo

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ ---

+ > git_version name=foo lead=1

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ ---

+ > git_version lead=0

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ ---

+ > git_version lead=1

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ ---

+ > git_version lead=0.1

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ ---

+ > git_version follow=1

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ ---

+ > git_version lead=1 follow=2

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ ---

+ > git_version lead=x follow=x

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ ---

+ > git_version lead=1-1 # invalid

+ git_version: lead and follow cannot contain dashes.

+ git_version lead=1-1 # invalid failed with value 1

+ ---

+ > git_version follow=2.0 # invalid

+ git_version: follow cannot contain dots.

+ git_version follow=2.0 # invalid failed with value 1

+ ---

+ > git_version follow=2-2 # invalid

+ git_version: lead and follow cannot contain dashes.

+ git_version follow=2-2 # invalid failed with value 1

+ ---

+ > git_version name= # invalid

+ git_version: name cannot be empty.

+ git_version name= # invalid failed with value 1

+ ---

+ > git_version name="$(git_name)"

+ git_name: Start by setting origin URL.

+ git_version: name cannot be empty.

+ git_version name="$(git_name)" failed with value 1

+ ---

+ > git_vcs

+ git_vcs: Start by setting origin URL.

+ git_vcs failed with value 1

+ ---

+ > git_vcs subtree=foo

+ git_vcs: Start by setting origin URL.

+ git_vcs subtree=foo failed with value 1

+ ---

+ > git_pack

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ git_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_pack dir_name=foo

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ git_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_pack dir_name=foo source_name=foo.tar.gz

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ git_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_pack path=foo dir_name=bar source_name=foo.tar.gz

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ git_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_archive

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ git_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_archive dir_name=foo

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ git_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_archive dir_name=foo source_name=foo.tar.gz

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ git_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_archive path=foo dir_name=bar source_name=foo.tar.gz

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ git_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_setup_macro

+ ---

+ > git_setup_macro dir_name=foo

+ ---

+ > git_changelog header_date_format="@@@"

+ ---

+ > git_changelog name=foo since_tag=foo-1.2-1 header_date_format="@@@"

+ ---

+ > git_changelog name=foo until_tag=foo-1.2-1 header_date_format="@@@"

+ ---

+ > git_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_date_format="@@@"

+ ---

+ > git_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_locale=POSIX header_date_format="@@@" body_wrap=42

+ ---

+ > git_dir_name

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ git_dir_name: Start by setting origin URL.

+ git_dir_name failed with value 1

+ ---

+ > git_dir_name name=foo

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ ---

+ > git_dir_name append=-baz

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ git_dir_name: Start by setting origin URL.

+ git_dir_name append=-baz failed with value 1

+ ---

+ > git_dir_name prepend=bar-

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ git_dir_name: Start by setting origin URL.

+ git_dir_name prepend=bar- failed with value 1

+ ---

+ > git_dir_name prepend=bar- append=-baz

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ git_dir_name: Start by setting origin URL.

+ git_dir_name prepend=bar- append=-baz failed with value 1

+ ---

+ > git_dir_name name=foo prepend=bar- append=-baz

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ ---

+ > git_dir_version

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ ---

+ > git_dir_version name=foo

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ ---

+ > git_dir_version name=foo lead=1

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ ---

+ > git_dir_version lead=0

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ ---

+ > git_dir_version lead=1

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ ---

+ > git_dir_version lead=0.1

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ ---

+ > git_dir_version follow=1

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ ---

+ > git_dir_version lead=1 follow=2

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ ---

+ > git_dir_version lead=x follow=x

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ ---

+ > git_dir_version lead=1-1 # invalid

+ git_dir_version: lead and follow cannot contain dashes.

+ git_dir_version lead=1-1 # invalid failed with value 1

+ ---

+ > git_dir_version follow=2.0 # invalid

+ git_dir_version: follow cannot contain dots.

+ git_dir_version follow=2.0 # invalid failed with value 1

+ ---

+ > git_dir_version follow=2-2 # invalid

+ git_dir_version: lead and follow cannot contain dashes.

+ git_dir_version follow=2-2 # invalid failed with value 1

+ ---

+ > git_dir_version name= # invalid

+ git_dir_version: name cannot be empty.

+ git_dir_version name= # invalid failed with value 1

+ ---

+ > git_dir_version name="$(git_name)"

+ git_name: Start by setting origin URL.

+ git_dir_version: name cannot be empty.

+ git_dir_version name="$(git_name)" failed with value 1

+ ---

+ > git_dir_vcs

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ git_dir_vcs: Start by setting origin URL.

+ git_dir_vcs failed with value 1

+ ---

+ > git_dir_vcs subtree=foo

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ git_dir_vcs: Start by setting origin URL.

+ git_dir_vcs subtree=foo failed with value 1

+ ---

+ > git_dir_pack

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ git_dir_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_dir_pack dir_name=foo

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ git_dir_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_dir_pack dir_name=foo source_name=foo.tar.gz

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ git_dir_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_dir_pack path=foo dir_name=bar source_name=foo.tar.gz

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ git_dir_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_dir_archive

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ git_dir_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_dir_archive dir_name=foo

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ git_dir_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_dir_archive dir_name=foo source_name=foo.tar.gz

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ git_dir_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_dir_archive path=foo dir_name=bar source_name=foo.tar.gz

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ git_dir_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_dir_setup_macro

+ ---

+ > git_dir_setup_macro dir_name=foo

+ ---

+ > git_dir_changelog header_date_format="@@@"

+ ---

+ > git_dir_changelog name=foo since_tag=foo-1.2-1 header_date_format="@@@"

+ ---

+ > git_dir_changelog name=foo until_tag=foo-1.2-1 header_date_format="@@@"

+ ---

+ > git_dir_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_date_format="@@@"

+ ---

+ > git_dir_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_locale=POSIX header_date_format="@@@" body_wrap=42

+ ---

+ > git_cwd_name

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ git_cwd_name: Start by setting origin URL.

+ git_cwd_name failed with value 1

+ ---

+ > git_cwd_name name=foo

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ ---

+ > git_cwd_name append=-baz

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ git_cwd_name: Start by setting origin URL.

+ git_cwd_name append=-baz failed with value 1

+ ---

+ > git_cwd_name prepend=bar-

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ git_cwd_name: Start by setting origin URL.

+ git_cwd_name prepend=bar- failed with value 1

+ ---

+ > git_cwd_name prepend=bar- append=-baz

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ git_cwd_name: Start by setting origin URL.

+ git_cwd_name prepend=bar- append=-baz failed with value 1

+ ---

+ > git_cwd_name name=foo prepend=bar- append=-baz

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ ---

+ > git_cwd_version

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ ---

+ > git_cwd_version name=foo

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ ---

+ > git_cwd_version name=foo lead=1

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ ---

+ > git_cwd_version lead=0

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ ---

+ > git_cwd_version lead=1

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ ---

+ > git_cwd_version lead=0.1

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ ---

+ > git_cwd_version follow=1

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ ---

+ > git_cwd_version lead=1 follow=2

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ ---

+ > git_cwd_version lead=x follow=x

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ ---

+ > git_cwd_version lead=1-1 # invalid

+ git_cwd_version: lead and follow cannot contain dashes.

+ git_cwd_version lead=1-1 # invalid failed with value 1

+ ---

+ > git_cwd_version follow=2.0 # invalid

+ git_cwd_version: follow cannot contain dots.

+ git_cwd_version follow=2.0 # invalid failed with value 1

+ ---

+ > git_cwd_version follow=2-2 # invalid

+ git_cwd_version: lead and follow cannot contain dashes.

+ git_cwd_version follow=2-2 # invalid failed with value 1

+ ---

+ > git_cwd_version name= # invalid

+ git_cwd_version: name cannot be empty.

+ git_cwd_version name= # invalid failed with value 1

+ ---

+ > git_cwd_version name="$(git_cwd_name)"

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ git_cwd_name: Start by setting origin URL.

+ git_cwd_version: name cannot be empty.

+ git_cwd_version name="$(git_cwd_name)" failed with value 1

+ ---

+ > git_cwd_vcs

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ git_cwd_vcs: Start by setting origin URL.

+ git_cwd_vcs failed with value 1

+ ---

+ > git_cwd_vcs subtree=foo

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ git_cwd_vcs: Start by setting origin URL.

+ git_cwd_vcs subtree=foo failed with value 1

+ ---

+ > git_cwd_pack

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ git_cwd_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_cwd_pack dir_name=foo

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ git_cwd_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_cwd_pack dir_name=foo source_name=foo.tar.gz

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ git_cwd_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_cwd_pack path=foo dir_name=bar source_name=foo.tar.gz

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ git_cwd_pack: OUTDIR is not set. No action taken.

+ ---

+ > git_cwd_archive

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ git_cwd_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_cwd_archive dir_name=foo

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ git_cwd_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_cwd_archive dir_name=foo source_name=foo.tar.gz

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ git_cwd_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_cwd_archive path=foo dir_name=bar source_name=foo.tar.gz

+ fatal: Not a git repository (or any parent up to mount point /)

+ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

+ git_cwd_archive: OUTDIR is not set. No action taken.

+ ---

+ > git_cwd_setup_macro

+ ---

+ > git_cwd_setup_macro dir_name=foo

+ ---

+ > git_cwd_changelog header_date_format="@@@"

+ ---

+ > git_cwd_changelog name=foo since_tag=foo-1.2-1 header_date_format="@@@"

+ ---

+ > git_cwd_changelog name=foo until_tag=foo-1.2-1 header_date_format="@@@"

+ ---

+ > git_cwd_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_date_format="@@@"

+ ---

+ > git_cwd_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_locale=POSIX header_date_format="@@@" body_wrap=42

+ ---

@@ -0,0 +1,165 @@ 

+ git_name: 

+ git_name name=foo: foo

+ git_name append=-baz: 

+ git_name prepend=bar-: 

+ git_name prepend=bar- append=-baz: 

+ git_name name=foo prepend=bar- append=-baz: bar-foo-baz

+ 

+ git_version: 0.0

+ git_version name=foo: 0.0

+ git_version name=foo lead=1: 1.0

+ git_version lead=0: 0.0

+ git_version lead=1: 1.0

+ git_version lead=0.1: 0.1.0

+ git_version follow=1: 0.1

+ git_version lead=1 follow=2: 1.2

+ git_version lead=x follow=x: x.x

+ git_version lead=1-1 # invalid: 

+ git_version follow=2.0 # invalid: 

+ git_version follow=2-2 # invalid: 

+ git_version name= # invalid: 

+ git_version name="$(git_name)": 

+ 

+ git_vcs: 

+ git_vcs subtree=foo: 

+ 

+ git_pack: bar-foo-baz-x.x.tar.gz

+ git_pack dir_name=foo: bar-foo-baz-x.x.tar.gz

+ git_pack dir_name=foo source_name=foo.tar.gz: foo.tar.gz

+ git_pack path=foo dir_name=bar source_name=foo.tar.gz: foo.tar.gz

+ 

+ git_archive: bar-foo-baz-x.x.tar.gz

+ git_archive dir_name=foo: bar-foo-baz-x.x.tar.gz

+ git_archive dir_name=foo source_name=foo.tar.gz: foo.tar.gz

+ git_archive path=foo dir_name=bar source_name=foo.tar.gz: foo.tar.gz

+ 

+ git_setup_macro: %setup -q -n bar-foo-baz-x.x

+ git_setup_macro dir_name=foo: %setup -q -n foo

+ 

+ git_changelog header_date_format="@@@":

+ 

+ 

+ git_changelog name=foo since_tag=foo-1.2-1 header_date_format="@@@":

+ 

+ 

+ git_changelog name=foo until_tag=foo-1.2-1 header_date_format="@@@":

+ 

+ 

+ git_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_date_format="@@@":

+ 

+ 

+ git_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_locale=POSIX header_date_format="@@@" body_wrap=42:

+ 

+ 

+ 

+ :::::::::::::::::::::

+ 

+ git_dir_name: 

+ git_dir_name name=foo: foo-

+ git_dir_name append=-baz: 

+ git_dir_name prepend=bar-: 

+ git_dir_name prepend=bar- append=-baz: 

+ git_dir_name name=foo prepend=bar- append=-baz: bar-foo-baz

+ 

+ git_dir_version: 0.0

+ git_dir_version name=foo: 0.0

+ git_dir_version name=foo lead=1: 1.0

+ git_dir_version lead=0: 0.0

+ git_dir_version lead=1: 1.0

+ git_dir_version lead=0.1: 0.1.0

+ git_dir_version follow=1: 0.1

+ git_dir_version lead=1 follow=2: 1.2

+ git_dir_version lead=x follow=x: x.x

+ git_dir_version lead=1-1 # invalid: 

+ git_dir_version follow=2.0 # invalid: 

+ git_dir_version follow=2-2 # invalid: 

+ git_dir_version name= # invalid: 

+ git_dir_version name="$(git_name)": 

+ 

+ git_dir_vcs: 

+ git_dir_vcs subtree=foo: 

+ 

+ git_dir_pack: bar-foo-baz-x.x.tar.gz

+ git_dir_pack dir_name=foo: bar-foo-baz-x.x.tar.gz

+ git_dir_pack dir_name=foo source_name=foo.tar.gz: foo.tar.gz

+ git_dir_pack path=foo dir_name=bar source_name=foo.tar.gz: foo.tar.gz

+ 

+ git_dir_archive: bar-foo-baz-x.x.tar.gz

+ git_dir_archive dir_name=foo: bar-foo-baz-x.x.tar.gz

+ git_dir_archive dir_name=foo source_name=foo.tar.gz: foo.tar.gz

+ git_dir_archive path=foo dir_name=bar source_name=foo.tar.gz: foo.tar.gz

+ 

+ git_dir_setup_macro: %setup -q -n bar-foo-baz-x.x

+ git_dir_setup_macro dir_name=foo: %setup -q -n foo

+ 

+ git_dir_changelog header_date_format="@@@":

+ 

+ 

+ git_dir_changelog name=foo since_tag=foo-1.2-1 header_date_format="@@@":

+ 

+ 

+ git_dir_changelog name=foo until_tag=foo-1.2-1 header_date_format="@@@":

+ 

+ 

+ git_dir_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_date_format="@@@":

+ 

+ 

+ git_dir_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_locale=POSIX header_date_format="@@@" body_wrap=42:

+ 

+ 

+ 

+ :::::::::::::::::::::

+ 

+ git_cwd_name: 

+ git_cwd_name name=foo: foo-

+ git_cwd_name append=-baz: 

+ git_cwd_name prepend=bar-: 

+ git_cwd_name prepend=bar- append=-baz: 

+ git_cwd_name name=foo prepend=bar- append=-baz: bar-foo-baz

+ 

+ git_cwd_version: 0.0

+ git_cwd_version name=foo: 0.0

+ git_cwd_version name=foo lead=1: 1.0

+ git_cwd_version lead=0: 0.0

+ git_cwd_version lead=1: 1.0

+ git_cwd_version lead=0.1: 0.1.0

+ git_cwd_version follow=1: 0.1

+ git_cwd_version lead=1 follow=2: 1.2

+ git_cwd_version lead=x follow=x: x.x

+ git_cwd_version lead=1-1 # invalid: 

+ git_cwd_version follow=2.0 # invalid: 

+ git_cwd_version follow=2-2 # invalid: 

+ git_cwd_version name= # invalid: 

+ git_cwd_version name="$(git_cwd_name)": 

+ 

+ git_cwd_vcs: 

+ git_cwd_vcs subtree=foo: 

+ 

+ git_cwd_pack: bar-foo-baz-x.x.tar.gz

+ git_cwd_pack dir_name=foo: bar-foo-baz-x.x.tar.gz

+ git_cwd_pack dir_name=foo source_name=foo.tar.gz: foo.tar.gz

+ git_cwd_pack path=foo dir_name=bar source_name=foo.tar.gz: foo.tar.gz

+ 

+ git_cwd_archive: bar-foo-baz-x.x.tar.gz

+ git_cwd_archive dir_name=foo: bar-foo-baz-x.x.tar.gz

+ git_cwd_archive dir_name=foo source_name=foo.tar.gz: foo.tar.gz

+ git_cwd_archive path=foo dir_name=bar source_name=foo.tar.gz: foo.tar.gz

+ 

+ git_cwd_setup_macro: %setup -q -n bar-foo-baz-x.x

+ git_cwd_setup_macro dir_name=foo: %setup -q -n foo

+ 

+ git_cwd_changelog header_date_format="@@@":

+ 

+ 

+ git_cwd_changelog name=foo since_tag=foo-1.2-1 header_date_format="@@@":

+ 

+ 

+ git_cwd_changelog name=foo until_tag=foo-1.2-1 header_date_format="@@@":

+ 

+ 

+ git_cwd_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_date_format="@@@":

+ 

+ 

+ git_cwd_changelog name=foo since_tag=foo-1.2-1 until_tag=foo-1.4-1 header_locale=POSIX header_date_format="@@@" body_wrap=42:

+ 

+ 

@@ -0,0 +1,15 @@ 

+ #!/bin/bash

+ 

+ . ../lib.sh

+ 

+ repo=`mktemp -d`

+ output=`mktemp`

+ 

+ prepare_input ../input $repo/input

+ 

+ touch output && cp output $output

+ 

+ generic_test opts='--dump-spec-only' path=$repo input=$repo/input expected_output=$output expected_log=log copy_only=$1

+ 

+ rm -rf $repo

+ rm $output

file modified
+8 -8
@@ -2,8 +2,8 @@ 

  

  SPEC_TEMPLATE = Template("""

  Name:       $pkgname

- Version:    1

- Release:    1

+ Version:    $version

+ Release:    $release

  Summary:    This is a test package.

  

  License:    GPLv2+
@@ -15,8 +15,8 @@ 

  

  SPEC_WITH_PATCH_TEMPLATE = Template("""

  Name:       $pkgname

- Version:    1

- Release:    1

+ Version:    $version

+ Release:    $release

  Summary:    This is a test package.

  

  License:    GPLv2+
@@ -30,8 +30,8 @@ 

  

  INVALID_SPEC_TEMPLATE = Template("""

  Name:       $pkgname

- Version:    1

- Release:    1

+ Version:    $version

+ Release:    $release

  Summary:    This is a test package.

  

  License:    GPLv2+
@@ -40,8 +40,8 @@ 

  

  NO_SOURCE_ZERO_SPEC_TEMPLATE = Template("""

  Name:       $pkgname

- Version:    1

- Release:    1

+ Version:    $version

+ Release:    $release

  Summary:    This is a test package.

  

  License:    GPLv2+

file modified
+66 -14
@@ -1,3 +1,5 @@ 

+ from __future__ import print_function

+ 

  import unittest

  import rpkglib

  import six
@@ -5,8 +7,9 @@ 

  import os

  import glob

  import tempfile

+ import configparser

+ import munch

  

- from six.moves import configparser

  from rpkglib.cli import rpkgClient

  from rpkglib.exceptions import NotUnpackedException

  
@@ -20,7 +23,11 @@ 

      from mock import MagicMock

  

  RPKG_CONFIG = """

- [distgit]

+ [rpkg]

+ preprocess_spec = True

+ auto_pack = True

+ 

+ [dist-git]

  lookaside = http://localhost/repo/pkgs/%(ns1)s/%(pkg)s/%(filename)s/%(hashtype)s/%(hash)s/%(filename)s

  lookaside_cgi = https://localhost/repo/pkgs/upload.cgi

  gitbaseurl = ssh://%(user)s@localhost/%(module)s
@@ -35,12 +42,12 @@ 

          config_file.write(RPKG_CONFIG)

          config_file.close()

  

-         config = configparser.SafeConfigParser()

-         config.read(self.config_path)

+         self.config = configparser.SafeConfigParser()

+         self.config.read(self.config_path)

  

-         self.client = rpkgClient(config, name='rpkg')

+         self.client = rpkgClient(self.config, name='rpkg')

          self.client.do_imports('rpkglib')

-         self.client.args = MagicMock(user='user', q='q', path=self.tmpdir)

+         self.client.args = munch.Munch(user='user', q='q', path=self.tmpdir, outdir=self.tmpdir, module_name=None, debug=False, v=False)

  

      def tearDown(self):

          os.unlink(self.config_path)
@@ -62,6 +69,8 @@ 

              user='user',

              quiet='q',

              realms=[],

+             outdir=self.tmpdir,

+             preprocess=True

          )

  

      def test_make_source_from_packed_raises(self):
@@ -72,14 +81,12 @@ 

  

      def test_make_source_from_unpacked(self):

          self.make_unpacked_content()

-         self.client.args.outdir = self.tmpdir

          self.client.args.spec = ''

          self.client.make_source()

          self.assertTrue(glob.glob('{}/{}'.format(self.tmpdir, '*.tar.gz')))

  

      def test_unpacked_changes_into_packed_by_make_sources(self):

          self.make_unpacked_content()

-         self.client.args.outdir = self.tmpdir

          self.client.args.spec = ''

          self.client.make_source()

          self.assertTrue(glob.glob('{}/{}'.format(self.tmpdir, '*.tar.gz')))
@@ -90,7 +97,6 @@ 

          self.make_packed_content()

          dircontent = os.listdir(self.tmpdir)

          self.client.args.spec = ''

-         self.client.args.outdir = self.tmpdir

          self.client.srpm()

          self.assertItemsEqual(

              os.listdir(self.tmpdir),
@@ -100,7 +106,6 @@ 

          self.make_unpacked_content()

          dircontent = os.listdir(self.tmpdir)

          self.client.args.spec = ''

-         self.client.args.outdir = self.tmpdir

          self.client.srpm()

          self.assertItemsEqual(

              os.listdir(self.tmpdir),
@@ -114,8 +119,6 @@ 

          self.touch_file('source0.tar.gz')

          dircontent = os.listdir(self.tmpdir)

  

-         self.client.args.outdir = self.tmpdir

- 

          self.client.args.spec = spec1_path

          self.client.srpm()

          self.assertItemsEqual(
@@ -124,7 +127,9 @@ 

  

          os.unlink(os.path.join(self.tmpdir, 'testpkg1-1-1.src.rpm'))

  

-         self.client.args.spec = spec2_path

+         self.client.cmd.set_specloc(spec2_path)

+         self.client.cmd.load_repo_spec()

+         self.client.cmd.load_spec()

          self.client.srpm()

          self.assertItemsEqual(

              os.listdir(self.tmpdir),
@@ -136,10 +141,57 @@ 

          self.touch_file('source0.tar.gz', subdir='SOURCES')

          self.client.args.spec = spec_path

          path = os.path.join(self.tmpdir, 'SOURCES')

-         self.client.args.path = path

          self.client.args.outdir = path

          dircontent = os.listdir(path)

          self.client.srpm()

          self.assertItemsEqual(

              os.listdir(path),

+             dircontent+['testpkg1.spec', 'testpkg1-1-1.src.rpm'])

+ 

+     def test_make_srpm_on_plain_dir_no_autopack(self):

+         client = rpkgClient(self.config, name='rpkg')

+         client.do_imports('rpkglib')

+         client.args = munch.Munch(user='user', q='q', path=self.tmpdir, outdir=self.tmpdir, module_name=None, debug=False, v=False)

+         client.auto_pack = False

+ 

+         spec1_path = self.dump_spec(

+             SPEC_TEMPLATE, pkgname='testpkg1', source0='source0.tar.gz')

+         self.touch_file('source0.tar.gz')

+         dircontent = os.listdir(self.tmpdir)

+ 

+         self.client.args.spec = spec1_path

+         self.client.srpm()

+         self.assertItemsEqual(

+             os.listdir(self.tmpdir),

              dircontent+['testpkg1-1-1.src.rpm'])

+ 

+     @mock.patch('rpkglib.Commands.add_tag')

+     def test_tag(self, mock_add_tag):

+         self.dump_spec(

+             SPEC_TEMPLATE, pkgname='testpkg1', version='1', release='4')

+ 

+         self.client.args.update({

+             'list': None,

+             'tag': None,

+             'delete': None,

+             'file': None,

+             'clog': None,

+             'force': False,

+             'message': 'message',

+         })

+ 

+         self.client.tag()

+         mock_add_tag.assert_called_with('testpkg1-1-4', False, 'message', None)

+ 

+         spec2_path = self.dump_spec(

+             SPEC_TEMPLATE, pkgname='testpkg2', version='x', release='x')

+ 

+         # reload everything

+         self.client.cmd.set_specloc(spec2_path)

+         self.client.cmd.load_repo_spec()

+         self.client.cmd.load_spec()

+         self.client.cmd.load_nameverrel()

+         self.client.cmd.load_nvr()

+ 

+         self.client.tag()

+         mock_add_tag.assert_called_with('testpkg2-x-x', False, 'message', None)

file modified
+29 -6
@@ -3,21 +3,26 @@ 

  import tarfile

  import six

  import git

- 

  import base

  import rpkglib

+ 

  from rpkglib.exceptions import NotUnpackedException, RpmSpecParseException,\

          NoSourceZeroException

  from rpkglib.utils import find_source_zero

+ 

  from spec_templates import SPEC_TEMPLATE, SPEC_WITH_PATCH_TEMPLATE,\

          INVALID_SPEC_TEMPLATE, NO_SOURCE_ZERO_SPEC_TEMPLATE

  

+ from pyrpkg.errors import rpkgError

+ 

  if six.PY3:

      from unittest import mock

      from unittest.mock import MagicMock

+     from io import StringIO

  else:

      import mock

      from mock import MagicMock

+     from cStringIO import StringIO

  

  class TestCommands(base.TestCase):

      def setUp(self):
@@ -30,7 +35,9 @@ 

                                      'http://copr-dist-git.fedorainfracloud.org/git/%(module)s',

                                      branchre='.*',

                                      kojiconfig='',

-                                     build_client=None)

+                                     build_client=None,

+                                     outdir=self.tmpdir,

+                                     preprocess=True)

  

      def tearDown(self):

          super(TestCommands, self).tearDown()
@@ -169,12 +176,12 @@ 

      def test_make_source_raises_on_packed(self):

          self.dump_spec(SPEC_TEMPLATE, source0='source0.tar.gz')

          with self.assertRaises(NotUnpackedException):

-             self.cmd.make_source(self.tmpdir)

+             self.cmd.make_source()

  

      def test_make_source_packs_on_unpacked(self):

          spec_path = self.dump_spec(SPEC_TEMPLATE, source0='source0.tar.gz')

          self.touch_file('patch.txt', subdir='dir')

-         archive_path = self.cmd.make_source(self.tmpdir)

+         archive_path = self.cmd.make_source()

          self.assertTrue(os.path.exists(archive_path))

  

          parsed_spec = self.get_parsed_spec(spec_path)
@@ -194,10 +201,26 @@ 

      def test_make_source_raises_on_invalid_spec(self):

          self.dump_spec(INVALID_SPEC_TEMPLATE)

          with self.assertRaises(RpmSpecParseException):

-             self.cmd.make_source(self.tmpdir)

+             self.cmd.make_source()

  

      def test_make_source_raises_on_no_source_zero(self):

          self.dump_spec(NO_SOURCE_ZERO_SPEC_TEMPLATE)

          self.touch_file('patch.txt')

          with self.assertRaises(NoSourceZeroException):

-             self.cmd.make_source(self.tmpdir)

+             self.cmd.make_source()

+ 

+     @mock.patch('sys.stdout', new_callable=StringIO)

+     def test_add_tag(self, mock_stdout):

+         with self.assertRaises(rpkgError) as err:

+             self.cmd.add_tag('foo-bar')

+ 

+         assert str(err.exception) == 'Tag foo-bar does not have n-v-r format.'

+ 

+         spec_path = self.dump_spec(

+             SPEC_TEMPLATE, pkgname='testpkg1', version='1', release='4')

+ 

+         self.init_repo_with_commit()

+         self.cmd.add_tag(self.cmd.nvr, message='message')

+ 

+         self.cmd.list_tag()

+         assert mock_stdout.getvalue() == 'testpkg1-1-4\n'

file modified
+6 -2
@@ -12,7 +12,9 @@ 

                                 'anongiturl',

                                 branchre='.*',

                                 kojiconfig='',

-                                build_client=None)

+                                build_client=None,

+                                outdir=self.tmpdir,

+                                preprocess=True)

          url = cmd.lookasidecache.get_download_url('forks/user/ns1/pkg', 'bar.tar.gz', '123asdf', 'outfile', 'sha512')

          self.assertEqual(url, 'http://localhost/repo/pkgs/ns1/pkg/bar.tar.gz/sha512/123asdf/bar.tar.gz')

  
@@ -25,6 +27,8 @@ 

                                 'anongiturl',

                                 branchre='.*',

                                 kojiconfig='',

-                                build_client=None)

+                                build_client=None,

+                                outdir=self.tmpdir,

+                                preprocess=True)

          url = cmd.lookasidecache.get_download_url('forks/user/ns1/pkg', 'bar.tar.gz', '123asdf', 'outfile', 'sha512')

          self.assertEqual(url, 'http://localhost/repo/pkgs/user/ns1/pkg/bar.tar.gz/sha512/123asdf/bar.tar.gz')

file added
+30
@@ -0,0 +1,30 @@ 

+ import unittest

+ import six

+ 

+ import base

+ from rpkglib import utils

+ 

+ if six.PY3:

+     from unittest import mock

+     from unittest.mock import MagicMock

+ else:

+     import mock

+     from mock import MagicMock

+ 

+ class TestCommands(base.TestCase):

+     def setUp(self):

+         super(TestCommands, self).setUp()

+ 

+     def tearDown(self):

+         super(TestCommands, self).tearDown()

+ 

+     def test_get_changelog_entry(self):

+         commit_message = 'first line %changelog\nsecond_line'

+         changelog_entry = utils.get_changelog_entry(commit_message)

+         assert changelog_entry == '- first line %%changelog'

+ 

+         commit_message = 'first line %changelog'*10

+         changelog_entry = utils.get_changelog_entry(commit_message)

+         split_lines = changelog_entry.split()

+         for line in split_lines:

+             assert len(line) <= 80

no initial comment

Oh boy, that is a big PR

I hasn't been able to review all of it yet, but my notes are starting to get quite long, so I am going to share my first impressions.

User POV

Running rpkg srpm in non-git directory fails with

git_pack: Error during source creation.
git_changelog: Start by setting origin URL.
fatal: Not a git repository (or any of the parent directories): .git
Wrote: /tmp/rpkg/foo.spec
error: line 2: Empty tag: Name:
can't parse specfile

It doesn't matter to me whether it should or shouldn't work without git initialization, I would just expect a more user-friendly error.

Similarly, running rpkg srpm in a git directory, which however doesn't have the origin remote (i.e. local project which hasn't been pushed yet), fails with

Wrote: /tmp/rpkg/foo.spec
error: line 2: Empty tag: Name:
can't parse specfile

It is because of the {{{ git_name }}} macro, but there should be a better message. As a user, I don't want to check the implementation of git_name macro and see that it takes the name from origin repo URL.

However, even though I don't use the {{{ git_name }}} and {{{ git_version lead=1 }}} macros, I still get

Wrote: /tmp/rpkg/bar.spec
error: line 3: Empty tag: Version:
can't parse specfile

Running rpkg sources seems to do nothing, but I would expect it to generate the tar that is packed into SRPM when running rpkg srpm. What is the content of it anyway? It looks like everything in the git directory, but I think that it rather should be only committed files because the final SRPM is labeled with the commit hash.

Lastly, Wrote: /tmp/rpkg/foo.spec. I don't like the idea of using always the same directory. It should be used mkdtemp() for that. Those generated tmp directories can be under /tmp/rpkg for sure, ...

Code review

What is the purpose of rpkg-client.spec.rpkg, rpkg-client.spec.rpkg.cwd and rpkg-client.spec.rpkg.dir? Are those supposed to be just examples of different kinds of macros? In this case they should be much shorter. I like that those are whole spec files that can be copy-pasted and tried, but (Build)Requires, install section and changelog should be greatly reduced.

I would prefer the same formatting of the spec files as in the documentation, which is

Name:          repo
Version:       1.0.git.1.01c067a5
Release:       1%{?dist}
Summary:       RPM packaging utitility
License:       GPLv2+
URL:           https://pagure.io/rpkg-client.git

See for example https://rpm-packaging-guide.github.io/#hello-world .

Macros in bash are one thing, but why do we need also preproc.sh and pack_sources.sh in bash? To me, it doesn't really look like a true part of rpkg but rather a hack. Also mixing languages is a bad thing. I understand the reason for using bash for implementing macros, but that should end there.

Philosophical topics

Those are just topics that I have in my head. I am sure that everyone will have a different opinion on this topics, so we can't say what is right or wrong here, but I just want to share what I think.

First, macros in bash. Some may say that it is a good idea because bash is kind of a universal language, everyone kind of knows it and users can simply implement their own macros in the project. Well, IMHO the premise is good, but to me, the bash is ugly as hell and looking on some macros, a write-only language. And I am not talking only about this type of constructions sed -e 's|/|-|g' -e 's|-$||' which I must say, are my favorites. I don't know if it is just me, but I feel like anyone can really re-open such project after few months and understand it. Personally, I would give an enormously huge +1 to using python for macro implementation and jinja2 for templating since the rest of the project is in python.

And it looked like there will be more of the topics, but at this point I really have just one.

Please don't take this feedback too offensively, I don't mean it this way at all. I just needed tu dump my head.

I would rather force rpmlint upstream to do this a right way:
https://github.com/rpm-software-management/rpmlint/issues/125

Noone knows who is going to parse the .rpmlint* files, and the only one
which one can think of actually doesn't (rpmlint itself).

Why the && f.startswith('.') check? Can the file be like ./something?

Well, saying once more publicly -- I don't think such code by-definition belongs
to rpkg (tool to work with dist-git, it could well mean that rpkg will never
happen to be distribution-default dist-git client and distros will have to stick
with their own fedpkg, rhpkg, centpkg forks). But this is not first time we
broke this rule, so it's getting less and less priority; maybe it's leading to another
fork say dist-git-client which will do nothing else than clone && rpmbuild -bs.

To me, the defaults for git_version/git_name are real magic; and dictate "how
users should do git repo maintenance ... but OTOH the shell
commands are supposed to be re-defined by rpkg config file in-repo. Sounds OK.
(Note that this may well bring additional srpm-buildrequires (build requires
needed for building the srpm).

I'm not the target audience for this feature, but it could be interesting to someone,
dunno. Thanks for the research.

Well, saying once more publicly -- I don't think such code by-definition belongs
to rpkg (tool to work with dist-git, it could well mean that rpkg will never
happen to be distribution-default dist-git client and distros will have to stick
with their own fedpkg, rhpkg, centpkg forks). But this is not first time we
broke this rule, so it's getting less and less priority

Yes, I am concerned about this too. The previous changes that broke the rule were quite small and helped to a unification of SCM method in Copr, which was really helpful.

Now I am not sure. It is a big change ... We should really talk about how important for us is the goal for rpkg to become the distribution-default dist-git client.

6 new commits added

  • update README.md
  • use git rev-parse --short HEAD to get the short commit hash
  • no HEAD handling
  • propagate errors
  • more debugging info about spec substitutions
  • whitespace tweaking + is_packed fixed

3 new commits added

  • add missing quotes
  • when bash function is invoked directly from console, ${FUNCNAME[-1]} is not main
  • add check for dirty working tree into git_archive

2 new commits added

  • encode also the latest file modification time into version if working tree is dirty
  • fix rpmlint config file lookup in lint method

@frostyx: ad. the error messages:

that should fixed now by 16e70e5. Can you retry on https://copr.fedorainfracloud.org/coprs/clime/rpkg-client/build/726008/.

Running rpkg sources seems to do nothing, but I would expect it to generate the tar that is packed into SRPM when running rpkg srpm.

rpkg sources actually just downloads sources from distgit. It does not do anything else. For dynamic generation of a source from Git repo, there is rpkg spec --sources. When rpkg srpm is invoked, sources are downloaded from DistGit if any and if you use {{{ git_pack }}} or {{{ git_archive}}} for some Source: field in the input spec file, a dynamically generated tarball is put into /tmp/rpkg as well.

What is the content of it anyway? It looks like everything in the git directory, but I think that it rather should be only committed files because the final SRPM is labeled with the commit hash.

Good point. I fixed the versioning to also take into account the current working tree state.
Actually, only {{{ git_pack }}} uses the working tree. {{{ git_archive }}} uses Git index (hence individual commits in Git history) to generate the tarball. It depends on user what he/she will pick (by the way, git_archive gives behavior closer to tito).

Lastly, Wrote: /tmp/rpkg/foo.spec. I don't like the idea of using always the same directory. It should be used mkdtemp() for that. Those generated tmp directories can be under /tmp/rpkg for sure, ...

I wouldn't like having the content hidden in some random directory names. The content generated by rpkg should be easy to find so that user can investigate it and use it further (e.g. to send a build srpm to COPR for building). Naming of the file depends on a package name, which should be good enough.

But what I would like to do is to add --rpmtree parameter to rpkg which will actually start generating the output files into the classic rpmbuild tree: BUILD BUILDROOT RPMS SOURCES SPECS SRPMS. I actually want to make this a default behaviour (and only generate the files directly into /tmp/rpkg if user asks for it by --outdir param or a config option). But this will likely come after this PR.

What is the purpose of rpkg-client.spec.rpkg, rpkg-client.spec.rpkg.cwd and rpkg-client.spec.rpkg.dir? Are those supposed to be just examples of different kinds of macros? In this case they should be much shorter. I like that those are whole spec files that can be copy-pasted and tried, but (Build)Requires, install section and changelog should be greatly reduced.

I quickly copied and modified rpkg-client.spec.rpkg. Better example templates will land with unit-tests (that will be part of this PR).

Macros in bash are one thing, but why do we need also preproc.sh and pack_sources.sh in bash? To me, it doesn't really look like a true part of rpkg but rather a hack. Also mixing languages is a bad thing. I understand the reason for using bash for implementing macros, but that should end there.

preproc.sh is the a script responsible for invoking a given macro and also for doing some setup (like e.g. sourcing the user definitions from rpkg.sh in the current working directory or maintaining function call cache - this will be described in docs). It could be done even without this file but the subprocess invocation from python would be then much more complex. That's why I kept it.

pack_source.sh is a helper script that produces results similar to git archive command (but pack_source.sh uses tar and it works on current working tree state as opposed to git_archive). Having this particular functionality separated makes it easier to test it (manually or from a test script). It is a useful script on its own.

I would give an enormously huge +1 to using python for macro implementation and jinja2 for templating since the rest of the project is in python.

bash over python was chosen for the macro implementation for the following reaons:

1) it is something, packagers might be used to already thanks to %() rpm construct (shell invocation)
2) All the macros currently implemented need lots of git calls - it is much more simpler for me to do those in shell than in python by using e.g. GitPython library
3) well, the previous reasons are the main ones but there are more. E.g. that you can do a lot with just git+coreutils installed (which almost everyone has by default) and using bash allows users to really easily provide his/her own macro definition (just by putting a bash function into rpkg.sh). It really cannot be simpler than that. Also using bash allowed for really compact implementation (preproc.py + preproc.sh have together 83 + 15 = 98 lines and that's really quite crazy considering that these two files basically implement the rpkg template language - all the rest are by default provided macros).

jinja2 was not picked because it uses just {{, }} and pontentially {%, %} tags which is too similar to rpm's own macros '%{ ... }`. It is also really a big overkill here and actually it also misses some features that we really need (function call cache that I will explain later).

Please don't take this feedback too offensively, I don't mean it this way at all. I just needed tu dump my head.

No, I am totally glad for it. I wanted to get as much feedback as possible.

@praiskup:

Well, saying once more publicly -- I don't think such code by-definition belongs
to rpkg (tool to work with dist-git, it could well mean that rpkg will never
happen to be distribution-default dist-git client and distros will have to stick
with their own fedpkg, rhpkg, centpkg forks). But this is not first time we
broke this rule, so it's getting less and less priority; maybe it's leading to another
fork say dist-git-client which will do nothing else than clone && rpmbuild -bs.

Well, rpkg srpm will do pretty much exactly what you describe at the end if:

1) user is not using any preprocessor macros
2) preprocess_spec is set to False in rpkg configuration
3) both

Nothing should be colliding with the existing use-cases.

Yes, I am concerned about this too. The previous changes that broke the rule were quite small and helped to a unification of SCM method in Copr, which was really helpful.
Now I am not sure. It is a big change ... We should really talk about how important for us is the goal for rpkg to become the distribution-default dist-git client.

(...actually by @frostyx)

Note that the current state here in this branch (and PR) is much more favourable for rpkg. That's because the spec template feature offered here makes the "auto-packing" explicit (before you couldn't tell from a spec file itself where the Source: is being obtained from, which is a huge drawback - now git_pack or git_archivemacros being invoked directly from spec fix that). This PR also offers to switch the both extra features (spec preprocessing + the deprecated auto-packing) off, which is even unnecessary in the case of spec templates.

Btw. a pretty quick tutorial is now available here: https://docs.pagure.org/rpkg-util/tutorials.html#spec-templates-from-scratch (it will need a revision).

1 new commit added

  • use brace expansion to generate radix digits, fix dirty check position in git archive

Can you summarize what this is supposed to do?

Can you summarize what this is supposed to do?

it allows for generation of spec files from git metadata and git content. So you can e.g. have a spec file that has value of the Version: field generated from your git repo history.

A couple of questions here:

  1. Can we have a way to make rpkg do post/pre-release properly in the Version field? Something like the tilde versioning proposal I have for Fedora (which other distributions already follow).

  2. Can we have an option for the changelog entries to be generated with full time stamps? That's been supported since RPM 4.14 using the date format style. We do this for rust2rpm (with openSUSE currently, but I think we'll change it for everyone), for example.

2 new commits added

  • fix Summary in spec
  • always regenerate the tarball
6 years ago

A couple of questions here:

Can we have a way to make rpkg do post/pre-release properly in the Version field? Something like the tilde versioning proposal I have for Fedora (which other distributions already follow).

Yes, you can specify follow argument for git version so it e.g becomes:

{{{ git_version follow=1.0~rc1 }}}

which will generate 0.1.0~rc1 optionally with dynamic suffixes (.git., .wtree.) when we are or non-tag in the current git history or if our working tree is dirty.

If follow parameter is specified, the second version field becomes fixed (normally it is derived from number of tags for a given package name and lead - lead is "major" number but we call it 'lead'). Developer can remove follow argument later and return to automatic versioning of the minor number (lead number is always versioned manually) .

But the problem with ~ here is that e.g. rpkg-util-1.1.4~rc1-1 is not a valid tag name according to git so a user wouldn't be able to create a tag on such version.

Can we have an option for the changelog entries to be generated with full time stamps? That's been supported since RPM 4.14 using the date format style. We do this for rust2rpm (with openSUSE currently, but I think we'll change it for everyone), for example.

Yes, sure. Actually full timestamp is default format for %(taggerdate) in

git tag -l --format="%(taggerdate)"

In then end I put %(taggerdate:format:%a %b %d %Y) there so the changelog looks more human-like. But we can add a parameter for full timestamps, for sure e.g.

{{{ git_changelog full_timestamps=1 }}}

{{{ git_changelog full_timestamps=1 }}}

Potentially a full header could be parametrized. Currently it is:

'* %(taggerdate:format:%a %b %d %Y) %(taggername) %(taggeremail)'

1 new commit added

  • use ctime instead of mtime to account for file renames and permission changes
6 years ago

3 new commits added

  • allow empty date format to get the git default
  • nestedExpression is probably not what we want for parsing
  • add header_date_format param for git_changelog, locale->header_locale, quoting
6 years ago

Potentially a full header could be parametrized. Currently it is:
'* %(taggerdate:format:%a %b %d %Y) %(taggername) %(taggeremail)'

That's actually not the full header as $verrel is not there. I've just added header_date_format for git_changelog macro.

7 new commits added

  • only fetch follows of a given lead from tag, code cleanup
  • use token in error log to get more dense output
  • bash tweaks according shellcheck
  • include changelog formatting also in git_changelog, variable and function cleanup
  • remove no longer needed function
  • code improvements
  • revision version bumping, fix git_archive when repo is not inited
6 years ago

1 new commit added

  • use Literal instead of Keyword for parsing so that e.g. '{{{ foo}}}' is parsed
6 years ago

1 new commit added

  • add git_vcs macro to denote canonical source
6 years ago

I've redone the bumping and versioning logic so that the relevant code is only in lib.sh and nowhere else (before there was some logic in lib.sh and also in rpkglib/__init__.py:add_tag).

git_version now works in the following way when spec template is evaluated:

  • if we are not bumping (i.e. we are not calling rpkg tag)
    • if follow is specified by user explicitly, return $lead.$follow.<dynamic suffixes>
    • otherwise, extract follow from the latest tag as the last version component (after the last .) and return $lead.$follow.<dynamic suffixes>

  • if we are bumping (i.e. we are calling rpkg tag)
    • if follow is specified by user explicitly, return $lead.$follow
    • otherwise, extract follow from the latest tag as the last version component (after the last .) and return $lead.$follow+1. If $follow is not a number, throw an error (manual setting of follow is needed).

I have also added {{{ git_vcs }}} macro (and the related macros: git_dir_vcs and git_cwd_vcs to get the origin of sources. This might come handy if you hold an rpm and you want to track it back to the original Git repository it comes from.

I think this PR is close to finish. I'll try to add some testing (although not sure how exhaustive it will be at this point).

I want to share some final thoughts.

rpkg sources actually just downloads sources from distgit. It does not do anything else. For dynamic generation of a source from Git repo, there is rpkg spec --sources.

Ok, it is good, that there is at least some way how to achieve this - rpkg spec --sources. So, once it is properly documented, I am fine with it. However, to be honest, I don't like the command very much. I wouldn't expect at all, that command rpkg spec ... will generate tarball to me.

Please consider rpkg sources for it. I don't mind if you choose not (re)implementing it for some reason, just please think about it.

pack_source.sh is a helper script that produces results similar to git archive command (but pack_source.sh uses tar and it works on current working tree state as opposed to git_archive). Having this particular functionality separated makes it easier to test it (manually or from a test script). It is a useful script on its own.

I can agree with all of it, but that actually isn't a valid reason for implementing standalone scripts in language A when the whole project is in language B. You might as well do it in Haskell. This way a different test toolkit needs to be used, it puts additional requirements for contributors to know another language on some level and so on. Even if it is a bash that everyone kind of knows.

1) it is something, packagers might be used to already thanks to %() rpm construct (shell invocation)
2) All the macros currently implemented need lots of git calls - it is much more simpler for me to do those in shell than in python by using e.g. GitPython library
3) well, the previous reasons are the main ones but there are more. E.g. that you can do a lot with just git+coreutils installed (which almost everyone has by default) and using bash allows users to really easily provide his/her own macro definition (just by putting a bash function into rpkg.sh). It really cannot be simpler than that.

Well, I've already said all my reasons why not to do it in bash, so I am not going to repeat myself. I can imagine that some people will agree that the bash is the best option here as well as some people that will disagree with it. In the end, someone has to make the decision and pick the language.

To address your comment ...

it is much more simpler for me to do those in shell than in python by using e.g. GitPython library

In my eyes, python + subprocess would still be a much better option than bash

and using bash allows users to really easily provide his/her own macro definition (just by putting a bash function into rpkg.sh)

This may as well be done with python by putting a function into rpkg.py

that should fixed now by 16e70e5. Can you retry on https://copr.fedorainfracloud.org/coprs/clime/rpkg-client/build/726008/.

Yes, I see there are a lot of changes since I tried it, so I will test them as well.

I want to share some final thoughts.

rpkg sources actually just downloads sources from distgit. It does not do anything else. For dynamic generation of a source from Git repo, there is rpkg spec --sources.

Ok, it is good, that there is at least some way how to achieve this - rpkg spec --sources. So, once it is properly documented, I am fine with it. However, to be honest, I don't like the command very much. I wouldn't expect at all, that command rpkg spec ... will generate tarball to me.
Please consider rpkg sources for it. I don't mind if you choose not (re)implementing it for some reason, just please think about it.

Actually only rpkg spec --sources really makes sense. That's because the tarball is generated as a side product of spec template evaluation (when git_pack or git_archive macros are present).

If you are a true functional purist, then this feature is probably not for you (and you can use more complicated syntax that might be added at some point later - it probably won't be added just for this reason though).

pack_source.sh is a helper script that produces results similar to git archive command (but pack_source.sh uses tar and it works on current working tree state as opposed to git_archive). Having this particular functionality separated makes it easier to test it (manually or from a test script). It is a useful script on its own.

I can agree with all of it, but that actually isn't a valid reason for implementing standalone scripts in language A when the whole project is in language B. You might as well do it in Haskell. This way a different test toolkit needs to be used, it puts additional requirements for contributors to know another language on some level and so on. Even if it is a bash that everyone kind of knows.

Well, some languages are more suitable to do one thing and some other are more suitable to do another thing. For text processing and git manipulation, I just prefer bash much more.

If you look e.g. at (a completely different project) firefox here: https://fedoramagazine.org/oxidizing-fedora-try-rust-applications-today/ (the paragraph about Tokei), how many languages are actually used to implement it.

I evaluated bash as much better language to implement the macros and I was really very happy about that choice during the implementation.

1) it is something, packagers might be used to already thanks to %() rpm construct (shell invocation)
2) All the macros currently implemented need lots of git calls - it is much more simpler for me to do those in shell than in python by using e.g. GitPython library
3) well, the previous reasons are the main ones but there are more. E.g. that you can do a lot with just git+coreutils installed (which almost everyone has by default) and using bash allows users to really easily provide his/her own macro definition (just by putting a bash function into rpkg.sh). It really cannot be simpler than that.

Well, I've already said all my reasons why not to do it in bash, so I am not going to repeat myself. I can imagine that some people will agree that the bash is the best option here as well as some people that will disagree with it. In the end, someone has to make the decision and pick the language.
To address your comment ...

it is much more simpler for me to do those in shell than in python by using e.g. GitPython library
self.repo.git.tag
In my eyes, python + subprocess would still be a much better option than bash

and using bash allows users to really easily provide his/her own macro definition (just by putting a bash function into rpkg.sh)

This may as well be done with python by putting a function into rpkg.py

Yes, that would work. Well, we don't have the equivalent implementation in python at hand to compare but I still believe the current implementation would come out better (=simpler).

Feel free to prove me wrong but as I said I was really happy about bash and started to appreciate that language much more.

that should fixed now by 16e70e5. Can you retry on https://copr.fedorainfracloud.org/coprs/clime/rpkg-client/build/726008/.

Yes, I see there are a lot of changes since I tried it, so I will test them as well.

Please, download the latest built package from https://copr.fedorainfracloud.org/coprs/clime/rpkg-client/. I am trying to keep it up-to-date.

Note that I understand all your arguments about bash being a bit arcane, hard-to-read language :) but I would still prefer it over python in certain use-cases (like this one).

...We could offer direct use of rpkg-util/rpkglib/preproc/scripts/pack_sources.sh as an alternative way to pack the sources for functional purists. Then they could avoid the git_pack and git_archive macros and use just what they need out of the rpkg template language if they wanted to. I don't want to offer that as an additional rpkg subcommand (rpkg pack-sources) because there already are tons of "source"-like subcommands. Rather, just put it into /usr/bin/ (/usr/bin/pack-sources) and mention it in docs and man pages as an alternative way to create the source tarball (it could also be a separate package altogether).

5 new commits added

  • change name of the user-defined macro file to rpkg.macros, which is more obvious
  • introduce setup script to set env instead of preprocess.sh, cleaner ENV var names
  • macro tests initial setup
  • we shouldn't invoke the command in 'cached', improve exit control
  • reorder functions in lib.sh, body_width -> body_wrap in git_changelog
6 years ago

I changed the name of the file with user-defined macros to 'rpkg.macros'. It is more obvious like that what is the purpose of the file if included in a user project.

Sorry for additional changes in this PR. I keep discovering things that can be done better. I would like to reach some final state before this is merged.

3 new commits added

  • 1 unittest and bugfix
  • basic macro test suite
  • bug-fixes in git_latest_ctime
6 years ago

8 new commits added

  • drop source_name tests (method does not exist), add setup_macro tests, regenerate
  • fix position of 2> /dev/null when fetching tags
  • no source_name macros, alias (cached git_name)-(cached git_version)
  • finish test_sources_subdir, do not output changelog date
  • make release in tag a required thing so that we can reliably parse out package name
  • fix dirty condition in git_archive, the previous relied on an existing tag
  • test input update, prepare_input added into tests, fix for changelog date changing
  • add append param to git_name, apend and prepend exactly what user tell you to
6 years ago

2 new commits added

  • change default auto_pack value to False
  • rename to rpkg-util, remove unused templates, add template examples
6 years ago

rebased onto 73a239c

6 years ago

1 new commit added

  • extend examples with more description
6 years ago

1 new commit added

  • example typo fixes
6 years ago

1 new commit added

  • add two tag tests and make_srpm on plain dir test with auto_pack off
6 years ago

3 new commits added

  • update tutorial and index.rst
  • fix setup.py and fix man pages generation
  • update doc/index.rst
6 years ago

98 new commits added

  • update tutorial and index.rst
  • fix setup.py and fix man pages generation
  • update doc/index.rst
  • add two tag tests and make_srpm on plain dir test with auto_pack off
  • example typo fixes
  • extend examples with more description
  • change default auto_pack value to False
  • rename to rpkg-util, remove unused templates, add template examples
  • drop source_name tests (method does not exist), add setup_macro tests, regenerate
  • fix position of 2> /dev/null when fetching tags
  • no source_name macros, alias (cached git_name)-(cached git_version)
  • finish test_sources_subdir, do not output changelog date
  • make release in tag a required thing so that we can reliably parse out package name
  • fix dirty condition in git_archive, the previous relied on an existing tag
  • test input update, prepare_input added into tests, fix for changelog date changing
  • add append param to git_name, apend and prepend exactly what user tell you to
  • 1 unittest and bugfix
  • basic macro test suite
  • bug-fixes in git_latest_ctime
  • change name of the user-defined macro file to rpkg.macros, which is more obvious
  • introduce setup script to set env instead of preprocess.sh, cleaner ENV var names
  • macro tests initial setup
  • we shouldn't invoke the command in 'cached', improve exit control
  • reorder functions in lib.sh, body_width -> body_wrap in git_changelog
  • add git_vcs macro to denote canonical source
  • use Literal instead of Keyword for parsing so that e.g. '{{{ foo}}}' is parsed
  • only fetch follows of a given lead from tag, code cleanup
  • use token in error log to get more dense output
  • bash tweaks according shellcheck
  • include changelog formatting also in git_changelog, variable and function cleanup
  • remove no longer needed function
  • code improvements
  • revision version bumping, fix git_archive when repo is not inited
  • allow empty date format to get the git default
  • nestedExpression is probably not what we want for parsing
  • add header_date_format param for git_changelog, locale->header_locale, quoting
  • use ctime instead of mtime to account for file renames and permission changes
  • fix Summary in spec
  • always regenerate the tarball
  • use brace expansion to generate radix digits, fix dirty check position in git archive
  • encode also the latest file modification time into version if working tree is dirty
  • fix rpmlint config file lookup in lint method
  • add missing quotes
  • when bash function is invoked directly from console, ${FUNCNAME[-1]} is not main
  • add check for dirty working tree into git_archive
  • update README.md
  • use git rev-parse --short HEAD to get the short commit hash
  • no HEAD handling
  • propagate errors
  • more debugging info about spec substitutions
  • whitespace tweaking + is_packed fixed
  • update README.md
  • fix git_changelog
  • replace in dir spec template
  • fix missing import
  • cache output of the 'output' caller
  • add append= param to git_name and use it
  • read rpkg.conf from the current working directory, use config merging
  • unhide rpkg.sh
  • we can rely on just basic git_* functions caching
  • add some spec template into root repo dir for testing
  • fix git archive functions
  • register clog with dump_spec_only
  • subcommand fixes
  • make rel optional in git_changelog
  • help message for tagging
  • make info of 'Source file already exists.' message
  • fix sources param for spec subcommand
  • add check for tag existence into git_tag
  • del tag in case of exception in load_spec or load_nameverrel
  • fix silent logging
  • fix quoting in git_changelog
  • add debug messages, do not dump sources on tagging
  • fix in numeric version check in add_tag
  • add --sources param for spec subcommand
  • basic implementation of git_dir_ and git_cwd_ function families
  • fixed source generation, further improvements in logging
  • quoting + logging improvements + source creation tweak
  • added env, added latest function call caching, finished basics of git_ functions, no "artifacts" generated when not needed, renamed distgit config section to dist-git
  • sort tags by unixdate, additional load_spec after tagging
  • fix git_changelog date
  • tagging editor fixed + code cleanup + git_changelog implemented
  • added self.repo_spec, fixes in tagging
  • strip_at fix
  • initialize spec_template
  • very basic logging implemented
  • git_pack and git_source_name implemented
  • add rpkg spec
  • tagging and git_version macro implemented
  • rpkg.sh back to lib.sh as we can just do name params with declare
  • rename make_source.sh script to pack_sources.sh
  • rename lib.sh to rpkg.sh, use lib.sh for generic helper methods
  • change argument expansion from $* to "$@"
  • change preproc shell type to bash
  • fix deps and update README
  • add missing dep on python-configparser
  • added spec file preprocessing
  • deprecate make_source and add option to disable auto_packing
6 years ago

5 new commits added

  • fix typo
  • add spec template description into man pages
  • small doc tweak
  • update man pages
  • bb .tito
6 years ago

1 new commit added

  • fix setup.py
6 years ago

Basic stuff should be in place so will try to merge.

Pull-Request has been merged by clime

6 years ago
Metadata
Changes Summary 78
-3
file removed
.tito/packages/.readme
-1
file removed
.tito/packages/rpkg-client
-5
file removed
.tito/tito.props
+97 -42
file changed
README.md
+4 -3
file changed
doc/index.rst
+159 -105
file changed
doc/tutorials.rst
+50
file added
examples/simple-template-cwd.spec.rpkg
+51
file added
examples/simple-template-dir.spec.rpkg
+128
file added
examples/simple-template.spec.rpkg
+349 -41
file changed
man/rpkg_man_page.py
+14 -21
file changed
rpkg
+23 -11
file renamed
rpkg-client.spec
rpkg-util.spec.rpkg
+6 -1
file changed
rpkg.conf
+200 -49
file changed
rpkglib/__init__.py
+141 -117
file changed
rpkglib/cli.py
+0 -3
file changed
rpkglib/exceptions.py
+96
file added
rpkglib/preproc.py
+384
file added
rpkglib/preproc/lib.sh
+61
file added
rpkglib/preproc/scripts/pack_sources.sh
+22
file added
rpkglib/preproc/setup
+34 -5
file changed
rpkglib/utils.py
+5 -2
file changed
run_tests.sh
+9 -7
file changed
setup.py
+21 -4
file changed
tests/base.py
+23
file added
tests/preproc/README
+135
file added
tests/preproc/input
+54
file added
tests/preproc/lib.sh
+39
file added
tests/preproc/preproc.py
+8
file added
tests/preproc/run.sh
+3
file added
tests/preproc/test_bash/input
+6
file added
tests/preproc/test_bash/log
+4
file added
tests/preproc/test_bash/output
+17
file added
tests/preproc/test_bash/run.sh
+11
file added
tests/preproc/test_bumped_version/input
+22
file added
tests/preproc/test_bumped_version/log
+11
file added
tests/preproc/test_bumped_version/output
+15
file added
tests/preproc/test_bumped_version/run.sh
+270
file added
tests/preproc/test_committed/log
+165
file added
tests/preproc/test_committed/output
+28
file added
tests/preproc/test_committed/run.sh
+270
file added
tests/preproc/test_dirty/log
+165
file added
tests/preproc/test_dirty/output
+24
file added
tests/preproc/test_dirty/run.sh
+315
file added
tests/preproc/test_inited/log
+165
file added
tests/preproc/test_inited/output
+17
file added
tests/preproc/test_inited/run.sh
+270
file added
tests/preproc/test_inited_origin_set/log
+165
file added
tests/preproc/test_inited_origin_set/output
+19
file added
tests/preproc/test_inited_origin_set/run.sh
+2
file added
tests/preproc/test_sources/input
+6
file added
tests/preproc/test_sources/log
+2
file added
tests/preproc/test_sources/output
+27
file added
tests/preproc/test_sources/run.sh
+2
file added
tests/preproc/test_sources_committed/input
+4
file added
tests/preproc/test_sources_committed/log
+2
file added
tests/preproc/test_sources_committed/output
+34
file added
tests/preproc/test_sources_committed/run.sh
+26
file added
tests/preproc/test_sources_subdir/input
+36
file added
tests/preproc/test_sources_subdir/log
+26
file added
tests/preproc/test_sources_subdir/output
+67
file added
tests/preproc/test_sources_subdir/run.sh
+270
file added
tests/preproc/test_subdir/log
+165
file added
tests/preproc/test_subdir/output
+21
file added
tests/preproc/test_subdir/run.sh
+270
file added
tests/preproc/test_tagged/log
+264
file added
tests/preproc/test_tagged/output
+27
file added
tests/preproc/test_tagged/run.sh
+270
file added
tests/preproc/test_tagged_committed/log
+168
file added
tests/preproc/test_tagged_committed/output
+26
file added
tests/preproc/test_tagged_committed/run.sh
+451
file added
tests/preproc/test_uninited/log
+165
file added
tests/preproc/test_uninited/output
+15
file added
tests/preproc/test_uninited/run.sh
+8 -8
file changed
tests/spec_templates.py
+66 -14
file changed
tests/test_cli.py
+29 -6
file changed
tests/test_cmd.py
+6 -2
file changed
tests/test_lookaside.py
+30
file added
tests/test_utils.py