Bug 21876

Summary: Untracked changes prevent building
Product: Koha Reporter: Mark Tompsett <mtompset>
Component: PackagingAssignee: Mark Tompsett <mtompset>
Status: ASSIGNED --- QA Contact: Testopia <testopia>
Severity: minor    
Priority: P5 - low CC: mirko, mtompset
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 21876: tweak the build script

Description Mark Tompsett 2018-11-23 13:45:44 UTC
On bug 18993 comment #29, I mentioned difficulty following the instructions to package up Koha following the instructions given at https://wiki.koha-community.org/wiki/Building_Debian_Packages_-_The_Easy_Way

With tcohen's patience and help, I believe I determined my problem was untracked files. Add functionality to check for untracked files to the build command.
Comment 1 Mark Tompsett 2018-11-23 14:54:01 UTC
Turns out the everything_is_committed function is not working. grep /^xxx/ is not working as expected. Minor tweak should fix that, but I'm also going to improve the error message.
Comment 2 Mark Tompsett 2018-11-23 20:03:05 UTC
Created attachment 82620 [details] [review]
Bug 21876: tweak the build script

While trying to build following the instructions on the wiki,
error after error was encountered, and frustration rose.
Eventually, tcohen mentioned untracked files. So, all untracked
files were purposefully deleted all, and then building succeeded
again.

To this end, the build script wa tweaked.

1) Sorry, a bunch of perlcritic things to get it
   perlcritic -2 clear were done. :)

Proof:
perlcritic -1 debian/build-git-snapshot
-- fear the long scrolly output
apply the patch
repeat
-- much shorter, and who cares about the print return value!
perlcritic -2 debian/build-git-snapshot
-- OK. YAY!

2) everything_is_committed was broken. It would always
   return 1 and keep going.

Proof:
touch foobar.
add a blank line to Koha.pm
now try to build. It will spend minutes and die miserably at the end.

To address this, it was tweaked to check for two cases:
uncommitted and untracked. You can test this with a combination
of touch foobar and blank line to Koha.pm to see.

3) While not a huge issue, the version should be better determined
   rather than hard coded as 16.06~git. Logic was added to
   better determine something based on Koha.pm through grep'ing,
   so as to not need PERL5LIB set.

Proof:
Try checking out 17.11.x
apply this patch (hopefully it does)
try to build without a -v parameter.
-- it should generate 17.11~git
Feel free to repeat with 18.05 and master
they should generate 18.05~git and 18.06~git

As always run the qa test tools. ;)
Oh wait, they don't run unless you rename this to a .pl file.
I guess that's another bug. And if you do rename to test,
it should only complain about Robin's last name.
Comment 3 Mark Tompsett 2018-11-23 22:36:14 UTC
Oh, and before I forget, I purposefully installed dh-make and got libwebservice-ils-perl installed in the pbuilder while testing. That may be an important substep that isn't documented. :)
Comment 4 Katrin Fischer 2019-02-10 11:28:18 UTC
Should this be needs sign-off?