Bug 1136963 - `make rpm` fails to build task RPM from git if task has not been tagged
Summary: `make rpm` fails to build task RPM from git if task has not been tagged
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Beaker
Classification: Retired
Component: command line
Version: 0.17
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: 0.18.3
Assignee: Dan Callaghan
QA Contact: tools-bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-09-03 16:56 UTC by Dan Lavu
Modified: 2018-02-06 00:41 UTC (History)
6 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2014-10-17 06:22:10 UTC
Embargoed:


Attachments (Terms of Use)

Description Dan Lavu 2014-09-03 16:56:20 UTC
Description of problem: When issuing the command `make rpm` the rpm-build fails due to git-archive being called in /usr/libexec/rhts/rhts-mk-build-package on line : 127


Version-Release number of selected component (if applicable):
rhts-devel-4.64-1.el6eng.noarch

How reproducible: always


Steps to Reproduce:
1. check out code using git 
2. run `make rpm` inside the git tree


Actual results:
makerpm
rhts-mk-build-package
           CURRENT_TAG: 
                  NAME: sssd-qe-tests-CoreOS-sssd-client-ad_provider-dyndns-dlavu
               VERSION: 1.1
               RELEASE: 0
            SOURCE_DIR: /gluster/brick/homedirs/dlavu/Code/git/sssd-qe-tests/client/ad_provider/dyndns
               TMP_DIR: /tmp/rhts-build-7miKbeWn
             BUILD_DIR: /tmp/rhts-build-7miKbeWn/rpm-build
  GENERATED_SOURCE_DIR: /tmp/rhts-build-7miKbeWn/build
           INSTALL_DIR: /tmp/rhts-build-7miKbeWn/install
Verifying that tag is present in remote: 
Creating tarball: /tmp/rhts-build-7miKbeWn/build/sssd-qe-tests-CoreOS-sssd-client-ad_provider-dyndns-dlavu-1.1-0.tar.gz
usage: git archive [options] <tree-ish> [path...]
   or: git archive --list
   or: git archive --remote <repo> [--exec <cmd>] [options] <tree-ish> [path...]
   or: git archive --remote <repo> [--exec <cmd>] --list

    --format <fmt>        archive format
    --prefix <prefix>     prepend prefix to each pathname in the archive
    -o, --output <file>   write the archive to this file
    --worktree-attributes
                          read .gitattributes in working directory
    -v, --verbose         be verbose
    -0                    store only
    -1                    compress faster
    -9                    compress better

    -l, --list            list supported archive formats

    --remote <repo>       retrieve the archive from remote repository <repo>
    --exec <cmd>          path to the remote git-upload-archive command

Gathering testinfo.desc files:
           EXTRACT_DIR: /tmp/rhts-build-7miKbeWn/extract-for-metadata
/tmp/rhts-build-7miKbeWn/extract-for-metadata ~/Code/git/sssd-qe-tests/client/ad_provider/dyndns
make[1]: Entering directory `/tmp/rhts-build-7miKbeWn/extract-for-metadata'
make[1]: *** No rule to make target `testinfo.desc'.  Stop.
make[1]: Leaving directory `/tmp/rhts-build-7miKbeWn/extract-for-metadata'
make: *** [noarch-rpm] Error 2


Expected results:
make rpm 
rhts-mk-build-package
           CURRENT_TAG: 
                  NAME: tmp-CoreOS-sssd-client-ad_provider-dyndns-dlavu
               VERSION: 1.1
               RELEASE: 0
            SOURCE_DIR: /gluster/brick/homedirs/dlavu/Code/git/sssd-qe-tests/client/ad_provider/dyndns
               TMP_DIR: /tmp/rhts-build-tvAYOPHq
             BUILD_DIR: /tmp/rhts-build-tvAYOPHq/rpm-build
  GENERATED_SOURCE_DIR: /tmp/rhts-build-tvAYOPHq/build
           INSTALL_DIR: /tmp/rhts-build-tvAYOPHq/install
Creating tarball: /tmp/rhts-build-tvAYOPHq/build/tmp-CoreOS-sssd-client-ad_provider-dyndns-dlavu-1.1-0.tar.gz
./
./ad_server.sh
./client.sh
./runtest
./Makefile
./tmp-CoreOS-sssd-client-ad_provider-dyndns-dlavu-1.1-0.noarch.rpm
Gathering testinfo.desc files:
           EXTRACT_DIR: /tmp/rhts-build-tvAYOPHq/extract-for-metadata
./
./ad_server.sh
./client.sh
./runtest
./Makefile
./tmp-CoreOS-sssd-client-ad_provider-dyndns-dlavu-1.1-0.noarch.rpm
/tmp/rhts-build-tvAYOPHq/extract-for-metadata ~/Code/git/sssd-qe-tests/client/ad_provider/dyndns
make[1]: Entering directory `/tmp/rhts-build-tvAYOPHq/extract-for-metadata'
rhts-lint testinfo.desc
make[1]: Leaving directory `/tmp/rhts-build-tvAYOPHq/extract-for-metadata'
~/Code/git/sssd-qe-tests/client/ad_provider/dyndns
Generating specfile: /tmp/rhts-build-tvAYOPHq/build/tmp-CoreOS-sssd-client-ad_provider-dyndns-dlavu-1.1-0.spec
Building package:
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.iE07RH
+ umask 022
+ cd /tmp/rhts-build-tvAYOPHq/rpm-build
+ LANG=C
+ export LANG
+ unset DISPLAY
+ cd /tmp/rhts-build-tvAYOPHq/rpm-build
+ rm -rf tmp-CoreOS-sssd-client-ad_provider-dyndns-dlavu-1.1
+ /bin/mkdir -p tmp-CoreOS-sssd-client-ad_provider-dyndns-dlavu-1.1
+ cd tmp-CoreOS-sssd-client-ad_provider-dyndns-dlavu-1.1
+ /usr/bin/gzip -dc /tmp/rhts-build-tvAYOPHq/build/tmp-CoreOS-sssd-client-ad_provider-dyndns-dlavu-1.1-0.tar.gz
+ /bin/tar -xf -
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ /bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.rJVaj4
+ umask 022
+ cd /tmp/rhts-build-tvAYOPHq/rpm-build
+ cd tmp-CoreOS-sssd-client-ad_provider-dyndns-dlavu-1.1
+ LANG=C
+ export LANG
+ unset DISPLAY
+ '[' /gluster/brick/homedirs/dlavu/rpmbuild/BUILDROOT/tmp-CoreOS-sssd-client-ad_provider-dyndns-dlavu-1.1-0.x86_64 '!=' / ']'
+ '[' -d /gluster/brick/homedirs/dlavu/rpmbuild/BUILDROOT/tmp-CoreOS-sssd-client-ad_provider-dyndns-dlavu-1.1-0.x86_64 ']'
+ mkdir -p /gluster/brick/homedirs/dlavu/rpmbuild/BUILDROOT/tmp-CoreOS-sssd-client-ad_provider-dyndns-dlavu-1.1-0.x86_64/mnt/tests
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.M8pLKq
+ umask 022
+ cd /tmp/rhts-build-tvAYOPHq/rpm-build
+ '[' /gluster/brick/homedirs/dlavu/rpmbuild/BUILDROOT/tmp-CoreOS-sssd-client-ad_provider-dyndns-dlavu-1.1-0.x86_64 '!=' / ']'
+ rm -rf /gluster/brick/homedirs/dlavu/rpmbuild/BUILDROOT/tmp-CoreOS-sssd-client-ad_provider-dyndns-dlavu-1.1-0.x86_64
++ dirname /gluster/brick/homedirs/dlavu/rpmbuild/BUILDROOT/tmp-CoreOS-sssd-client-ad_provider-dyndns-dlavu-1.1-0.x86_64
+ mkdir -p /gluster/brick/homedirs/dlavu/rpmbuild/BUILDROOT
+ mkdir /gluster/brick/homedirs/dlavu/rpmbuild/BUILDROOT/tmp-CoreOS-sssd-client-ad_provider-dyndns-dlavu-1.1-0.x86_64
+ cd tmp-CoreOS-sssd-client-ad_provider-dyndns-dlavu-1.1
+ LANG=C
+ export LANG
+ unset DISPLAY
+ mkdir -p /gluster/brick/homedirs/dlavu/rpmbuild/BUILDROOT/tmp-CoreOS-sssd-client-ad_provider-dyndns-dlavu-1.1-0.x86_64/mnt/tests
+ make DEST=/gluster/brick/homedirs/dlavu/rpmbuild/BUILDROOT/tmp-CoreOS-sssd-client-ad_provider-dyndns-dlavu-1.1-0.x86_64 install
make[1]: Entering directory `/tmp/rhts-build-tvAYOPHq/rpm-build/tmp-CoreOS-sssd-client-ad_provider-dyndns-dlavu-1.1'
rhts-lint testinfo.desc
mkdir -p /gluster/brick/homedirs/dlavu/rpmbuild/BUILDROOT/tmp-CoreOS-sssd-client-ad_provider-dyndns-dlavu-1.1-0.x86_64/mnt/tests/CoreOS/sssd/client/ad_provider/dyndns/dlavu
cp -a testinfo.desc ad_server.sh client.sh runtest Makefile /gluster/brick/homedirs/dlavu/rpmbuild/BUILDROOT/tmp-CoreOS-sssd-client-ad_provider-dyndns-dlavu-1.1-0.x86_64/mnt/tests/CoreOS/sssd/client/ad_provider/dyndns/dlavu
if [ -e "runtest.sh" ]; then install -m 0755 runtest.sh /gluster/brick/homedirs/dlavu/rpmbuild/BUILDROOT/tmp-CoreOS-sssd-client-ad_provider-dyndns-dlavu-1.1-0.x86_64/mnt/tests/CoreOS/sssd/client/ad_provider/dyndns/dlavu; fi
rm testinfo.desc
make[1]: Leaving directory `/tmp/rhts-build-tvAYOPHq/rpm-build/tmp-CoreOS-sssd-client-ad_provider-dyndns-dlavu-1.1'
+ chmod -R a-s /gluster/brick/homedirs/dlavu/rpmbuild/BUILDROOT/tmp-CoreOS-sssd-client-ad_provider-dyndns-dlavu-1.1-0.x86_64
+ /usr/lib/rpm/brp-compress
Processing files: tmp-CoreOS-sssd-client-ad_provider-dyndns-dlavu-1.1-0.noarch
Checking for unpackaged file(s): /usr/lib/rpm/check-files /gluster/brick/homedirs/dlavu/rpmbuild/BUILDROOT/tmp-CoreOS-sssd-client-ad_provider-dyndns-dlavu-1.1-0.x86_64
Wrote: /tmp/rhts-build-tvAYOPHq/install/noarch/tmp-CoreOS-sssd-client-ad_provider-dyndns-dlavu-1.1-0.noarch.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.iGrWZ9
+ umask 022
+ cd /tmp/rhts-build-tvAYOPHq/rpm-build
+ cd tmp-CoreOS-sssd-client-ad_provider-dyndns-dlavu-1.1
+ '[' /gluster/brick/homedirs/dlavu/rpmbuild/BUILDROOT/tmp-CoreOS-sssd-client-ad_provider-dyndns-dlavu-1.1-0.x86_64 '!=' / ']'
+ '[' -d /gluster/brick/homedirs/dlavu/rpmbuild/BUILDROOT/tmp-CoreOS-sssd-client-ad_provider-dyndns-dlavu-1.1-0.x86_64 ']'
+ rm -rf /gluster/brick/homedirs/dlavu/rpmbuild/BUILDROOT/tmp-CoreOS-sssd-client-ad_provider-dyndns-dlavu-1.1-0.x86_64
+ exit 0
Finished building test package


Additional info:
Commenting out the if else statement in /usr/libexec/rhts/rhts-mk-build-package permits the rpm to build.

Comment 2 Dan Callaghan 2014-09-05 02:57:46 UTC
(In reply to Dan Lavu from comment #0)
>            CURRENT_TAG: 

You haven't tagged any version of the task yet, so it is trying to invoke git archive with no arguments. The fact that it used to work (just using version 1.1-0 with whatever is in the current working directory) was more an accident than anything else.

The error handling for this case should be improved.

Comment 3 Dan Lavu 2014-09-15 20:18:12 UTC
Sorry it took me so long to get back to this. We haven't tagged our branch, since we've been doing a thorough code review.

Agreed, better error handling will be nice improvement and maybe build and omit the branch info if missing. Regardless this is not a bug, close or enhancement, your pick.

Cheers

Comment 4 Dan Callaghan 2014-09-17 06:14:37 UTC
(In reply to Dan Lavu from comment #3)
> We haven't tagged our branch,
> since we've been doing a thorough code review.

Yeah, there are all sorts of normal and sane practices which the rhts-* scripts simply do not handle because they came from the CVS era where everything was centralised and linear. (Do you know about Bill Peck's experimental restraint harness, which lets you avoid all the "make rpm" stuff entirely and run tasks straight from git?)

Note that the rhts-* scripts support a mode where the task is not checked into version control, so the user is responsible for bumping the version manually rather than using "make tag". I guess that is what you were intending to use here?

The problem is that the rhts-* scripts think you are using version control because you are inside a git repo, even if the task itself is not actually committed yet. So as a workaround you can just move the task outside of your git checkout.

If you mean that the task *is* committed to git but you are not using "make tag" to track the versions... well, that is not really how the rhts-* scripts want to be used. True, they did previously just silently proceed and use -0 for the RPM release, if there was no tag. However that is just as likely to indicate a user error (forgot to tag) or a bug in the script (not finding tags correctly).

So I think in this case, if the scripts think they are in a git repo but can't find any tag to use, they should just bail out with an informative error.

Comment 5 Dan Callaghan 2014-09-17 06:31:02 UTC
(In reply to Dan Callaghan from comment #4)
> So I think in this case, if the scripts think they are in a git repo but
> can't find any tag to use, they should just bail out with an informative
> error.

http://gerrit.beaker-project.org/3332

$ make rpm
rhts-mk-build-package
           CURRENT_TAG: 
                  NAME: tmp---distribution-beaker-asdf
               VERSION: 1.2
               RELEASE: 0
            SOURCE_DIR: /home/dcallagh/work/beaker/Server/task_test
Error: no tags found
(Hint: make tag)
(Hint: to skip version control, move this task outside your git tree)
make: *** [noarch-rpm] Error 1

Comment 8 Dan Callaghan 2014-10-17 06:22:10 UTC
rhts 4.65 has been released.


Note You need to log in before you can comment on or make changes to this bug.