Browse Source

Merge branch '0install_script' into dev

Merges improvements in productions scripts (scripts to generated bianry and
source code tarball).

  Conflicts:
 	src/oclaunch.ml

Some code from oclaunch.ml (for initialisation and so on) was moved to
command_def.ml file. New code to display time was added this way.
Leo 9 years ago
parent
commit
a7efd7b72e
8 changed files with 108 additions and 22 deletions
  1. 30 13
      0install.sh
  2. 3 0
      CHANGELOG.md
  3. 6 0
      CONTRIBUTING.md
  4. 22 0
      code_of_conduct.md
  5. 12 6
      pkg.sh
  6. 11 3
      release.sh
  7. 18 0
      sign-dist.sh
  8. 6 0
      src/command_def.ml

+ 30 - 13
0install.sh

@@ -2,26 +2,43 @@
 
 
 # Script to create 0install archives
 # Script to create 0install archives
 
 
-# Get and set compilation settings
-./configure --disable-debug --disable-docs --disable-profile --disable-tests > BUILD_INFO.txt
+### parameter variables ###
+build_log=BUILD_INFO.txt # Logs included in distributed archive
+dbg_log=dbg.log #To debug this script, dropped sometimes
 
 
+echo "========= Building ========="
+# Get and set compilation settings
+./configure --disable-debug --disable-docs --disable-profile --disable-tests > $build_log
 # First compile
 # First compile
 make
 make
 
 
-# Copy in dist
-cp ./_build/src/oclaunch.native ./dist/oclaunch
+# Copy in distribution directory (if exists)
+dist=./dist
+if [ ! -d $dist ]; then
+  mkdir $dist
+fi
+# Archive name
+name=oclaunch-v$(cat ./VERSION)_$(arch)
+final_binary_path=./$name/oclaunch
+final_binary_name=oclaunch
+cp ./_build/src/oclaunch.native $dist/$final_binary_name
 # Move BUILD_INFO
 # Move BUILD_INFO
-mv BUILD_INFO.txt ./dist/
+mv $build_log ./$dist/
 
 
-cd dist
-# Archive name
-name=oclaunch-v$(cat ../VERSION)_$(arch)
-mkdir $name
+cd $dist
+if [ ! -d $name ]; then
+  mkdir $name
+fi
 # Put executable in it
 # Put executable in it
-mv oclaunch BUILD_INFO.txt $name
+mv $final_binary_name $build_log $name
 
 
-# XXX Debug
-tree
+tree > $dbg_log
 
 
 # Create archive
 # Create archive
-tar -cvaf $name.tar.lzma $name
+echo "========= Creating first archive ========="
+tar -cvaf $name.tar.lzma $name >> $dbg_log
+
+# Create stripped archive
+strip $final_binary_path
+echo "========= Creating second (stripped) archive ========="
+tar -cvaf ${name}_stripped.tar.lzma $name >> $dbg_log

+ 3 - 0
CHANGELOG.md

@@ -33,6 +33,9 @@
    + More natural behavior when starting from an empty file. (Don't increment
    + More natural behavior when starting from an empty file. (Don't increment
      number of launch when nothing is actually launched)
      number of launch when nothing is actually launched)
    + For the futur : Running infinite, daemon mode...
    + For the futur : Running infinite, daemon mode...
+ + Improve release script, to enhance contributing experience (making easier to
+   release source-code, binaries, signing…). TODO Merge name format of
+   Oinstall.sh and pkg.sh
 
 
 ## 0.2.x
 ## 0.2.x
 
 

+ 6 - 0
CONTRIBUTING.md

@@ -0,0 +1,6 @@
+# Contributions are most welcome, not only for the code !
+
+See [the website](http://oclaunch.tuxfamily.org/contribute.html) for details.
+
+By participating in this project you agree to abide by its
+[terms](oclaunch.tuxfamily.org/rules.html).

+ 22 - 0
code_of_conduct.md

@@ -0,0 +1,22 @@
+# Contributor Code of Conduct
+
+As contributors and maintainers of this project, and in the interest of fostering an open and welcoming community, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
+
+We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, or nationality.
+
+Examples of unacceptable behavior by participants include:
+
+* The use of sexualized language or imagery
+* Personal attacks
+* Trolling or insulting/derogatory comments
+* Public or private harassment
+* Publishing other's private information, such as physical or electronic addresses, without explicit permission
+* Other unethical or unprofessional conduct.
+
+Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. By adopting this Code of Conduct, project maintainers commit themselves to fairly and consistently applying these principles to every aspect of managing this project. Project maintainers who do not follow or enforce the Code of Conduct may be permanently removed from the project team.
+
+This code of conduct applies both within project spaces and in public spaces when an individual is representing the project or its community.
+
+Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
+
+This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0, available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/)

+ 12 - 6
pkg.sh

@@ -4,15 +4,21 @@
 echo "Start"
 echo "Start"
 
 
 # If directory doesn't exist, create it
 # If directory doesn't exist, create it
-if ! [[ -e dist ]]; then
+if ! [ -e dist ]; then
     mkdir dist
     mkdir dist
 fi
 fi
 
 
 # If no tag, use commit SHA1
 # If no tag, use commit SHA1
-tag=`git tag --points-at HEAD`
-id=`git rev-parse --short --verify HEAD`
-name=OcLaunch_${tag}-${id}.tgz
+id=`git describe --abbrev=40 --candidates=50 HEAD`
+name=OcLaunch_${id}
 
 
-echo "Write in" $name
-git archive master --prefix=${name}/ --format=tgz -o dist/$name
+echo "Writing in" $name".*"
+git archive HEAD --prefix=${name}/ --format=tar.gz -o dist/${name}.tar.gz -9
+git archive HEAD --prefix=${name}/ --format=zip -o dist/${name}.zip -9
+# Creating .xz and .bz2 from tar archive
+tar_name=${name}.tar
+git archive HEAD --prefix=${name}/ --format=tar -o dist/${tar_name}
+cd dist
+bzip2 -c9 < ${tar_name} >  ${tar_name}.bz2
+xz -c9 < ${tar_name} >  ${tar_name}.xz
 
 

+ 11 - 3
release.sh

@@ -7,8 +7,16 @@
 
 
 # Record changes
 # Record changes
 git commit -a -m "Version $(cat ./VERSION)"
 git commit -a -m "Version $(cat ./VERSION)"
-git tag -s v$(cat VERSION) -m "Release $(cat VERSION)"
+git tag -s v$(cat VERSION) -m "Release version $(cat VERSION)"
 
 
-# Cleanup dist directory to put the new archives
-rm -r dist/*
+# Cleanup dist directory to put the new archives, if exists
+if [ -d dist ]; then
+  rm -r dist/*
+fi
+# Binary archives
 ./0install.sh
 ./0install.sh
+# Source code
+./pkg.sh
+
+# Signing everything
+./sign-dist.sh

+ 18 - 0
sign-dist.sh

@@ -0,0 +1,18 @@
+#!/bin/sh
+
+# Script used to sign (almost) everything in the dist folder
+
+if [ ! -d dist ]; then
+  mkdir dist
+fi
+cd dist
+# File to signed
+# MEMO: -e: regexp, -v: not matched
+tobe_sig=$(ls | grep -e ".tar" -e ".zip" -v ".sig")
+
+for element in ${tobe_sig}
+do
+  echo "Signing" ${element}
+  gpg --detach-sign ${element}
+done
+

+ 6 - 0
src/command_def.ml

@@ -233,6 +233,9 @@ let default =
       Default.run ~rc n)
       Default.run ~rc n)
 
 
 let run ~version ~build_info () =
 let run ~version ~build_info () =
+  (* Store begin time *)
+  let start = Time.(now () |> to_float) in
+
 
 
   (* XXX Hack to allow to run 'oclaunch 5' or 'oclaunch' as before, i.e. do not
   (* XXX Hack to allow to run 'oclaunch 5' or 'oclaunch' as before, i.e. do not
    * display help for sub commands but use the program directly *)
    * display help for sub commands but use the program directly *)
@@ -291,6 +294,9 @@ let run ~version ~build_info () =
       | Error -> Messages.warning "Error with lockfile"
       | Error -> Messages.warning "Error with lockfile"
   ));
   ));
 
 
+  (* Display total running time, to float is a number of secconds *)
+  Messages.debug Time.(now () |> to_float |> (-.) start |> ( *. ) (-1.)
+  |> sprintf "Runned during %f second(s)");
   (* Reset display *)
   (* Reset display *)
   Messages.reset ();
   Messages.reset ();