Re: Help with rubygem packaging

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



For linked-list,

> + ruby -Ilib:. -e 'Dir.glob "test/**/test_*.rb", &method(:require)'
...
> 0 runs, 0 assertions, 0 failures, 0 errors, 0 skips
> + popd

"test/**/test_*.rb" you are using is incorrect in this case, and
different from the guideline. The test files were not captured..
"./test/**/*_test.rb" works possibly.

```
$ find . -name "test_*.rb"
./linked-list-0.0.13/test/test_helper.rb

$ find . -name "*_test.rb"
./linked-list-0.0.13/test/list_test.rb
./linked-list-0.0.13/test/node_test.rb
./linked-list-0.0.13/test/conversions_test.rb
```

For hrx,

> Looks like %check for hrx is a no go due to missing dep that isn't present in the repo
>
> + pushd ./usr/share/gems/gems/hrx-1.0.0
> ~/rpmbuild/BUILD/hrx-1.0.0/usr/share/gems/gems/hrx-1.0.0 ~/rpmbuild/BUILD/hrx-1.0.0
> + ln -s /home/leigh/rpmbuild/BUILD/spec spec
> + rspec -rspec_helper spec
>
> An error occurred while loading ./spec/archive_spec.rb.
> Failure/Error: require 'rspec/temp_dir'

You see the missing dep 'rspec/temp_dir' is a testing dep.

```
$ cat hrx-1.0.0/Gemfile
...
gem "rspec-temp_dir", "~> 1.0", group: :test
```

We are trying to run a unit tests as much as possible, commenting out
or skipping the testing dep specific logic.
When you have %check section, I think that you feel more secure.

You learned commenting out not used dep like `sed -i '/bundler/
s/^/#/' Rakefile`.
You can adapt the way to this "rspec/temp_dir" case too like this.

```
$ sed -i "/require 'rspec\/temp_dir'/ s/^/#/" spec/archive_spec.rb
```

And you see the temp_dir rubygem dep is used for only
spec/archive_spec.rb context "::load" and "#write!".

```
$ grep -r temp_dir spec/
```

spec/archive_spec.rb

```
  context "::load" do
...
  end

  context "#write!" do
...
  end
...
```

You can adapt the way to comment out the specific lines like this.

```
$ sed -i '/^  context "::load" do$/,/^  end$/ s/^/#/' spec/archive_spec.rb
$ sed -i '/^  context "#write!" do$/,/^  end$/ s/^/#/' spec/archive_spec.rb
```

Or if the entire unit case does not work due to the missing testing
dep, you can just rename the test file to be skipped by rspec like
this.

```
$ mv spec/archive_spec.rb{,.disabled}
```

There is a good way to see all the RPM spec file easily. You can do
grep to see the examples.
(I think if this way is not documented, it is useful to be documented
somewhere in the guideline).

```
$ wget http://src.fedoraproject.org/repo/rpm-specs-latest.tar.xz

$ tar xvf rpm-specs-latest.tar.xz

$ ls rpm-specs/*.spec | wc -l
21514
```


-- 
Jun | He - His - Him
_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Users]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]

  Powered by Linux