[For Ubuntu PPA Maintainers] Uploading a Stable Release

Having trouble installing or compiling FreeCAD? Get help here.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
NormandC
Veteran
Posts: 18589
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

[For Ubuntu PPA Maintainers] Uploading a Stable Release

Post by NormandC »

This post is intended for the maintainers of the Ubuntu PPA (Personal Package Archive). Right now that would be sgrogan. My aim is to answer his request in the 0.16 Release topic. In creating a separate topic I'm hoping it won't be drowned in a larger topic and be easier to search in the future.

This is specifically about uploading a package to the FreeCAD Stable Releases PPA. The method is quite different from creating packages for the Daily Builds PPA, but pretty straighforward. Basically, the steps are
  1. Creating a tarball (an archive of the source code in .tar.gz format. The naming and versioning of this archive is very specific.)
  2. Building a source package, which is actually a build recipe made of 3 files
  3. Uploading the source package to the PPA
  4. Launchpad builds the binary packages.
  1. Creating a tarball
    Assuming the directory holding the source code is named "freecad-code"; we need to check out the release branch. Exemple below is for the past 0.15.4671 release.

    Code: Select all

    cd freecad-code
    git checkout remotes/origin/releases/FreeCAD-0-15
    Then we need to create a build directory and execute cmake to generate requisite build files (like the Version.h file)

    Code: Select all

    cd ..
    mkdir freecad-releases-0-15-build
    cd freecad-releases-0-15-build
    cmake ../freecad-code
    Creating a tarball is done using a handy script

    Code: Select all

    make dist-git
    If the package is intended for Debian, some libraries have to be left out. The command is

    Code: Select all

    make distdfsg-git
    DFSG stands for Debian Free Software Guidelines. I've actually always wondered if we should use the DFSG tarball, since Ubuntu is based on Debian and copies most of its libraries...

    The tarball is saved in the freecad-code directory.
  2. Building a source package
    General instructions on how to build a source package on Launchpad:
    https://help.launchpad.net/Packaging/PP ... rcePackage

    What I was doing specifically for FreeCAD packages:
    1. Extract the tarball
    2. Rename the tarball to freecad_0.15.4671.orig.tar.gz. Don't forget to replace the dash (-) with an underscore (_) The process is pretty fussy about this, if you forget to do it the tarball won't be recognized and you'll get an error message in the console when you build the package.
    3. Insert a "debian" folder into the extracted tarball folder. You could copy one from the daily builds PPA, but take care to edit the changelog and set the right version number. The best would be to use the debian folder from the 0.15.4671 debian source, and append the new release to the existing changelog. See the debian folder for freecad 0.15.4671 built for Ubuntu 15.04 here: https://launchpad.net/~freecad-maintain ... ian.tar.gz
      (These files can be found in the "Package details" link of the PPA webpage)
    Next comes the actual building of the source package. I always signed my packages, for that you need to install gpg and create a key (which you've probably done already). The command to build the source package is

    Code: Select all

    debuild -k0x12345678 -S -sa
    Where you replace "12345678" with your actual key ID. The source package itself takes less than 30 seconds to build. You should create source packages for each supported Ubuntu version (12.04, 14.04, 15.04...), each time updating the /debian/changelog file to match the Ubuntu version.
  3. Uploading the source package to the PPA
    That one is pretty straighforward.
    https://help.launchpad.net/Packaging/PPA/Uploading

    The command is shown in the PPA webpage under "Uploading packages to this PPA". To upload all source packages in one go:

    Code: Select all

    dput ppa:freecad-maintainers/freecad-stable *.changes
    Now this takes some time (and depends on your upload speed), because unfortunately the tarball will be uploaded as many times as there are source packages.

    Once uploaded, you get an automated email notification to let you know whether your upload was accepted or not.
That's it, you're done.

When the time comes, I'll try to follow up on any questions you post here, but I can't promise prompt replies.

Once you run through the process and validate it (or find errors), it might be a good idea to create a wiki page about it.
User avatar
yorik
Founder
Posts: 13665
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: [For Ubuntu PPA Maintainers] Uploading a Stable Release

Post by yorik »

Precious resource, thanks Normand!
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: [For Ubuntu PPA Maintainers] Uploading a Stable Release

Post by abdullah »

Thanks Normand :)
User avatar
NormandC
Veteran
Posts: 18589
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: [For Ubuntu PPA Maintainers] Uploading a Stable Release

Post by NormandC »

Well thank me when you try it and it works. :D
User avatar
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

Re: [For Ubuntu PPA Maintainers] Uploading a Stable Release

Post by sgrogan »

NormandC wrote:Extract the tarball
Thanks Norm for this. How exactly to do this step. I do not see where the .tar.gz is created. Do I need to set the CMAKE flag FREECAD_BUILD_DEBIAN? (or use the one from https://github.com/FreeCAD/FreeCAD/releases/tag/0.15 I realize this is new but your insight if it's usable or not is welcome)
TIA
BTW: I've realized I can practice with a Wily stable 0.15 release, which is what I'm attempting.
"fight the good fight"
User avatar
NormandC
Veteran
Posts: 18589
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: [For Ubuntu PPA Maintainers] Uploading a Stable Release

Post by NormandC »

sgrogan wrote:How exactly to do this step. I do not see where the .tar.gz is created.
If memory serves, the tarball is saved in the source code directory, that is the folder I named "freecad-code" in my post.
sgrogan wrote:Do I need to set the CMAKE flag FREECAD_BUILD_DEBIAN?
No, I don't recall what it's used for, Werner told me but I forgot. I think it dates back from years ago when Werner was building .deb packages directly and uploading them to Sourceforge... In any case I'm not sure that method would work for the PPA.

You can extract the tarball the way you please, either from the terminal or the way I prefer, from the GUI. ;)
jean.thil
Posts: 209
Joined: Tue Jul 28, 2015 7:28 am

Re: [For Ubuntu PPA Maintainers] Uploading a Stable Release

Post by jean.thil »

Hi,

I am writing a script to automate things to build a deb. It is not finished yet but will probably tonight. It takes the master branch code from the zip available on Github.

Code: Select all

#!/bin/bash

#get master
#wget https://github.com/FreeCAD/FreeCAD/archive/master.zip
#unflate zip,
unzip master.zip
name="freecad_"
mydate=$(date  +"%Y%m%d")
filename=$name$mydate.orig
echo  "filename" $filename
mv FreeCAD-master $filename
tar -cf $filename.tar $filename
gzip $filename.tar
One drawback of this script is that the deb will be tagged with the date not the version number available in the about freecad dialog. To get it, one must read config.h.in [edit : wrong information] and extract the version number first but I have not yet search how to do that.

-DFREECAD_BUILD_DEBIAN=ON \ is set in the debian/rules file from the debian folder Normand linked to.
Last edited by jean.thil on Thu Feb 11, 2016 8:47 pm, edited 1 time in total.
User avatar
NormandC
Veteran
Posts: 18589
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: [For Ubuntu PPA Maintainers] Uploading a Stable Release

Post by NormandC »

Hello,

I'm not very good at scripting, what does this exactly do? Looks to me like it only creates a tarball of the source code and sets a name? What do you do next to build the package?
jean.thil wrote:the deb will be tagged with the date not the version number available in the about freecad dialog. To get it, one must read config.h.in and extract the version number first but I have not yet search how to do that.
IMO for technical support purposes (by the forum regulars) it is very important that the correct info shows up in the About FreeCAD menu. When I go home tonight I will post hints about that, basically you need to configure CMake as if for a compile, this creates a Version.h file that has to be copied into the build folder.
jean.thil
Posts: 209
Joined: Tue Jul 28, 2015 7:28 am

Re: [For Ubuntu PPA Maintainers] Uploading a Stable Release

Post by jean.thil »

Looks to me like it only creates a tarball of the source code and sets a name?
Yes, you're right. I want to automate the whole build process but I am a beginner at bash and moreover my wife wanted us to go to the restaurant tonight so no progress today. :D
it is very important that the correct info shows up in the About FreeCAD
The name set to the deb file has no effect on the info that shows up in the About FreeCAD.
User avatar
NormandC
Veteran
Posts: 18589
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: [For Ubuntu PPA Maintainers] Uploading a Stable Release

Post by NormandC »

My mistake, I didn't read carefully... :oops:
Post Reply