Bug 998369 - Add unique constraint to Tasks' RPM name
Summary: Add unique constraint to Tasks' RPM name
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Beaker
Classification: Retired
Component: scheduler
Version: 0.14
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: 0.15
Assignee: Amit Saha
QA Contact: tools-bugs
URL:
Whiteboard:
Depends On:
Blocks: 994789
TreeView+ depends on / blocked
 
Reported: 2013-08-19 07:31 UTC by Amit Saha
Modified: 2018-02-06 00:41 UTC (History)
8 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2013-10-03 02:28:19 UTC
Embargoed:


Attachments (Terms of Use)

Description Amit Saha 2013-08-19 07:31:49 UTC
Description of problem:

Currently, an UNIQUE constraint exists for the task name, but not for the RPM name. This allows two tasks to exist (unique as far as Beaker is concerned), but actually pointing to the same RPM file. This doesn't affect Beaker's functioning in anyway, but we can't rely any more on the one-one mapping between the two.


Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:

Have an one-one mapping between the task name and RPM name.


Additional info:

This is needed so that tools like beaker-sync-tasks which do reasonably rely on the mapping doesn't break.

Comment 2 Amit Saha 2013-08-27 07:13:33 UTC
Adding a unique key constraint and considering that we are using unicode limits us to 255 characters for the RPM name[1]. I will do a check to see how many of the production RPMs exceed that.

[1] https://drupal.org/node/554820

Comment 3 Amit Saha 2013-09-02 01:28:11 UTC
(In reply to Amit Saha from comment #2)
> Adding a unique key constraint and considering that we are using unicode
> limits us to 255 characters for the RPM name[1]. I will do a check to see
> how many of the production RPMs exceed that.

Hmm i was obviously not thinking of file system limits there, which makes that a 0 percent probability of finding one.

Comment 4 Amit Saha 2013-09-02 01:50:10 UTC
On Gerrit: http://gerrit.beaker-project.org/#/c/2191/

Comment 6 xjia 2013-09-03 12:42:40 UTC
Verify:
The length of rpm's name should not be large than 256. That's linux limited. And upload different tasks with same rpm package name, it will fail. 

[root@beaker-client-rhel6 jiaxuan]# pwd
/root/haha/Sanity/jiaxuan
[root@beaker-client-rhel6 jiaxuan]# bkr task-add jiaxuan-1.0-1.noarch.rpm
jiaxuan-1.0-1.noarch.rpm
Success
[root@beaker-client-rhel6 jiaxuan]# cd /root/haha2/Sanity/jiaxuan1/
[root@beaker-client-rhel6 jiaxuan1]# ls
jiaxuan-1.0-1.noarch.rpm  Makefile  PURPOSE  runtest.sh
[root@beaker-client-rhel6 jiaxuan1]# bkr task-add jiaxuan-1.0-1.noarch.rpm
jiaxuan-1.0-1.noarch.rpm
Exception: <Fault 1: <class 'bkr.common.bexceptions.BX'>:Cannot import duplicate task jiaxuan-1.0-1.noarch.rpm>
[root@beaker-client-rhel6 jiaxuan1]# vim
jiaxuan-1.0-1.noarch.rpm  Makefile                  PURPOSE                   runtest.sh
[root@beaker-client-rhel6 jiaxuan1]# vim Makefile
[root@beaker-client-rhel6 jiaxuan1]# vim runtest.sh
[root@beaker-client-rhel6 jiaxuan1]# rm -rf jiaxuan-1.0-1.noarch.rpm
[root@beaker-client-rhel6 jiaxuan1]# cat Makefile | grep PACKAGE_NAME
export PACKAGE_NAME=jiaxuan
[root@beaker-client-rhel6 jiaxuan1]# vim Makefile
[root@beaker-client-rhel6 jiaxuan1]# make package
rhts-mk-build-package
           CURRENT_TAG: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890-1_0-1
                  NAME: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
               VERSION: 1.0
               RELEASE: 1
            SOURCE_DIR: /root/haha2/Sanity/jiaxuan1
               TMP_DIR: /mnt/testarea/rhts-build-qWczWpH3
             BUILD_DIR: /mnt/testarea/rhts-build-qWczWpH3/rpm-build
  GENERATED_SOURCE_DIR: /mnt/testarea/rhts-build-qWczWpH3/build
           INSTALL_DIR: /mnt/testarea/rhts-build-qWczWpH3/install
Creating tarball: /mnt/testarea/rhts-build-qWczWpH3/build/1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890-1.0-1.tar.gz
tar (child): /mnt/testarea/rhts-build-qWczWpH3/build/1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890-1.0-1.tar.gz: Cannot open./
./PURPOSE
: File name too long
./runtest.sh
tar (child): Error is not recoverable: exiting now
./Makefile
tar: Child returned status 2
tar: Error is not recoverable: exiting now
make: *** [noarch-rpm] Error 1

Comment 7 Nick Coghlan 2013-10-03 02:28:19 UTC
Beaker 0.15 has been released.


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